Merge branch 'sb/submodule-move-head-error-msg'
authorJunio C Hamano <gitster@pobox.com>
Tue, 24 Jul 2018 21:50:43 +0000 (14:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Jul 2018 21:50:43 +0000 (14:50 -0700)
"git checkout --recurse-submodules another-branch" did not report
in which submodule it failed to update the working tree, which
resulted in an unhelpful error message.

* sb/submodule-move-head-error-msg:
submodule.c: report the submodule that an error occurs in

1  2 
submodule.c
t/lib-submodule-update.sh
diff --cc submodule.c
index d3a9aab83dc90b0c7797cc4b83d0a83bf6c196b7,1b950f9627d92b9b101638467d590d59c83c6e59..2a6381864e128c0122c1cbab6d148cf3c0d82961
@@@ -1677,12 -1658,12 +1677,12 @@@ int submodule_move_head(const char *pat
                argv_array_push(&cp.args, "-m");
  
        if (!(flags & SUBMODULE_MOVE_HEAD_FORCE))
 -              argv_array_push(&cp.args, old ? old : EMPTY_TREE_SHA1_HEX);
 +              argv_array_push(&cp.args, old_head ? old_head : empty_tree_oid_hex());
  
 -      argv_array_push(&cp.args, new ? new : EMPTY_TREE_SHA1_HEX);
 +      argv_array_push(&cp.args, new_head ? new_head : empty_tree_oid_hex());
  
        if (run_command(&cp)) {
-               ret = -1;
+               ret = error(_("Submodule '%s' could not be updated."), path);
                goto out;
        }
  
Simple merge