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

Re: [PATCH v2] git-prompt: stop manually parsing HEAD with unknown ref formats

From
Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Date
Jan 4, 2024, 11:51 UTC
Message-ID
<ZZabqfPDcA1jtmZS@ugly>
In-Reply-To
<ef4e36a5a40c369da138242a8fdc9e12a846613b.1704356313.git.ps@pks.im>
On Thu, Jan 04, 2024 at 09:21:53AM +0100, Patrick Steinhardt wrote:
Show 10 quoted lines
>--- a/contrib/completion/git-prompt.sh
>+++ b/contrib/completion/git-prompt.sh
>@@ -408,7 +408,7 @@ __git_ps1 ()
> 
> 	local repo_info rev_parse_exit_code
> 	repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
>-		--is-bare-repository --is-inside-work-tree \
>+		--is-bare-repository --is-inside-work-tree --show-ref-format \
> 		--short HEAD 2>/dev/null)"
>

that makes me wonder whether adding support for `--symbolic-ref HEAD` here would not be the cleaner solution? and why stop there, and not add a few more ps1 would need, like --upstream and --sequencer-state? (though arguably, this overloading of `rev-parse` should be deprecated in favor of a new generalized `query` command, maybe even unified with `var`.)

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 6 of 7 in “git-prompt: stop manually parsing HEAD”
  1. git-prompt: stop manually parsing HEADPatrick Steinhardt, Nov 24, 2023
  2. Eric SunshineNov 24, 2023
  3. SZEDER GáborNov 24, 2023
  4. Patrick SteinhardtDec 1, 2023
  5. git-prompt: stop manually parsing HEAD with unknown ref formatsPatrick Steinhardt, Jan 4, 2024
  6. Oswald BuddenhagenJan 4, 2024
  7. Patrick SteinhardtJan 4, 2024

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.