* Wrong gitattributes documentation?
@ 2017-06-02 17:12 Rene Pasing
2017-06-03 0:01 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Rene Pasing @ 2017-06-02 17:12 UTC (permalink / raw)
To: git
Hi all,
I have noticed a strange behaviour when using git-lfs.
If I understood correctly, git-lfs adds patterns to .gitattributes, for
which git then calls lfs for any matches with this pattern.
The problem is, the documentation[1] says: "The rules how the pattern
matches paths are the same as in .gitignore files; see gitignore[5].",
so when I have a pattern like '/images/', it should match on all
files+folders under /images, even the directory itself, right? Or when
I'd use '/images/*', it should match on all files+folders under /images,
right?
This does not seem to be the case. Nothing is done by lfs when using
'/images/', and when using '/images/*', it only takes into account files
which are directly in /images (so it doesnt take into account
subdirectories).
The only solution to this (until now) is to use '/images/**/*', which
seems to do exactly what I want (lfs gets executed for all files+folders
under /images).
Is this expected behaviour? If yes, then the documentation of
gitattributes seems incorrect to me. If not, can this be considered as a
bug?
I found several complaints about this to git-lfs (or other projects
relying on gitattributes), e.g. [2], but I didn't find anything about
this regarding gitattributes itself.
Thanks for answers
Regards
Rene
PS: $ git --version
git version 2.1.4
[1] = https://git-scm.com/docs/gitattributes
[2] = https://github.com/git-lfs/git-lfs/issues/2068
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wrong gitattributes documentation?
2017-06-02 17:12 Wrong gitattributes documentation? Rene Pasing
@ 2017-06-03 0:01 ` Junio C Hamano
2017-06-03 1:10 ` Rene Pasing
2017-06-03 1:20 ` Rene Pasing
0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2017-06-03 0:01 UTC (permalink / raw)
To: Rene Pasing; +Cc: git
Rene Pasing <rene@pasing.net> writes:
> The problem is, the documentation[1] says: "The rules how the pattern
> matches paths are the same as in .gitignore files; see gitignore[5].",
> so when I have a pattern like '/images/', it should match on all
> files+folders under /images, even the directory itself, right?
>
> Or when
> I'd use '/images/*', it should match on all files+folders under
> /images, right?
My reading of "PATTERN FORMAT" section in "git help ignore" says it
shouldn't.
- If the pattern does not contain a slash '/', Git treats it as
a shell glob pattern and checks for a match against the
pathname relative to the location of the `.gitignore` file
(relative to the toplevel of the work tree if not from a
`.gitignore` file).
- Otherwise, Git treats the pattern as a shell glob suitable
for consumption by fnmatch(3) with the FNM_PATHNAME flag:
wildcards in the pattern will not match a / in the pathname.
For example, "Documentation/{asterisk}.html" matches
"Documentation/git.html" but not "Documentation/ppc/ppc.html"
or "tools/perf/Documentation/perf.html".
Your "/images/*" is the "Otherwise" case, isn't it?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wrong gitattributes documentation?
2017-06-03 0:01 ` Junio C Hamano
@ 2017-06-03 1:10 ` Rene Pasing
2017-06-03 1:20 ` Rene Pasing
1 sibling, 0 replies; 4+ messages in thread
From: Rene Pasing @ 2017-06-03 1:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On 06/03/2017 02:01 AM, Junio C Hamano wrote:
> Your "/images/*" is the "Otherwise" case, isn't it?
Yes, true. I forgot to mention in my first mail that I also tried
'/images/', which had the same (=none) effect as '/images/*', sorry
about the confusion.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wrong gitattributes documentation?
2017-06-03 0:01 ` Junio C Hamano
2017-06-03 1:10 ` Rene Pasing
@ 2017-06-03 1:20 ` Rene Pasing
1 sibling, 0 replies; 4+ messages in thread
From: Rene Pasing @ 2017-06-03 1:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On 06/03/2017 02:01 AM, Junio C Hamano wrote:
> Your "/images/*" is the "Otherwise" case, isn't it?
Ok, sorry, didn't read your answer thoroughly enough the first time.
The problem is, when I have an entry in .gitignore like this:
/images
Then git will ignore that whole directory (and all of its subfolders
etc.). Git will just ignore everything in the tree starting with that
pathname.
But when I use the same pattern ('/images') in .gitattributes I would
expect (due to the documentation) that git-lfs will be called for all
files+subfolders+subfolderfiles and even the folder itself (this is what
I understand from 'The rules how the pattern matches paths are the same
as in .gitignore files').
This does not seem to be the case!
Sorry again for the confusion.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-03 1:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02 17:12 Wrong gitattributes documentation? Rene Pasing
2017-06-03 0:01 ` Junio C Hamano
2017-06-03 1:10 ` Rene Pasing
2017-06-03 1:20 ` Rene Pasing
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).