Mercurial > hg-stable
changeset 45434:d4cf80341589
git: fix index handling of removed files during commit (issue6398)
Other changes in this series also changed the behavior here in
positive ways, but this was the final step that actually fixed things.
Differential Revision: https://phab.mercurial-scm.org/D8999
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Mon, 07 Sep 2020 17:16:16 -0400 |
parents | 601e3658216d |
children | 0a57ef4b3bdb |
files | hgext/git/dirstate.py tests/test-git-interop.t |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/git/dirstate.py Mon Sep 07 17:14:59 2020 -0400 +++ b/hgext/git/dirstate.py Mon Sep 07 17:16:16 2020 -0400 @@ -303,8 +303,10 @@ def drop(self, f): index = self.git.index index.read() - index.remove(pycompat.fsdecode(f)) - index.write() + fs = pycompat.fsdecode(f) + if fs in index: + index.remove(fs) + index.write() def remove(self, f): index = self.git.index
--- a/tests/test-git-interop.t Mon Sep 07 17:14:59 2020 -0400 +++ b/tests/test-git-interop.t Mon Sep 07 17:16:16 2020 -0400 @@ -270,3 +270,8 @@ +++ b/beta Mon Jan 01 00:00:11 2007 +0000 @@ -0,0 +1,1 @@ +beta + + +Deleting files should also work (this was issue6398) + $ hg rm beta + $ hg ci -m 'remove beta'