Re: [regression?] trailing slash required in .gitattributes

2013-03-23 Thread Jeff King
On Fri, Mar 22, 2013 at 04:08:08PM -0700, Junio C Hamano wrote: Jeff King p...@peff.net writes: if (pathlen pathname[pathlen-1] == '/') pathlen--; would work. But it seems that match_basename, despite taking the length of all of the strings we pass it, will happily use

Re: [regression?] trailing slash required in .gitattributes

2013-03-23 Thread Junio C Hamano
Jeff King p...@peff.net writes: Yeah, that is a possibility, though it involves casting away some constness. Patch is below, which seems to work. Hmm, because this was after I read this part: ... match_basename, despite taking the length of all of the strings we pass it, will happily use

Re: [regression?] trailing slash required in .gitattributes

2013-03-22 Thread Jeff King
On Tue, Mar 19, 2013 at 02:10:42PM -0400, Jeff King wrote: The issue bisects to 94bc671 (Add directory pattern matching to attributes, 2012-12-08). That commit actually tests not only that subdir/ matches, but also that just subdir does not match. [...] So I think the regression is

Re: [regression?] trailing slash required in .gitattributes

2013-03-22 Thread Junio C Hamano
Jeff King p...@peff.net writes: if (pathlen pathname[pathlen-1] == '/') pathlen--; would work. But it seems that match_basename, despite taking the length of all of the strings we pass it, will happily use NUL-terminated functions like strcmp or fnmatch. Converting the former

Re: [regression?] trailing slash required in .gitattributes

2013-03-22 Thread Duy Nguyen
On Fri, Mar 22, 2013 at 06:24:39PM -0400, Jeff King wrote: I'm having trouble figuring out the right solution for this. Thanks for looking into this. It was on my todo list, but you beat me to it :) But then here we'll end up feeding foo/ to be compared with foo, which we don't want. For a

Re: [regression?] trailing slash required in .gitattributes

2013-03-22 Thread Duy Nguyen
On Sat, Mar 23, 2013 at 11:18:24AM +0700, Duy Nguyen wrote: You can use nwildmatch() from this patch. I tested it lightly with t3070-wildmatch.sh, feeding the strings with no terminating NUL. It seems to work ok. And valgrind spotted my faults, especially for using strchr. You would need this

[regression?] trailing slash required in .gitattributes

2013-03-19 Thread Jeff King
Prior to v1.8.1.1, if I did this: git init echo content foo mkdir subdir echo content subdir/bar echo subdir export-ignore .gitattributes git add . git commit -m one git archive HEAD | tar tf - my archive would contain only foo and .gitattributes, not subdir. As of v1.8.1.1,

Re: [regression?] trailing slash required in .gitattributes

2013-03-19 Thread Junio C Hamano
Jeff King p...@peff.net writes: Prior to v1.8.1.1, if I did this: git init echo content foo mkdir subdir echo content subdir/bar echo subdir export-ignore .gitattributes git add . git commit -m one git archive HEAD | tar tf - my archive would contain only foo and

Re: [regression?] trailing slash required in .gitattributes

2013-03-19 Thread Jeff King
On Tue, Mar 19, 2013 at 01:57:56PM -0400, Jeff King wrote: Prior to v1.8.1.1, if I did this: git init echo content foo mkdir subdir echo content subdir/bar echo subdir export-ignore .gitattributes git add . git commit -m one git archive HEAD | tar tf - my