* [PATCH 0/2] Clarify semantics of git attribute macros
@ 2011-08-03 13:41 Michael Haggerty
2011-08-03 13:41 ` [PATCH 1/2] gitattributes: Clarify discussion of " Michael Haggerty
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Michael Haggerty @ 2011-08-03 13:41 UTC (permalink / raw)
To: git; +Cc: gitster, peff, Michael Haggerty
Make it clearer that attribute macros do not only affect other
attributes, but are attributes themselves.
The second patch changes the nomenclature in gitattributes(5) from
"attribute macro" to "macro attribute", which I think makes the point
a tiny bit clearer. But it is definitely optional.
Michael Haggerty (2):
gitattributes: Clarify discussion of attribute macros
gitattributes: Reword "attribute macro" to "macro attribute"
Documentation/gitattributes.txt | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
--
1.7.6.8.gd2879
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] gitattributes: Clarify discussion of attribute macros
2011-08-03 13:41 [PATCH 0/2] Clarify semantics of git attribute macros Michael Haggerty
@ 2011-08-03 13:41 ` Michael Haggerty
2011-08-03 19:46 ` Jeff King
2011-08-03 13:41 ` [PATCH 2/2] gitattributes: Reword "attribute macro" to "macro attribute" Michael Haggerty
2011-08-03 21:34 ` [PATCH 0/2] Clarify semantics of git attribute macros Philip Oakley
2 siblings, 1 reply; 7+ messages in thread
From: Michael Haggerty @ 2011-08-03 13:41 UTC (permalink / raw)
To: git; +Cc: gitster, peff, Michael Haggerty
In particular, make it clear that attribute macros are themselves
recorded as attributes in addition to setting other attributes.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
Documentation/gitattributes.txt | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 412c55b..ccb3f3f 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -879,16 +879,19 @@ produced for, any binary file you track. You would need to specify e.g.
------------
but that may become cumbersome, when you have many attributes. Using
-attribute macros, you can specify groups of attributes set or unset at
-the same time. The system knows a built-in attribute macro, `binary`:
+attribute macros, you can define an attribute that, when set, also
+sets or unsets a number of other attributes at the same time. The
+system knows a built-in attribute macro, `binary`:
------------
*.jpg binary
------------
-which is equivalent to the above. Note that the attribute macros can only
-be "Set" (see the above example that sets "binary" macro as if it were an
-ordinary attribute --- setting it in turn unsets "text" and "diff").
+Setting the "binary" attribute also unsets the "text" and "diff"
+attributes as above. Note that attribute macros can only be "Set",
+though setting one might have the effect of setting or unsetting other
+attributes or even returning other attributes to the "Unspecified"
+state.
DEFINING ATTRIBUTE MACROS
--
1.7.6.8.gd2879
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] gitattributes: Reword "attribute macro" to "macro attribute"
2011-08-03 13:41 [PATCH 0/2] Clarify semantics of git attribute macros Michael Haggerty
2011-08-03 13:41 ` [PATCH 1/2] gitattributes: Clarify discussion of " Michael Haggerty
@ 2011-08-03 13:41 ` Michael Haggerty
2011-08-03 21:34 ` [PATCH 0/2] Clarify semantics of git attribute macros Philip Oakley
2 siblings, 0 replies; 7+ messages in thread
From: Michael Haggerty @ 2011-08-03 13:41 UTC (permalink / raw)
To: git; +Cc: gitster, peff, Michael Haggerty
The new wording makes it clearer that such a beast is an attribute in
addition to being a macro (as opposed to being only a macro that is
used for attributes).
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
Documentation/gitattributes.txt | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index ccb3f3f..2bbe76b 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -79,7 +79,7 @@ Attributes for all users on a system should be placed in the
`$(prefix)/etc/gitattributes` file.
Sometimes you would need to override an setting of an attribute
-for a path to `unspecified` state. This can be done by listing
+for a path to `Unspecified` state. This can be done by listing
the name of the attribute prefixed with an exclamation point `!`.
@@ -868,7 +868,7 @@ If this attribute is not set or has an invalid value, the value of the
(See linkgit:git-config[1]).
-USING ATTRIBUTE MACROS
+USING MACRO ATTRIBUTES
----------------------
You do not want any end-of-line conversions applied to, nor textual diffs
@@ -879,27 +879,27 @@ produced for, any binary file you track. You would need to specify e.g.
------------
but that may become cumbersome, when you have many attributes. Using
-attribute macros, you can define an attribute that, when set, also
+macro attributes, you can define an attribute that, when set, also
sets or unsets a number of other attributes at the same time. The
-system knows a built-in attribute macro, `binary`:
+system knows a built-in macro attribute, `binary`:
------------
*.jpg binary
------------
Setting the "binary" attribute also unsets the "text" and "diff"
-attributes as above. Note that attribute macros can only be "Set",
+attributes as above. Note that macro attributes can only be "Set",
though setting one might have the effect of setting or unsetting other
attributes or even returning other attributes to the "Unspecified"
state.
-DEFINING ATTRIBUTE MACROS
+DEFINING MACRO ATTRIBUTES
-------------------------
-Custom attribute macros can be defined only in the `.gitattributes` file
-at the toplevel (i.e. not in any subdirectory). The built-in attribute
-macro "binary" is equivalent to:
+Custom macro attributes can be defined only in the `.gitattributes`
+file at the toplevel (i.e. not in any subdirectory). The built-in
+macro attribute "binary" is equivalent to:
------------
[attr]binary -diff -text
--
1.7.6.8.gd2879
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitattributes: Clarify discussion of attribute macros
2011-08-03 13:41 ` [PATCH 1/2] gitattributes: Clarify discussion of " Michael Haggerty
@ 2011-08-03 19:46 ` Jeff King
2011-08-03 21:40 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Jeff King @ 2011-08-03 19:46 UTC (permalink / raw)
To: Michael Haggerty; +Cc: git, gitster
On Wed, Aug 03, 2011 at 03:41:29PM +0200, Michael Haggerty wrote:
> -which is equivalent to the above. Note that the attribute macros can only
> -be "Set" (see the above example that sets "binary" macro as if it were an
> -ordinary attribute --- setting it in turn unsets "text" and "diff").
> +Setting the "binary" attribute also unsets the "text" and "diff"
> +attributes as above. Note that attribute macros can only be "Set",
> +though setting one might have the effect of setting or unsetting other
> +attributes or even returning other attributes to the "Unspecified"
> +state.
This is slightly confusing. You can "unset" an attribute macro, and it
will be reported as "unset". Which seems to contradict what is written
above (although the error comes from the previous text). I think there
are two possibilities for what a user might expect unsetting a macro to
do for the sub-attributes:
1. Leave them unspecified.
2. Negate them (i.e., "-binary" means "text diff".
and we do (1).
I don't know if that was intentional, or if the behavior is simply
accidental and the original code was simply never meant to have
"-binary" called at all.
-Peff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Clarify semantics of git attribute macros
2011-08-03 13:41 [PATCH 0/2] Clarify semantics of git attribute macros Michael Haggerty
2011-08-03 13:41 ` [PATCH 1/2] gitattributes: Clarify discussion of " Michael Haggerty
2011-08-03 13:41 ` [PATCH 2/2] gitattributes: Reword "attribute macro" to "macro attribute" Michael Haggerty
@ 2011-08-03 21:34 ` Philip Oakley
2 siblings, 0 replies; 7+ messages in thread
From: Philip Oakley @ 2011-08-03 21:34 UTC (permalink / raw)
To: Michael Haggerty, git; +Cc: gitster, peff, Michael Haggerty
From: "Michael Haggerty"
> Make it clearer that attribute macros do not only affect other
> attributes, but are attributes themselves.
I felt that this summary was the better wording. It is simple and direct.
i.e. "Note: Attribute macros not only affect attributes, but are attributes
themselves."
Philip Oakley
Scotland
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitattributes: Clarify discussion of attribute macros
2011-08-03 19:46 ` Jeff King
@ 2011-08-03 21:40 ` Junio C Hamano
2011-08-03 22:40 ` Jeff King
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2011-08-03 21:40 UTC (permalink / raw)
To: Jeff King; +Cc: Michael Haggerty, git
Jeff King <peff@peff.net> writes:
> I don't know if that was intentional, or if the behavior is simply
> accidental and the original code was simply never meant to have
> "-binary" called at all.
The latter. You were never expected to say -macro at all.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] gitattributes: Clarify discussion of attribute macros
2011-08-03 21:40 ` Junio C Hamano
@ 2011-08-03 22:40 ` Jeff King
0 siblings, 0 replies; 7+ messages in thread
From: Jeff King @ 2011-08-03 22:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Michael Haggerty, git
On Wed, Aug 03, 2011 at 02:40:19PM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > I don't know if that was intentional, or if the behavior is simply
> > accidental and the original code was simply never meant to have
> > "-binary" called at all.
>
> The latter. You were never expected to say -macro at all.
OK. Maybe we should flag an error, then? Or if not, then make the
documentation more clear that it's not allowed (or even say the current
behavior is reasonable, and document it).
-Peff
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-08-03 22:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-03 13:41 [PATCH 0/2] Clarify semantics of git attribute macros Michael Haggerty
2011-08-03 13:41 ` [PATCH 1/2] gitattributes: Clarify discussion of " Michael Haggerty
2011-08-03 19:46 ` Jeff King
2011-08-03 21:40 ` Junio C Hamano
2011-08-03 22:40 ` Jeff King
2011-08-03 13:41 ` [PATCH 2/2] gitattributes: Reword "attribute macro" to "macro attribute" Michael Haggerty
2011-08-03 21:34 ` [PATCH 0/2] Clarify semantics of git attribute macros Philip Oakley
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 NNTP newsgroup(s).