Skip to contentSkip to conversation

Add exclude file support to cg-status

PATCH In review Matt Porter 3 participants 9 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add exclude file support to cg-status

Adds a trivial per-repository exclude file implementation for cg-status on top of the new git-ls-files option.

cg-status (mode:100755 sha1:6669e36f5ff5d5964882b58ba43a5dcab4fd7fc6) renamed from cg-status (mode:100755 sha1:9e7f0e59284a3d15cda35bbd5579c44d8eda05d5) +7 -1
@@ -7,8 +7,14 @@
 
 . cg-Xlib
 
+EXCLUDEFILE=.git/exclude
+EXCLUDE=
+if [ -f $EXCLUDEFILE ]; then
+	EXCLUDE="--exclude-from=$EXCLUDEFILE"
+fi
+
 {
-	git-ls-files -z -t --others --deleted --unmerged
+	git-ls-files -z -t --others --deleted --unmerged $EXCLUDE
 } | sort -z -k 2 | xargs -0 sh -c '
 while [ "$1" ]; do
 	tag=${1% *};
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"MP" == Matt Porter <[email protected]> writes:

MP> Adds a trivial per-repository exclude file implementation for MP> cg-status on top of the new git-ls-files option.

MP> +EXCLUDEFILE=.git/exclude

Good intentions, but shouldn't the file be .git/info/exclude (i.e. under .git/info)?

#2 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"MP" == Matt Porter <[email protected]> writes:

MP> Adds a trivial per-repository exclude file implementation for MP> cg-status on top of the new git-ls-files option.

MP> +EXCLUDEFILE=.git/exclude

Good intentions, but shouldn't the file be .git/info/exclude (i.e. under .git/info)?

My reasoning for not doing something like this was that there is only ever one exclude file. In other instances of cogito specific data in the .git directory, there is a subdir named for the class of data being stored there (i.e. branches, refs). In this case, it didn't seem necessary. On the other hand, this made me wonder whether there should just be a .git/cginfo subdir where exclude, branches, refs, etc. all live under since they are cogito specfic functionality. Something like:

.git/cginfo/

exclude
branches/
refs/

and so on...

-Matt

#3 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"MP" == Matt Porter <[email protected]> writes:

MP> My reasoning for not doing something like this was that there is MP> only ever one exclude file. In other instances of cogito specific MP> data in the .git directory, there is a subdir named for the class MP> of data being stored there (i.e. branches, refs). In this case, MP> it didn't seem necessary. On the other hand, this made me MP> wonder whether there should just be a .git/cginfo subdir where MP> exclude, branches, refs, etc. all live under since they are MP> cogito specfic functionality. Something like:

MP> .git/cginfo/

MP> 	    exclude
MP> 	    branches/
MP> 	    refs/

MP> and so on...

You may want to check the past thread, like this one:

From: Daniel Barkalow <[email protected]>
To: Junio C Hamano <[email protected]>
cc: David Greaves <[email protected]>,
GIT Mailing Lists <[email protected]>
Subject: Re: [PATCh] jit-trackdown
Message-ID: <[email protected]>

On Fri, 29 Apr 2005, Junio C Hamano wrote:

> Have toilet side gitters reached a concensus (or semi-concensus) > on how things under .git/ should be organized? Is there a > summary somewhere, something along the following lines?

I've made a proposal like the following:

.git/
objects/ (traditional)
refs/ Directories of hex SHA1 + newline files
heads/ Commits which are heads of various sorts
tags/ Tags, by the tag name (or some local renaming of it)
info/ Other shared information
remotes
... Everything else isn't shared
HEAD Symlink to refs/heads/<something>

The plumbing doesn't care what you name heads or tags, but expects things to be in heads to be commit objects and tags to be tag objects (which can tag whatever).

AFAICT, there is general concensus that this is how things should be, but I haven't convinced Linus that the plumbing should know about anything other than objects/.

-Daniel

#4 lore raw
Quoted 1 line · Junio C Hamano

You may want to check the past thread, like this one:

<snip>

Quoted 9 lines

.git/
objects/ (traditional)
refs/ Directories of hex SHA1 + newline files
heads/ Commits which are heads of various sorts
tags/ Tags, by the tag name (or some local renaming of it)
info/ Other shared information
remotes
... Everything else isn't shared
HEAD Symlink to refs/heads/<something>

Ok, I see I skimmed the archives way too fast after vacation. :)

I'll update the patch to match.

Thanks,
Matt

#5 lore raw
In reply to Junio C Hamano
Quoted 10 lines · Junio C Hamano
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"MP" == Matt Porter <[email protected]> writes:

MP> Adds a trivial per-repository exclude file implementation for MP> cg-status on top of the new git-ls-files option.

MP> +EXCLUDEFILE=.git/exclude

Good intentions, but shouldn't the file be .git/info/exclude (i.e. under .git/info)?

Ok, here is the updated version.

cg-status (mode:100755 sha1:874504aa8cf9ab7076eb405e19995615b4f59eab) renamed from cg-status (mode:100755 sha1:9e7f0e59284a3d15cda35bbd5579c44d8eda05d5) +7 -1
@@ -7,8 +7,14 @@
 
 . cg-Xlib
 
+EXCLUDEFILE=.git/info/exclude
+EXCLUDE=
+if [ -f $EXCLUDEFILE ]; then
+	EXCLUDE="--exclude-from=$EXCLUDEFILE"
+fi
+
 {
-	git-ls-files -z -t --others --deleted --unmerged
+	git-ls-files -z -t --others --deleted --unmerged $EXCLUDE
 } | sort -z -k 2 | xargs -0 sh -c '
 while [ "$1" ]; do
 	tag=${1% *};
#6 lore raw
In reply to Matt Porter

Dear diary, on Tue, May 03, 2005 at 02:10:42AM CEST, I got a letter where Matt Porter <[email protected]> told me that...

Quoted 4 lines

Adds a trivial per-repository exclude file implementation for cg-status on top of the new git-ls-files option.

Thanks, applied. I decided to go with this version instead of the .git/info/exclude one since I *don't* think you want to share this. The very fact it is in the .git/ directory implies here that these are your local exclude patterns which are likely temporary and more importantly you don't want them under version control. Therefore they aren't really interesting for anyone else and should be kept per-tree. That's this file's point as I view it. If you want something more persistent, get it to git's sight.

The fact that we have no support for version-tracked exclude file can't stop me! ;-)

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
#7 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"PB" == Petr Baudis <[email protected]> writes:

PB> ... since I *don't* think you want to share this. The very PB> fact it is in the .git/ directory implies here that these PB> are your local exclude patterns which are likely PB> temporary...

Is it really the case? I recall that Linux kernel started shipping with the standard dontdiff file for everybody's use some time ago, after enough people wanted it included in the upstream release. Maybe you would want to read from both?

PB> The fact that we have no support for version-tracked exclude file can't PB> stop me! ;-)

What darcs folks do is that they have a per-tree configuration (kept in ./_darcs, which is similar to our ./.git) that says which file is the exclude list, and by setting configuration item to point at a file which _is_ version controlled they can share the exclude file.

#8 lore raw

Dear diary, on Mon, May 09, 2005 at 01:28:44AM CEST, I got a letter where Junio C Hamano <[email protected]> told me that...

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"PB" == Petr Baudis <[email protected]> writes:

PB> ... since I *don't* think you want to share this. The very PB> fact it is in the .git/ directory implies here that these PB> are your local exclude patterns which are likely PB> temporary...

Is it really the case? I recall that Linux kernel started shipping with the standard dontdiff file for everybody's use some time ago, after enough people wanted it included in the upstream release. Maybe you would want to read from both?

Of course. You should combine them both, the .git/ one having the ultimate precedence (if we support the CVS-like ! stuff too).

That is, in CVS the version-controlled files are per-directory, which can be very nice too; things are getting harder now, though, since we should have some per-project ignore file too.

Quoted 8 lines

PB> The fact that we have no support for version-tracked exclude file can't PB> stop me! ;-)

What darcs folks do is that they have a per-tree configuration (kept in ./_darcs, which is similar to our ./.git) that says which file is the exclude list, and by setting configuration item to point at a file which _is_ version controlled they can share the exclude file.

That is certainly a good idea (at least for kernel, where you probably just want to give it dontdiff), but we need a sensible default.

Signature · 3 lines
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor