git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / 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

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

Dear diary, on Thu, Jan 19, 2006 at 11:07:12AM CET, I got a letter
where Karl Hasselström <kha@treskal.com> said that...
> On 2006-01-07 23:19:31 +0100, Karl Hasselström wrote:
> 
> > 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(-)
> 
> Did you miss this patch, or just not like it?

Just postponed for next sweep through my patch queue, due today or
tomorrow. ;) I will rename cg-default-exclude to default-exclude,
though.

Oh, now I remember - one my major concern is that now Cogito will not
work if not make install'd, which is how I actually primarily use it on
my machine.

Sorry for the delay,

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe.  -- Douglas Adams

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

* Re: [PATCH] Lower priority of Cogito's default exclude patterns
  2006-01-19 12:42   ` Petr Baudis
@ 2006-01-19 14:07     ` Karl Hasselström
  2006-01-21  2:04       ` Petr Baudis
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Hasselström @ 2006-01-19 14:07 UTC (permalink / raw
  To: Petr Baudis; +Cc: git

On 2006-01-19 13:42:44 +0100, Petr Baudis wrote:

> Dear diary, on Thu, Jan 19, 2006 at 11:07:12AM CET, I got a letter
> where Karl Hasselström <kha@treskal.com> said that...
>
> > On 2006-01-07 23:19:31 +0100, Karl Hasselström wrote:
> >
> > > 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(-)
> >
> > Did you miss this patch, or just not like it?
>
> Just postponed for next sweep through my patch queue, due today or
> tomorrow. ;) I will rename cg-default-exclude to default-exclude,
> though.

Good point.

> Oh, now I remember - one my major concern is that now Cogito will
> not work if not make install'd, which is how I actually primarily
> use it on my machine.

The not-installed case could easily be worked around by users if
cogito looked at /etc/cogito/exclude and ~/.cogito/exclude as well.
(Or maybe that should be /etc/git/exclude and ~/.gitexclude, so that
e.g. stgit can use the same files.) Would you accept a patch that did
this?

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

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

* Re: [PATCH] Lower priority of Cogito's default exclude patterns
  2006-01-19 14:07     ` Karl Hasselström
@ 2006-01-21  2:04       ` Petr Baudis
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Baudis @ 2006-01-21  2:04 UTC (permalink / raw
  To: Karl Hasselström; +Cc: git

Thanks, patch applied and pushed out.

Dear diary, on Thu, Jan 19, 2006 at 03:07:28PM CET, I got a letter
where Karl Hasselström <kha@treskal.com> said that...
> On 2006-01-19 13:42:44 +0100, Petr Baudis wrote:
> > Oh, now I remember - one my major concern is that now Cogito will
> > not work if not make install'd, which is how I actually primarily
> > use it on my machine.
> 
> The not-installed case could easily be worked around by users if
> cogito looked at /etc/cogito/exclude and ~/.cogito/exclude as well.
> (Or maybe that should be /etc/git/exclude and ~/.gitexclude, so that
> e.g. stgit can use the same files.) Would you accept a patch that did
> this?

Sorry, this doesn't make sense to me - how would that help? The user can
as well just make install in that case, instead of manually copying out
one file.

	if [ -n "${COGITO_SHARE}" ]; then
		COGITO_REAL_SHARE="${COGITO_SHARE}"
		return
	fi
	if [ "${0%/*}" != "$0" ]; then
		COGITO_REAL_SHARE="${0%/*}/"
		return
	fi
	# I'm not sure if the following normally ever gets triggered.
	# I can only do it by `sh cg-status`. --pasky
	COGITO_REAL_SHARE="./$_git_relpath/"

should work well, though.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe.  -- Douglas Adams

^ permalink raw reply	[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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).