-
Notifications
You must be signed in to change notification settings - Fork 703
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to avoid file mode changes in go-git? #82
Comments
Did you ever get a workaround/solution for this, I'm hitting the same problem in WSL. |
Hmm, I wrapped the git binary as a standard client finally. It brings a binary dependency but works great till now. |
Same here. Unfortunately, a bunch of functions need to be replaced: |
To help us keep things tidy and focus on the active tasks, we've introduced a stale bot to spot issues/PRs that haven't had any activity in a while. This particular issue hasn't had any updates or activity in the past 90 days, so it's been labeled as 'stale'. If it remains inactive for the next 30 days, it'll be automatically closed. We understand everyone's busy, but if this issue is still important to you, please feel free to add a comment or make an update to keep it active. Thanks for your understanding and cooperation! |
It would be good if anyone still experiencing this could confirm whether this is also the case when using |
I came here because I'm facing the same issue. I'm not sure if this is exactly how you meant your above suggestion to be used, so I guessed:
Unfortunately, this did not resolve the issue, and I'm still seeing the file mode changes. |
@craigbrett17 can you please provide an example repository so folks can try to reproduce/fix the issue? |
Unfortunately I didn't come across this whilst doing some noble and fulfilling open source volunteering, but as part of work, so the repository is private. I'll throw something together that uses this library to illustrate this if that'll help. |
@pjbgf As requested, I've put together a working example that reproduces this reliably on Windows. https://github.com/craigbrett17/go-git-buggy Absolutely meant as an example repository, so please treat it as such. Any help gratefully appreciated. |
@craigbrett17 the "Plain" versions of the go-git commands use the default fs, can you please try again with: func (c *GitClient) Clone(dir string, organisation string, repo string) (*git.Repository, error) {
repositoryName := fmt.Sprintf("https://github.com/%s/%s.git", organisation, repo)
wt := osfs.New(dir, osfs.WithBoundOS())
dotfs, err := wt.Chroot(git.GitDirName)
if err != nil {
return nil, err
}
store := filesystem.NewStorage(dotfs, cache.NewObjectLRUDefault())
repository, err := git.Clone(store, wt, &git.CloneOptions{
URL: repositoryName,
Progress: os.Stdout,
Depth: 1,
})
return repository, err
}
func (c *GitClient) LoadFromDirectory(dir string) (*git.Repository, error) {
wt := osfs.New(dir, osfs.WithBoundOS())
dotfs, err := wt.Chroot(git.GitDirName)
if err != nil {
return nil, err
}
store := filesystem.NewStorage(dotfs, cache.NewObjectLRUDefault())
return git.Open(store, wt)
} |
@pjbgf I gave this a try, no dice I'm afraid. I still see these file mode changes as before. Feel free to give it a try yourself if you have access to a Windows machine. |
To help us keep things tidy and focus on the active tasks, we've introduced a stale bot to spot issues/PRs that haven't had any activity in a while. This particular issue hasn't had any updates or activity in the past 90 days, so it's been labeled as 'stale'. If it remains inactive for the next 30 days, it'll be automatically closed. We understand everyone's busy, but if this issue is still important to you, please feel free to add a comment or make an update to keep it active. Thanks for your understanding and cooperation! |
馃憤 Awesome project! it helped me a lot.
Currently, I'm facing the file mode changing issues in my project.
Per the "How do I make Git ignore file mode (chmod) changes?" q&a in StackOverflow, I tried to set the
filemode
setting tofalse
into the git config file under the cloned repo. But it doesn't work.I also found a similar issue in the old repo: Changing file mode on NTFS #866
Did anyone know how to avoid this kind of issue in go-git? Thank you!
The text was updated successfully, but these errors were encountered: