Skip to content

Commit bf1e28e

Browse files
bwijengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d2172ef commit bf1e28e

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

builtin/rebase.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,12 +1968,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
19681968
state_dir_path("autostash", &options);
19691969
struct child_process stash = CHILD_PROCESS_INIT;
19701970
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);
19771971

19781972
argv_array_pushl(&stash.args,
19791973
"stash", "create", "autostash", NULL);
@@ -1994,17 +1988,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
19941988
options.state_dir);
19951989
write_file(autostash, "%s", oid_to_hex(&oid));
19961990
printf(_("Created autostash: %s\n"), buf.buf);
1997-
if (reset_head(&head->object.oid, "reset --hard",
1991+
if (reset_head(NULL, "reset --hard",
19981992
NULL, RESET_HEAD_HARD, NULL, NULL) < 0)
19991993
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');
20081994

20091995
if (discard_index(the_repository->index) < 0 ||
20101996
repo_read_index(the_repository) < 0)

t/t3420-rebase-autostash.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ test_expect_success setup '
3737
create_expected_success_am () {
3838
cat >expected <<-EOF
3939
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
40-
HEAD is now at $(git rev-parse --short feature-branch) third commit
4140
First, rewinding head to replay your work on top of it...
4241
Applying: second commit
4342
Applying: third commit
@@ -48,7 +47,6 @@ create_expected_success_am () {
4847
create_expected_success_interactive () {
4948
q_to_cr >expected <<-EOF
5049
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
51-
HEAD is now at $(git rev-parse --short feature-branch) third commit
5250
Applied autostash.
5351
Successfully rebased and updated refs/heads/rebased-feature-branch.
5452
EOF
@@ -57,7 +55,6 @@ create_expected_success_interactive () {
5755
create_expected_failure_am () {
5856
cat >expected <<-EOF
5957
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
60-
HEAD is now at $(git rev-parse --short feature-branch) third commit
6158
First, rewinding head to replay your work on top of it...
6259
Applying: second commit
6360
Applying: third commit
@@ -70,7 +67,6 @@ create_expected_failure_am () {
7067
create_expected_failure_interactive () {
7168
cat >expected <<-EOF
7269
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
73-
HEAD is now at $(git rev-parse --short feature-branch) third commit
7470
Applying autostash resulted in conflicts.
7571
Your changes are safe in the stash.
7672
You can run "git stash pop" or "git stash drop" at any time.

0 commit comments

Comments
 (0)