ambiguous git-reflog output for symbolic refs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I encountered some output that seems unexpected and ambiguous to me
when calling git-reflog on a symbolic ref.

Specifically, if the symbolic ref has no reflog of its own, then
git-reflog shows the reflog of the symbolic ref's target, but with the
symbolic ref's name in the output lines. This means you can't tell if
the reflog entries are from the symbolic ref's reflog, or from the
symbolic ref target's reflog:

To illustrate, create a symbolic ref pointing to a branch (this is
using git version 2.25.0):

$ git update-ref -m AAA refs/heads/test-branch
931dd4e7f267865e8077ae47c75888fe5d1b2755
$ git symbolic-ref refs/my-symbolic refs/heads/test-branch

Now, the git-reflog command below shows the log entries for
refs/heads/test-branch:

$ git reflog refs/my-symbolic
931dd4e (HEAD -> master, refs/my-symbolic, test-branch)
refs/my-symbolic@{0}: AAA

But if we ensure that refs/my-symbolic has its own reflog, e.g. by doing this:

$ git update-ref -m BBB --create-reflog refs/my-symbolic
931dd4e7f267865e8077ae47c75888fe5d1b2755

Then running the same git-reflog command as above now shows the
symbolic ref's reflog instead of the target's:

$ git reflog refs/my-symbolic
931dd4e (HEAD -> master, refs/my-symbolic, test-branch)
refs/my-symbolic@{0}: BBB

(The ref is still a symbolic ref pointing to "test-branch" as you can
see below.)

$ git symbolic-ref refs/my-symbolic
refs/heads/test-branch

To recap, looking at the two git-reflog outputs above, there's no way
to tell from the output which of the two cases you're in (the symbolic
ref's reflog or the target's).

So my question is: Is this behaving like it should? I was surprised
that git-reflog dereferences the symbolic ref prior to querying the
reflog, and even more surprising, replaces "refs/heads/test-branch" in
refs/heads/test-branch's reflog with "refs/my-symbolic".

And either way, is there a way to get unambiguous output? For example,
is there a way to make sure you're reading the symbolic ref's reflog
and not the reflog of its target?

Thank you,
--Chris



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux