reset: avoid redundant error message

If writing or committing the new index file fails, we print "Could not write new index file." followed by "Could not reset index file to revision $rev.". The first message seems to imply the second, so print only the first message. Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin von Zweigbergk committed Jan 14, 2013 at 21:47 UTC 1ca38f85860b33ddc79b1494baf29aecde8616cd
1 file changed +3 -5
builtin/reset.c
+3 -5
@@ -338,13 +338,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
338 int err = reset_index(sha1, reset_type, quiet);
339 if (reset_type == KEEP && !err)
340 err = reset_index(sha1, MIXED, quiet);
341 - if (!err &&
342 - (write_cache(newfd, active_cache, active_nr) ||
343 - commit_locked_index(lock))) {
344 - err = error(_("Could not write new index file."));
345 - }
341 if (err)
342 die(_("Could not reset index file to revision '%s'."), rev);
343 + if (write_cache(newfd, active_cache, active_nr) ||
344 + commit_locked_index(lock))
345 + die(_("Could not write new index file."));
346 }
347
348 /* Any resets update HEAD to the head being switched to,