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>
This commit is contained in:
parent
b7099a06e8
commit
1ca38f8586
@ -338,13 +338,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
|
|||||||
int err = reset_index(sha1, reset_type, quiet);
|
int err = reset_index(sha1, reset_type, quiet);
|
||||||
if (reset_type == KEEP && !err)
|
if (reset_type == KEEP && !err)
|
||||||
err = reset_index(sha1, MIXED, quiet);
|
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)
|
if (err)
|
||||||
die(_("Could not reset index file to revision '%s'."), rev);
|
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,
|
/* Any resets update HEAD to the head being switched to,
|
||||||
|
Loading…
Reference in New Issue
Block a user