From: Dan Holmsand <holmsand@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Make cg-status report added/removed files correctly
Date: Mon, 30 May 2005 00:11:09 +0200 [thread overview]
Message-ID: <d7deh7$sbk$1@sea.gmane.org> (raw)
[-- 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
reply other threads:[~2005-05-29 22:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='d7deh7$sbk$1@sea.gmane.org' \
--to=holmsand@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).