Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh38
1 files changed, 37 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 514d2eb7ab..b010a67309 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -72,7 +72,24 @@ resolve_relative_url ()
#
module_list()
{
- git ls-files --error-unmatch --stage -- "$@" | sane_grep '^160000 '
+ git ls-files --error-unmatch --stage -- "$@" |
+ perl -e '
+ my %unmerged = ();
+ my ($null_sha1) = ("0" x 40);
+ while (<STDIN>) {
+ chomp;
+ my ($mode, $sha1, $stage, $path) =
+ /^([0-7]+) ([0-9a-f]{40}) ([0-3])\t(.*)$/;
+ next unless $mode eq "160000";
+ if ($stage ne "0") {
+ if (!$unmerged{$path}++) {
+ print "$mode $null_sha1 U\t$path\n";
+ }
+ next;
+ }
+ print "$_\n";
+ }
+ '
}
#
@@ -423,9 +440,15 @@ cmd_update()
cmd_init "--" "$@" || return
fi
+ cloned_modules=
module_list "$@" |
while read mode sha1 stage path
do
+ if test "$stage" = U
+ then
+ echo >&2 "Skipping unmerged submodule $path"
+ continue
+ fi
name=$(module_name "$path") || exit
url=$(git config submodule."$name".url)
update_module=$(git config submodule."$name".update)
@@ -442,6 +465,7 @@ cmd_update()
if ! test -d "$path"/.git -o -f "$path"/.git
then
module_clone "$path" "$url" "$reference"|| exit
+ cloned_modules="$cloned_modules;$name"
subsha1=
else
subsha1=$(clear_local_git_env; cd "$path" &&
@@ -472,6 +496,13 @@ cmd_update()
die "Unable to fetch in submodule path '$path'"
fi
+ # Is this something we just cloned?
+ case ";$cloned_modules;" in
+ *";$name;"*)
+ # then there is no local change to integrate
+ update_module= ;;
+ esac
+
case "$update_module" in
rebase)
command="git rebase"
@@ -764,6 +795,11 @@ cmd_status()
name=$(module_name "$path") || exit
url=$(git config submodule."$name".url)
displaypath="$prefix$path"
+ if test "$stage" = U
+ then
+ say "U$sha1 $displaypath"
+ continue
+ fi
if test -z "$url" || ! test -d "$path"/.git -o -f "$path"/.git
then
say "-$sha1 $displaypath"