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

Touch tracked files that are already added to git #1104

Merged
merged 3 commits into from Apr 5, 2016

Conversation

Projects
None yet
2 participants
@sinbad
Copy link
Contributor

sinbad commented Mar 22, 2016

Resolves #1057

If a file is already tracked in git when it's added to git-lfs tracking, that file is now 'touched' (mtime/atime file attributes updated) to ensure that it appears as modified in git status along with the .gitattributes and therefore prompts the user to re-commit it. Without doing this git doesn't detect that the index is dirty for this file and the user could commit .gitattributes but with the file content remaining as non-LFS, which can cause problems when checking out this commit in future. Checking out this commit will forever after show the file as modified in the working copy because smudge will not have LFS data to checkout from even though .gitattributes says it should have, and clean will show a diff.

sinbad added some commits Mar 22, 2016

'git lfs track' now automatically touches matching files already in git
This makes them appear as modified in 'git status' which indicates they
need to be re-committed to be moved into LFS if already in git.
See #1057

@sinbad sinbad added the review label Mar 22, 2016

@sinbad sinbad referenced this pull request Mar 22, 2016

Closed

Lfs detection inconsistent #1057

@technoweenie technoweenie referenced this pull request Mar 31, 2016

Closed

Git LFS v1.2 #844

16 of 17 tasks complete
git/git.go Outdated
line := scanner.Text()
ret = append(ret, strings.TrimSpace(line))
}
return ret, nil

This comment has been minimized.

@technoweenie

technoweenie Apr 4, 2016

Member

I think this should wait for the command to finish before returning.

@technoweenie

This comment has been minimized.

Copy link
Member

technoweenie commented Apr 4, 2016

Looks great 👍. I updated git.GetTrackedFiles() so it waits for the command to finish.

@sinbad

This comment has been minimized.

Copy link
Contributor Author

sinbad commented Apr 5, 2016

I updated git.GetTrackedFiles() so it waits for the command to finish.

Doh, thanks for catching that.

@sinbad sinbad merged commit 65f53a6 into master Apr 5, 2016

3 checks passed

GitHub CLA @sinbad has accepted the GitHub Contributor License Agreement.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@sinbad sinbad deleted the touch-tracked-files branch Apr 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment