git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] -x (no-exclude) option for cg-status
@ 2005-08-10 18:42 Pavel Roskin
  0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2005-08-10 18:42 UTC (permalink / raw)
  To: Petr Baudis, git

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-10 18:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-10 18:42 [PATCH] -x (no-exclude) option for cg-status Pavel Roskin

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).