[PATCH] -x (no-exclude) option for cg-status
From: Pavel Roskin <hidden>
Date: 2016-06-15 22:42:03
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted>
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