Git development
 help / color / mirror / Atom feed
* [PATCH] Lower priority of Cogito's default exclude patterns
@ 2006-01-07 22:19 Karl  Hasselström
       [not found] ` <20060119100712.GA12154@diana.vm.bytemark.co.uk>
  0 siblings, 1 reply; 4+ messages in thread
From: Karl  Hasselström @ 2006-01-07 22:19 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

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 <kha@treskal.com>

---

 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
+*~
+#*

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-01-21  2:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-07 22:19 [PATCH] Lower priority of Cogito's default exclude patterns Karl  Hasselström
     [not found] ` <20060119100712.GA12154@diana.vm.bytemark.co.uk>
2006-01-19 12:42   ` Petr Baudis
2006-01-19 14:07     ` Karl Hasselström
2006-01-21  2:04       ` Petr Baudis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox