Merge branch 'jk/replace-perl-in-built-scripts'
authorJunio C Hamano <gitster@pobox.com>
Thu, 5 Dec 2013 20:58:21 +0000 (12:58 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Dec 2013 20:58:21 +0000 (12:58 -0800)
* jk/replace-perl-in-built-scripts:
use @@PERL@@ in built scripts

1  2 
git-am.sh
git-request-pull.sh
git-submodule.sh
diff --combined git-am.sh
index 7ea40fe6449b665713a8272f125936edf632189b,46e83569aaa2ae86cf57d66d3ae8dfa708bb4eaf..bbea43075be030c272ef0d8e4cb9c25a179d4e53
+++ b/git-am.sh
@@@ -6,7 -6,7 +6,7 @@@ SUBDIRECTORY_OK=Ye
  OPTIONS_KEEPDASHDASH=
  OPTIONS_SPEC="\
  git am [options] [(<mbox>|<Maildir>)...]
 -git am [options] (--resolved | --skip | --abort)
 +git am [options] (--continue | --skip | --abort)
  --
  i,interactive   run interactively
  b,binary*       (historical option -- no-op)
@@@ -102,7 -102,7 +102,7 @@@ stop_here_user_resolve () 
            printf '%s\n' "$resolvemsg"
            stop_here $1
      fi
 -    eval_gettextln "When you have resolved this problem, run \"\$cmdline --resolved\".
 +    eval_gettextln "When you have resolved this problem, run \"\$cmdline --continue\".
  If you prefer to skip this patch, run \"\$cmdline --skip\" instead.
  To restore the original branch and stop patching, run \"\$cmdline --abort\"."
  
@@@ -302,7 -302,7 +302,7 @@@ split_patches () 
                        # not starting with Author, From or Date is the
                        # subject, and the body starts with the next nonempty
                        # line not starting with Author, From or Date
-                       perl -ne 'BEGIN { $subject = 0 }
+                       @@PERL@@ -ne 'BEGIN { $subject = 0 }
                                if ($subject > 1) { print ; }
                                elsif (/^\s+$/) { next ; }
                                elsif (/^Author:/) { s/Author/From/ ; print ;}
                        # Since we cannot guarantee that the commit message is in
                        # git-friendly format, we put no Subject: line and just consume
                        # all of the message as the body
-                       LANG=C LC_ALL=C perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 }
+                       LANG=C LC_ALL=C @@PERL@@ -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 }
                                if ($subject) { print ; }
                                elsif (/^\# User /) { s/\# User/From:/ ; print ; }
                                elsif (/^\# Date /) {
@@@ -446,8 -446,6 +446,8 @@@ don
  # If the dotest directory exists, but we have finished applying all the
  # patches in them, clear it out.
  if test -d "$dotest" &&
 +   test -f "$dotest/last" &&
 +   test -f "$dotest/next" &&
     last=$(cat "$dotest/last") &&
     next=$(cat "$dotest/next") &&
     test $# != 0 &&
@@@ -456,7 -454,7 +456,7 @@@ the
     rm -fr "$dotest"
  fi
  
 -if test -d "$dotest"
 +if test -d "$dotest" && test -f "$dotest/last" && test -f "$dotest/next"
  then
        case "$#,$skip$resolved$abort" in
        0,*t*)
        esac
        rm -f "$dotest/dirtyindex"
  else
 -      # Make sure we are not given --skip, --resolved, nor --abort
 +      # Possible stray $dotest directory in the independent-run
 +      # case; in the --rebasing case, it is upto the caller
 +      # (git-rebase--am) to take care of stray directories.
 +      if test -d "$dotest" && test -z "$rebasing"
 +      then
 +              case "$skip,$resolved,$abort" in
 +              ,,t)
 +                      rm -fr "$dotest"
 +                      exit 0
 +                      ;;
 +              *)
 +                      die "$(eval_gettext "Stray \$dotest directory found.
 +Use \"git am --abort\" to remove it.")"
 +                      ;;
 +              esac
 +      fi
 +
 +      # Make sure we are not given --skip, --continue, nor --abort
        test "$skip$resolved$abort" = "" ||
                die "$(gettext "Resolve operation not in progress, we are not resuming.")"
  
@@@ -670,7 -651,7 +670,7 @@@ d
        #  - patch is the patch body.
        #
        # When we are resuming, these files are either already prepared
 -      # by the user, or the user can tell us to do so by --resolved flag.
 +      # by the user, or the user can tell us to do so by --continue flag.
        case "$resume" in
        '')
                if test -f "$dotest/rebasing"
@@@ -797,6 -778,13 +797,6 @@@ To restore the original branch and sto
            action=yes
        fi
  
 -      if test -f "$dotest/final-commit"
 -      then
 -              FIRSTLINE=$(sed 1q "$dotest/final-commit")
 -      else
 -              FIRSTLINE=""
 -      fi
 -
        if test $action = skip
        then
                go_next
                stop_here $this
        fi
  
 +      if test -f "$dotest/final-commit"
 +      then
 +              FIRSTLINE=$(sed 1q "$dotest/final-commit")
 +      else
 +              FIRSTLINE=""
 +      fi
 +
        say "$(eval_gettext "Applying: \$FIRSTLINE")"
  
        case "$resolved" in
@@@ -923,10 -904,5 +923,10 @@@ if test -s "$dotest"/rewritten; the
      fi
  fi
  
 -rm -fr "$dotest"
 -git gc --auto
 +# If am was called with --rebasing (from git-rebase--am), it's up to
 +# the caller to take care of housekeeping.
 +if ! test -f "$dotest/rebasing"
 +then
 +      rm -fr "$dotest"
 +      git gc --auto
 +fi
diff --combined git-request-pull.sh
index ebf1269d297cbc9513cb6b52726ae4590520ae92,46be6a29ae3574ff4d2d3438ebe754b3abe4f194..fe21d5db631cac88a52d765e5052d4f725aad69e
@@@ -51,18 -51,8 +51,18 @@@ f
  tag_name=$(git describe --exact "$head^0" 2>/dev/null)
  
  test -n "$base" && test -n "$url" || usage
 -baserev=$(git rev-parse --verify "$base"^0) &&
 -headrev=$(git rev-parse --verify "$head"^0) || exit
 +
 +baserev=$(git rev-parse --verify --quiet "$base"^0)
 +if test -z "$baserev"
 +then
 +    die "fatal: Not a valid revision: $base"
 +fi
 +
 +headrev=$(git rev-parse --verify --quiet "$head"^0)
 +if test -z "$headrev"
 +then
 +    die "fatal: Not a valid revision: $head"
 +fi
  
  merge_base=$(git merge-base $baserev $headrev) ||
  die "fatal: No commits in common between $base and $head"
@@@ -106,7 -96,7 +106,7 @@@ find_matching_ref=
        }
  '
  
- ref=$(git ls-remote "$url" | perl -e "$find_matching_ref" "$head" "$headrev" "$tag_name")
+ ref=$(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "$head" "$headrev" "$tag_name")
  
  url=$(git ls-remote --get-url "$url")
  
diff --combined git-submodule.sh
index c878d9579d5cdd66759ab14867f9e47ee75baf00,4cf94d1056334aeacc76c548cc03ee8c17beffd4..ed02f032140e0e93fd920f591f41bc328a071833
@@@ -8,19 -8,15 +8,19 @@@ dashless=$(basename "$0" | sed -e 's/-
  USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
     or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
     or: $dashless [--quiet] init [--] [<path>...]
 +   or: $dashless [--quiet] deinit [-f|--force] [--] <path>...
     or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
     or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
     or: $dashless [--quiet] foreach [--recursive] <command>
     or: $dashless [--quiet] sync [--recursive] [--] [<path>...]"
  OPTIONS_SPEC=
 +SUBDIRECTORY_OK=Yes
  . git-sh-setup
  . git-sh-i18n
  . git-parse-remote
  require_work_tree
 +wt_prefix=$(git rev-parse --show-prefix)
 +cd_to_toplevel
  
  command=
  branch=
@@@ -35,7 -31,6 +35,7 @@@ nofetch
  update=
  prefix=
  custom_name=
 +depth=
  
  # The function takes at most 2 arguments. The first argument is the
  # URL that navigates to the submodule origin repo. When relative, this URL
@@@ -110,58 -105,21 +110,58 @@@ resolve_relative_url (
        echo "${is_relative:+${up_path}}${remoteurl#./}"
  }
  
 +# Resolve a path to be relative to another path.  This is intended for
 +# converting submodule paths when git-submodule is run in a subdirectory
 +# and only handles paths where the directory separator is '/'.
 +#
 +# The output is the first argument as a path relative to the second argument,
 +# which defaults to $wt_prefix if it is omitted.
 +relative_path ()
 +{
 +      local target curdir result
 +      target=$1
 +      curdir=${2-$wt_prefix}
 +      curdir=${curdir%/}
 +      result=
 +
 +      while test -n "$curdir"
 +      do
 +              case "$target" in
 +              "$curdir/"*)
 +                      target=${target#"$curdir"/}
 +                      break
 +                      ;;
 +              esac
 +
 +              result="${result}../"
 +              if test "$curdir" = "${curdir%/*}"
 +              then
 +                      curdir=
 +              else
 +                      curdir="${curdir%/*}"
 +              fi
 +      done
 +
 +      echo "$result$target"
 +}
 +
  #
  # Get submodule info for registered submodules
  # $@ = path to limit submodule list
  #
  module_list()
  {
 +      eval "set $(git rev-parse --sq --prefix "$wt_prefix" -- "$@")"
        (
 -              git ls-files --error-unmatch --stage -- "$@" ||
 +              git ls-files -z --error-unmatch --stage -- "$@" ||
                echo "unmatched pathspec exists"
        ) |
-       perl -e '
+       @@PERL@@ -e '
        my %unmerged = ();
        my ($null_sha1) = ("0" x 40);
        my @out = ();
        my $unmatched = 0;
 +      $/ = "\0";
        while (<STDIN>) {
                if (/^unmatched pathspec/) {
                        $unmatched = 1;
@@@ -252,7 -210,6 +252,7 @@@ module_clone(
        name=$2
        url=$3
        reference="$4"
 +      depth="$5"
        quiet=
        if test -n "$GIT_QUIET"
        then
                mkdir -p "$gitdir_base"
                (
                        clear_local_git_env
 -                      git clone $quiet -n ${reference:+"$reference"} \
 +                      git clone $quiet ${depth:+"$depth"} -n ${reference:+"$reference"} \
                                --separate-git-dir "$gitdir" "$url" "$sm_path"
                ) ||
                die "$(eval_gettext "Clone of '\$url' into submodule path '\$sm_path' failed")"
@@@ -324,7 -281,6 +324,7 @@@ isnumber(
  cmd_add()
  {
        # parse $args after "submodule ... add".
 +      reference_path=
        while test $# -ne 0
        do
                case "$1" in
                        ;;
                --reference)
                        case "$2" in '') usage ;; esac
 -                      reference="--reference=$2"
 +                      reference_path=$2
                        shift
                        ;;
                --reference=*)
 -                      reference="$1"
 +                      reference_path="${1#--reference=}"
                        ;;
                --name)
                        case "$2" in '') usage ;; esac
                        custom_name=$2
                        shift
                        ;;
 +              --depth)
 +                      case "$2" in '') usage ;; esac
 +                      depth="--depth=$2"
 +                      shift
 +                      ;;
 +              --depth=*)
 +                      depth=$1
 +                      ;;
                --)
                        shift
                        break
                shift
        done
  
 +      if test -n "$reference_path"
 +      then
 +              is_absolute_path "$reference_path" ||
 +              reference_path="$wt_prefix$reference_path"
 +
 +              reference="--reference=$reference_path"
 +      fi
 +
        repo=$1
        sm_path=$2
  
                usage
        fi
  
 +      is_absolute_path "$sm_path" || sm_path="$wt_prefix$sm_path"
 +
        # assure repo is absolute or relative to parent
        case "$repo" in
        ./*|../*)
 +              test -z "$wt_prefix" ||
 +              die "$(gettext "Relative path can only be used from the toplevel of the working tree")"
 +
                # dereference source url relative to parent's url
                realrepo=$(resolve_relative_url "$repo") || exit
                ;;
@@@ -469,7 -404,7 +469,7 @@@ Use -f if you really want to add it." >
                                echo "$(eval_gettext "Reactivating local git directory for submodule '\$sm_name'.")"
                        fi
                fi
 -              module_clone "$sm_path" "$sm_name" "$realrepo" "$reference" || exit
 +              module_clone "$sm_path" "$sm_name" "$realrepo" "$reference" "$depth" || exit
                (
                        clear_local_git_env
                        cd "$sm_path" &&
@@@ -535,28 -470,21 +535,28 @@@ cmd_foreach(
                die_if_unmatched "$mode"
                if test -e "$sm_path"/.git
                then
 -                      say "$(eval_gettext "Entering '\$prefix\$sm_path'")"
 +                      displaypath=$(relative_path "$sm_path")
 +                      say "$(eval_gettext "Entering '\$prefix\$displaypath'")"
                        name=$(module_name "$sm_path")
                        (
                                prefix="$prefix$sm_path/"
                                clear_local_git_env
 -                              # we make $path available to scripts ...
 -                              path=$sm_path
                                cd "$sm_path" &&
 -                              eval "$@" &&
 +                              sm_path=$(relative_path "$sm_path") &&
 +                              # we make $path available to scripts ...
 +                              path=$sm_path &&
 +                              if test $# -eq 1
 +                              then
 +                                      eval "$1"
 +                              else
 +                                      "$@"
 +                              fi &&
                                if test -n "$recursive"
                                then
                                        cmd_foreach "--recursive" "$@"
                                fi
                        ) <&3 3<&- ||
 -                      die "$(eval_gettext "Stopping at '\$sm_path'; script returned non-zero status.")"
 +                      die "$(eval_gettext "Stopping at '\$prefix\$displaypath'; script returned non-zero status.")"
                fi
        done
  }
@@@ -595,14 -523,12 +595,14 @@@ cmd_init(
                die_if_unmatched "$mode"
                name=$(module_name "$sm_path") || exit
  
 +              displaypath=$(relative_path "$sm_path")
 +
                # Copy url setting when it is not set yet
                if test -z "$(git config "submodule.$name.url")"
                then
                        url=$(git config -f .gitmodules submodule."$name".url)
                        test -z "$url" &&
 -                      die "$(eval_gettext "No url found for submodule path '\$sm_path' in .gitmodules")"
 +                      die "$(eval_gettext "No url found for submodule path '\$displaypath' in .gitmodules")"
  
                        # Possibly a url relative to parent
                        case "$url" in
                                ;;
                        esac
                        git config submodule."$name".url "$url" ||
 -                      die "$(eval_gettext "Failed to register url for submodule path '\$sm_path'")"
 +                      die "$(eval_gettext "Failed to register url for submodule path '\$displaypath'")"
  
 -                      say "$(eval_gettext "Submodule '\$name' (\$url) registered for path '\$sm_path'")"
 +                      say "$(eval_gettext "Submodule '\$name' (\$url) registered for path '\$displaypath'")"
                fi
  
                # Copy "update" setting when it is not set yet
 -              upd="$(git config -f .gitmodules submodule."$name".update)"
 -              test -z "$upd" ||
 -              test -n "$(git config submodule."$name".update)" ||
 -              git config submodule."$name".update "$upd" ||
 -              die "$(eval_gettext "Failed to register update mode for submodule path '\$sm_path'")"
 +              if upd="$(git config -f .gitmodules submodule."$name".update)" &&
 +                 test -n "$upd" &&
 +                 test -z "$(git config submodule."$name".update)"
 +              then
 +                      case "$upd" in
 +                      rebase | merge | none)
 +                              ;; # known modes of updating
 +                      *)
 +                              echo >&2 "warning: unknown update mode '$upd' suggested for submodule '$name'"
 +                              upd=none
 +                              ;;
 +                      esac
 +                      git config submodule."$name".update "$upd" ||
 +                      die "$(eval_gettext "Failed to register update mode for submodule path '\$displaypath'")"
 +              fi
 +      done
 +}
 +
 +#
 +# Unregister submodules from .git/config and remove their work tree
 +#
 +# $@ = requested paths (use '.' to deinit all submodules)
 +#
 +cmd_deinit()
 +{
 +      # parse $args after "submodule ... deinit".
 +      while test $# -ne 0
 +      do
 +              case "$1" in
 +              -f|--force)
 +                      force=$1
 +                      ;;
 +              -q|--quiet)
 +                      GIT_QUIET=1
 +                      ;;
 +              --)
 +                      shift
 +                      break
 +                      ;;
 +              -*)
 +                      usage
 +                      ;;
 +              *)
 +                      break
 +                      ;;
 +              esac
 +              shift
 +      done
 +
 +      if test $# = 0
 +      then
 +              die "$(eval_gettext "Use '.' if you really want to deinitialize all submodules")"
 +      fi
 +
 +      module_list "$@" |
 +      while read mode sha1 stage sm_path
 +      do
 +              die_if_unmatched "$mode"
 +              name=$(module_name "$sm_path") || exit
 +
 +              displaypath=$(relative_path "$sm_path")
 +
 +              # Remove the submodule work tree (unless the user already did it)
 +              if test -d "$sm_path"
 +              then
 +                      # Protect submodules containing a .git directory
 +                      if test -d "$sm_path/.git"
 +                      then
 +                              echo >&2 "$(eval_gettext "Submodule work tree '\$displaypath' contains a .git directory")"
 +                              die "$(eval_gettext "(use 'rm -rf' if you really want to remove it including all of its history)")"
 +                      fi
 +
 +                      if test -z "$force"
 +                      then
 +                              git rm -qn "$sm_path" ||
 +                              die "$(eval_gettext "Submodule work tree '\$displaypath' contains local modifications; use '-f' to discard them")"
 +                      fi
 +                      rm -rf "$sm_path" &&
 +                      say "$(eval_gettext "Cleared directory '\$displaypath'")" ||
 +                      say "$(eval_gettext "Could not remove submodule work tree '\$displaypath'")"
 +              fi
 +
 +              mkdir "$sm_path" || say "$(eval_gettext "Could not create empty submodule directory '\$displaypath'")"
 +
 +              # Remove the .git/config entries (unless the user already did it)
 +              if test -n "$(git config --get-regexp submodule."$name\.")"
 +              then
 +                      # Remove the whole section so we have a clean state when
 +                      # the user later decides to init this submodule again
 +                      url=$(git config submodule."$name".url)
 +                      git config --remove-section submodule."$name" 2>/dev/null &&
 +                      say "$(eval_gettext "Submodule '\$name' (\$url) unregistered for path '\$displaypath'")"
 +              fi
        done
  }
  
@@@ -761,14 -599,6 +761,14 @@@ cmd_update(
                --checkout)
                        update="checkout"
                        ;;
 +              --depth)
 +                      case "$2" in '') usage ;; esac
 +                      depth="--depth=$2"
 +                      shift
 +                      ;;
 +              --depth=*)
 +                      depth=$1
 +                      ;;
                --)
                        shift
                        break
                        update_module=$(git config submodule."$name".update)
                fi
  
 +              displaypath=$(relative_path "$prefix$sm_path")
 +
                if test "$update_module" = "none"
                then
 -                      echo "Skipping submodule '$prefix$sm_path'"
 +                      echo "Skipping submodule '$displaypath'"
                        continue
                fi
  
                        # Only mention uninitialized submodules when its
                        # path have been specified
                        test "$#" != "0" &&
 -                      say "$(eval_gettext "Submodule path '\$prefix\$sm_path' not initialized
 +                      say "$(eval_gettext "Submodule path '\$displaypath' not initialized
  Maybe you want to use 'update --init'?")"
                        continue
                fi
  
                if ! test -d "$sm_path"/.git -o -f "$sm_path"/.git
                then
 -                      module_clone "$sm_path" "$name" "$url" "$reference" || exit
 +                      module_clone "$sm_path" "$name" "$url" "$reference" "$depth" || exit
                        cloned_modules="$cloned_modules;$name"
                        subsha1=
                else
                        subsha1=$(clear_local_git_env; cd "$sm_path" &&
                                git rev-parse --verify HEAD) ||
 -                      die "$(eval_gettext "Unable to find current revision in submodule path '\$prefix\$sm_path'")"
 +                      die "$(eval_gettext "Unable to find current revision in submodule path '\$displaypath'")"
                fi
  
                if test -n "$remote"
                                (clear_local_git_env; cd "$sm_path" &&
                                        ( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
                                         test -z "$rev") || git-fetch)) ||
 -                              die "$(eval_gettext "Unable to fetch in submodule path '\$prefix\$sm_path'")"
 +                              die "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")"
                        fi
  
                        # Is this something we just cloned?
                        case "$update_module" in
                        rebase)
                                command="git rebase"
 -                              die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$prefix\$sm_path'")"
 -                              say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': rebased into '\$sha1'")"
 +                              die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
 +                              say_msg="$(eval_gettext "Submodule path '\$displaypath': rebased into '\$sha1'")"
                                must_die_on_failure=yes
                                ;;
                        merge)
                                command="git merge"
 -                              die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$prefix\$sm_path'")"
 -                              say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': merged in '\$sha1'")"
 +                              die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$displaypath'")"
 +                              say_msg="$(eval_gettext "Submodule path '\$displaypath': merged in '\$sha1'")"
 +                              must_die_on_failure=yes
 +                              ;;
 +                      !*)
 +                              command="${update_module#!}"
 +                              die_msg="$(eval_gettext "Execution of '\$command \$sha1' failed in submodule  path '\$prefix\$sm_path'")"
 +                              say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': '\$command \$sha1'")"
                                must_die_on_failure=yes
                                ;;
                        *)
                                command="git checkout $subforce -q"
 -                              die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$prefix\$sm_path'")"
 -                              say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': checked out '\$sha1'")"
 +                              die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
 +                              say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
                                ;;
                        esac
  
                        res=$?
                        if test $res -gt 0
                        then
 -                              die_msg="$(eval_gettext "Failed to recurse into submodule path '\$prefix\$sm_path'")"
 +                              die_msg="$(eval_gettext "Failed to recurse into submodule path '\$displaypath'")"
                                if test $res -eq 1
                                then
                                        err="${err};$die_msg"
@@@ -1043,24 -865,16 +1043,24 @@@ cmd_summary() 
        fi
  
        cd_to_toplevel
 +      eval "set $(git rev-parse --sq --prefix "$wt_prefix" -- "$@")"
        # Get modified modules cared by user
        modules=$(git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- "$@" |
                sane_egrep '^:([0-7]* )?160000' |
 -              while read mod_src mod_dst sha1_src sha1_dst status name
 +              while read mod_src mod_dst sha1_src sha1_dst status sm_path
                do
                        # Always show modules deleted or type-changed (blob<->module)
 -                      test $status = D -o $status = T && echo "$name" && continue
 +                      test $status = D -o $status = T && echo "$sm_path" && continue
 +                      # Respect the ignore setting for --for-status.
 +                      if test -n "$for_status"
 +                      then
 +                              name=$(module_name "$sm_path")
 +                              ignore_config=$(get_submodule_config "$name" ignore none)
 +                              test $status != A -a $ignore_config = all && continue
 +                      fi
                        # Also show added or modified modules which are checked out
 -                      GIT_DIR="$name/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
 -                      echo "$name"
 +                      GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
 +                      echo "$sm_path"
                done
        )
  
                ! GIT_DIR="$name/.git" git-rev-parse -q --verify $sha1_dst^0 >/dev/null &&
                missing_dst=t
  
 +              display_name=$(relative_path "$name")
 +
                total_commits=
                case "$missing_src,$missing_dst" in
                t,)
 -                      errmsg="$(eval_gettext "  Warn: \$name doesn't contain commit \$sha1_src")"
 +                      errmsg="$(eval_gettext "  Warn: \$display_name doesn't contain commit \$sha1_src")"
                        ;;
                ,t)
 -                      errmsg="$(eval_gettext "  Warn: \$name doesn't contain commit \$sha1_dst")"
 +                      errmsg="$(eval_gettext "  Warn: \$display_name doesn't contain commit \$sha1_dst")"
                        ;;
                t,t)
 -                      errmsg="$(eval_gettext "  Warn: \$name doesn't contain commits \$sha1_src and \$sha1_dst")"
 +                      errmsg="$(eval_gettext "  Warn: \$display_name doesn't contain commits \$sha1_src and \$sha1_dst")"
                        ;;
                *)
                        errmsg=
                        submodule="$(gettext "submodule")"
                        if test $mod_dst = 160000
                        then
 -                              echo "* $name $sha1_abbr_src($blob)->$sha1_abbr_dst($submodule)$total_commits:"
 +                              echo "* $display_name $sha1_abbr_src($blob)->$sha1_abbr_dst($submodule)$total_commits:"
                        else
 -                              echo "* $name $sha1_abbr_src($submodule)->$sha1_abbr_dst($blob)$total_commits:"
 +                              echo "* $display_name $sha1_abbr_src($submodule)->$sha1_abbr_dst($blob)$total_commits:"
                        fi
                else
 -                      echo "* $name $sha1_abbr_src...$sha1_abbr_dst$total_commits:"
 +                      echo "* $display_name $sha1_abbr_src...$sha1_abbr_dst$total_commits:"
                fi
                if test -n "$errmsg"
                then
                        echo
                fi
                echo
 -      done |
 -      if test -n "$for_status"; then
 -              if [ -n "$files" ]; then
 -                      gettextln "Submodules changed but not updated:" | git stripspace -c
 -              else
 -                      gettextln "Submodule changes to be committed:" | git stripspace -c
 -              fi
 -              printf "\n" | git stripspace -c
 -              git stripspace -c
 -      else
 -              cat
 -      fi
 +      done
  }
  #
  # List all submodules, prefixed with:
@@@ -1218,7 -1041,7 +1218,7 @@@ cmd_status(
                die_if_unmatched "$mode"
                name=$(module_name "$sm_path") || exit
                url=$(git config submodule."$name".url)
 -              displaypath="$prefix$sm_path"
 +              displaypath=$(relative_path "$prefix$sm_path")
                if test "$stage" = U
                then
                        say "U$sha1 $displaypath"
                        say "-$sha1 $displaypath"
                        continue;
                fi
 -              set_name_rev "$sm_path" "$sha1"
                if git diff-files --ignore-submodules=dirty --quiet -- "$sm_path"
                then
 +                      set_name_rev "$sm_path" "$sha1"
                        say " $sha1 $displaypath$revname"
                else
                        if test -z "$cached"
                        then
                                sha1=$(clear_local_git_env; cd "$sm_path" && git rev-parse --verify HEAD)
 -                              set_name_rev "$sm_path" "$sha1"
                        fi
 +                      set_name_rev "$sm_path" "$sha1"
                        say "+$sha1 $displaypath$revname"
                fi
  
@@@ -1313,8 -1136,7 +1313,8 @@@ cmd_sync(
  
                if git config "submodule.$name.url" >/dev/null 2>/dev/null
                then
 -                      say "$(eval_gettext "Synchronizing submodule url for '\$prefix\$sm_path'")"
 +                      displaypath=$(relative_path "$prefix$sm_path")
 +                      say "$(eval_gettext "Synchronizing submodule url for '\$displaypath'")"
                        git config submodule."$name".url "$super_config_url"
  
                        if test -e "$sm_path"/.git
  while test $# != 0 && test -z "$command"
  do
        case "$1" in
 -      add | foreach | init | update | status | summary | sync)
 +      add | foreach | init | deinit | update | status | summary | sync)
                command=$1
                ;;
        -q|--quiet)