Skip to content
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

git diff strange warning for gitattributes when diff file in subfolder #255

Closed
toninlg opened this issue Jul 24, 2015 · 8 comments · Fixed by #276
Closed

git diff strange warning for gitattributes when diff file in subfolder #255

toninlg opened this issue Jul 24, 2015 · 8 comments · Fixed by #276
Assignees

Comments

@toninlg
Copy link

toninlg commented Jul 24, 2015

Hi,
I've a repository with four subfolders in it and .gitattributes at the root.
When using the following command:

git diff adb8ff70694379ee2d339ef94900b602fa62593c:folder/file.c..cae5dc93450f6d604debfbe832790f0c2968ce48:folder/file.c

The diff is shown but the following warnings are shown at the end:

warning: unable to access 'adb8ff70694379ee2d339ef94900b602fa62593c:folder/.gitattributes': Invalid argument
warning: unable to access 'adb8ff70694379ee2d339ef94900b602fa62593c:folder/file.c..cae5dc93450f6d604debfbe832790f0c2968ce48:folder/.gitattributes': Invalid argument
warning: unable to access 'cae5dc93450f6d604debfbe832790f0c2968ce48:folder/.gitattributes': Invalid argument

version is Git for Windows 2.3.5 release 8.
I've cloned the repository to linux with git version 2.4.6, no warnings are displayed.
I've installed the last version Git-2.4.6-5th on another computer without doing any specific git config, cloned the repository and same warnings are displayed.

I've no warning on Windows when doing:

git diff adb8ff70694379ee2d339ef94900b602fa62593c:.gitignore..cae5dc93450f6d604debfbe832790f0c2968ce48:.gitignore

Thank you.

@toninlg
Copy link
Author

toninlg commented Jul 24, 2015

It can be reproduced with a repository with 3 commits:

  • 1st commit:
    .gitattributes file at git root folder with some lines
  • 2nd commit:
    folder/file.txt with some lines
  • 3rd commit:
    add some lines in folder/file.txt

then:
git diff sha1_commit2:folder/file.txt sha1_commit3:folder/file.txt

in this case, I've only two warnings:

  • sha1_commit2:folder/.gitattributes
  • sha1_commit3:folder/.gitattributes

@dscho
Copy link
Member

dscho commented Aug 7, 2015

@toninlg can you please provide a complete verifiable example? I.e. something like a repository that only needs to be cloned and a script inside that needs to be run to demonstrate the bug?

@toninlg
Copy link
Author

toninlg commented Aug 9, 2015

@dscho You can clone https://github.com/toninlg/gitattributes_warning.git

and run the script diff.sh at the root of the repository

@dscho
Copy link
Member

dscho commented Aug 12, 2015

I can confirm with the MCVE that this is a Windows-only bug.

@dscho dscho self-assigned this Aug 12, 2015
dscho added a commit to dscho/git that referenced this issue Aug 13, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
Copy link
Member

dscho commented Aug 13, 2015

@toninlg please test #276.

@dscho
Copy link
Member

dscho commented Aug 14, 2015

@toninlg please test #276.

@toninlg
Copy link
Author

toninlg commented Aug 14, 2015

Sorry for the time to reply.
I have tested #276 on top of last commit on master and I can confirm that it solves the problem.

Thank you.

@toninlg toninlg closed this as completed Aug 14, 2015
@dscho
Copy link
Member

dscho commented Aug 15, 2015

I have tested #276 on top of last commit on master and I can confirm that it solves the problem.

Perfect! Thanks for testing!

dscho added a commit to dscho/git that referenced this issue Aug 30, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Sep 10, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Sep 18, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Sep 29, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Oct 5, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Oct 18, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Nov 7, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Dec 11, 2015
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Jan 5, 2016
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Jan 12, 2016
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue May 10, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue May 10, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue May 15, 2017
This problem has been reported originally in August 2015, as

	git-for-windows#255

The symptom: when passing <commit>:<directory>/<file> style arguments to
`git diff`, Git tries to read the attributes from a file called
<commit>:<directory>/.gitattributes.

This symptom is more prominent on Windows because the colon in the file
name is illegal, and therefore reported to the user. On Linux, the colon
is legal, and it just so happens that that file typically does not
exist, and therefore there are no adverse consequences.

However, it is still a bug: Git should not even attempt to open that
file. Let's add a test case to demonstrate that problem, even on Linux
and MacOSX.

The underlying problem will be really tricky to fix: the run_diff*()
family of functions expects the path passed via the diff_filespec
structs to be the path as if it were in the worktree. However, when
processing the `git diff <blob1> <blob2>` invocation, Git uses
setup_revisions()'s parsing of the pending objects to fill in this
information, and setup_revisions() simply copies the command-line
argument, rather than reconstructing the actual *file* path.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue May 15, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes the symptom reported in

	git-for-windows#255

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue May 16, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue May 16, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue May 23, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue May 23, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue May 29, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue May 29, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue May 30, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue May 30, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue May 30, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Jun 5, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Jun 7, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Jun 7, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Jun 19, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Jun 20, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Jun 25, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Jun 26, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Jul 5, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Jul 13, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes git-for-windows#255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Jul 14, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Jul 21, 2017
On Windows, a file name containing a colon is illegal. We should
therefore expect the corresponding errno when `fopen()` is called for a
path of the form <commit>:.gitattributes.

This fixes #255.

Signed-off-by: Johannes Schindelin <[email protected]>
jeffhostetler pushed a commit to jeffhostetler/git that referenced this issue Apr 13, 2020
…ire-time option

This will need a change in microsoft/scalar and microsoft/vfsforgit to handle the correct input. It has _never worked_.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants