@@ -11,7 +11,7 @@ report () {
1111#
1212"
1313 trailer=" "
14- while read oldmode mode oldsha sha status name newname
14+ while read status name newname
1515 do
1616 echo -n " $header "
1717 header=" "
@@ -41,16 +41,11 @@ git-update-index -q --unmerged --refresh || exit
4141
4242if GIT_DIR=" $GIT_DIR " git-rev-parse --verify HEAD > /dev/null 2>&1
4343then
44- git-diff-index -M --cached HEAD |
44+ git-diff-index -M --cached --name-status HEAD |
4545 sed -e '
46- s/^://
47- h
48- s/^[^ ]*//
46+ s/\\/\\\\/g
4947 s/ /\\ /g
50- x
51- s/ .*$//
52- G
53- s/\n/ /' |
48+ ' |
5449 report " Updated but not checked in" " will commit"
5550
5651 committable=" $? "
6055#'
6156 git-ls-files |
6257 sed -e '
58+ s/\\/\\\\/g
6359 s/ /\\ /g
64- s/^/o o o o A /' |
60+ s/^/A /
61+ ' |
6562 report " Updated but not checked in" " will commit"
6663
6764 committable=" $? "
6865fi
6966
70- git-diff-files |
67+ git-diff-files --name-status |
7168sed -e '
72- s/^://
73- h
74- s/^[^ ]*//
69+ s/\\/\\\\/g
7570 s/ /\\ /g
76- x
77- s/ .*$//
78- G
79- s/\n/ /' |
71+ ' |
8072report " Changed but not updated" " use git-update-index to mark for commit"
8173
82- if grep -v ' ^#' " $GIT_DIR /info/exclude" > /dev/null 2>&1
74+
75+ if test -f " $GIT_DIR /info/exclude"
8376then
84- git-ls-files --others \
85- --exclude-from=" $GIT_DIR /info/exclude" \
86- --exclude-per-directory=.gitignore |
87- sed -e '
88- 1i\
89- #\
90- # Ignored files:\
91- # (use "git add" to add to commit)\
92- #
93- s/^/# /
94- $a\
95- #'
96- fi
77+ git-ls-files -z --others \
78+ --exclude-from=" $GIT_DIR /info/exclude" \
79+ --exclude-per-directory=.gitignore
80+ else
81+ git-ls-files -z --others \
82+ --exclude-per-directory=.gitignore
83+ fi |
84+ perl -e ' $/ = "\0";
85+ my $shown = 0;
86+ while (<>) {
87+ chomp;
88+ s|\\|\\\\|g;
89+ s|\t|\\t|g;
90+ s|\n|\\n|g;
91+ s/^/# /;
92+ if (!$shown) {
93+ print "#\n# Ignored files:\n";
94+ print "# (use \"git add\" to add to commit)\n#\n";
95+ $shown = 1;
96+ }
97+ print "$_\n";
98+ }
99+ '
97100
98101case " $committable " in
991020)
0 commit comments