From: Pavel Roskin <proski@gnu.org>
To: Petr Baudis <pasky@suse.cz>, git <git@vger.kernel.org>
Subject: [PATCH] -x (no-exclude) option for cg-status
Date: Wed, 10 Aug 2005 14:42:19 -0400 [thread overview]
Message-ID: <1123699339.17725.13.camel@dv> (raw)
Hello!
I'm trying to reimplement my cg-clean script so that it reuses more code
from other utilities. This patch makes it possible to call cg-status
from cg-clean.
This patch adds the "-x" option that instructs cg-status not to ignore
any files. Also, the code has been changed to add standard includes in
a loop.
Signed-off-by: Pavel Roskin <proski@gnu.org>
diff --git a/cg-status b/cg-status
--- a/cg-status
+++ b/cg-status
@@ -34,6 +34,9 @@
# -w::
# Show the working tree file list.
#
+# -x::
+# Don't exclude any files from listing.
+#
# FILES
# -----
# $GIT_DIR/exclude::
@@ -53,11 +56,14 @@ USAGE="cg-status [-g] [-w]"
gitstatus=
workstatus=
+noexclude=
while optparse; do
if optparse -g; then
gitstatus=1
elif optparse -w; then
workstatus=1
+ elif optparse -x; then
+ noexclude=1
else
optfail
fi
@@ -116,18 +122,21 @@ fi
if [ "$workstatus" ]; then
- EXCLUDEFILE=$_git/exclude
EXCLUDE=
- if [ -f $EXCLUDEFILE ]; then
- EXCLUDE="$EXCLUDE --exclude-from=$EXCLUDEFILE"
+ if [ -z "$noexclude" ]; then
+ EXCLUDEFILE=$_git/exclude
+ for excl in '*.[ao]' '.*' tags '*~' '#*' ',,merge*'; do
+ EXCLUDE="$EXCLUDE --exclude=$excl"
+ done
+ if [ -f $EXCLUDEFILE ]; then
+ EXCLUDE="$EXCLUDE --exclude-from=$EXCLUDEFILE"
+ fi
+ EXCLUDE="$EXCLUDE --exclude-per-directory=.gitignore"
fi
git-update-cache --refresh > /dev/null
- git-ls-files --others --exclude='*.[ao]' --exclude='.*' --exclude=tags \
- --exclude='*~' --exclude='#*' \
- --exclude=',,merge*' $EXCLUDE \
- --exclude-per-directory=.gitignore |
+ git-ls-files --others $EXCLUDE |
{ if [ "$_git_relpath" ]; then sed -n "s|^$_git_relpath||p"; else cat; fi } |
sed 's,^,? ,'
--
Regards,
Pavel Roskin
reply other threads:[~2005-08-10 18:42 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=1123699339.17725.13.camel@dv \
--to=proski@gnu.org \
--cc=git@vger.kernel.org \
--cc=pasky@suse.cz \
/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).