* [PATCH] Make cg-status report added/removed files correctly
@ 2005-05-29 22:11 Dan Holmsand
0 siblings, 0 replies; only message in thread
From: Dan Holmsand @ 2005-05-29 22:11 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 522 bytes --]
cg-status presently only cares about the cache (by parsing the output of
git-update-cache and git-ls-files), when it should look at the tree in HEAD.
This patch fixes this, by using git-diff-cache HEAD instead (using
git-diff-files only to detect the difference between missing files and
cg-rm'd ones).
It also uses the exclusion mechanism in git-ls-files, instead of parsing
git-ls-files output, and adds '*~' and '#*' to the list of patterns
excluded by default.
Signed-off-by: Dan Holmsand <holmsand@gmail.com>
[-- Attachment #2: cg-status.patch.txt --]
[-- Type: text/plain, Size: 1092 bytes --]
diff --git a/cg-status b/cg-status
--- a/cg-status
+++ b/cg-status
@@ -7,33 +7,24 @@
. ${COGITO_LIB}cg-Xlib
+[ 0 -eq $# ] || die "no arguments allowed"
+
EXCLUDEFILE=$_git/exclude
EXCLUDE=
if [ -f $EXCLUDEFILE ]; then
EXCLUDE="--exclude-from=$EXCLUDEFILE"
fi
-{
- git-ls-files -z -t --others --deleted --unmerged $EXCLUDE
-} | sort -z -k 2 | xargs -0 sh -c '
-while [ "$1" ]; do
- tag=${1% *};
- filename=${1#* };
- case "$filename" in
- *.[ao] | tags | ,,merge*) ;;
- *) echo "$tag $filename";;
- esac
- shift
-done
-' padding
+git-update-cache --refresh > /dev/null
+
+git-ls-files --others --exclude='*.[ao]' --exclude='.*' --exclude=tags \
+ --exclude='*~' --exclude='#*' \
+ --exclude=',,merge*' $EXCLUDE | sed 's,^,? ,'
-{
- git-update-cache --refresh
-} | cut -f 1 -d ":" | xargs sh -c '
-while [ "$1" ]; do
- tag="M";
- filename=${1%: *};
- echo "$tag $filename";
- shift
+git-diff-cache HEAD | cut -f5- -d' ' |
+while IFS=$'\t' read -r mode file; do
+ if [ "$mode" = D ]; then
+ [ "$(git-diff-files "$file")" ] && mode=!
+ fi
+ echo "$mode $file"
done
-' padding
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-05-29 22:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-29 22:11 [PATCH] Make cg-status report added/removed files correctly Dan Holmsand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).