Hi Junio, On Sun, 8 Jul 2018, Johannes Schindelin wrote: > I just encoutered a problem with your `refs/notes/amlog` and I hope you > can help me with that. > > Concretely, I want GitGitGadget to be able to identify the commit that > corresponds to a given mail that contained a patch (if it ever made it > into `pu`), to automate all kinds of tedious things that I currently have > to perform manually. > > And here I hit a block: I am looking for the commit corresponding to > aca087479b35cbcbd7c84c7ca3bcf556133d0548.1530274571.git.gitgitgadget@xxxxxxxxx > > When I ask `git notes --ref=refs/notes/gitster-amlog show > 4cec3986f017d84c8d6a2c4233d2eba4a3ffa60d` (the SHA-1 is the one > corresponding to `Message-Id: <...>` for that mail), it insists on > outputting > > 5902152ab02291af4454f24a8ccaf2adddefc306 > > However, I cannot find that commit anywhere. > > When I look for the commit in the same manual, tedious way that I want to > automate, I find that it *is* in `pu`, but as > > 5cf8e064747be2026bb23be37f84f2f0b2a31781 > > Even curiouser: when I now ask for the commit notes for both of those > SHA-1s, I get back the correct, same Message-Id *for both of them*, which > makes me think that it was recorded correctly, but then overwritten due to > some process I don't understand. > > Would you be able to shed light into this? I think I reconstructed the culprit: In https://github.com/git/git/commit/a7cddab6e8, your post-applypatch hook added the note for commit 5902152ab02291af4454f24a8ccaf2adddefc306 that it was generated from Message-Id: <aca087479b35cbcbd7c84c7ca3bcf556133d0548.1530274571.git.gitgitgadget@xxxxxxxxx>, and then https://github.com/git/git/commit/ff28c8f9283 added the note to map that Message-Id back to that commit. So far, so good! But then, https://github.com/git/git/commit/81b08c718e9 indicates that you ran an interactive rebase and amended the commit 5902152ab02291af4454f24a8ccaf2adddefc306 and the result was a new commit 5cf8e064747be2026bb23be37f84f2f0b2a31781 that was then also mapped to that Message-Id. And obviously, you lack a post-rewrite hook a la ```sh refopt=--ref=refs/notes/amlog while read old new rest do mid="$(git notes $refopt show $old 2>/dev/null)" && git notes $refopt set -m "$mid" $new done ``` I was pretty happy to figure that out all on my own, and already on my way to come up with that post-rewrite hook and a script to parse all of the commits in refs/notes/amlog whose commit message contains `commit --amend` to fix those problems, but before starting, I wanted to sanity check the oldest such commit: https://github.com/git/git/commit/49bc3858e3c You will be readily able to verify that it maps the commit 73bfebd43e14bcc1502577c0933b6a16ad540b99 to Message-Id: <20170619175605.27864-3-phillip.wood@xxxxxxxxxxxx>, but that 7c1a3dcf23e (which corresponds to that Message-Id) maps to f64760904766db662badf1256923532b9e1a6ebd. So yes, there is the same problem with this mapping, and we need to fix it. *However*. Neither https://github.com/git/git/commit/73bfebd43e1 nor https://github.com/git/git/commit/f6476090476 show any commit! Does that mean that the patch with that Message-Id never made it into `master` and was simply dropped and gc'ed at some stage? Actually, no: https://public-inbox.org/git/20170619175605.27864-3-phillip.wood@xxxxxxxxxxxx/ corresponds quite clearly to https://github.com/git/git/commit/1ceb9dfab7e Now, that commit message was clearly edited by you (I note the capital "A" in Phillip's "Add" vs your lower-case "a" in "add"), but the patch quite obviously made it into our code based in its original shape. So I looked for the commit notes for that commit, but there aren't any! To summarize, there are two commits recorded for that Message-Id, the later one not mapped back, and neither is the correct commit that made it into `master`. It would be nice to figure out what went wrong there, and how to fix it for the future (and also to fix up the existing mis-mappings in `amlog`). However, at this stage I really have not enough information at my hands, even with as much effort as I spent so far to figure out where my patch went (which started this bug hunt). Could you kindly spend some time on that? Otherwise, `amlog` is a lot less useful than it could otherwise be. Thanks, Dscho P.S.: funny side note: it would appear that the rewritten notes all get the author of the patch author, look e.g. at the author of https://github.com/git/git/commit/81b08c718e97