New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patterns in .gitattributes do not work if they end with a slash #87
Comments
From the documentation on gitattributes:
In other words the pattern needs to be changed from With pattern specified as
With pattern specified as
Perhaps you should report this discrepancy as a bug to the maintainers of git:
Tested using
|
Good point. I interpret the documentation that The documentation is at least misleading IMHO, so I am going to report it to git. |
Please post a link to the report here for reference.
|
Hello, did this report lead to a fix? I'm seeing the same in recent versions of the documentation. For what it's worth, I pinned down the commit adding support for excluding files with the It would be nice to have |
AFAIK not. I mailed the git mailing list, but without any response.
The problem appears to be that git-archive behaves different than documented,
and git-archive-all does it “correct” instead.
|
I doubt they will ever fix this dues to backward compatibility. With enough discrepancies I could add "as git-archive" mode, but there are not complaints for that while, IIRC, you could just change the pattern to work with both. @qmonnet Maybe bump that thread on kernel.org, see if there is someone to help this time around? |
Thank you both for your answers! I agree that the change of pattern is trivial and can fix the issue; it's not something big, just that the difference in behaviour (or inconsistencies in Git's docs) can lead to surprise/confusion. It would be nice to document this difference somewhere in git-archive-all, maybe? I'll try to bump the thread on the ML, good idea, if I can find the time (won't be this week). |
I have also encountered these behavior differences, though I would suggest mimicking the In my use case(Git 2.34.1) for the pattern
References |
…the release packages The `git-archive-all` utility doesn't treat the `/dir/` pattern as the same with the `git archive` command, remove the trailing slash to workaround the problem. Fixes #1. Fixes #3. Refer-to: Description - gitattributes - Git Documentation <https://www.git-scm.com/docs/gitattributes#_description> Refer-to: Patterns in .gitattributes do not work if they end with a slash · Issue #87 · Kentzo/git-archive-all <Kentzo/git-archive-all#87> Refer-to: Identify root cause · Task · the-common/docker-compose-config-templates <https://gitlab.com/the-common/docker-compose-config-templates/-/work_items/2> Signed-off-by: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
…the release packages The `git-archive-all` utility doesn't treat the `/dir/` pattern as the same with the `git archive` command, remove the trailing slash to workaround the problem. Fixes #1. Fixes #3. Refer-to: Description - gitattributes - Git Documentation <https://www.git-scm.com/docs/gitattributes#_description> Refer-to: Patterns in .gitattributes do not work if they end with a slash · Issue #87 · Kentzo/git-archive-all <Kentzo/git-archive-all#87> Refer-to: Identify root cause · Task · the-common/docker-compose-config-templates <https://gitlab.com/the-common/docker-compose-config-templates/-/work_items/2> Signed-off-by: 林博仁(Buo-ren, Lin) <Buo.Ren.Lin@gmail.com>
The patterns in
.gitattributes
are allowed to end with a slash, in which case they match only directories, not files.Apparently, this is not supported correctly by
git-archive-all
.Running this in a shell:
results in:
(on Ubuntu 20.04.)
.gitattributes
is now:Compare against
git:archive
:results in:
The text was updated successfully, but these errors were encountered: