builtin/rebase.c: Remove pointless message

When doing 'git rebase --autostash <upstream> <master>' with a dirty worktree a 'HEAD is now at ...' message is emitted, which is pointless as it refers to the old active branch which isn't actually moved. This commit removes the 'HEAD is now at...' message. Signed-off-by: Ben Wijen <ben@wijen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ben Wijen committed Aug 30, 2019 at 17:16 UTC bf1e28e0ad9b1d0d04203ebc43b9008de1969503
2 files changed +1 -19
builtin/rebase.c
+1 -15
@@ -1968,12 +1968,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1968 state_dir_path("autostash", &options);
1969 struct child_process stash = CHILD_PROCESS_INIT;
1970 struct object_id oid;
1971 - struct object_id head_oid;
1972 - struct commit *head;
1973 -
1974 - if (get_oid("HEAD", &head_oid))
1975 - die(_("could not determine HEAD revision"));
1976 - head = lookup_commit_reference(the_repository, &head_oid);
1971
1972 argv_array_pushl(&stash.args,
1973 "stash", "create", "autostash", NULL);
@@ -1994,17 +1988,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1988 options.state_dir);
1989 write_file(autostash, "%s", oid_to_hex(&oid));
1990 printf(_("Created autostash: %s\n"), buf.buf);
1997 - if (reset_head(&head->object.oid, "reset --hard",
1991 + if (reset_head(NULL, "reset --hard",
1992 NULL, RESET_HEAD_HARD, NULL, NULL) < 0)
1993 die(_("could not reset --hard"));
2000 - printf(_("HEAD is now at %s"),
2001 - find_unique_abbrev(&head->object.oid,
2002 - DEFAULT_ABBREV));
2003 - strbuf_reset(&buf);
2004 - pp_commit_easy(CMIT_FMT_ONELINE, head, &buf);
2005 - if (buf.len > 0)
2006 - printf(" %s", buf.buf);
2007 - putchar('\n');
1994
1995 if (discard_index(the_repository->index) < 0 ||
1996 repo_read_index(the_repository) < 0)
t/t3420-rebase-autostash.sh
-4
@@ -37,7 +37,6 @@ test_expect_success setup '
37 create_expected_success_am () {
38 cat >expected <<-EOF
39 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
40 - HEAD is now at $(git rev-parse --short feature-branch) third commit
40 First, rewinding head to replay your work on top of it...
41 Applying: second commit
42 Applying: third commit
@@ -48,7 +47,6 @@ create_expected_success_am () {
47 create_expected_success_interactive () {
48 q_to_cr >expected <<-EOF
49 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
51 - HEAD is now at $(git rev-parse --short feature-branch) third commit
50 Applied autostash.
51 Successfully rebased and updated refs/heads/rebased-feature-branch.
52 EOF
@@ -57,7 +55,6 @@ create_expected_success_interactive () {
55 create_expected_failure_am () {
56 cat >expected <<-EOF
57 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
60 - HEAD is now at $(git rev-parse --short feature-branch) third commit
58 First, rewinding head to replay your work on top of it...
59 Applying: second commit
60 Applying: third commit
@@ -70,7 +67,6 @@ create_expected_failure_am () {
67 create_expected_failure_interactive () {
68 cat >expected <<-EOF
69 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
73 - HEAD is now at $(git rev-parse --short feature-branch) third commit
70 Applying autostash resulted in conflicts.
71 Your changes are safe in the stash.
72 You can run "git stash pop" or "git stash drop" at any time.