summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-12-21 23:58:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-21 23:58:44 (GMT)
commitfa82cf43b1da596d043b5e21fb22a4c5f0456fa4 (patch)
tree2a94ed1e3fc80a8c3b10a419e896a039cab1f6d4
parent730f2a8a60960c30a79e00ebe034836f60befbf0 (diff)
downloadgit-fa82cf43b1da596d043b5e21fb22a4c5f0456fa4.zip
git-fa82cf43b1da596d043b5e21fb22a4c5f0456fa4.tar.gz
git-fa82cf43b1da596d043b5e21fb22a4c5f0456fa4.tar.bz2
Meta/post-applypatch: don't contaminate amlog with useless "reverse mapping"
The notes/amlog database is used to annotate individual commits that result from "git am" application. A note is attached to the commit object and record s the Message-ID of the incoming e-mailed patch that resulted in the commit, so "git show --notes=amlog" would easily show where the commit came from. The rewrite-hook mechanism can be used to maintain the notes across rebasing and amending (but cherry-pick does not preserve the note by design---the maintainer has to be careful to avoid using cherry-pick). One message can and does result in multiple commits, and the mapping worked naturally in this direction. Originally it felt like a good idea to create a blob object that has a Message-ID in it, and annotate the blob object with a note message that has the name of the commit object that results by running "git am" on the message, and mix such records in the notes database. When you have a message, from the Message-ID, you can manufacture a blob that has the Message-ID in it and ask the notes database about the note attached to it, effectively giving you a reverse mapping. This was ugly, unnecessary and unworkable at the same time. - These blobs with message-ID in them are not anchored by any ref; the reverse mapping entries in the notes tree were subject to be gc'ed any time. - "git grep -e '<message-id>' notes/amlog" essentially gives a mechanism that is quick enough to find what commits resulted from a message. - There is no machinery that helps these reverse mapping notes to be maintained across rebases and amends. Because a single "git am" session is often far from enough for an e-mailed patch, these "reverse" entries that were created upon the first application quickly became stale pointing at commits that have been amended away. There often are more than one commit that result from the same message on topic branches while the right base is being selected, so "the last one wins" rule, if it were even possible to implement, wouldn't have been sufficient. Since grepping for the Message-ID in the notes database, i.e. using the forward mapping, gives an access to the necessary piece of information reliably and quicly enough, let's retire the failed attempt to throw reverse mapping entries in to the "amlog" notes.
-rwxr-xr-xpost-applypatch2
1 files changed, 0 insertions, 2 deletions
diff --git a/post-applypatch b/post-applypatch
index 886ad76..83db132 100755
--- a/post-applypatch
+++ b/post-applypatch
@@ -49,7 +49,5 @@ then
GIT_NOTES_REF=refs/notes/amlog
export GIT_NOTES_REF
git notes add -f -m "Message-Id: $message_id" "$head"
- blob=$(git notes list "$head") &&
- git notes append -m "$head" $blob
)
fi