summaryrefslogtreecommitdiff
path: root/builtin/reset.c
diff options
context:
space:
mode:
authorMartin von Zweigbergk <martinvonz@gmail.com>2013-01-15 05:47:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-15 17:38:07 (GMT)
commit1ca38f85860b33ddc79b1494baf29aecde8616cd (patch)
treee006fb78cad200db0da68a3bebc4b4c6445a6788 /builtin/reset.c
parentb7099a06e8ffe61a06d3e32632e832e59f23bd4d (diff)
downloadgit-1ca38f85860b33ddc79b1494baf29aecde8616cd.zip
git-1ca38f85860b33ddc79b1494baf29aecde8616cd.tar.gz
git-1ca38f85860b33ddc79b1494baf29aecde8616cd.tar.bz2
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>
Diffstat (limited to 'builtin/reset.c')
-rw-r--r--builtin/reset.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index 7c440ad..97fa9f7 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -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,