Skip to content

Commit

Permalink
reset: avoid redundant error message
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Martin von Zweigbergk authored and Junio C Hamano committed Jan 15, 2013
1 parent b7099a0 commit 1ca38f8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions builtin/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
int err = reset_index(sha1, reset_type, quiet);
if (reset_type == KEEP && !err)
err = reset_index(sha1, MIXED, quiet);
if (!err &&
(write_cache(newfd, active_cache, active_nr) ||
commit_locked_index(lock))) {
err = error(_("Could not write new index file."));
}
if (err)
die(_("Could not reset index file to revision '%s'."), rev);
if (write_cache(newfd, active_cache, active_nr) ||
commit_locked_index(lock))
die(_("Could not write new index file."));
}

/* Any resets update HEAD to the head being switched to,
Expand Down

0 comments on commit 1ca38f8

Please sign in to comment.