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

Re: [PATCH] completion: fix PS1 display during a merge on detached HEAD

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 16, 2009, 19:59 UTC
Message-ID
<20090516195947.GI30527@spearce.org>
In-Reply-To
<7vzldcnawx.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> If your merge stops in a conflict while on a detached HEAD, recent
> completion code fails to show anything.  This was because various cases
> added to support the operation-in-progress markers (e.g. REBASE, MERGING)
> forgot that they need to set the variable "b" to something for the result
> they computed to be displayed at all.
> 
> Probably not many people make trial merges on a detached HEAD (which is
> tremendously useful feature of git, by the way), and that may be why this
> was not noticed for a long time.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Yay, thanks Junio.
Trivially-Acked-By: Shawn O. Pearce <spearce@spearce.org>
:-)
Show 18 quoted lines
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index ad26b7c..4462ef0 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -99,10 +99,10 @@ __git_ps1 ()
>  		elif [ -d "$g/rebase-merge" ]; then
>  			r="|REBASE-m"
>  			b="$(cat "$g/rebase-merge/head-name")"
> -		elif [ -f "$g/MERGE_HEAD" ]; then
> -			r="|MERGING"
> -			b="$(git symbolic-ref HEAD 2>/dev/null)"
>  		else
> +			if [ -f "$g/MERGE_HEAD" ]; then
> +				r="|MERGING"
> +			fi
>  			if [ -f "$g/BISECT_LOG" ]; then
>  				r="|BISECTING"
>  			fi
-- 
Shawn.
Previous: Junio C Hamano
Message 2 of 2 in “completion: fix PS1 display during a merge on detached HEAD”
  1. completion: fix PS1 display during a merge on detached HEADJunio C Hamano, May 16, 2009
  2. Shawn O. PearceMay 16, 2009

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.