##// END OF EJS Templates
subrepo: fix git status false positive (issue3109)...
Eric Roshan Eisner -
r15531:0810ccc5 stable
parent child Browse files
Show More
@@ -807,6 +807,12 b' class gitsubrepo(abstractsubrepo):'
807 def _gitisbare(self):
807 def _gitisbare(self):
808 return self._gitcommand(['config', '--bool', 'core.bare']) == 'true'
808 return self._gitcommand(['config', '--bool', 'core.bare']) == 'true'
809
809
810 def _gitupdatestat(self):
811 """This must be run before git diff-index.
812 diff-index only looks at changes to file stat;
813 this command looks at file contents and updates the stat."""
814 self._gitcommand(['update-index', '-q', '--refresh'])
815
810 def _gitbranchmap(self):
816 def _gitbranchmap(self):
811 '''returns 2 things:
817 '''returns 2 things:
812 a map from git branch to revision
818 a map from git branch to revision
@@ -876,6 +882,7 b' class gitsubrepo(abstractsubrepo):'
876 # different version checked out
882 # different version checked out
877 return True
883 return True
878 # check for staged changes or modified files; ignore untracked files
884 # check for staged changes or modified files; ignore untracked files
885 self._gitupdatestat()
879 out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
886 out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
880 return code == 1
887 return code == 1
881
888
@@ -983,6 +990,7 b' class gitsubrepo(abstractsubrepo):'
983 source, revision, kind = state
990 source, revision, kind = state
984 self._fetch(source, revision)
991 self._fetch(source, revision)
985 base = self._gitcommand(['merge-base', revision, self._state[1]])
992 base = self._gitcommand(['merge-base', revision, self._state[1]])
993 self._gitupdatestat()
986 out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
994 out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
987
995
988 def mergefunc():
996 def mergefunc():
@@ -1090,6 +1098,7 b' class gitsubrepo(abstractsubrepo):'
1090 # if the repo is missing, return no results
1098 # if the repo is missing, return no results
1091 return [], [], [], [], [], [], []
1099 return [], [], [], [], [], [], []
1092 modified, added, removed = [], [], []
1100 modified, added, removed = [], [], []
1101 self._gitupdatestat()
1093 if rev2:
1102 if rev2:
1094 command = ['diff-tree', rev1, rev2]
1103 command = ['diff-tree', rev1, rev2]
1095 else:
1104 else:
@@ -361,6 +361,15 b" Don't crash if the .hgsubstate entry is "
361 $ hg update -qC nosubstate
361 $ hg update -qC nosubstate
362 $ ls s
362 $ ls s
363
363
364 issue3109: false positives in git diff-index
365
366 $ hg update -q
367 $ touch -t 200001010000 s/g
368 $ hg status --subrepos
369 $ touch -t 200001010000 s/g
370 $ hg sum | grep commit
371 commit: (clean)
372
364 Check hg update --clean
373 Check hg update --clean
365 $ cd $TESTTMP/ta
374 $ cd $TESTTMP/ta
366 $ echo > s/g
375 $ echo > s/g
General Comments 0
You need to be logged in to leave comments. Login now