From: "\"Peter Valdemar Mørch (Lists)\"" <4ux6as402@sneakemail.com>
To: Nanako Shiraishi <nanako3@lavabit.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab
Date: Thu, 24 Jul 2008 11:41:42 +0200	[thread overview]
Message-ID: <48884E56.6070801@sneakemail.com> (raw)
In-Reply-To: <20080724172912.6117@nanako3.lavabit.com>
Actually, it gets stranger and stranger!
Nanako Shiraishi nanako3-at-lavabit.com |Lists| wrote:
>> The '-trailing-space' syntax to disable the trailing-space setting 
>> is not obvious and not documented as far as I can see. I would have
>> assumed a value of '' would disable it.
> 
> Doesn't gitattributes(5) describe the overall syntax in detail?
First, git-config.1 does not mention gitattributes except for specific
settings. core.whitespace is not one of these.
gitattributes.5 has:
> Sometimes you would need to override an setting of an attribute for a
>  path to unspecified state. This can be done by listing the name of 
> the attribute prefixed with an exclamation point !.
note that this is ! before the *name* of the attribute, and for 
"Checking whitespace errors / whitespace":
> The core.whitespace configuration variable allows you to define what 
> diff and apply should consider whitespace errors for all paths in the
>  project (See git-config(1)). This attribute gives you finer control 
> per path.
...
> Unspecified: Use the value of core.whitespace configuration variable
>  to decide what to notice as error.
> 
> String: Specify a comma separate list of common whitespace problems 
> to notice in the same format as core.whitespace configuration 
> variable.
So now, git attributes says to unspecify a setting with '!' in front of
the attribute *name*, which for core.whitespace means use the value from
git-config, which if not specified means to error on e.g. trailing-space.
Now, I notice that git's own .gitattributes has this:
> * whitespace=!indent,trail,space
> *.[ch] whitespace
Which I assume actually works, but is invalid according to git-config.1 
and gitattributes.5 because:
For the first line, neither of the values 'indent', 'trail' nor 'space'
are valid for core.whitespace, and the '!' notation is not defined in
neither gitattributes.5 nor in git-config.1 for *values*.
For the second line, gitattributes states generally about attributes that:
> Set: The path has the attribute with special value "true"; this is 
> specified by listing only the name of the attribute in the attribute 
> list.
A value of true (unspecified would have required:"*.[ch] !whitespace") 
is not valid for core.whitespace either.
So now (as I read it), neither git-config.1 nor gitattributes.5 specify 
how to turn off core.whitespace "elements", but .gitattributes (from git 
itself) uses one notation (!) with settings that are invalid for other 
reaons, while "grep core.whitespace t/*" uses another notation (-) to 
turn off elements.
Also in t/* the elements have various different names, such as: "trail", 
"trailing", "trailing-space". t/t4019-diff-wserror.sh also uses this:
> echo "F whitespace=-trail" >.gitattributes
just to make things interesting!
It seems that there is some inconsistency about this. Perhaps 
documentation (and changing t/* and .gitattributes accordingly) isn't 
such a bad idea! :D
Peter
-- 
Peter Valdemar Mørch
http://www.morch.com
next prev parent reply	other threads:[~2008-07-24  9:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24  5:34 [PATCH] Document disabling core.whitespace values trailing-space and space-before-tab "Peter Valdemar Mørch (Lists)"
2008-07-24  8:29 ` Nanako Shiraishi
2008-07-24  9:41   ` "Peter Valdemar Mørch (Lists)" [this message]
2008-07-25  4:44   ` Junio C Hamano
2008-07-25  6:11     ` Peter Valdemar Mørch
2008-07-25  6:13     ` "Peter Valdemar Mørch (Lists)"
2008-07-25  8:49     ` Junio C Hamano
2008-07-25  7:28 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=48884E56.6070801@sneakemail.com \
    --to=4ux6as402@sneakemail.com \
    --cc=git@vger.kernel.org \
    --cc=nanako3@lavabit.com \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
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).