git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Maarten de VriesNext: Jeff King
Message 3 of 9 in “Fwd: Bug report: reset -p HEAD”
  1. Maarten de VriesOct 24, 2013
  2. Maarten de VriesOct 24, 2013
  3. Re* Bug report: reset -p HEADJunio C Hamano, Oct 25, 2013
  4. Jeff KingOct 25, 2013
  5. Martin von ZweigbergkOct 25, 2013
  6. 0/2 reset -p and unborn branchesJeff King, Oct 25, 2013
  7. 1/2 add-interactive: handle unborn branch in patch modeJeff King, Oct 25, 2013
  8. 2/2 reset: pass real rev name to add--interactiveJeff King, Oct 25, 2013
  9. Junio C HamanoOct 25, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.