{"thread":{"id":"27591","subject":"[PATCH v3 1/2] Add new function die_with_status","startedAt":"2011-06-09T07:47:01Z","lastAt":"2011-06-13T18:07:03Z","messageCount":6,"participants":["Fredrik Gustafsson","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"169738","messageId":"1307605623-2831-1-git-send-email-iveqy@iveqy.com","threadId":"27591","inReplyTo":null,"subject":"[PATCH v3 0/2] submodule update continue","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2011-06-09T07:47:01Z","receivedAt":"2011-06-09T07:47:01Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"This series adds support to submodule update to continue if some\nsubmodules fail to do so.\n\nThis is the third iteration of this patch series. \nThe first can be found on:\nhttp://thread.gmane.org/gmane.comp.version-control.git/171895\nThe second can be found on:\nhttp://thread.gmane.org/gmane.comp.version-control.git/173629\nFredrik Gustafsson (2):\n  Add new function die_with_status\n  submodule update: continue when a checkout fails\n\n git-sh-setup.sh             |   12 +++-\n git-submodule.sh            |   48 +++++++++++++--\n t/t7406-submodule-update.sh |  144 +++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 196 insertions(+), 8 deletions(-)\n\n-- \n1.7.6.rc0.14.g4fc55\n"},{"id":"169737","messageId":"1307605623-2831-2-git-send-email-iveqy@iveqy.com","threadId":"27591","inReplyTo":"1307605623-2831-1-git-send-email-iveqy@iveqy.com","subject":"[PATCH v3 1/2] Add new function die_with_status","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2011-06-09T07:47:02Z","receivedAt":"2011-06-09T07:47:02Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"This function takes the exit code as a parameter.\n\nThis allows scripts to control the exit code when they need to die.\n\nMake the old die-function to use die_with_status for simpler\nmaintenance.\n\ndie no longer prints empty die messages, this is a changed behavior.\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\nMentored-by: Jens Lehmann <Jens.Lehmann@web.de>\nMentored-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n git-sh-setup.sh |   12 ++++++++++--\n 1 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 94e26ed..1a91f6e 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -40,8 +40,16 @@ git_broken_path_fix () {\n # @@BROKEN_PATH_FIX@@\n \n die() {\n-\techo >&2 \"$@\"\n-\texit 1\n+\tdie_with_status 1 $@\n+}\n+die_with_status() {\n+\tstat=$1\n+\tshift\n+\tif test ${#@} -gt 0\n+\tthen\n+\t\techo >&2 \"$@\"\n+\tfi\n+\texit $stat\n }\n \n GIT_QUIET=\n-- \n1.7.6.rc0.14.g4fc55\n"},{"id":"169739","messageId":"1307605623-2831-3-git-send-email-iveqy@iveqy.com","threadId":"27591","inReplyTo":"1307605623-2831-1-git-send-email-iveqy@iveqy.com","subject":"[PATCH v3 2/2] submodule update: continue when a checkout fails","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2011-06-09T07:47:03Z","receivedAt":"2011-06-09T07:47:03Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"\"git submodule update\" stops at the first error and gives control\nback to the user. Only after the user fixes the problematic\nsubmodule and runs \"git submodule update\" again, the second error\nis found. And the user needs to repeat until all the problems are\nfound and fixed one by one. This is tedious.\n\nInstead, the command can remember which submodules it had trouble with,\ncontinue updating the ones it can, and report which ones had errors at\nthe end. The user can run \"git submodule update\", find all the ones that\nneed minor fixing (e.g. working tree was dirty) to fix them in a single\npass. Then another \"git submodule update\" can be run to update all.\n\nNote that the problematic submodules are skipped only when they are to\nbe integrated with a safer value of submodule.<name>.update option,\nnamely \"checkout\". Fixing a failure in a submodule that uses \"rebase\" or\n\"merge\" may need an involved conflict resolution by the user, and\nleaving too many submodules in states that need resolution would not\nreduce the mental burden on the user.\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\nMentored-by: Jens Lehmann <Jens.Lehmann@web.de>\nMentored-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n git-submodule.sh            |   48 +++++++++++++--\n t/t7406-submodule-update.sh |  144 +++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 186 insertions(+), 6 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex d189a24..69780a8 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -444,7 +444,8 @@ cmd_update()\n \tfi\n \n \tcloned_modules=\n-\tmodule_list \"$@\" |\n+\tmodule_list \"$@\" | {\n+\terr=\n \twhile read mode sha1 stage path\n \tdo\n \t\tif test \"$stage\" = U\n@@ -525,17 +526,52 @@ cmd_update()\n \t\t\t\t;;\n \t\t\tesac\n \n-\t\t\t(clear_local_git_env; cd \"$path\" && $command \"$sha1\") ||\n-\t\t\tdie \"Unable to $action '$sha1' in submodule path '$path'\"\n-\t\t\tsay \"Submodule path '$path': $msg '$sha1'\"\n+\t\t\tif (clear_local_git_env; cd \"$path\" && $command \"$sha1\")\n+\t\t\tthen\n+\t\t\t\tsay \"Submodule path '$path': $msg '$sha1'\"\n+\t\t\telse\n+\t\t\t\tcase $action in\n+\t\t\t\trebase|merge)\n+\t\t\t\t\tdie_with_status 2 \"Unable to $action '$sha1' in submodule path '$path'\"\n+\t\t\t\t\t;;\n+\t\t\t\t*)\n+\t\t\t\t\terr=\"${err} \\\"Failed to $action in submodule path '$path'\\\"\"\n+\t\t\t\t\tcontinue\n+\t\t\t\t\t;;\n+\t\t\t\tesac\n+\t\t\tfi\n \t\tfi\n \n \t\tif test -n \"$recursive\"\n \t\tthen\n-\t\t\t(clear_local_git_env; cd \"$path\" && eval cmd_update \"$orig_flags\") ||\n-\t\t\tdie \"Failed to recurse into submodule path '$path'\"\n+\t\t\t(clear_local_git_env; cd \"$path\" && eval cmd_update \"$orig_flags\")\n+\t\t\tres=$?\n+\t\t\tif test $res -gt 0\n+\t\t\tthen\n+\t\t\t\tif test $res -eq 1\n+\t\t\t\tthen\n+\t\t\t\t\terr=\"${err} \\\"Failed to recurse into submodule path '$path'\\\"\"\n+\t\t\t\t\tcontinue\n+\t\t\t\telse\n+\t\t\t\t\tdie_with_status $res \"Failed to recurse into submodule path '$path'\"\n+\t\t\t\tfi\n+\t\t\tfi\n \t\tfi\n \tdone\n+\n+\tif test -n \"$err\"\n+\tthen\n+\t\tOIFS=$IFS\n+\t\tIFS=';'\n+\t\tfor e in $err\n+\t\tdo\n+\t\t\techo $e\n+\t\tdone\n+\t\tIFS=$OIFS\n+\t\tdie\n+\tfi\n+\n+\t}\n }\n \n set_name_rev () {\ndiff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\nindex 4f16fcc..807f761 100755\n--- a/t/t7406-submodule-update.sh\n+++ b/t/t7406-submodule-update.sh\n@@ -298,4 +298,148 @@ test_expect_success 'submodule update ignores update=rebase config for new submo\n \t)\n '\n \n+test_expect_success 'submodule update continues after checkout error' '\n+\t(cd super &&\n+\t git reset --hard HEAD &&\n+\t git submodule add ../submodule submodule2 &&\n+\t git submodule init &&\n+\t git commit -am \"new_submodule\" &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../expect\n+\t ) &&\n+\t (cd submodule &&\n+\t  test_commit \"update_submodule\" file\n+\t ) &&\n+\t (cd submodule2 &&\n+\t  test_commit \"update_submodule2\" file\n+\t ) &&\n+\t git add submodule &&\n+\t git add submodule2 &&\n+\t git commit -m \"two_new_submodule_commits\" &&\n+\t (cd submodule &&\n+\t  echo \"\" > file\n+\t ) &&\n+\t git checkout HEAD^ &&\n+\t test_must_fail git submodule update &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../actual\n+\t ) &&\n+\t test_cmp expect actual\n+\t)\n+'\n+test_expect_success 'submodule update continues after recursive checkout error' '\n+\t(cd super &&\n+\t git reset --hard HEAD &&\n+\t git checkout master &&\n+\t git submodule update &&\n+\t (cd submodule &&\n+\t  git submodule add ../submodule subsubmodule &&\n+\t  git submodule init &&\n+\t  git commit -m \"new_subsubmodule\"\n+\t ) &&\n+\t git add submodule &&\n+\t git commit -m \"update_submodule\" &&\n+\t (cd submodule &&\n+\t  (cd subsubmodule &&\n+\t   test_commit \"update_subsubmodule\" file\n+\t  ) &&\n+\t  git add subsubmodule &&\n+\t  test_commit \"update_submodule_again\" file &&\n+\t  (cd subsubmodule &&\n+\t   test_commit \"update_subsubmodule_again\" file\n+\t  ) &&\n+\t  test_commit \"update_submodule_again_again\" file\n+\t ) &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../expect &&\n+\t  test_commit \"update_submodule2_again\" file\n+\t ) &&\n+\t git add submodule &&\n+\t git add submodule2 &&\n+\t git commit -m \"new_commits\" &&\n+\t git checkout HEAD^ &&\n+\t (cd submodule &&\n+\t  git checkout HEAD^ &&\n+\t  (cd subsubmodule &&\n+\t   echo \"\" > file\n+\t  )\n+\t ) &&\n+\t test_must_fail git submodule update --recursive &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../actual\n+\t ) &&\n+\t test_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'submodule update exit immediately in case of merge conflict' '\n+\t(cd super &&\n+\t git checkout master &&\n+\t git reset --hard HEAD &&\n+\t (cd submodule &&\n+\t  (cd subsubmodule &&\n+\t   git reset --hard HEAD\n+\t  )\n+\t ) &&\n+\t git submodule update --recursive &&\n+\t (cd submodule &&\n+\t  test_commit \"update_submodule_2\" file\n+\t ) &&\n+\t (cd submodule2 &&\n+\t  test_commit \"update_submodule2_2\" file\n+\t ) &&\n+\t git add submodule &&\n+\t git add submodule2 &&\n+\t git commit -m \"two_new_submodule_commits\" &&\n+\t (cd submodule &&\n+\t  git checkout master &&\n+\t  test_commit \"conflict\" file &&\n+\t  echo \"conflict\" > file\n+\t ) &&\n+\t git checkout HEAD^ &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../expect\n+\t ) &&\n+\t git config submodule.submodule.update merge &&\n+\t test_must_fail git submodule update &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../actual\n+\t ) &&\n+\t test_cmp expect actual\n+\t)\n+'\n+test_expect_success 'submodule update exit immediately after recursive rebase error' '\n+\t(cd super &&\n+\t git checkout master &&\n+\t git reset --hard HEAD &&\n+\t (cd submodule &&\n+\t  git reset --hard HEAD &&\n+\t  git submodule update --recursive\n+\t ) &&\n+\t (cd submodule &&\n+\t  test_commit \"update_submodule_3\" file\n+\t ) &&\n+\t (cd submodule2 &&\n+\t  test_commit \"update_submodule2_3\" file\n+\t ) &&\n+\t git add submodule &&\n+\t git add submodule2 &&\n+\t git commit -m \"two_new_submodule_commits\" &&\n+\t (cd submodule &&\n+\t  git checkout master &&\n+\t  test_commit \"conflict2\" file &&\n+\t  echo \"conflict\" > file\n+\t ) &&\n+\t git checkout HEAD^ &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../expect\n+\t ) &&\n+\t git config submodule.submodule.update rebase &&\n+\t test_must_fail git submodule update &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../actual\n+\t ) &&\n+\t test_cmp expect actual\n+\t)\n+'\n test_done\n-- \n1.7.6.rc0.14.g4fc55\n"},{"id":"169795","messageId":"7vlixayl7d.fsf@alter.siamese.dyndns.org","threadId":"27591","inReplyTo":"1307605623-2831-3-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH v3 2/2] submodule update: continue when a checkout fails","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-09T17:21:42Z","receivedAt":"2011-06-09T17:21:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fredrik Gustafsson <iveqy@iveqy.com> writes:\n\n> +\t\t\t\t*)\n> +\t\t\t\t\terr=\"${err} \\\"Failed to $action in submodule path '$path'\\\"\"\n> ...\n> +\t\t\t\t\terr=\"${err} \\\"Failed to recurse into submodule path '$path'\\\"\"\n> +\t\t\t\t\tcontinue\n> +\t\t\t\telse\n> +\t\t\t\t\tdie_with_status $res \"Failed to recurse into submodule path '$path'\"\n> +\t\t\t\tfi\n> +\t\t\tfi\n>  \t\tfi\n>  \tdone\n> +\n> +\tif test -n \"$err\"\n> +\tthen\n> +\t\tOIFS=$IFS\n> +\t\tIFS=';'\n> +\t\tfor e in $err\n\nHmm, I do not see anybody concatenating things with semicolons in between...\nAm I reading a right patch?\n\nAlso I am puzzled what the double-quotes around each error message are\ndoing. Are they meant to be shown to the end user?\n\n> +\t\tdo\n> +\t\t\techo $e\n\nShould this go to the standard error output?\n\n> +\t\tdone\n> +\t\tIFS=$OIFS\n> +\t\tdie\n\nDo we want to give an extra empty line here with \"die\"?\n"},{"id":"169955","messageId":"1307985326-3216-1-git-send-email-iveqy@iveqy.com","threadId":"27591","inReplyTo":"7vlixayl7d.fsf@alter.siamese.dyndns.org","subject":"[PATCH v4 2/2] submodule update: continue when a checkout fails","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2011-06-13T17:15:26Z","receivedAt":"2011-06-13T17:15:26Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"\"git submodule update\" stops at the first error and gives control\nback to the user. Only after the user fixes the problematic\nsubmodule and runs \"git submodule update\" again, the second error\nis found. And the user needs to repeat until all the problems are\nfound and fixed one by one. This is tedious.\n\nInstead, the command can remember which submodules it had trouble with,\ncontinue updating the ones it can, and report which ones had errors at\nthe end. The user can run \"git submodule update\", find all the ones that\nneed minor fixing (e.g. working tree was dirty) to fix them in a single\npass. Then another \"git submodule update\" can be run to update all.\n\nNote that the problematic submodules are skipped only when they are to\nbe integrated with a safer value of submodule.<name>.update option,\nnamely \"checkout\". Fixing a failure in a submodule that uses \"rebase\" or\n\"merge\" may need an involved conflict resolution by the user, and\nleaving too many submodules in states that need resolution would not\nreduce the mental burden on the user.\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\nMentored-by: Jens Lehmann <Jens.Lehmann@web.de>\nMentored-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\nI'm sorry. You were reading a mix between two solutions that slipped\nthrough. Here's a corrected patch.\n\nI'll changed it to be printed to standard error output instead.\n\ndie will not print an empty line (as of the first patch in this series) but I\nchanged this to \"exit 1\" instead to be more clear.\n\n git-submodule.sh            |   50 +++++++++++++--\n t/t7406-submodule-update.sh |  144 +++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 188 insertions(+), 6 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex d189a24..eb5eebc 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -444,7 +444,8 @@ cmd_update()\n \tfi\n \n \tcloned_modules=\n-\tmodule_list \"$@\" |\n+\tmodule_list \"$@\" | {\n+\terr=\n \twhile read mode sha1 stage path\n \tdo\n \t\tif test \"$stage\" = U\n@@ -525,17 +526,54 @@ cmd_update()\n \t\t\t\t;;\n \t\t\tesac\n \n-\t\t\t(clear_local_git_env; cd \"$path\" && $command \"$sha1\") ||\n-\t\t\tdie \"Unable to $action '$sha1' in submodule path '$path'\"\n-\t\t\tsay \"Submodule path '$path': $msg '$sha1'\"\n+\t\t\tif (clear_local_git_env; cd \"$path\" && $command \"$sha1\")\n+\t\t\tthen\n+\t\t\t\tsay \"Submodule path '$path': $msg '$sha1'\"\n+\t\t\telse\n+\t\t\t\tcase $action in\n+\t\t\t\trebase|merge)\n+\t\t\t\t\tdie_with_status 2 \"Unable to $action '$sha1' in submodule path '$path'\"\n+\t\t\t\t\t;;\n+\t\t\t\t*)\n+\t\t\t\t\terr=\"${err};Failed to $action in submodule path '$path'\"\n+\t\t\t\t\tcontinue\n+\t\t\t\t\t;;\n+\t\t\t\tesac\n+\t\t\tfi\n \t\tfi\n \n \t\tif test -n \"$recursive\"\n \t\tthen\n-\t\t\t(clear_local_git_env; cd \"$path\" && eval cmd_update \"$orig_flags\") ||\n-\t\t\tdie \"Failed to recurse into submodule path '$path'\"\n+\t\t\t(clear_local_git_env; cd \"$path\" && eval cmd_update \"$orig_flags\")\n+\t\t\tres=$?\n+\t\t\tif test $res -gt 0\n+\t\t\tthen\n+\t\t\t\tif test $res -eq 1\n+\t\t\t\tthen\n+\t\t\t\t\terr=\"${err};Failed to recurse into submodule path '$path'\"\n+\t\t\t\t\tcontinue\n+\t\t\t\telse\n+\t\t\t\t\tdie_with_status $res \"Failed to recurse into submodule path '$path'\"\n+\t\t\t\tfi\n+\t\t\tfi\n \t\tfi\n \tdone\n+\n+\tif test -n \"$err\"\n+\tthen\n+\t\tOIFS=$IFS\n+\t\tIFS=';'\n+\t\tfor e in $err\n+\t\tdo\n+\t\t\tif test -n \"$e\"\n+\t\t\tthen\n+\t\t\t\techo >&2 \"$e\"\n+\t\t\tfi\n+\t\tdone\n+\t\tIFS=$OIFS\n+\t\texit 1\n+\tfi\n+\t}\n }\n \n set_name_rev () {\ndiff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\nindex 4f16fcc..807f761 100755\n--- a/t/t7406-submodule-update.sh\n+++ b/t/t7406-submodule-update.sh\n@@ -298,4 +298,148 @@ test_expect_success 'submodule update ignores update=rebase config for new submo\n \t)\n '\n \n+test_expect_success 'submodule update continues after checkout error' '\n+\t(cd super &&\n+\t git reset --hard HEAD &&\n+\t git submodule add ../submodule submodule2 &&\n+\t git submodule init &&\n+\t git commit -am \"new_submodule\" &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../expect\n+\t ) &&\n+\t (cd submodule &&\n+\t  test_commit \"update_submodule\" file\n+\t ) &&\n+\t (cd submodule2 &&\n+\t  test_commit \"update_submodule2\" file\n+\t ) &&\n+\t git add submodule &&\n+\t git add submodule2 &&\n+\t git commit -m \"two_new_submodule_commits\" &&\n+\t (cd submodule &&\n+\t  echo \"\" > file\n+\t ) &&\n+\t git checkout HEAD^ &&\n+\t test_must_fail git submodule update &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../actual\n+\t ) &&\n+\t test_cmp expect actual\n+\t)\n+'\n+test_expect_success 'submodule update continues after recursive checkout error' '\n+\t(cd super &&\n+\t git reset --hard HEAD &&\n+\t git checkout master &&\n+\t git submodule update &&\n+\t (cd submodule &&\n+\t  git submodule add ../submodule subsubmodule &&\n+\t  git submodule init &&\n+\t  git commit -m \"new_subsubmodule\"\n+\t ) &&\n+\t git add submodule &&\n+\t git commit -m \"update_submodule\" &&\n+\t (cd submodule &&\n+\t  (cd subsubmodule &&\n+\t   test_commit \"update_subsubmodule\" file\n+\t  ) &&\n+\t  git add subsubmodule &&\n+\t  test_commit \"update_submodule_again\" file &&\n+\t  (cd subsubmodule &&\n+\t   test_commit \"update_subsubmodule_again\" file\n+\t  ) &&\n+\t  test_commit \"update_submodule_again_again\" file\n+\t ) &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../expect &&\n+\t  test_commit \"update_submodule2_again\" file\n+\t ) &&\n+\t git add submodule &&\n+\t git add submodule2 &&\n+\t git commit -m \"new_commits\" &&\n+\t git checkout HEAD^ &&\n+\t (cd submodule &&\n+\t  git checkout HEAD^ &&\n+\t  (cd subsubmodule &&\n+\t   echo \"\" > file\n+\t  )\n+\t ) &&\n+\t test_must_fail git submodule update --recursive &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../actual\n+\t ) &&\n+\t test_cmp expect actual\n+\t)\n+'\n+\n+test_expect_success 'submodule update exit immediately in case of merge conflict' '\n+\t(cd super &&\n+\t git checkout master &&\n+\t git reset --hard HEAD &&\n+\t (cd submodule &&\n+\t  (cd subsubmodule &&\n+\t   git reset --hard HEAD\n+\t  )\n+\t ) &&\n+\t git submodule update --recursive &&\n+\t (cd submodule &&\n+\t  test_commit \"update_submodule_2\" file\n+\t ) &&\n+\t (cd submodule2 &&\n+\t  test_commit \"update_submodule2_2\" file\n+\t ) &&\n+\t git add submodule &&\n+\t git add submodule2 &&\n+\t git commit -m \"two_new_submodule_commits\" &&\n+\t (cd submodule &&\n+\t  git checkout master &&\n+\t  test_commit \"conflict\" file &&\n+\t  echo \"conflict\" > file\n+\t ) &&\n+\t git checkout HEAD^ &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../expect\n+\t ) &&\n+\t git config submodule.submodule.update merge &&\n+\t test_must_fail git submodule update &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../actual\n+\t ) &&\n+\t test_cmp expect actual\n+\t)\n+'\n+test_expect_success 'submodule update exit immediately after recursive rebase error' '\n+\t(cd super &&\n+\t git checkout master &&\n+\t git reset --hard HEAD &&\n+\t (cd submodule &&\n+\t  git reset --hard HEAD &&\n+\t  git submodule update --recursive\n+\t ) &&\n+\t (cd submodule &&\n+\t  test_commit \"update_submodule_3\" file\n+\t ) &&\n+\t (cd submodule2 &&\n+\t  test_commit \"update_submodule2_3\" file\n+\t ) &&\n+\t git add submodule &&\n+\t git add submodule2 &&\n+\t git commit -m \"two_new_submodule_commits\" &&\n+\t (cd submodule &&\n+\t  git checkout master &&\n+\t  test_commit \"conflict2\" file &&\n+\t  echo \"conflict\" > file\n+\t ) &&\n+\t git checkout HEAD^ &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../expect\n+\t ) &&\n+\t git config submodule.submodule.update rebase &&\n+\t test_must_fail git submodule update &&\n+\t (cd submodule2 &&\n+\t  git rev-parse --max-count=1 HEAD > ../actual\n+\t ) &&\n+\t test_cmp expect actual\n+\t)\n+'\n test_done\n-- \n1.7.6.rc0.14.gc8898.dirty\n"},{"id":"169959","messageId":"7vd3ihobaw.fsf@alter.siamese.dyndns.org","threadId":"27591","inReplyTo":"1307605623-2831-2-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH v3 1/2] Add new function die_with_status","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-13T18:07:03Z","receivedAt":"2011-06-13T18:07:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fredrik Gustafsson <iveqy@iveqy.com> writes:\n\n> die no longer prints empty die messages, this is a changed behavior.\n\nThat is what we we usually call a regression, but I think the original is\nnot correct to begin with.  It should have used \"$*\" not \"$@\".\n\n> diff --git a/git-sh-setup.sh b/git-sh-setup.sh\n> index 94e26ed..1a91f6e 100644\n> --- a/git-sh-setup.sh\n> +++ b/git-sh-setup.sh\n> @@ -40,8 +40,16 @@ git_broken_path_fix () {\n>  # @@BROKEN_PATH_FIX@@\n>  \n>  die() {\n> -\techo >&2 \"$@\"\n> -\texit 1\n> +\tdie_with_status 1 $@\n\nMake it a habit to always quote \"$@\" when relaying what was given to you,\nso that when somebody sends a parameter with IFS in it, you won't split it\nwhile passing it down. I.e.\n\n\tdie () {\n        \tdie_with_status 1 \"$@\"\n\t}\n\n> +}\n\nBlank line here after the closing brace and the beginning of next function.\n\n> +die_with_status() {\n> +\tstat=$1\n> +\tshift\n> +\tif test ${#@} -gt 0\n> +\tthen\n> +\t\techo >&2 \"$@\"\n> +\tfi\n\nI think an unconditional\n\n\techo >&2 \"$*\"\n\nis good enough here.\n\n> +\texit $stat\n>  }\n>  \n>  GIT_QUIET=\n"}]}