{"thread":{"id":"24112","subject":"Amending a merge commit doesn't update the rerere cache","startedAt":"2010-06-14T23:04:34Z","lastAt":"2010-07-05T13:15:20Z","messageCount":9,"participants":["Jay Soffian","Michael J Gruber","Johannes Sixt","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"143705","messageId":"AANLkTik50ayTQUnft4oD0Paqf-AuFWxGNdx_zZlHKFPg@mail.gmail.com","threadId":"24112","inReplyTo":null,"subject":"Amending a merge commit doesn't update the rerere cache","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-06-14T23:04:34Z","receivedAt":"2010-06-14T23:04:34Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Subject says it all, but I'll elaborate.\n\nDuring the course of testing a merge, I'll sometimes realize there was\na mistake and I'll amend the merge commit. Sadly this doesn't update\nthe rerere cache. For now I've been doing this:\n\n   mv .git/rr-cache .git/rr-cache.saved &&\n   git rerere-train HEAD -1 &&\n   rsync -av .git/rr-cache/ .git/rr-cache.saved &&\n   rm -rf .git/rr-cache &&\n   mv .git/rr-cache.saved .git/rr-cache\n\nWhich is quite hackish. I think amending a merge commit should\nprobably update the rr-cache, but I'm not sure how best to fix this.\n\nThoughts?\n\nj.\n"},{"id":"143720","messageId":"ebd2b2b5bb3352c6204f181416a7a521f8c6abf7.1276582759.git.git@drmicha.warpmail.net","threadId":"24112","inReplyTo":"AANLkTik50ayTQUnft4oD0Paqf-AuFWxGNdx_zZlHKFPg@mail.gmail.com","subject":"[PATCH] rerere.txt: Document forget subcommand","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-06-15T06:21:06Z","receivedAt":"2010-06-15T06:21:06Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"dea4562 (rerere forget path: forget recorded resolution, 2009-12-25)\nintroduced the forget subcommand for rerere.\n\nDocument it.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n Documentation/git-rerere.txt |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt\nindex acc220a..a7370d3 100644\n--- a/Documentation/git-rerere.txt\n+++ b/Documentation/git-rerere.txt\n@@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolution of conflicted merges\n \n SYNOPSIS\n --------\n-'git rerere' ['clear'|'diff'|'status'|'gc']\n+'git rerere' ['clear'|'forget' <pathspec>|'diff'|'status'|'gc']\n \n DESCRIPTION\n -----------\n@@ -40,6 +40,10 @@ This resets the metadata used by rerere if a merge resolution is to be\n aborted.  Calling 'git am [--skip|--abort]' or 'git rebase [--skip|--abort]'\n will automatically invoke this command.\n \n+'forget' <pathspec>::\n+\n+This resets the conflict resolutions which rerere has recorded for <pathspec>.\n+\n 'diff'::\n \n This displays diffs for the current state of the resolution.  It is\n-- \n1.7.1.511.gfbed4\n"},{"id":"143721","messageId":"4C171C7B.3060904@viscovery.net","threadId":"24112","inReplyTo":"AANLkTik50ayTQUnft4oD0Paqf-AuFWxGNdx_zZlHKFPg@mail.gmail.com","subject":"Re: Amending a merge commit doesn't update the rerere cache","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-06-15T06:23:55Z","receivedAt":"2010-06-15T06:23:55Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/15/2010 1:04, schrieb Jay Soffian:\n> Subject says it all, but I'll elaborate.\n> \n> During the course of testing a merge, I'll sometimes realize there was\n> a mistake and I'll amend the merge commit. Sadly this doesn't update\n> the rerere cache.\n\nThere is\n\n\tgit rerere forget that/conflicted/file\n\nIt definitely works as long as the conflict is still recorded in the\nindex; I'm not sure if it works after you have staged the updated resolution.\n\n-- Hannes\n"},{"id":"143743","messageId":"AANLkTimlVyDCc72yirAcL0t0YEWErAT_e0Fadq-WbxNM@mail.gmail.com","threadId":"24112","inReplyTo":"4C171C7B.3060904@viscovery.net","subject":"Re: Amending a merge commit doesn't update the rerere cache","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-06-15T13:08:57Z","receivedAt":"2010-06-15T13:08:57Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Jun 15, 2010 at 2:23 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> There is\n>\n>        git rerere forget that/conflicted/file\n>\n> It definitely works as long as the conflict is still recorded in the\n> index; I'm not sure if it works after you have staged the updated resolution.\n\nIn fact, I use \"rerere forget\" as part of a hacked up rerere-train\nthat I call after I've gotten my merge correct:\n\n---- snip ----\nset -- $(git rev-list --parents HEAD -1)\ncommit=$1; shift\nparent1=$1; shift\nother_parents=\"$@\"\nif test -z \"$other_parents\"; then\n        echo >&2 \"HEAD is not a merge commit\"\n        exit 1\nfi\n\nwhence=$(git rev-parse --abbrev-ref HEAD)\ntrap 'git checkout \"$whence\"' EXIT\n\ngit checkout -q \"$parent1^0\"\nif git merge $other_parents; then\n        echo \"HEAD merges cleanly\"\n        exit 0\nfi\n\ngit show -s --pretty=format:\"Learning from %h: %s\" \"$commit\"\ngit rerere forget 2>/dev/null\ngit checkout -q $commit -- .\ngit rerere\n---- snip ----\n\nI'm still interesting in making commit do the right thing though. In\ngeneral, rerere is an underdocumented feature; I guess I'll start\nfixing that part first.\n\n(Aside: and the reason I care about rerere being correct is that I\noften need to eventually rebase these merges, which is itself a rather\ndelicate procedure.)\n\nj.\n"},{"id":"143762","messageId":"7vr5k86ylg.fsf@alter.siamese.dyndns.org","threadId":"24112","inReplyTo":"ebd2b2b5bb3352c6204f181416a7a521f8c6abf7.1276582759.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] rerere.txt: Document forget subcommand","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-15T16:37:47Z","receivedAt":"2010-06-15T16:37:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> dea4562 (rerere forget path: forget recorded resolution, 2009-12-25)\n> introduced the forget subcommand for rerere.\n> ...\n> diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt\n> index acc220a..a7370d3 100644\n> --- a/Documentation/git-rerere.txt\n> +++ b/Documentation/git-rerere.txt\n> @@ -40,6 +40,10 @@ This resets the metadata used by rerere if a merge resolution is to be\n>  aborted.  Calling 'git am [--skip|--abort]' or 'git rebase [--skip|--abort]'\n>  will automatically invoke this command.\n>  \n> +'forget' <pathspec>::\n> +\n> +This resets the conflict resolutions which rerere has recorded for <pathspec>.\n> +\n\nThis description is not _incorrect_ per-se, but it does not convey one\nimportant aspect of the subcommand; unlike \"clear\" and \"gc\", \"forget\" only\nworks in the context of the _current_ conflict resolution, just like\n\"diff\" and \"status\".\n\nPerhaps s/for <pathspec>/for the current conflict in <pathspec>/ would be\na sufficient improvement?\n"},{"id":"143766","messageId":"AANLkTinfDixTH_l_1quVg68oz4E0AeuuyyOAVrJ2liVz@mail.gmail.com","threadId":"24112","inReplyTo":"7vr5k86ylg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] rerere.txt: Document forget subcommand","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-06-15T16:45:19Z","receivedAt":"2010-06-15T16:45:19Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Jun 15, 2010 at 12:37 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> +'forget' <pathspec>::\n>> +\n>> +This resets the conflict resolutions which rerere has recorded for <pathspec>.\n>> +\n>\n> This description is not _incorrect_ per-se, but it does not convey one\n> important aspect of the subcommand; unlike \"clear\" and \"gc\", \"forget\" only\n> works in the context of the _current_ conflict resolution, just like\n> \"diff\" and \"status\".\n>\n> Perhaps s/for <pathspec>/for the current conflict in <pathspec>/ would be\n> a sufficient improvement?\n\nAlso, pathspec is optional.\n\nj.\n"},{"id":"143815","messageId":"4C188060.5000903@drmicha.warpmail.net","threadId":"24112","inReplyTo":"7vr5k86ylg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] rerere.txt: Document forget subcommand","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-06-16T07:42:24Z","receivedAt":"2010-06-16T07:42:24Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 15.06.2010 18:37:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> dea4562 (rerere forget path: forget recorded resolution, 2009-12-25)\n>> introduced the forget subcommand for rerere.\n>> ...\n>> diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt\n>> index acc220a..a7370d3 100644\n>> --- a/Documentation/git-rerere.txt\n>> +++ b/Documentation/git-rerere.txt\n>> @@ -40,6 +40,10 @@ This resets the metadata used by rerere if a merge resolution is to be\n>>  aborted.  Calling 'git am [--skip|--abort]' or 'git rebase [--skip|--abort]'\n>>  will automatically invoke this command.\n>>  \n>> +'forget' <pathspec>::\n>> +\n>> +This resets the conflict resolutions which rerere has recorded for <pathspec>.\n>> +\n> \n> This description is not _incorrect_ per-se, but it does not convey one\n> important aspect of the subcommand; unlike \"clear\" and \"gc\", \"forget\" only\n> works in the context of the _current_ conflict resolution, just like\n> \"diff\" and \"status\".\n\nDoes \"current context\" mean\n\n- any recorded resolutions for the hunks which are currently recorded as\nin in conflict\n\nor\n\n- the resolution which has (just) been recorded for the current conflict?\n\nI'm completely agnostic of the underlying implementation of rerere (as\ndemonstrated by my questions probably...).\n\n> Perhaps s/for <pathspec>/for the current conflict in <pathspec>/ would be\n> a sufficient improvement?\n\nI guess that would mean 2 above?\n\nIn any case, rerere forget is not a solution for the original \"amend\nmerge commit and forget previous resolution\" question, I guess (I just\nhappened to note it's undocumented). One would have to redo the merge to\nget the conflict info into the index, right?\n\nMichael\n"},{"id":"143827","messageId":"7vljaeg9wt.fsf@alter.siamese.dyndns.org","threadId":"24112","inReplyTo":"4C188060.5000903@drmicha.warpmail.net","subject":"Re: [PATCH] rerere.txt: Document forget subcommand","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-16T17:33:06Z","receivedAt":"2010-06-16T17:33:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Junio C Hamano venit, vidit, dixit 15.06.2010 18:37:\n>> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>>> +'forget' <pathspec>::\n>>> +\n>>> +This resets the conflict resolutions which rerere has recorded for <pathspec>.\n>> \n>> This description is not _incorrect_ per-se, but it does not convey one\n>> important aspect of the subcommand; unlike \"clear\" and \"gc\", \"forget\" only\n>> works in the context of the _current_ conflict resolution, just like\n>> \"diff\" and \"status\".\n>\n> Does \"current context\" mean\n>\n> - any recorded resolutions for the hunks which are currently recorded as\n> in in conflict\n>\n> or\n>\n> - the resolution which has (just) been recorded for the current conflict?\n\nThe latter.  You can have more than one rerere database entries for the\nsame path (i.e. merge conflict resolutions for unrelated branches, each of\nwhich changes unrelated things that happen to be in the same path).  The\nentries in the rerere database are \"when we see a conflict of this shape\n(anywhere), the user wants to resolve it this way\", indexed by the shape\nof the conflict.  There is no \"path\" recorded in the database.\n\nWhen \"rerere forget\" is run, it needs to be told which entry to forget,\nand this is done by regenerating the conflict you just had (and possibly\nhave already resolved, if you are using recent enough git that knows\n\"resolve undo\") using the information in the index, and <pathspec> is used\nto limit this set (i.e. when you have more than one path conflicted in the\ncurrent merge).\n\n> In any case, rerere forget is not a solution for the original \"amend\n> merge commit and forget previous resolution\" question, I guess (I just\n> happened to note it's undocumented). One would have to redo the merge to\n> get the conflict info into the index, right?\n\nOnce you write the result of a merge out to a tree, the tree does not even\nknow if there was a conflict.  It does not know how you arrived to that\nstate in general.  You simply don't have enough information after reading\na tree into your index in order to \"amend\" it.  When reading a tree that\nbelongs to a merge commit into the index, we _could_ try to regenerate the\nconflicted state and immediately resolve them to the tree's state but I\ndon't think it is worth the cost and complexity.  Besides, at that point\nyou do not even know what merge strategy (and which version of that\nstrategy) was originally used.\n"},{"id":"144821","messageId":"4d2171a1aeb40321f5956da48f2a36e7709a8a7c.1278333908.git.git@drmicha.warpmail.net","threadId":"24112","inReplyTo":"7vljaeg9wt.fsf@alter.siamese.dyndns.org","subject":"[PATCHv2] rerere.txt: Document forget subcommand","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-07-05T13:15:20Z","receivedAt":"2010-07-05T13:15:20Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"dea4562 (rerere forget path: forget recorded resolution, 2009-12-25)\nintroduced the forget subcommand for rerere.\n\nDocument it.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nThis somewhat fell under all radars.\n\nv2 takes into account suggestions by Junio and Jay.\n\n Documentation/git-rerere.txt |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt\nindex acc220a..db99d47 100644\n--- a/Documentation/git-rerere.txt\n+++ b/Documentation/git-rerere.txt\n@@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolution of conflicted merges\n \n SYNOPSIS\n --------\n-'git rerere' ['clear'|'diff'|'status'|'gc']\n+'git rerere' ['clear'|'forget' [<pathspec>]|'diff'|'status'|'gc']\n \n DESCRIPTION\n -----------\n@@ -40,6 +40,11 @@ This resets the metadata used by rerere if a merge resolution is to be\n aborted.  Calling 'git am [--skip|--abort]' or 'git rebase [--skip|--abort]'\n will automatically invoke this command.\n \n+'forget' <pathspec>::\n+\n+This resets the conflict resolutions which rerere has recorded for the current\n+conflict in <pathspec>.  The <pathspec> is optional.\n+\n 'diff'::\n \n This displays diffs for the current state of the resolution.  It is\n-- \n1.7.1.621.g01d76\n"}]}