You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File Lock blocks git lfs checkout from replacing files #3102
Hi @FattyMieo, thanks for opening this. It seems like a bug to me, and I think that we have a couple of options on how to go forward. My inclination is to suggest that you use git checkout instead of git lfs checkout, since it is deprecated and will n ot be included in future releases starting after v3.0.0.
Alternatively, we could teach git lfs checkout to work around these, by first making the file writeable if it is not. That would look something like:
diff --git a/lfs/gitfilter_smudge.go b/lfs/gitfilter_smudge.go
index 0d1c0d1b..21886cb2 100644
--- a/lfs/gitfilter_smudge.go+++ b/lfs/gitfilter_smudge.go@@ -21,6 +21,19 @@ func (f *GitFilter) SmudgeToFile(filename string, ptr *Pointer, download bool, m
return fmt.Errorf("Could not create working directory file: %v", err)
}
defer file.Close()
++ stat, err := file.Stat()+ if err != nil {+ return fmt.Errorf("Could not stat working directory file: %v", err)+ }++ // When we're done, return the file back to its normal permission bits.+ defer file.Chmod(stat.Mode())++ if err := file.Chmod(stat.Mode() | 0200); err != nil {+ return fmt.Errorf("Could not make file write-able for checkout")+ }+
if _, err := f.Smudge(file, ptr, filename, download, manifest, cb); err != nil {
if errors.IsDownloadDeclinedError(err) {
// write placeholder data instead
But it might not be worthwhile if we're going to remove the command anyway.
@FattyMieo Thanks for opening the issue! In regards to @ttaylorr's comment above, I think git checkout is the best path forward here, since git lfs checkout is currently deprecated. I've also done a quick test locally and git checkout seems to work if a file is locked.
My team was using Gitkraken and this was happening when I checkout between branches (and pulling new changes). Gitkraken doesn't throw any error logs and so is when I attempted to do git checkout in git bash; only the files are still remained pointers. The error log only shows up when I do git lfs checkout.
I'm not sure if this affects if I were using a GUI client.
In regards to @ttaylorr's comment above, I think git checkout is the best path forward here, since git lfs checkout is currently deprecated.
@PastelMobileSuit and I had another chance to chat about this, and we've decided to patch the deprecated git lfs checkout command so that this will work while users convert to using git-checkout(1).
Activity
ttaylorr commentedon Jul 5, 2018
Hi @FattyMieo, thanks for opening this. It seems like a bug to me, and I think that we have a couple of options on how to go forward. My inclination is to suggest that you use
git checkoutinstead ofgit lfs checkout, since it is deprecated and will n ot be included in future releases starting after v3.0.0.Alternatively, we could teach
git lfs checkoutto work around these, by first making the file writeable if it is not. That would look something like:But it might not be worthwhile if we're going to remove the command anyway.
@larsxschneider @PastelMobileSuit what do you think?
PastelMobileSuit commentedon Jul 5, 2018
@FattyMieo Thanks for opening the issue! In regards to @ttaylorr's comment above, I think
git checkoutis the best path forward here, sincegit lfs checkoutis currently deprecated. I've also done a quick test locally andgit checkoutseems to work if a file is locked.FattyMieo commentedon Jul 8, 2018
Thank you for the replies.
My team was using Gitkraken and this was happening when I checkout between branches (and pulling new changes). Gitkraken doesn't throw any error logs and so is when I attempted to do
git checkoutin git bash; only the files are still remained pointers. The error log only shows up when I dogit lfs checkout.I'm not sure if this affects if I were using a GUI client.
ttaylorr commentedon Jul 9, 2018
@PastelMobileSuit and I had another chance to chat about this, and we've decided to patch the deprecated
git lfs checkoutcommand so that this will work while users convert to usinggit-checkout(1).