changeset 314:fb74133d2025

Issue 14: NPE for merged dirstate and a file missed in dirstate's first parent
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 27 Sep 2011 06:34:54 +0200
parents c1e3c18fd2f2
children 8952f89be195
files src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Tue Sep 27 05:57:30 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Tue Sep 27 06:34:54 2011 +0200
@@ -272,7 +272,11 @@
 				// check actual content to avoid false modified files
 				HgDataFile df = repo.getFileNode(fname);
 				Nodeid rev = getDirstateParentManifest().nodeid(fname);
-				if (!areTheSame(f, df, rev)) {
+				// rev might be null here if fname comes to dirstate as a result of a merge operation
+				// where one of the parents (first parent) had no fname file, but second parent had.
+				// E.g. fork revision 3, revision 4 gets .hgtags, few modifications and merge(3,12)
+				// see Issue 14 for details
+				if (rev == null || !areTheSame(f, df, rev)) {
 					inspector.modified(df.getPath());
 				} else {
 					inspector.clean(df.getPath());