73
#
74
module_list()
75
{
76
- git ls-files --error-unmatch --stage -- "$@" |
76
+ (
77
+ git ls-files --error-unmatch --stage -- "$@" ||
78
+ echo "unmatched pathspec exists"
79
+ ) |
80
perl -e '
81
my %unmerged = ();
82
my ($null_sha1) = ("0" x 40);
83
+ my @out = ();
84
+ my $unmatched = 0;
85
while (<STDIN>) {
86
+ if (/^unmatched pathspec/) {
87
+ $unmatched = 1;
88
+ next;
89
+ }
90
chomp;
91
my ($mode, $sha1, $stage, $path) =
92
/^([0-7]+) ([0-9a-f]{40}) ([0-3])\t(.*)$/;
93
next unless $mode eq "160000";
94
if ($stage ne "0") {
95
if (!$unmerged{$path}++) {
87
- print "$mode $null_sha1 U\t$path\n";
96
+ push @out, "$mode $null_sha1 U\t$path\n";
97
}
98
next;
99
}
91
- print "$_\n";
100
+ push @out, "$_\n";
101
+ }
102
+ if ($unmatched) {
103
+ print "#unmatched\n";
104
+ } else {
105
+ print for (@out);
106
}
107
'
108
}
109
110
+die_if_unmatched ()
111
+{
112
+ if test "$1" = "#unmatched"
113
+ then
114
+ exit 1
115
+ fi
116
+}
117
+
118
#
119
# Map submodule path to submodule name
120
#
368
module_list |
369
while read mode sha1 stage sm_path
370
do
371
+ die_if_unmatched "$mode"
372
if test -e "$sm_path"/.git
373
then
374
say "$(eval_gettext "Entering '\$prefix\$sm_path'")"
421
module_list "$@" |
422
while read mode sha1 stage sm_path
423
do
424
+ die_if_unmatched "$mode"
425
name=$(module_name "$sm_path") || exit
426
427
# Copy url setting when it is not set yet
522
err=
523
while read mode sha1 stage sm_path
524
do
525
+ die_if_unmatched "$mode"
526
if test "$stage" = U
527
then
528
echo >&2 "Skipping unmerged submodule $sm_path"
918
module_list "$@" |
919
while read mode sha1 stage sm_path
920
do
921
+ die_if_unmatched "$mode"
922
name=$(module_name "$sm_path") || exit
923
url=$(git config submodule."$name".url)
924
displaypath="$prefix$sm_path"
987
module_list "$@" |
988
while read mode sha1 stage sm_path
989
do
990
+ die_if_unmatched "$mode"
991
name=$(module_name "$sm_path")
992
url=$(git config -f .gitmodules --get submodule."$name".url)
993