git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] -x (no-exclude) option for cg-status

From
PRPavel Roskin <proski@gnu.org>
Date
Aug 10, 2005, 18:42 UTC
Message-ID
<1123699339.17725.13.camel@dv>
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
Message 1 of 1 in “-x (no-exclude) option for cg-status”
  1. -x (no-exclude) option for cg-statusPavel Roskin, Aug 10, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.