[PATCH] Fix stale git status
- From: Peter Tyser <ptyser gmail com>
- To: meld-list gnome org
- Subject: [PATCH] Fix stale git status
- Date: Mon, 5 Apr 2010 22:42:05 -0500
Recent commit 84524f7f2be4722f206e77e3d8fc8acb25de7fea replaced the use
of "git status" with the lower-level "git diff-index". However, when
using "git diff-index" we need to explicitly update the index prior
to running "git diff-index". Previously, "git status" would
automatically update the index prior to diffing.
If the index is not explicitly updated, meld reports incorrect
file status in certain scenarios. For example, running:
- sed -i 's/firefox/chrome/' GNUMakefile
- git diff (update git's index)
- sed -i 's/chrome/firefox/' GNUMakefile (git's index is now out of date)
- bin/meld ./
Meld will then show GNUMakefile as being modified even though its contents
are actually unchanged.
Calling "git update-index --refresh" prior to "git diff-index" resolves
the previous stale status issue.
Signed-off-by: Peter Tyser <ptyser gmail com>
---
Junio Hamano gives a good explanation at
http://comments.gmane.org/gmane.comp.version-control.git/141698
Sorry for not catching this in the original commit.
Best,
Peter
meld/vc/git.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/meld/vc/git.py b/meld/vc/git.py
index 6fafa16..2d4bd74 100644
--- a/meld/vc/git.py
+++ b/meld/vc/git.py
@@ -74,6 +74,9 @@ class Vc(_vc.CachedVc):
def _lookup_tree_cache(self, rootdir):
while 1:
try:
+ # Update the index before getting status, otherwise we could
+ # be reading stale status information
+ os.system("git update-index --refresh")
proc = _vc.popen([self.CMD, "diff-index", "--name-status", \
"HEAD", "./"], cwd=self.location)
entries = proc.read().split("\n")[:-1]
--
1.6.2-rc2.GIT
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]