git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Retout <tim@retout.co.uk>
To: Git Mailing List <git@vger.kernel.org>
Cc: Tim Retout <tim@retout.co.uk>
Subject: [PATCH] builtin-reset.c: Extend hard reset error message when using paths.
Date: Mon, 13 Apr 2009 19:14:04 +0100	[thread overview]
Message-ID: <1239646444-11653-1-git-send-email-tim@retout.co.uk> (raw)

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@retout.co.uk>
---
 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

             reply	other threads:[~2009-04-13 18:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-13 18:14 Tim Retout [this message]
2009-04-13 19:51 ` [PATCH] builtin-reset.c: Extend hard reset error message when using paths Junio C Hamano
2009-04-13 21:19   ` Tim Retout
2009-04-14  5:35   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1239646444-11653-1-git-send-email-tim@retout.co.uk \
    --to=tim@retout.co.uk \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).