Specify symlink type in .gitattributes#1897
Merged
dscho merged 3 commits intogit-for-windows:masterfrom Oct 31, 2018
piscisaureus:symlink-attr
Merged
Specify symlink type in .gitattributes#1897dscho merged 3 commits intogit-for-windows:masterfrom piscisaureus:symlink-attr
dscho merged 3 commits intogit-for-windows:masterfrom
piscisaureus:symlink-attr
Conversation
Signed-off-by: Bert Belder <bertbelder@gmail.com>
dscho
requested changes
Oct 29, 2018
Member
dscho
left a comment
There was a problem hiding this comment.
This looks pretty awesome already, and I like this idea of specifying the symlink type via the Git attributes! I offered a couple of suggestions how to change this, hopefully you agree that those are improvements?
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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 <bertbelder@gmail.com>
Author
|
@dscho Thanks for the review. I've updated the patch, PTAL. |
piscisaureus
commented
Oct 29, 2018
Signed-off-by: Bert Belder <bertbelder@gmail.com>
dscho
approved these changes
Oct 31, 2018
Member
|
Excellent. Thank you so much! |
dscho
added a commit
to git-for-windows/build-extra
that referenced
this pull request
Oct 31, 2018
The type of symlinks to create (directory or file) [can now be specified via the `.gitattributes`](git-for-windows/git#1897). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho
added a commit
to dscho/git
that referenced
this pull request
Nov 19, 2018
Specify symlink type in .gitattributes
dscho
added a commit
to dscho/git
that referenced
this pull request
Nov 19, 2018
Specify symlink type in .gitattributes
dscho
added a commit
to dscho/git
that referenced
this pull request
Nov 20, 2018
Specify symlink type in .gitattributes
dscho
added a commit
to dscho/git
that referenced
this pull request
Nov 20, 2018
Specify symlink type in .gitattributes
dscho
added a commit
that referenced
this pull request
Nov 21, 2018
Specify symlink type in .gitattributes
dscho
added a commit
that referenced
this pull request
Nov 21, 2018
Specify symlink type in .gitattributes
dscho
added a commit
to dscho/git
that referenced
this pull request
Nov 23, 2018
Specify symlink type in .gitattributes
dscho
added a commit
to dscho/git
that referenced
this pull request
Nov 23, 2018
Specify symlink type in .gitattributes
dscho
added a commit
to dscho/git
that referenced
this pull request
Nov 30, 2018
Specify symlink type in .gitattributes
dscho
added a commit
to dscho/git
that referenced
this pull request
Nov 30, 2018
Specify symlink type in .gitattributes
This was referenced Apr 9, 2026
This was referenced Apr 17, 2026
This was referenced Apr 26, 2026
This file contains hidden or 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
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.
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=fileorsymlink=dirthe user can specify whattype of symlink Git should create, so Git doesn't have to rely on
unreliable heuristics.