git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] gitattribute macro expansion oddity
@ 2012-01-10  7:03 Jeff King
  2012-01-10  9:01 ` Michael Haggerty
  2012-01-10 17:22 ` [BUG] gitattribute macro expansion oddity Junio C Hamano
  0 siblings, 2 replies; 13+ messages in thread
From: Jeff King @ 2012-01-10  7:03 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Henrik Grubbström, git-dev

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:

  $ git show 2a0f4bf7 LibGit2Sharp/Configuration.cs
  ...
  diff --git a/LibGit2Sharp/Configuration.cs b/LibGit2Sharp/Configuration.cs
  index 83cc9d6..9ab0b60 100644
  --- a/LibGit2Sharp/Configuration.cs
  +++ b/LibGit2Sharp/Configuration.cs

Looks OK. Now try a diff that also has a binary file (that is marked
such via gitattributes):

  $ git show 2a0f4bf7 Lib/NativeBinaries/x86/git2.dll \
                      LibGit2Sharp/Configuration.cs
  ...
  diff --git a/Lib/NativeBinaries/x86/git2.dll b/Lib/NativeBinaries/x86/git2.dll
  index dab0d04..8de18ab 100644
  Binary files a/Lib/NativeBinaries/x86/git2.dll and b/Lib/NativeBinaries/x86/git2.dll differ
  diff --git a/LibGit2Sharp/Configuration.cs b/LibGit2Sharp/Configuration.cs
  index 83cc9d6..9ab0b60 100644
  Binary files a/LibGit2Sharp/Configuration.cs and b/LibGit2Sharp/Configuration.cs differ

Now the Configuration.cs blobs appear binary!

It has nothing to do with pathspecs; if you do a non-limited diff of
2a0f4bf7, you'll see many of the files appear as binary. Running it
through the debugger, it looks like we are getting wrong diff attribute
values for later paths, as if the earlier lookups are somehow polluting
the attribute stack.

The gitattributes in this repository look reasonably sane, but even if
they were not, nothing should make a file have different attributes
based on other files that were diffed.

Bisection points to ec775c4 (attr: Expand macros immediately when
encountered., 2010-04-06), but it's too late for me to dig further
tonight. Cc'ing Junio as the author of the attr code and Henrik as the
author of ec775c4.

-Peff

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-01-11  4:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-10  7:03 [BUG] gitattribute macro expansion oddity Jeff King
2012-01-10  9:01 ` Michael Haggerty
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

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).