[PATCH v2 10/19] reset: avoid redundant error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 builtin/reset.c | 8 +++-----
 1 file 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,
-- 
1.8.1.1.454.gce43f05

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]