]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-submodule.sh
Merge branch 'jc/format-patch-error-check'
[thirdparty/git.git] / git-submodule.sh
index 02a0d728174a0201c966abd73299d03c198d03b4..2c0fb6d723b74bb5bccba1ea49f97cdf23def361 100755 (executable)
@@ -5,7 +5,8 @@
 # Copyright (c) 2007 Lars Hjemli
 
 dashless=$(basename "$0" | sed -e 's/-/ /')
-USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
+USAGE="[--quiet] [--cached]
+   or: $dashless [--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] (--all| [--] <path>...)
@@ -593,7 +594,7 @@ cmd_update()
                                # is not reachable from a ref.
                                is_tip_reachable "$sm_path" "$sha1" ||
                                fetch_in_submodule "$sm_path" $depth ||
-                               say "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")"
+                               say "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'; trying to directly fetch \$sha1:")"
 
                                # Now we tried the usual fetch, but $sha1 may
                                # not be reachable from any of the refs
@@ -850,8 +851,11 @@ cmd_summary() {
                        ;;
                esac
 
-               sha1_abbr_src=$(echo $sha1_src | cut -c1-7)
-               sha1_abbr_dst=$(echo $sha1_dst | cut -c1-7)
+               sha1_abbr_src=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_src 2>/dev/null ||
+                       echo $sha1_src | cut -c1-7)
+               sha1_abbr_dst=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_dst 2>/dev/null ||
+                       echo $sha1_dst | cut -c1-7)
+
                if test $status = T
                then
                        blob="$(gettext "blob")"