-
Notifications
You must be signed in to change notification settings - Fork 787
git: worktree, canonicalize pathnames when calling Worktree.Add(), Fixes #1460 #1491
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
base: main
Are you sure you want to change the base?
Conversation
Worktree.Add()
, Fixes #1460
8361313
to
4727c64
Compare
Worktree.Add()
, Fixes #1460go-git#1460 Ensure that adding files off the filesystem root gets the filenames right. Fixes: Issue go-git#1460
if string(path[0]) == string(filepath.Separator) { | ||
root := w.Filesystem.Root() | ||
path, _ = filepath.Rel(root, filepath.Join(root, ".", path)) | ||
} |
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.
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.
Not entirely sure I understand, as the use case here is creating a new file; but there's already util.getUnderlyingAndPath
, which I suppose could use an exported version, would that be sufficient for this?
Ensure that adding files off the filesystem root gets the filenames right.
Fixes: Issue #1460