[PATCH] builtin-reset.c: Extend hard reset error message when using paths.

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

 



Users who invoke 'git reset --hard <paths>' are probably trying to
update paths in their working directory.  The error message should
point them in the direction of git-checkout(1).

Signed-off-by: Tim Retout <tim@xxxxxxxxxxxx>
---
 builtin-reset.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/builtin-reset.c b/builtin-reset.c
index c0cb915..885ca9a 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -257,6 +257,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 	if (i < argc) {
 		if (reset_type == MIXED)
 			warning("--mixed option is deprecated with paths.");
+		else if (reset_type == HARD)
+			die("Cannot do %s reset with paths.\n"
+			    "See git-checkout(1) to update paths in the working tree.",
+					reset_type_names[reset_type]);
 		else if (reset_type != NONE)
 			die("Cannot do %s reset with paths.",
 					reset_type_names[reset_type]);
-- 
1.6.2.2

--
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]