{"thread":{"id":"29415","subject":"[PATCH] mergetool: Suppress stderr and fix the \"both added\" test","startedAt":"2012-01-21T10:26:18Z","lastAt":"2012-01-21T23:58:02Z","messageCount":3,"participants":["David Aguilar","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"182895","messageId":"1327141578-54796-1-git-send-email-davvid@gmail.com","threadId":"29415","inReplyTo":null,"subject":"[PATCH] mergetool: Suppress stderr and fix the \"both added\" test","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2012-01-21T10:26:18Z","receivedAt":"2012-01-21T10:26:18Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Silence error messages when \"git checkout-index\" is used to\ncheckout a stage that does not exist.  This can happen now that\nmergetool calls checkout_staged_file() unconditionally when\ncreating the temporary $BASE, $LOCAL, and $REMOTE files.\n\nFix the test so that it checks the contents of the \"both added\"\nfile.  The test was passing as a consequence of accidentally\nhanding a bad path to \"cat\".\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nThis applies on top of da/maint-mergetool-twoway in pu.\n\n git-mergetool.sh     |    4 +++-\n t/t7610-mergetool.sh |    5 +++--\n 2 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex 24bedc5..a9f23f7 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -181,7 +181,9 @@ stage_submodule () {\n }\n \n checkout_staged_file () {\n-    tmpfile=$(expr \"$(git checkout-index --temp --stage=\"$1\" \"$2\")\" : '\\([^\t]*\\)\t')\n+    tmpfile=$(expr \\\n+\t    \"$(git checkout-index --temp --stage=\"$1\" \"$2\" 2>/dev/null)\" \\\n+\t    : '\\([^\t]*\\)\t')\n \n     if test $? -eq 0 -a -n \"$tmpfile\" ; then\n \tmv -- \"$(git rev-parse --show-cdup)$tmpfile\" \"$3\"\ndiff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh\nindex 2272743..3f261a3 100755\n--- a/t/t7610-mergetool.sh\n+++ b/t/t7610-mergetool.sh\n@@ -465,8 +465,9 @@ test_expect_success 'directory vs modified submodule' '\n test_expect_success 'file with no base' '\n     git checkout -b test13 branch1 &&\n     test_must_fail git merge master &&\n-    git mergetool --no-prompt --tool mybase -- base &&\n-    test \"$(cat \"$MERGED\")\" = \"\" &&\n+    git mergetool --no-prompt --tool mybase -- both &&\n+    >expected &&\n+    test_cmp both expected &&\n     git reset --hard master >/dev/null 2>&1\n '\n \n-- \n1.7.7.166.g1cd0c\n"},{"id":"182905","messageId":"7v39b8d9w6.fsf@alter.siamese.dyndns.org","threadId":"29415","inReplyTo":"1327141578-54796-1-git-send-email-davvid@gmail.com","subject":"Re: [PATCH] mergetool: Suppress stderr and fix the \"both added\" test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-01-21T21:27:05Z","receivedAt":"2012-01-21T21:27:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> Silence error messages when \"git checkout-index\" is used to\n> checkout a stage that does not exist.  This can happen now that\n> mergetool calls checkout_staged_file() unconditionally when\n> creating the temporary $BASE, $LOCAL, and $REMOTE files.\n>\n> Fix the test so that it checks the contents of the \"both added\"\n> file.  The test was passing as a consequence of accidentally\n> handing a bad path to \"cat\".\n>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> ---\n> This applies on top of da/maint-mergetool-twoway in pu.\n\nThanks.\n\nIt might make sense to squash this into the previous patch, which luckily\nhasn't hit 'next' yet, though---which I can do locally without need for\nre-send if you like.\n"},{"id":"182916","messageId":"-1651957157444815476@unknownmsgid","threadId":"29415","inReplyTo":"7v39b8d9w6.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] mergetool: Suppress stderr and fix the \"both added\" test","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2012-01-21T23:58:02Z","receivedAt":"2012-01-21T23:58:02Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Jan 21, 2012, at 1:27 PM, Junio C Hamano <gitster@pobox.com> wrote:\n\n> David Aguilar <davvid@gmail.com> writes:\n>\n>> Silence error messages when \"git checkout-index\" is used to\n>> checkout a stage that does not exist.  This can happen now that\n>> mergetool calls checkout_staged_file() unconditionally when\n>> creating the temporary $BASE, $LOCAL, and $REMOTE files.\n>>\n>> Fix the test so that it checks the contents of the \"both added\"\n>> file.  The test was passing as a consequence of accidentally\n>> handing a bad path to \"cat\".\n>>\n>> Signed-off-by: David Aguilar <davvid@gmail.com>\n>> ---\n>> This applies on top of da/maint-mergetool-twoway in pu.\n>\n> Thanks.\n>\n> It might make sense to squash this into the previous patch, which luckily\n> hasn't hit 'next' yet, though---which I can do locally without need for\n> re-send if you like.\n\nYes, please squash this commit. This is certainly a fix up.\n\nThanks,\nDavid\n"}]}