Re: [PATCH 1/3] Add basic infrastructure to assign attributes to paths

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 1/3] Add basic infrastructure to assign attributes to paths

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:04

Andy Parkins [off-list ref] writes:
quoted
parent directories.  Lines in $GIT_DIR/info/attributes file are
used as the lowest precedence default rules.
Shouldn't this be the highest precedence?  This would be important for 
those cases where I (as a fringe developer) disagree with an attribute 
that's been assigned in-tree.  I don't want to force my will on every 
other developer, but would want my repository to work how I like it.  
Johannes Sixt [off-list ref] writes:
quoted
This makes paths with 'nodiff' attribute not to produce
"textual" diffs from 'git-diff' family.
If saying "nodiff" can be made equivalent to "!diff", then I'd strongly
prefer an attribute "diff" over "nodiff". I'm a strong disbeliever in
double negation.
Both of these are good points.

The only reason I initially made it 'nodiff' was to have a pair
of examples to demonstrate positive and negative setting of
attributes, and I agree it makes more sense to say 'diff' in
positive.

I reshuffled the code to make $GIT_DIR/info/attributes the
highest precedence, and unsetting 'diff' attribute to disable
diff; the result is in 'next'.

I'll follow this message up with a few more patches in the
series.

[PATCH 2/2] Define a few built-in attribute rules.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:04

This adds an obviously sane pair of default attribute rules as built-ins.

Signed-off-by: Junio C Hamano <redacted>
---
 attr.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/attr.c b/attr.c
index 3a14df1..9068c2e 100644
--- a/attr.c
+++ b/attr.c
@@ -194,6 +194,8 @@ static void free_attr_elem(struct attr_stack *e)
 }
 
 static const char *builtin_attr[] = {
+	"[attr]binary !diff !crlf",
+	"* diff crlf",
 	NULL,
 };
 
-- 
1.5.1.1.810.gac3a

Re: [PATCH 2/2] Define a few built-in attribute rules.

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:04


On Sat, 14 Apr 2007, Junio C Hamano wrote:
This adds an obviously sane pair of default attribute rules as built-ins.
I'm not sure.
+	"[attr]binary !diff !crlf",
+	"* diff crlf",
Why would 

	* diff crlf

be "obviously sane"?

In fact, I'd call it obviously insane.

We do *not* want to default crlf to all files. We want the default to be 
"automatic crlf depending on content". 

Then, on top of that, you can *explicitly* specify crlf or !crlf on some 
particular filename pattern bases.

(Side thought - I have to concur with whoever suggested "-" instead of 
"!". It just reads better, I think)

		Linus

Re: [PATCH 2/2] Define a few built-in attribute rules.

From: Brian Gernhardt <hidden>
Date: 2016-06-15 22:43:04

On Apr 14, 2007, at 9:41 PM, Linus Torvalds wrote:
(Side thought - I have to concur with whoever suggested "-" instead of
"!". It just reads better, I think)
The "diff" vs "nodiff" argument reminds me of Vim option setting.   
Marking a path "diff" means a diff is useful.  Marking it "nodiff"  
marks it non-useful, same with "crlf" and "nocrlf".  Just an idea to  
throw out there.  It's fairly unambiguous.

~~ Brian G.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help