{"thread":{"id":"17457","subject":"git mergetool from next not working in subdirectory","startedAt":"2009-01-30T13:05:45Z","lastAt":"2009-01-30T16:22:22Z","messageCount":8,"participants":["Jonas Flodén","Johannes Gilger","Charles Bailey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"102582","messageId":"glutv9$4b1$1@ger.gmane.org","threadId":"17457","inReplyTo":null,"subject":"git mergetool from next not working in subdirectory","fromName":"Jonas Flodén","fromEmail":"jonas.floden@gmail.com","sentAt":"2009-01-30T13:05:45Z","receivedAt":"2009-01-30T13:05:45Z","isPatch":false,"sender":{"key":"jonas.floden@gmail.com","avatar":null},"body":"Hi,\n\nI just upgraded to the current 'next' version of git\n(v1.6.1.2-418-gd79e69c). When I run git mergetool from\na subdirectory in my workspace I get the following output:\n(with obfuscated output..)\n\n~/src/rep/subdir $ git mergetool\nMerging the files: a/b/file.c\n\ngit checkout-index: subdir/subdir/a/b/file.c is not in the cache\ngit checkout-index: subdir/subdir/a/b/file.c is not in the cache\ngit checkout-index: subdir/subdir/a/b/file.c is not in the cache\nNormal merge conflict for 'a/b/file.c':\n  {local}: modified\n\n  {remote}: modified\n\nHit return to start merge resolution tool (kdiff3):\n\nWhen I hit enter the merge resolution finishes right away\nand the file ends up empty.\n\nNote how subdir is duplicated in the output above.\n\nThis works perfectly fine with the 'master' version (1.6.1.2-253-ga34a).\n\nRegards,\nJonas\n"},{"id":"102592","messageId":"glv0jl$cbl$1@ger.gmane.org","threadId":"17457","inReplyTo":"glutv9$4b1$1@ger.gmane.org","subject":"Re: git mergetool from next not working in subdirectory","fromName":"Johannes Gilger","fromEmail":"heipei@hackvalue.de","sentAt":"2009-01-30T13:50:46Z","receivedAt":"2009-01-30T13:50:46Z","isPatch":false,"sender":{"key":"heipei@hackvalue.de","avatar":"https://avatars.githubusercontent.com/u/6072?v=4"},"body":"On 2009-01-30, Jonas Flodén <jonas.floden@gmail.com> wrote:\n> I just upgraded to the current 'next' version of git\n> ...\n> This works perfectly fine with the 'master' version (1.6.1.2-253-ga34a).\n\nHi,\n\nas you're running next you seem to be interested in the git development. \nThat's why I suggest you try to bisect the commit that causes this. \nFixing it is another problem entirely, but this way you'd at least take \nthe tedious of work of a. duplicating your setup b. finding the bug off \nof the git developers.\n\nGreetings,\nJojo\n\n-- \nJohannes Gilger <heipei@hackvalue.de>\nhttp://hackvalue.de/heipei/\nGPG-Key: 0x42F6DE81\nGPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81\n"},{"id":"102594","messageId":"20090130140615.GA26321@hashpling.org","threadId":"17457","inReplyTo":"glutv9$4b1$1@ger.gmane.org","subject":"Re: git mergetool from next not working in subdirectory","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2009-01-30T14:06:15Z","receivedAt":"2009-01-30T14:06:15Z","isPatch":false,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"On Fri, Jan 30, 2009 at 02:05:45PM +0100, Jonas Flodén wrote:\n> ~/src/rep/subdir $ git mergetool\n> Merging the files: a/b/file.c\n> \n> git checkout-index: subdir/subdir/a/b/file.c is not in the cache\n> git checkout-index: subdir/subdir/a/b/file.c is not in the cache\n> git checkout-index: subdir/subdir/a/b/file.c is not in the cache\n> Normal merge conflict for 'a/b/file.c':\n>   {local}: modified\n> \n>   {remote}: modified\n\n\nOh bother. I know exactly what this is. ls-files -u shows paths\nrelative to the work tree root, whereas checkout-index responds to\nrelative paths. Essentially the \"$prefix\" needs to come out of the\ncalls to the new checkout_staged_file shell function.\n\nThis is the bad commit 0ec7b6c26dad51f690cd985d4a5357634123c4b7\n\nI can patch this (and more importantly add a test for this) tonight if\nnobody beats me to it.\n\n-- \nCharles Bailey\nhttp://ccgi.hashpling.plus.com/blog/\n"},{"id":"102598","messageId":"1233325351-31496-1-git-send-email-charles@hashpling.org","threadId":"17457","inReplyTo":"20090130140615.GA26321@hashpling.org","subject":"[PATCH] Quick and dirty mergetool fix","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2009-01-30T14:22:31Z","receivedAt":"2009-01-30T14:22:31Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"---\n git-mergetool.sh |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex aefdca7..db9ef43 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -161,9 +161,9 @@ merge_file () {\n     local_mode=`git ls-files -u -- \"$MERGED\" | awk '{if ($3==2) print $1;}'`\n     remote_mode=`git ls-files -u -- \"$MERGED\" | awk '{if ($3==3) print $1;}'`\n \n-    base_present   && checkout_staged_file 1 \"$prefix$MERGED\" \"$BASE\"\n-    local_present  && checkout_staged_file 2 \"$prefix$MERGED\" \"$LOCAL\"\n-    remote_present && checkout_staged_file 3 \"$prefix$MERGED\" \"$REMOTE\"\n+    base_present   && checkout_staged_file 1 \"$MERGED\" \"$BASE\"\n+    local_present  && checkout_staged_file 2 \"$MERGED\" \"$LOCAL\"\n+    remote_present && checkout_staged_file 3 \"$MERGED\" \"$REMOTE\"\n \n     if test -z \"$local_mode\" -o -z \"$remote_mode\"; then\n \techo \"Deleted merge conflict for '$MERGED':\"\n-- \n1.6.1.235.gc9d403\n"},{"id":"102608","messageId":"4983241B.6020208@gmail.com","threadId":"17457","inReplyTo":"1233325351-31496-1-git-send-email-charles@hashpling.org","subject":"Re: [PATCH] Quick and dirty mergetool fix","fromName":"Jonas Flodén","fromEmail":"jonas.floden@gmail.com","sentAt":"2009-01-30T16:00:27Z","receivedAt":"2009-01-30T16:00:27Z","isPatch":true,"sender":{"key":"jonas.floden@gmail.com","avatar":null},"body":"Hmm, with that patch I get get this instead:\n\nmv: cannot stat `.merge_file_Yg2IIs': No such file or directory\nmv: cannot stat `.merge_file_4xGT8t': No such file or directory\nmv: cannot stat `.merge_file_4XAVAt': No such file or directory\n\nWhich seems to be a problem in checkout_staged_file()\n\nThe .merge_file_* files exists in the repository root (the dir with\n.git) but I don't know how to fix that..\n\nThanks!\n\n// Jonas\n"},{"id":"102611","messageId":"1233332166-14300-1-git-send-email-charles@hashpling.org","threadId":"17457","inReplyTo":"4983241B.6020208@gmail.com","subject":"[PATCH] Quick and dirty mergetool fix - take 2","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2009-01-30T16:16:06Z","receivedAt":"2009-01-30T16:16:06Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"---\n git-mergetool.sh |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex aefdca7..d495a6b 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -131,7 +131,7 @@ checkout_staged_file () {\n     tmpfile=$(expr \"$(git checkout-index --temp --stage=\"$1\" \"$2\")\" : '\\([^\t]*\\)\t')\n \n     if test $? -eq 0 -a -n \"$tmpfile\" ; then\n-\tmv -- \"$tmpfile\" \"$3\"\n+\tmv -- \"$(git rev-parse --show-cdup)$tmpfile\" \"$3\"\n     fi\n }\n \n@@ -161,9 +161,9 @@ merge_file () {\n     local_mode=`git ls-files -u -- \"$MERGED\" | awk '{if ($3==2) print $1;}'`\n     remote_mode=`git ls-files -u -- \"$MERGED\" | awk '{if ($3==3) print $1;}'`\n \n-    base_present   && checkout_staged_file 1 \"$prefix$MERGED\" \"$BASE\"\n-    local_present  && checkout_staged_file 2 \"$prefix$MERGED\" \"$LOCAL\"\n-    remote_present && checkout_staged_file 3 \"$prefix$MERGED\" \"$REMOTE\"\n+    base_present   && checkout_staged_file 1 \"$MERGED\" \"$BASE\"\n+    local_present  && checkout_staged_file 2 \"$MERGED\" \"$LOCAL\"\n+    remote_present && checkout_staged_file 3 \"$MERGED\" \"$REMOTE\"\n \n     if test -z \"$local_mode\" -o -z \"$remote_mode\"; then\n \techo \"Deleted merge conflict for '$MERGED':\"\n-- \n1.6.1.235.gc9d403\n"},{"id":"102613","messageId":"20090130161850.GB26321@hashpling.org","threadId":"17457","inReplyTo":"1233332166-14300-1-git-send-email-charles@hashpling.org","subject":"Re: [PATCH] Quick and dirty mergetool fix - take 2","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2009-01-30T16:18:50Z","receivedAt":"2009-01-30T16:18:50Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"On Fri, Jan 30, 2009 at 04:16:06PM +0000, Charles Bailey wrote:\n\nSorry, I meant to add this comment to the last patch.\n\nI have a test so I'm more confident about this version. It's not\nsigned off yet as I want to clean up the new test and make sure I've\nconsidered everything - well more things - but it should at least work\nnow.\n\n-- \nCharles Bailey\nhttp://ccgi.hashpling.plus.com/blog/\n"},{"id":"102614","messageId":"4983293E.9070401@gmail.com","threadId":"17457","inReplyTo":"1233332166-14300-1-git-send-email-charles@hashpling.org","subject":"Re: [PATCH] Quick and dirty mergetool fix - take 2","fromName":"Jonas Flodén","fromEmail":"jonas.floden@gmail.com","sentAt":"2009-01-30T16:22:22Z","receivedAt":"2009-01-30T16:22:22Z","isPatch":true,"sender":{"key":"jonas.floden@gmail.com","avatar":null},"body":"Charles Bailey wrote:\n> ---\n>  git-mergetool.sh |    8 ++++----\n>  1 files changed, 4 insertions(+), 4 deletions(-)\n> \n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index aefdca7..d495a6b 100755\n> --- a/git-mergetool.sh\n> +++ b/git-mergetool.sh\n> @@ -131,7 +131,7 @@ checkout_staged_file () {\n>      tmpfile=$(expr \"$(git checkout-index --temp --stage=\"$1\" \"$2\")\" : '\\([^\t]*\\)\t')\n>  \n>      if test $? -eq 0 -a -n \"$tmpfile\" ; then\n> -\tmv -- \"$tmpfile\" \"$3\"\n> +\tmv -- \"$(git rev-parse --show-cdup)$tmpfile\" \"$3\"\n>      fi\n>  }\n>  \n> @@ -161,9 +161,9 @@ merge_file () {\n>      local_mode=`git ls-files -u -- \"$MERGED\" | awk '{if ($3==2) print $1;}'`\n>      remote_mode=`git ls-files -u -- \"$MERGED\" | awk '{if ($3==3) print $1;}'`\n>  \n> -    base_present   && checkout_staged_file 1 \"$prefix$MERGED\" \"$BASE\"\n> -    local_present  && checkout_staged_file 2 \"$prefix$MERGED\" \"$LOCAL\"\n> -    remote_present && checkout_staged_file 3 \"$prefix$MERGED\" \"$REMOTE\"\n> +    base_present   && checkout_staged_file 1 \"$MERGED\" \"$BASE\"\n> +    local_present  && checkout_staged_file 2 \"$MERGED\" \"$LOCAL\"\n> +    remote_present && checkout_staged_file 3 \"$MERGED\" \"$REMOTE\"\n>  \n>      if test -z \"$local_mode\" -o -z \"$remote_mode\"; then\n>  \techo \"Deleted merge conflict for '$MERGED':\"\n\nYes, I was just about to propose a similar patch.\n\nThis solution works for me!\n\nYou might want to remove $prefix from the top of the\nfile since it's not used any more.\n\nThanks!\n\n// Jonas\n"}]}