[PATCH] Lower priority of Cogito's default exclude patterns
From: Karl Hasselström <hidden>
Date: 2016-06-15 22:42:16
Subsystem:
kernel build + files below scripts/ (unless maintained elsewhere), the rest · Maintainers:
Nathan Chancellor, Nicolas Schier, Linus Torvalds
Put the default exclude patterns in a file referenced with --exclude-from, instead of on the command line with --exclude. (The existing behavior was bad since --exclude has higher priority than --exclude-from and --exclude-per-directory, which made it impossible for the user to override the default patterns.) Signed-off-by: Karl Hasselström <redacted> --- Makefile | 15 +++++++++++++-- cg-Xlib | 6 +++++- cg-default-exclude | 6 ++++++ 3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 700491f..9ec9d07 100644
--- a/Makefile
+++ b/Makefile@@ -3,6 +3,7 @@ prefix=$(HOME) bindir=$(prefix)/bin libdir=$(prefix)/lib/cogito +sharedir=$(prefix)/share/cogito INSTALL?=install
@@ -25,6 +26,8 @@ GEN_SCRIPT= cg-version VERSION= VERSION +SHARE_FILES= cg-default-exclude + ### Build rules
@@ -62,6 +65,7 @@ test: all ### Installation rules sedlibdir=$(shell echo $(libdir) | sed 's/\//\\\//g') +sedsharedir=$(shell echo $(sharedir) | sed 's/\//\\\//g') .PHONY: install install-cogito install-doc install: install-cogito
@@ -83,14 +87,20 @@ install-cogito: $(SCRIPT) $(LIB_SCRIPT) $(INSTALL) $(LIB_SCRIPT) $(DESTDIR)$(libdir) cd $(DESTDIR)$(bindir); \ for file in $(SCRIPT) $(GEN_SCRIPT); do \ - sed -e 's/\$${COGITO_LIB}/"\$${COGITO_LIB:-$(sedlibdir)\/}"/g' $$file > $$file.new; \ + sed -e 's/\$${COGITO_LIB}/"\$${COGITO_LIB:-$(sedlibdir)\/}"/g' $$file \ + | sed -e 's/\$${COGITO_SHARE}/"\$${COGITO_SHARE:-$(sedsharedir)\/}"/g' \ + > $$file.new; \ cat $$file.new > $$file; rm $$file.new; \ done cd $(DESTDIR)$(libdir); \ for file in $(LIB_SCRIPT); do \ - sed -e 's/\$${COGITO_LIB}/"\$${COGITO_LIB:-$(sedlibdir)\/}"/g' $$file > $$file.new; \ + sed -e 's/\$${COGITO_LIB}/"\$${COGITO_LIB:-$(sedlibdir)\/}"/g' $$file \ + | sed -e 's/\$${COGITO_SHARE}/"\$${COGITO_SHARE:-$(sedsharedir)\/}"/g' \ + > $$file.new; \ cat $$file.new > $$file; rm $$file.new; \ done + $(INSTALL) -m755 -d $(DESTDIR)$(sharedir) + $(INSTALL) -m644 $(SHARE_FILES) $(DESTDIR)$(sharedir) install-doc: $(MAKE) -C Documentation install
@@ -98,6 +108,7 @@ install-doc: uninstall: cd $(DESTDIR)$(bindir) && rm -f $(SCRIPT) $(GEN_SCRIPT) cd $(DESTDIR)$(libdir) && rm -f $(LIB_SCRIPT) + cd $(DESTDIR)$(sharedir) && rm -f $(SHARE_FILES)
diff --git a/cg-Xlib b/cg-Xlib
index 46a8a73..b1d1561 100755
--- a/cg-Xlib
+++ b/cg-Xlib@@ -190,9 +190,13 @@ list_untracked_files() excludeflag="$1"; shift EXCLUDE=() if [ "$excludeflag" != "no" -a "$excludeflag" != "noexclude" ]; then - for excl in '*.[ao]' '.*' '!.gitignore' tags '*~' '#*' "$@"; do + for excl in "$@"; do EXCLUDE[${#EXCLUDE[@]}]="--exclude=$excl" done + EXCLUDEFILE="${COGITO_SHARE}cg-default-exclude" + if [ -f "$EXCLUDEFILE" ]; then + EXCLUDE[${#EXCLUDE[@]}]="--exclude-from=$EXCLUDEFILE" + fi EXCLUDEFILE="$_git/info/exclude" if [ -f "$EXCLUDEFILE" ]; then EXCLUDE[${#EXCLUDE[@]}]="--exclude-from=$EXCLUDEFILE"
diff --git a/cg-default-exclude b/cg-default-exclude
new file mode 100644
index 0000000..f24dad6
--- /dev/null
+++ b/cg-default-exclude@@ -0,0 +1,6 @@ +*.[ao] +.* +!.gitignore +tags +*~ +#*