forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Touch up symlink .gitattributes support #2091
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since `git_check_attr()` implicitly depends on the index, we really should redo this in a manner that has a chance of going into upstream: by introducing an index-aware helper function to create symbolic links, and to override that in a Windows-specific manner instead. In preparation for this, let's drop the original commit for now. Signed-off-by: Johannes Schindelin <[email protected]>
On Windows, symbolic links actually have a type depending on the target: it can be a file or a directory. In certain circumstances, this poses problems, e.g. when a symbolic link is supposed to point into a submodule that is not checked out, so there is no way for Git to auto-detect the type. To help with that, we will add support over the course of the next commits to specify that symlink type via the Git attributes. This requires an index_state, though, something that Git for Windows' `symlink()` replacement cannot know about because the function signature is defined by the POSIX standard and not ours to change. So let's introduce a helper function to create symbolic links that *does* know about the index_state. Signed-off-by: Johannes Schindelin <[email protected]>
drizzd
approved these changes
Feb 25, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Two minor comments.
Would you like me to test as well?
On Windows, symbolic links have a type: a "file symlink" must point at a file, and a "directory symlink" must point at a directory. If the type of symlink does not match its target, it doesn't work. Git does not record the type of symlink in the index or in a tree. On checkout it'll guess the type, which only works if the target exists at the time the symlink is created. This may often not be the case, for example when the link points at a directory inside a submodule. By specifying `symlink=file` or `symlink=dir` the user can specify what type of symlink Git should create, so Git doesn't have to rely on unreliable heuristics. Signed-off-by: Bert Belder <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
dscho
force-pushed
the
symlink-attr-extra
branch
from
February 25, 2019 20:26
67aabba
to
74e71f1
Compare
Thank you for the review, @drizzd!
That would be nice ;-) |
I tested lightly, and everything seems to work as intended, still! |
dscho
added a commit
to dscho/git
that referenced
this pull request
May 13, 2019
Touch up symlink .gitattributes support
dscho
added a commit
to dscho/git
that referenced
this pull request
May 13, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
May 14, 2019
Touch up symlink .gitattributes support
dscho
added a commit
that referenced
this pull request
May 14, 2019
Touch up symlink .gitattributes support
dscho
added a commit
that referenced
this pull request
May 14, 2019
Touch up symlink .gitattributes support
dscho
added a commit
that referenced
this pull request
May 14, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
May 19, 2019
Touch up symlink .gitattributes support
dscho
added a commit
to dscho/git
that referenced
this pull request
May 19, 2019
Touch up symlink .gitattributes support
dscho
added a commit
that referenced
this pull request
May 19, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 8, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 8, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 8, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 9, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 9, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 9, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 12, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 12, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 12, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 12, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 14, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 14, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 16, 2019
Touch up symlink .gitattributes support
dscho
added a commit
that referenced
this pull request
Aug 22, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Aug 23, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Sep 2, 2019
Touch up symlink .gitattributes support
dscho
added a commit
that referenced
this pull request
Sep 24, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Sep 30, 2019
Touch up symlink .gitattributes support
dscho
added a commit
that referenced
this pull request
Oct 2, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Oct 7, 2019
Touch up symlink .gitattributes support
git-for-windows-ci
pushed a commit
that referenced
this pull request
Oct 17, 2019
Touch up symlink .gitattributes support
dscho
added a commit
that referenced
this pull request
Oct 21, 2019
Touch up symlink .gitattributes support
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In git.git's
master
, thegit_check_attr()
function already reflects the fact that it relies on the presence of a Git index: thegit_check_attr()
function takes an explicitindex
parameter, in preparation for some future in which multiple submodules can be processed in the same process (i.e. with multiple Git indexes).To reflect that in our
.gitattributes
support for symbolic link types, let's redo a part of those patches: instead of hacking intosymlink()
, we implement and use an index-aware function that creates symbolic links.