diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index c885fc08f0..8ba5e1e1f6 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2366,40 +2366,35 @@ static int run_update_command(struct update_data *ud, int subforce) if (run_command(&cp)) { switch (ud->update_strategy.type) { case SM_UPDATE_CHECKOUT: - printf(_("Unable to checkout '%s' in submodule path '%s'"), - oid, ud->displaypath); + die_message(_("Unable to checkout '%s' in submodule path '%s'"), + oid, ud->displaypath); break; case SM_UPDATE_REBASE: - printf(_("Unable to rebase '%s' in submodule path '%s'"), - oid, ud->displaypath); + die_message(_("Unable to rebase '%s' in submodule path '%s'"), + oid, ud->displaypath); break; case SM_UPDATE_MERGE: - printf(_("Unable to merge '%s' in submodule path '%s'"), - oid, ud->displaypath); + die_message(_("Unable to merge '%s' in submodule path '%s'"), + oid, ud->displaypath); break; case SM_UPDATE_COMMAND: - printf(_("Execution of '%s %s' failed in submodule path '%s'"), - ud->update_strategy.command, oid, ud->displaypath); + die_message(_("Execution of '%s %s' failed in submodule path '%s'"), + ud->update_strategy.command, oid, ud->displaypath); break; default: BUG("unexpected update strategy type: %s", submodule_strategy_to_string(&ud->update_strategy)); } - /* - * NEEDSWORK: We are currently printing to stdout with error - * return so that the shell caller handles the error output - * properly. Once we start handling the error messages within - * C, we should use die() instead. - */ if (must_die_on_failure) - return 2; - /* - * This signifies to the caller in shell that the command - * failed without dying - */ + exit(128); + + /* the command failed, but update must continue */ return 1; } + if (ud->quiet) + return 0; + switch (ud->update_strategy.type) { case SM_UPDATE_CHECKOUT: printf(_("Submodule path '%s': checked out '%s'\n"), diff --git a/git-submodule.sh b/git-submodule.sh index aa8bdfca9d..a84143daab 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -404,7 +404,7 @@ cmd_update() # exit codes for run-update-procedure: # 0: update was successful, say command output # 1: update procedure failed, but should not die - # 2 or 128: subcommand died during execution + # 128: subcommand died during execution # 3: no update procedure was run res="$?" case $res in @@ -412,11 +412,12 @@ cmd_update() say "$out" ;; 1) - err="${err};fatal: $out" + err="${err};$out" continue ;; - 2|128) - die_with_status $res "fatal: $out" + 128) + printf >&2 "$out" + exit $res ;; esac