X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-submodule.sh;h=e2082fd1492fe34e69c59f0a46cbaf7ddd2e2a8e;hb=9b0aa728705439ca4b4e7ec845f79f8487059320;hp=850d4235a003a9934681b319199e82da07a865dd;hpb=65c042d44dc843021f1410f1219104681fdd3469;p=git.git diff --git a/git-submodule.sh b/git-submodule.sh index 850d4235a..e2082fd14 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -57,7 +57,7 @@ resolve_relative_url () # module_list() { - git ls-files --error-unmatch --stage -- "$@" | grep '^160000 ' + git ls-files --error-unmatch --stage -- "$@" | sane_grep '^160000 ' } # @@ -222,7 +222,7 @@ cmd_add() module_clone "$path" "$realrepo" "$reference" || exit ( - unset GIT_DIR + clear_local_git_env cd "$path" && # ash fails to wordsplit ${branch:+-b "$branch"...} case "$branch" in @@ -278,7 +278,7 @@ cmd_foreach() name=$(module_name "$path") ( prefix="$prefix$path/" - unset GIT_DIR + clear_local_git_env cd "$path" && eval "$@" && if test -n "$recursive" @@ -434,7 +434,7 @@ cmd_update() module_clone "$path" "$url" "$reference"|| exit subsha1= else - subsha1=$(unset GIT_DIR; cd "$path" && + subsha1=$(clear_local_git_env; cd "$path" && git rev-parse --verify HEAD) || die "Unable to find current revision in submodule path '$path'" fi @@ -454,7 +454,7 @@ cmd_update() if test -z "$nofetch" then - (unset GIT_DIR; cd "$path" && + (clear_local_git_env; cd "$path" && git-fetch) || die "Unable to fetch in submodule path '$path'" fi @@ -477,14 +477,14 @@ cmd_update() ;; esac - (unset GIT_DIR; cd "$path" && $command "$sha1") || + (clear_local_git_env; cd "$path" && $command "$sha1") || die "Unable to $action '$sha1' in submodule path '$path'" say "Submodule path '$path': $msg '$sha1'" fi if test -n "$recursive" then - (unset GIT_DIR; cd "$path" && cmd_update $orig_args) || + (clear_local_git_env; cd "$path" && cmd_update $orig_args) || die "Failed to recurse into submodule path '$path'" fi done @@ -492,7 +492,7 @@ cmd_update() set_name_rev () { revname=$( ( - unset GIT_DIR + clear_local_git_env cd "$1" && { git describe "$2" 2>/dev/null || git describe --tags "$2" 2>/dev/null || @@ -572,7 +572,7 @@ cmd_summary() { cd_to_toplevel # Get modified modules cared by user modules=$(git $diff_cmd $cached --raw $head -- "$@" | - egrep '^:([0-7]* )?160000' | + sane_egrep '^:([0-7]* )?160000' | while read mod_src mod_dst sha1_src sha1_dst status name do # Always show modules deleted or type-changed (blob<->module) @@ -586,7 +586,7 @@ cmd_summary() { test -z "$modules" && return git $diff_cmd $cached --raw $head -- $modules | - egrep '^:([0-7]* )?160000' | + sane_egrep '^:([0-7]* )?160000' | cut -c2- | while read mod_src mod_dst sha1_src sha1_dst status name do @@ -688,7 +688,11 @@ cmd_summary() { echo done | if test -n "$for_status"; then - echo "# Modified submodules:" + if [ -n "$files" ]; then + echo "# Submodules changed but not updated:" + else + echo "# Submodule changes to be committed:" + fi echo "#" sed -e 's|^|# |' -e 's|^# $|#|' else @@ -753,7 +757,7 @@ cmd_status() else if test -z "$cached" then - sha1=$(unset GIT_DIR; cd "$path" && git rev-parse --verify HEAD) + sha1=$(clear_local_git_env; cd "$path" && git rev-parse --verify HEAD) set_name_rev "$path" "$sha1" fi say "+$sha1 $displaypath$revname" @@ -763,7 +767,7 @@ cmd_status() then ( prefix="$displaypath/" - unset GIT_DIR + clear_local_git_env cd "$path" && cmd_status $orig_args ) || @@ -814,7 +818,7 @@ cmd_sync() if test -e "$path"/.git then ( - unset GIT_DIR + clear_local_git_env cd "$path" remote=$(get_default_remote) say "Synchronizing submodule url for '$name'"