# HG changeset patch # User Augie Fackler # Date 2020-09-07 21:12:29 # Node ID c675295696439c1037feea93119b43151927ba54 # Parent 6739ef7c5fcffab62e5cd59c200ddc97a8b42204 git: fix up dirstate use of index This was super-broken before, and somehow none of the existing attempts to use this code tripped on the defects here. Sigh. Differential Revision: https://phab.mercurial-scm.org/D8996 diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py --- a/hgext/git/dirstate.py +++ b/hgext/git/dirstate.py @@ -276,13 +276,22 @@ class gitdirstate(object): pass def add(self, f): - self.git.index.add(pycompat.fsdecode(f)) + index = self.git.index + index.read() + index.add(pycompat.fsdecode(f)) + index.write() def drop(self, f): - self.git.index.remove(pycompat.fsdecode(f)) + index = self.git.index + index.read() + index.remove(pycompat.fsdecode(f)) + index.write() def remove(self, f): - self.git.index.remove(pycompat.fsdecode(f)) + index = self.git.index + index.read() + index.remove(pycompat.fsdecode(f)) + index.write() def copied(self, path): # TODO: track copies?