aboutsummaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-08-25 14:46:43 -0700
committerJunio C Hamano <gitster@pobox.com>2009-08-25 14:46:43 -0700
commit079f298513f9875dfd9f2eaaacc58c294c546571 (patch)
tree3b8d0b544e33a4aeffd5b961e8971760b4a84679 /git-submodule.sh
parentd6d994d9115ee7ce5bb5ffcfb75fea838174b9c4 (diff)
parentef92e1a43632c5b29b89da058f45d9c085ad18b7 (diff)
downloadgit-079f298513f9875dfd9f2eaaacc58c294c546571.tar.gz
git-079f298513f9875dfd9f2eaaacc58c294c546571.tar.xz
Merge branch 'jl/submodule-summary-diff-files'
* jl/submodule-summary-diff-files: Documentaqtion/git-submodule.txt: Typofix git submodule summary: add --files option
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index ebed711da..9bdd6ea3d 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -4,7 +4,7 @@
#
# Copyright (c) 2007 Lars Hjemli
-USAGE="[--quiet] [--cached] \
+USAGE="[--quiet] [--cached|--files] \
[add [-b branch] <repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch] [--rebase|--merge]|summary [-n|--summary-limit <n>] [<commit>]] \
[--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
OPTIONS_SPEC=
@@ -16,6 +16,7 @@ command=
branch=
reference=
cached=
+files=
nofetch=
update=
@@ -460,6 +461,7 @@ set_name_rev () {
cmd_summary() {
summary_limit=-1
for_status=
+ diff_cmd=diff-index
# parse $args after "submodule ... summary".
while test $# -ne 0
@@ -468,6 +470,9 @@ cmd_summary() {
--cached)
cached="$1"
;;
+ --files)
+ files="$1"
+ ;;
--for-status)
for_status="$1"
;;
@@ -504,9 +509,17 @@ cmd_summary() {
head=HEAD
fi
+ if [ -n "$files" ]
+ then
+ test -n "$cached" &&
+ die "--cached cannot be used with --files"
+ diff_cmd=diff-files
+ head=
+ fi
+
cd_to_toplevel
# Get modified modules cared by user
- modules=$(git diff-index $cached --raw $head -- "$@" |
+ modules=$(git $diff_cmd $cached --raw $head -- "$@" |
egrep '^:([0-7]* )?160000' |
while read mod_src mod_dst sha1_src sha1_dst status name
do
@@ -520,7 +533,7 @@ cmd_summary() {
test -z "$modules" && return
- git diff-index $cached --raw $head -- $modules |
+ git $diff_cmd $cached --raw $head -- $modules |
egrep '^:([0-7]* )?160000' |
cut -c2- |
while read mod_src mod_dst sha1_src sha1_dst status name