Re* Bug report: reset -p HEAD
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 25, 2013, 03:40 UTC
- Message-ID
- <xmqqvc0mj9wi.fsf_-_@gitster.dls.corp.google.com>
- In-Reply-To
- <CAPWpf+zkA68pzR3qx5xma8BNiONwt5o8iNba0x8fmmiDAWpHuw@mail.gmail.com>
Maarten de Vries <maarten@de-vri.es> writes:
> Some more info: It used to work as intended. Using a bisect shows it > has been broken by commit 166ec2e9.
Thanks.
A knee-jerk change without thinking what side-effect it has for you to try out.
builtin/reset.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/reset.c b/builtin/reset.c index f2f9d55..a3088d9 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -304,7 +304,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix) if (patch_mode) { if (reset_type != NONE) die(_("--patch is incompatible with --{hard,mixed,soft}")); - return run_add_interactive(sha1_to_hex(sha1), "--patch=reset", &pathspec); + return run_add_interactive( + (unborn || strcmp(rev, "HEAD")) + ? sha1_to_hex(sha1) + : "HEAD", "--patch=reset", &pathspec); } /* git reset tree [--] paths... can be used to