{"thread":{"id":"52918","subject":"ambiguous git-reflog output for symbolic refs","startedAt":"2020-02-29T04:49:57Z","lastAt":"2020-02-29T04:49:57Z","messageCount":1,"participants":["Chris Jerdonek"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"392707","messageId":"CAOTb1wfXp+gXSwbG-CVgVE8E_5yzxQKwNKh_=3ECqTMvZFw7dQ@mail.gmail.com","threadId":"52918","inReplyTo":null,"subject":"ambiguous git-reflog output for symbolic refs","fromName":"Chris Jerdonek","fromEmail":"chris.jerdonek@gmail.com","sentAt":"2020-02-29T04:49:43Z","receivedAt":"2020-02-29T04:49:57Z","isPatch":false,"sender":{"key":"chris.jerdonek@gmail.com","avatar":"https://gravatar.com/avatar/86b2cff752baeaabcfaf26ff30fd8f74c5caf8657fdb7990dc3c787d542f26a3?d=mp&s=160"},"body":"Hi,\n\nI encountered some output that seems unexpected and ambiguous to me\nwhen calling git-reflog on a symbolic ref.\n\nSpecifically, if the symbolic ref has no reflog of its own, then\ngit-reflog shows the reflog of the symbolic ref's target, but with the\nsymbolic ref's name in the output lines. This means you can't tell if\nthe reflog entries are from the symbolic ref's reflog, or from the\nsymbolic ref target's reflog:\n\nTo illustrate, create a symbolic ref pointing to a branch (this is\nusing git version 2.25.0):\n\n$ git update-ref -m AAA refs/heads/test-branch\n931dd4e7f267865e8077ae47c75888fe5d1b2755\n$ git symbolic-ref refs/my-symbolic refs/heads/test-branch\n\nNow, the git-reflog command below shows the log entries for\nrefs/heads/test-branch:\n\n$ git reflog refs/my-symbolic\n931dd4e (HEAD -> master, refs/my-symbolic, test-branch)\nrefs/my-symbolic@{0}: AAA\n\nBut if we ensure that refs/my-symbolic has its own reflog, e.g. by doing this:\n\n$ git update-ref -m BBB --create-reflog refs/my-symbolic\n931dd4e7f267865e8077ae47c75888fe5d1b2755\n\nThen running the same git-reflog command as above now shows the\nsymbolic ref's reflog instead of the target's:\n\n$ git reflog refs/my-symbolic\n931dd4e (HEAD -> master, refs/my-symbolic, test-branch)\nrefs/my-symbolic@{0}: BBB\n\n(The ref is still a symbolic ref pointing to \"test-branch\" as you can\nsee below.)\n\n$ git symbolic-ref refs/my-symbolic\nrefs/heads/test-branch\n\nTo recap, looking at the two git-reflog outputs above, there's no way\nto tell from the output which of the two cases you're in (the symbolic\nref's reflog or the target's).\n\nSo my question is: Is this behaving like it should? I was surprised\nthat git-reflog dereferences the symbolic ref prior to querying the\nreflog, and even more surprising, replaces \"refs/heads/test-branch\" in\nrefs/heads/test-branch's reflog with \"refs/my-symbolic\".\n\nAnd either way, is there a way to get unambiguous output? For example,\nis there a way to make sure you're reading the symbolic ref's reflog\nand not the reflog of its target?\n\nThank you,\n--Chris\n"}]}