Commit Diff


commit - 6d15dc69f06b84b429b255763d5f75e9f22869a7
commit + 4ba5cca9fcd43c92643d303d9fade96556bfbe00
blob - e7055fd5e6b3d6a39a016774c3c5ed30c1ca88b1
blob + f9a63056f68c10fe8374e38153081755932c1e97
--- lib/worktree.c
+++ lib/worktree.c
@@ -5022,6 +5022,18 @@ append_ct_diff(struct got_commitable *ct, int *diff_he
 	char *id_str = NULL;
 
 	memset(&sb, 0, sizeof(sb));
+
+	if (diff_staged) {
+		if (ct->staged_status != GOT_STATUS_MODIFY &&
+		    ct->staged_status != GOT_STATUS_ADD &&
+		    ct->staged_status != GOT_STATUS_DELETE)
+			return NULL;
+	} else {
+		if (ct->status != GOT_STATUS_MODIFY &&
+		    ct->status != GOT_STATUS_ADD &&
+		    ct->status != GOT_STATUS_DELETE)
+			return NULL;
+	}
 
 	err = got_opentemp_truncate(f1);
 	if (err)