Skip to content

Commit

Permalink
Fix for issues gitless-vcs/gitless#195
Browse files Browse the repository at this point in the history
  • Loading branch information
goldstar611 committed Feb 21, 2022
1 parent 69691d5 commit b12843f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gitless/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ def __getattr__(self, name):
# `git rm` and then created file with same name).
pygit2.GIT_STATUS_WT_NEW | pygit2.GIT_STATUS_INDEX_DELETED: (
GL_STATUS_TRACKED, True, True, True, False),
pygit2.GIT_STATUS_INDEX_NEW | pygit2.GIT_STATUS_WT_DELETED: (
GL_STATUS_TRACKED, True, False, True, False),

### WT_MODIFIED | INDEX_* ###
pygit2.GIT_STATUS_WT_MODIFIED | pygit2.GIT_STATUS_INDEX_NEW: (
Expand Down
11 changes: 11 additions & 0 deletions gitless/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
UNTRACKED_FP_WITH_SPACE = 'f2 space'
IGNORED_FP = 'f3'
IGNORED_FP_WITH_SPACE = 'f3 space'
DELETED_TRACKED_FP = 'f4'
DELETED_TRACKED_FP_CONTENTS = 'this file will be git added and then filesystem removed\n'
NONEXISTENT_FP = 'nonexistent'
NONEXISTENT_FP_WITH_SPACE = 'nonexistent space'
GITIGNORE_FP = '.gitignore'
Expand Down Expand Up @@ -288,6 +290,15 @@ def test_track_ignored(self):
def test_track_gitignore(self):
self.__assert_track_untracked(GITIGNORE_FP)

def test_delete_tracked(self):
utils_lib.write_file(DELETED_TRACKED_FP, contents=DELETED_TRACKED_FP_CONTENTS)
utils_lib.git(
'add',
DELETED_TRACKED_FP,)
os.remove(DELETED_TRACKED_FP)
# status_file() should not raise KeyError(513)
self.curr_b.status_file(DELETED_TRACKED_FP)


class TestFileUntrack(TestFile):

Expand Down

0 comments on commit b12843f

Please sign in to comment.