147
148
if ! git submodule--helper config --check-writeable >/dev/null 2>&1
149
then
150
- die "$(eval_gettext "please make sure that the .gitmodules file is in the working tree")"
150
+ die "fatal: $(eval_gettext "please make sure that the .gitmodules file is in the working tree")"
151
fi
152
153
if test -n "$reference_path"
176
case "$repo" in
177
./*|../*)
178
test -z "$wt_prefix" ||
179
- die "$(gettext "Relative path can only be used from the toplevel of the working tree")"
179
+ die "fatal: $(gettext "Relative path can only be used from the toplevel of the working tree")"
180
181
# dereference source url relative to parent's url
182
realrepo=$(git submodule--helper resolve-relative-url "$repo") || exit
186
realrepo=$repo
187
;;
188
*)
189
- die "$(eval_gettext "repo URL: '\$repo' must be absolute or begin with ./|../")"
189
+ die "fatal: $(eval_gettext "repo URL: '\$repo' must be absolute or begin with ./|../")"
190
;;
191
esac
192
205
if test -z "$force"
206
then
207
git ls-files --error-unmatch "$sm_path" > /dev/null 2>&1 &&
208
- die "$(eval_gettext "'\$sm_path' already exists in the index")"
208
+ die "fatal: $(eval_gettext "'\$sm_path' already exists in the index")"
209
else
210
git ls-files -s "$sm_path" | sane_grep -v "^160000" > /dev/null 2>&1 &&
211
- die "$(eval_gettext "'\$sm_path' already exists in the index and is not a submodule")"
211
+ die "fatal: $(eval_gettext "'\$sm_path' already exists in the index and is not a submodule")"
212
fi
213
214
if test -d "$sm_path" &&
215
test -z $(git -C "$sm_path" rev-parse --show-cdup 2>/dev/null)
216
then
217
git -C "$sm_path" rev-parse --verify -q HEAD >/dev/null ||
218
- die "$(eval_gettext "'\$sm_path' does not have a commit checked out")"
218
+ die "fatal: $(eval_gettext "'\$sm_path' does not have a commit checked out")"
219
fi
220
221
if test -z "$force"
238
239
if ! git submodule--helper check-name "$sm_name"
240
then
241
- die "$(eval_gettext "'$sm_name' is not a valid submodule name")"
241
+ die "fatal: $(eval_gettext "'$sm_name' is not a valid submodule name")"
242
fi
243
244
# perhaps the path exists and is already a git repo, else clone it
281
git config submodule."$sm_name".url "$realrepo"
282
283
git add --no-warn-embedded-repo $force "$sm_path" ||
284
- die "$(eval_gettext "Failed to add submodule '\$sm_path'")"
284
+ die "fatal: $(eval_gettext "Failed to add submodule '\$sm_path'")"
285
286
git submodule--helper config submodule."$sm_name".path "$sm_path" &&
287
git submodule--helper config submodule."$sm_name".url "$repo" &&
290
git submodule--helper config submodule."$sm_name".branch "$branch"
291
fi &&
292
git add --force .gitmodules ||
293
- die "$(eval_gettext "Failed to register submodule '\$sm_path'")"
293
+ die "fatal: $(eval_gettext "Failed to register submodule '\$sm_path'")"
294
295
# NEEDSWORK: In a multi-working-tree world, this needs to be
296
# set in the per-worktree config.
565
else
566
subsha1=$(sanitize_submodule_env; cd "$sm_path" &&
567
git rev-parse --verify HEAD) ||
568
- die "$(eval_gettext "Unable to find current revision in submodule path '\$displaypath'")"
568
+ die "fatal: $(eval_gettext "Unable to find current revision in submodule path '\$displaypath'")"
569
fi
570
571
if test -n "$remote"
575
then
576
# Fetch remote before determining tracking $sha1
577
fetch_in_submodule "$sm_path" $depth ||
578
- die "$(eval_gettext "Unable to fetch in submodule path '\$sm_path'")"
578
+ die "fatal: $(eval_gettext "Unable to fetch in submodule path '\$sm_path'")"
579
fi
580
remote_name=$(sanitize_submodule_env; cd "$sm_path" && git submodule--helper print-default-remote)
581
sha1=$(sanitize_submodule_env; cd "$sm_path" &&
582
git rev-parse --verify "${remote_name}/${branch}") ||
583
- die "$(eval_gettext "Unable to find current \${remote_name}/\${branch} revision in submodule path '\$sm_path'")"
583
+ die "fatal: $(eval_gettext "Unable to find current \${remote_name}/\${branch} revision in submodule path '\$sm_path'")"
584
fi
585
586
if test "$subsha1" != "$sha1" || test -n "$force"
604
# not be reachable from any of the refs
605
is_tip_reachable "$sm_path" "$sha1" ||
606
fetch_in_submodule "$sm_path" "$depth" "$sha1" ||
607
- die "$(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain \$sha1. Direct fetching of that commit failed.")"
607
+ die "fatal: $(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain \$sha1. Direct fetching of that commit failed.")"
608
fi
609
610
must_die_on_failure=
611
case "$update_module" in
612
checkout)
613
command="git checkout $subforce -q"
614
- die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
614
+ die_msg="fatal: $(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
615
say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
616
;;
617
rebase)
618
command="git rebase ${GIT_QUIET:+--quiet}"
619
- die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
619
+ die_msg="fatal: $(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
620
say_msg="$(eval_gettext "Submodule path '\$displaypath': rebased into '\$sha1'")"
621
must_die_on_failure=yes
622
;;
623
merge)
624
command="git merge ${GIT_QUIET:+--quiet}"
625
- die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$displaypath'")"
625
+ die_msg="fatal: $(eval_gettext "Unable to merge '\$sha1' in submodule path '\$displaypath'")"
626
say_msg="$(eval_gettext "Submodule path '\$displaypath': merged in '\$sha1'")"
627
must_die_on_failure=yes
628
;;
629
!*)
630
command="${update_module#!}"
631
- die_msg="$(eval_gettext "Execution of '\$command \$sha1' failed in submodule path '\$displaypath'")"
631
+ die_msg="fatal: $(eval_gettext "Execution of '\$command \$sha1' failed in submodule path '\$displaypath'")"
632
say_msg="$(eval_gettext "Submodule path '\$displaypath': '\$command \$sha1'")"
633
must_die_on_failure=yes
634
;;
635
*)
636
- die "$(eval_gettext "Invalid update mode '$update_module' for submodule path '$path'")"
636
+ die "fatal: $(eval_gettext "Invalid update mode '$update_module' for submodule path '$path'")"
637
esac
638
639
if (sanitize_submodule_env; cd "$sm_path" && $command "$sha1")
660
res=$?
661
if test $res -gt 0
662
then
663
- die_msg="$(eval_gettext "Failed to recurse into submodule path '\$displaypath'")"
663
+ die_msg="fatal: $(eval_gettext "Failed to recurse into submodule path '\$displaypath'")"
664
if test $res -ne 2
665
then
666
err="${err};$die_msg"