# HG changeset patch # User Augie Fackler # Date 1599513149 14400 # 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 -r 6739ef7c5fcf -r c67529569643 hgext/git/dirstate.py --- a/hgext/git/dirstate.py Mon Sep 07 16:27:12 2020 -0400 +++ b/hgext/git/dirstate.py Mon Sep 07 17:12:29 2020 -0400 @@ -276,13 +276,22 @@ 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?