Thread (7 messages) 7 messages, 4 authors, 2024-01-04

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

From: Oswald Buddenhagen <hidden>
Date: 2024-01-04 11:51:13

On Thu, Jan 04, 2024 at 09:21:53AM +0100, Patrick Steinhardt wrote:
quoted hunk ↗ jump to hunk
--- 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`.)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help