From: Michael Haggerty <mhagger@alum.mit.edu>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
"Henrik Grubbström" <grubba@grubba.org>,
git-dev@github.com
Subject: Re: [BUG] gitattribute macro expansion oddity
Date: Tue, 10 Jan 2012 10:01:34 +0100 [thread overview]
Message-ID: <4F0BFE6E.6080904@alum.mit.edu> (raw)
In-Reply-To: <20120110070300.GA17086@sigill.intra.peff.net>
On 01/10/2012 08:03 AM, Jeff King wrote:
> I'm seeing some very odd behavior with git's attribute expansion for
> diffs. You can see it with this repository:
>
> git clone git://github.com/libgit2/libgit2sharp.git
>
> Try a diff of a non-binary file: [...]
The problem has nothing with diffing; simply interrogating the attribute
values gives different results depending on the order of the files:
$ git check-attr --all Lib/NativeBinaries/x86/git2.dll
LibGit2Sharp/Configuration.cs
Lib/NativeBinaries/x86/git2.dll: binary: set
Lib/NativeBinaries/x86/git2.dll: diff: unset
Lib/NativeBinaries/x86/git2.dll: text: unset
LibGit2Sharp/Configuration.cs: binary: set
LibGit2Sharp/Configuration.cs: diff: unset
LibGit2Sharp/Configuration.cs: text: unset
LibGit2Sharp/Configuration.cs: crlf: set
$ git check-attr --all LibGit2Sharp/Configuration.cs
Lib/NativeBinaries/x86/git2.dll
LibGit2Sharp/Configuration.cs: diff: csharp
LibGit2Sharp/Configuration.cs: crlf: set
Lib/NativeBinaries/x86/git2.dll: binary: set
Lib/NativeBinaries/x86/git2.dll: diff: unset
Lib/NativeBinaries/x86/git2.dll: text: unset
It also doesn't depend on the fact that Lib/.gitattributes uses CRLF as
its EOL, nor does it depend on the use of the "binary" macro. However,
it does depend on the fact that the directory name "Lib" matches the
first part of the directory name "LibGit2Sharp". Here is a simplified
demonstration of the problem:
a=LibA/a.txt
b=Lib/b.bin
rm -rf foo
git init foo
cd foo
mkdir $(dirname $a) $(dirname $b)
touch $a $b
echo '*.txt foo' >.gitattributes
echo '* bar' >$(dirname $b)/.gitattributes
git add .
git commit -am 'Demonstrate problem'
echo '================================================='
git check-attr --all $b $a
echo '================================================='
git check-attr --all $a $b
echo '================================================='
The attributes of $a are different depending on what order $a and $b
appear in the "git check-attr" command line.
Changing the example to "a=foo/a.txt" makes the problem go away.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
next prev parent reply other threads:[~2012-01-10 9:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-10 7:03 [BUG] gitattribute macro expansion oddity Jeff King
2012-01-10 9:01 ` Michael Haggerty [this message]
2012-01-10 17:11 ` Jeff King
2012-01-10 18:08 ` [PATCH] attr: don't confuse prefixes with leading directories Jeff King
2012-01-10 18:21 ` Jeff King
2012-01-10 19:23 ` Junio C Hamano
2012-01-10 19:28 ` Jeff King
2012-01-10 19:32 ` Jeff King
2012-01-10 20:25 ` Junio C Hamano
2012-01-10 22:31 ` Jeff King
2012-01-10 19:25 ` Junio C Hamano
2012-01-10 17:22 ` [BUG] gitattribute macro expansion oddity Junio C Hamano
2012-01-11 4:37 ` Michael Haggerty
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=4F0BFE6E.6080904@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=git-dev@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=grubba@grubba.org \
--cc=peff@peff.net \
/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).