Update git-status to new git-diff-* and git-ls-files output.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Oct 14, 2005 at 21:56 UTC
71ac8356d8f64e2408e49ee8bf35d4e69cc9359e
1 file changed
+35
-32
git-status.sh
+35
-32
@@ -11,7 +11,7 @@ report () {
11
#
12
"
13
trailer=""
14
- while read oldmode mode oldsha sha status name newname
14
+ while read status name newname
15
do
16
echo -n "$header"
17
header=""
@@ -41,16 +41,11 @@ git-update-index -q --unmerged --refresh || exit
41
42
if GIT_DIR="$GIT_DIR" git-rev-parse --verify HEAD >/dev/null 2>&1
43
then
44
- git-diff-index -M --cached HEAD |
44
+ git-diff-index -M --cached --name-status HEAD |
45
sed -e '
46
- s/^://
47
- h
48
- s/^[^ ]*//
46
+ s/\\/\\\\/g
47
s/ /\\ /g
50
- x
51
- s/ .*$//
52
- G
53
- s/\n/ /' |
48
+ ' |
49
report "Updated but not checked in" "will commit"
50
51
committable="$?"
@@ -60,40 +55,48 @@ else
55
#'
56
git-ls-files |
57
sed -e '
58
+ s/\\/\\\\/g
59
s/ /\\ /g
64
- s/^/o o o o A /' |
60
+ s/^/A /
61
+ ' |
62
report "Updated but not checked in" "will commit"
63
64
committable="$?"
65
fi
66
70
-git-diff-files |
67
+git-diff-files --name-status |
68
sed -e '
72
- s/^://
73
- h
74
- s/^[^ ]*//
69
+ s/\\/\\\\/g
70
s/ /\\ /g
76
- x
77
- s/ .*$//
78
- G
79
- s/\n/ /' |
71
+' |
72
report "Changed but not updated" "use git-update-index to mark for commit"
73
82
-if grep -v '^#' "$GIT_DIR/info/exclude" >/dev/null 2>&1
74
+
75
+if test -f "$GIT_DIR/info/exclude"
76
then
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
+'
100
101
case "$committable" in
102
0)