-
Notifications
You must be signed in to change notification settings - Fork 127
Add support for working copies created with git worktree #1803
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
Conversation
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.
Nice! Thanks for adding this. Added some comments, but mostly nitpicking.
internal/files/repository.go
Outdated
| } | ||
| var worktree gitWorktree | ||
| dec := yaml.NewDecoder(bytes.NewBuffer(content)) | ||
| dec.KnownFields(true) |
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.
Nit. Do we need this? This can be an issue if some other field is added to this file, right?
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.
TBH I don't know if that file could have other fields, so probably it's better to just remove it and ensure that at least the file contains "gitdir"...
internal/files/repository.go
Outdated
| "gopkg.in/yaml.v3" | ||
| ) | ||
|
|
||
| func isGitWorktree(path string) error { |
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.
Nit. We could maybe add some test cases for this function.
💚 Build Succeeded
History
cc @mrodm |
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.
👍
Add support for working copies created with
git worktreecommand.Working copies created with this command do not have a
.gitfolder, instead those working copies have a.gitfile where it is indicated where the reference repository is. For isntance:Currently,
elastic-packagefails since.gitis not a folder with this error:buildfolder does not exist andelastic-packageneeds to create it