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

Re: [PATCH v2 5/6] status: do not depend on rebase reflog messages

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 17, 2013, 17:54 UTC
Message-ID
<7vr4g0ei6n.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1371372316-16059-6-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 16 quoted lines
> diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
> index bf08d4e..739624e 100755
> --- a/t/t7512-status-help.sh
> +++ b/t/t7512-status-help.sh
> @@ -188,10 +188,9 @@ test_expect_success 'status when rebasing -i in edit mode' '
>  	export FAKE_LINES &&
>  	test_when_finished "git rebase --abort" &&
>  	ONTO=$(git rev-parse --short HEAD~2) &&
> -	TGT=$(git rev-parse --short two_rebase_i) &&
>  	git rebase -i HEAD~2 &&
>  	cat >expected <<-EOF &&
> -	# HEAD detached from $TGT
> +	# rebase in progress; onto $ONTO
>  	# You are currently editing a commit while rebasing branch '\''rebase_i_edit'\'' on '\''$ONTO'\''.
>  	#   (use "git commit --amend" to amend the current commit)
>  	#   (use "git rebase --continue" once you are satisfied with your changes)

This hunk (and others that used to use $TGT) shows that the original test was depending too much on the implementation detail (i.e. that rebase/rebase-i internally uses checkout to affect the reflog, making the info shown as "detached from/at" not useful during "rebase"). This step may have started as a workaround against the fallout from 6/6, but I think this is a good change by itself independent of "checkut -" fix, which is the main topic of this series.

Show 12 quoted lines
> diff --git a/wt-status.c b/wt-status.c
> index 2511270..85a00f1 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -1174,7 +1174,10 @@ void wt_status_print(struct wt_status *s)
>  			branch_name += 11;
>  		else if (!strcmp(branch_name, "HEAD")) {
>  			branch_status_color = color(WT_STATUS_NOBRANCH, s);
> -			if (state.detached_from) {
> +			if (state.rebase_in_progress || state.rebase_interactive_in_progress) {
> +				on_what = _("rebase in progress; onto ");
> +				branch_name = state.onto;

The part after "||" is what I missed in the "how about an approach along this line" patch.

Good job.
> +			} else if (state.detached_from) {
>  				unsigned char sha1[20];
>  				branch_name = state.detached_from;
>  				if (!get_sha1("HEAD", sha1) &&
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 7 of 15 in “Fix checkout-dash to work with rebase”
  1. 0/6 Fix checkout-dash to work with rebaseRamkumar Ramachandra, Jun 16, 2013
  2. 1/6 t/checkout-last: checkout - doesn't work after rebaseRamkumar Ramachandra, Jun 16, 2013
  3. 2/6 rebase: prepare to write reflog message for checkoutRamkumar Ramachandra, Jun 16, 2013
  4. 3/6 rebase -i: prepare to write reflog message for checkoutRamkumar Ramachandra, Jun 16, 2013
  5. 4/6 wt-status: remove unused field in grab_1st_switch_cbdataRamkumar Ramachandra, Jun 16, 2013
  6. 5/6 status: do not depend on rebase reflog messagesRamkumar Ramachandra, Jun 16, 2013
  7. Junio C HamanoJun 17, 2013
  8. 6/6 checkout: respect GIT_REFLOG_ACTIONRamkumar Ramachandra, Jun 16, 2013
  9. Junio C HamanoJun 17, 2013
  10. Junio C HamanoJun 17, 2013
  11. Ramkumar RamachandraJun 18, 2013
  12. Ramkumar RamachandraJun 18, 2013
  13. Ramkumar RamachandraJun 18, 2013
  14. Junio C HamanoJun 18, 2013
  15. Ramkumar RamachandraJun 18, 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.