Thanks to visit codestin.com
Credit goes to github.com

Skip to content

checkout fails when checking out branches on an NTFS or Fat32 drive from MacOS or Linux #4504

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

Closed
cjhoward92 opened this issue Jan 29, 2018 · 2 comments

Comments

@cjhoward92
Copy link
Contributor

cjhoward92 commented Jan 29, 2018

Reproduction steps

Create a repo on an NTFS or Fat32 drive and try to checkout different branches from either MacOS or Linux.

Expected behavior

Checkout works fine

Actual behavior

Checkout fails due to potential filemode issues

Version of libgit2 (release number or SHA1)

Any version after this PR was merged

Operating system(s) tested

MacOSx
Ubuntu 16.04

This works fine on Windows since Windows does not care about filemode, but after said PR was merged there seem to be issues when the target drive does not care about filemodes on an OS that does.

I tracked it down finally and it turns out we get in a weird state where we have an added file in our current branch that is not in the branch I want to check out, and when the checkout code tries to remove this file it finds that the mtime and mode on the workdir version of the file do not match that of the index. This causes the code to check the mode against the baseitem->mode which always fails. Since we are doing a safe checkout the checkout says there is a conflict that needs to be resolved and fails.

Here is where it fails

Not sure what exactly causes the state or how to properly rectify it yet. Attached is a repo that can reproduce the issue. Just unzip it and checkout any of the other branches with libgit2. I tried to diagnose this myself but I ran out of time and haven't had another chance since I originally found the issue. Ed told me to open an issue here so maybe another contributor could have a crack at it if they have time.

dummyrepo.zip

@tiennou
Copy link
Contributor

tiennou commented Jan 31, 2018

I've built a sketchy (and somewhat wrong) checkout example (https://github.com/tiennou/libgit2/tree/examples/checkout) for the occasion, and can confirm it fails to checkout (from feature/3 to feature/1).

It seems we're using the build architecture to do some core.filemode checks, which fails in this case. I'll see if I can come up with a fix.

@cjhoward92
Copy link
Contributor Author

@tiennou Any progress on this? Thanks for looking into it!

@libgit2 libgit2 deleted a comment from frzland777 Feb 16, 2018
ethomson added a commit to ethomson/libgit2 that referenced this issue Feb 20, 2018
ethomson added a commit to ethomson/libgit2 that referenced this issue Feb 20, 2018
pks-t pushed a commit to pks-t/libgit2 that referenced this issue Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants