forked from git-lfs/git-lfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checkout: gracefully handle files deleted from the index
Right now, when someone deletes a pointer from the index with `git rm` and then runs `git lfs checkout`, the operation fails with a message of "Could not update the index" because our invocation of `git update-index` is missing the `--add` flag. Obviously, the user does not expect an error in this case, and `git checkout` simply ignores files staged for deletation, so let's do the same thing. If a file on disk is deleted, check the index with `git diff-index` to see if it's deleted from `HEAD`. If so, ignore the file, just like Git does. Note that we use `git diff-index` specifically because it doesn't refresh the index and is therefore much cheaper than alternatives, such as `git status`, which might do that.
- Loading branch information
Showing
3 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters