Hello, On Tue, Feb 6, 2024 at 2:55 PM Phillip Wood <phillip.wood123@xxxxxxxxx> wrote: > > Hi Karthik > > On 06/02/2024 08:52, Karthik Nayak wrote: > > On Mon, Feb 5, 2024 at 7:48 PM Phillip Wood <phillip.wood123@xxxxxxxxx> wrote: > >> On 29/01/2024 11:35, Karthik Nayak wrote: > >>> When the user uses an empty string pattern (""), we don't match any refs > >>> in git-for-each-ref(1). This is because in git-for-each-ref(1), we use > >>> path based matching and an empty string doesn't match any path. > >>> > >>> In this commit we change this behavior by making empty string pattern > >>> match all references. This is done by introducing a new flag > >>> `FILTER_REFS_NO_FILTER` in `ref-filter.c`, which uses the newly > >>> introduced `refs_for_each_all_refs()` function to iterate over all the > >>> refs in the repository. > >> > >> It actually iterates over all the refs in the current worktree, not all > >> the refs in the repository. I have to say that I find it extremely > >> unintuitive that "" behaves differently to not giving a pattern. I > >> wonder if we can find a better UI here - perhaps a command line option > >> to include pseudorefs? > >> > > > > As Patrick mentioned, this was discussed a while ago and we decided to > > move forward with the `git for-each-ref ""` syntax. > > Thanks I'd missed that discussion. I see that at the end of that > discussion Junio was concerned that the proposed "" did not account for > "refs/worktrees/$worktree/*" [1] - how has that been resolved? > The current implementation (merged to next) prints all the refs from the current worktree and doesn't support printing from other worktrees. $ git worktree add ../wt-files @~10 Preparing worktree (detached HEAD 559d5138bc) HEAD is now at 559d5138bc Merge branch 'jc/make-libpath-template' into next $ cd ../wt-files/ direnv: unloading $ git for-each-ref "" | grep -v "refs" 559d5138bc8b81354fd1bc3421ace614076e66de commit HEAD 559d5138bc8b81354fd1bc3421ace614076e66de commit ORIG_HEAD $ git rebase -i @~3 Stopped at be65f9ef88... t/Makefile: get UNIT_TESTS list from C sources You can amend the commit now, with git commit --amend '-S' Once you are satisfied with your changes, run git rebase --continue $ git for-each-ref "" | grep -v "refs" be65f9ef88ff741454dcf10a0af6e384d0bf26cf commit HEAD 43f081b9c7dfb9c23e547ffee1778af0f30c5c4e commit ORIG_HEAD be65f9ef88ff741454dcf10a0af6e384d0bf26cf commit REBASE_HEAD