{"thread":{"id":"6135","subject":"[PATCH 2/2] Use branch names in 'git-rebase -m' conflict hunks.","startedAt":"2006-12-28T01:43:40Z","lastAt":"2006-12-28T01:43:40Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"30385","messageId":"20061228014340.GB16790@spearce.org","threadId":"6135","inReplyTo":"35ce346ffc16a7c294a8a1e69e604dfec81d288f.1167270210.git.spearce@spearce.org","subject":"[PATCH 2/2] Use branch names in 'git-rebase -m' conflict hunks.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-12-28T01:43:40Z","receivedAt":"2006-12-28T01:43:40Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If a three-way merge in git-rebase generates a conflict then we\nshould take advantage of git-merge-recursive's ability to include\nthe branch name of each side of the conflict hunk by setting the\nGITHEAD_* environment variables.\n\nIn the case of rebase there aren't really two clear branches; we\nhave the branch we are rebasing onto, and we have the branch we are\ncurrently rebasing.  Since most conflicts will be arising between\nthe user's current branch and the branch they are rebasing onto\nwe assume the stuff that isn't in the current commit is the \"onto\"\nbranch and the stuff in the current commit is the \"current\" branch.\n\nThis assumption may however come up wrong if the user resolves one\nconflict in such a way that it conflicts again on a future commit\nalso being rebased.  In this case the user's prior resolution will\nappear to be in the \"onto\" part of the hunk.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n git-rebase.sh |   11 ++++++++++-\n 1 files changed, 10 insertions(+), 1 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex b99f1e3..1f00cb0 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -80,10 +80,18 @@ continue_merge () {\n call_merge () {\n \tcmt=\"$(cat $dotest/cmt.$1)\"\n \techo \"$cmt\" > \"$dotest/current\"\n-\tgit-merge-$strategy \"$cmt^\" -- HEAD \"$cmt\"\n+\thd=$(git-rev-parse --verify HEAD)\n+\tcmt_name=$(git-symbolic-ref HEAD)\n+\tmsgnum=$(cat $dotest/msgnum)\n+\tend=$(cat $dotest/end)\n+\teval GITHEAD_$cmt='\"${cmt_name##refs/heads/}~$(($end - $msgnum))\"'\n+\teval GITHEAD_$hd='\"$(cat $dotest/onto_name)\"'\n+\texport GITHEAD_$cmt GITHEAD_$hd\n+\tgit-merge-$strategy \"$cmt^\" -- \"$hd\" \"$cmt\"\n \trv=$?\n \tcase \"$rv\" in\n \t0)\n+\t\tunset GITHEAD_$cmt GITHEAD_$hd\n \t\treturn\n \t\t;;\n \t1)\n@@ -316,6 +324,7 @@ fi\n \n mkdir -p \"$dotest\"\n echo \"$onto\" > \"$dotest/onto\"\n+echo \"$onto_name\" > \"$dotest/onto_name\"\n prev_head=`git-rev-parse HEAD^0`\n echo \"$prev_head\" > \"$dotest/prev_head\"\n \n-- \n1.4.4.3.gd2e4\n"}]}