File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -261,9 +261,17 @@ static int is_index_unchanged(void)
261
261
return error (_ ("Could not resolve HEAD commit\n" ));
262
262
263
263
head_commit = lookup_commit (head_sha1 );
264
- if (!head_commit || parse_commit (head_commit ))
265
- return error (_ ("could not parse commit %s\n" ),
266
- sha1_to_hex (head_commit -> object .sha1 ));
264
+
265
+ /*
266
+ * If head_commit is NULL, check_commit, called from
267
+ * lookup_commit, would have indicated that head_commit is not
268
+ * a commit object already. parse_commit() will return failure
269
+ * without further complaints in such a case. Otherwise, if
270
+ * the commit is invalid, parse_commit() will complain. So
271
+ * there is nothing for us to say here. Just return failure.
272
+ */
273
+ if (parse_commit (head_commit ))
274
+ return -1 ;
267
275
268
276
if (!active_cache_tree )
269
277
active_cache_tree = cache_tree ();
You can’t perform that action at this time.
0 commit comments