submodule update: align reporting path for custom command execution
In the predefined actions (merge, rebase, none, checkout), we use the display path, which is relative to the current working directory. Also use the display path when running a custom command. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 29, 2016 at 18:27 UTC
b08238ac3f5e4033d26824afc65e7397fbb61847
2 files changed
+28
-5
git-submodule.sh
+2
-2
@@ -802,8 +802,8 @@ Maybe you want to use 'update --init'?")"
802
;;
803
!*)
804
command="${update_module#!}"
805
- die_msg="$(eval_gettext "Execution of '\$command \$sha1' failed in submodule path '\$prefix\$sm_path'")"
806
- say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': '\$command \$sha1'")"
805
+ die_msg="$(eval_gettext "Execution of '\$command \$sha1' failed in submodule path '\$displaypath'")"
806
+ say_msg="$(eval_gettext "Submodule path '\$displaypath': '\$command \$sha1'")"
807
must_die_on_failure=yes
808
;;
809
*)
t/t7406-submodule-update.sh
+26
-3
@@ -344,16 +344,39 @@ test_expect_success 'submodule update - command in .git/config' '
344
)
345
'
346
347
+cat << EOF >expect
348
+Execution of 'false $submodulesha1' failed in submodule path 'submodule'
349
+EOF
350
+
351
test_expect_success 'submodule update - command in .git/config catches failure' '
352
(cd super &&
353
git config submodule.submodule.update "!false"
354
) &&
355
(cd super/submodule &&
352
- git reset --hard HEAD^
356
+ git reset --hard $submodulesha1^
357
) &&
358
(cd super &&
355
- test_must_fail git submodule update submodule
356
- )
359
+ test_must_fail git submodule update submodule 2>../actual
360
+ ) &&
361
+ test_cmp actual expect
362
+'
363
+
364
+cat << EOF >expect
365
+Execution of 'false $submodulesha1' failed in submodule path '../submodule'
366
+EOF
367
+
368
+test_expect_success 'submodule update - command in .git/config catches failure -- subdirectory' '
369
+ (cd super &&
370
+ git config submodule.submodule.update "!false"
371
+ ) &&
372
+ (cd super/submodule &&
373
+ git reset --hard $submodulesha1^
374
+ ) &&
375
+ (cd super &&
376
+ mkdir tmp && cd tmp &&
377
+ test_must_fail git submodule update ../submodule 2>../../actual
378
+ ) &&
379
+ test_cmp actual expect
380
'
381
382
test_expect_success 'submodule init does not copy command into .git/config' '