If abbreviating git dir, display correct path on a bare repo#797
If abbreviating git dir, display correct path on a bare repo#797RexTremendae wants to merge 1 commit intodahlbyk:masterfrom
Conversation
dahlbyk
left a comment
There was a problem hiding this comment.
Sorry for the delayed review. Appreciate the contribution!
Thoughts on my comment?
| # Up one level from `.git` | ||
| if ($gitPath) { $gitPath = Split-Path $gitPath -Parent } | ||
| # Up one level from `.git` if inside git directory | ||
| if ($gitPath -and $gitPath.EndsWith(".git")) { $gitPath = Split-Path $gitPath -Parent } |
There was a problem hiding this comment.
There was a problem hiding this comment.
Right you are...
Thinking a little bit more about it, I think my solution is a little bit over-simplified. Maybe the correct solution would be to base the logic on the same information that casues the "BARE:" label to appear? However, I cannot see that information being stored anywhere other than in the branch specifier after the function Get-GitBranch has completed.
I really don't have the full overview of how all the functions work together in the code base; maybe it is possible to receive this information somehow?
There was a problem hiding this comment.
Thinking a little bit more about it, I think my solution is a little bit over-simplified. Maybe the correct solution would be to base the logic on the same information that casues the "BARE:" label to appear? However, I cannot see that information being stored anywhere other than in the branch specifier after the function
Get-GitBranchhas completed.
You're right, we only store BARE/GIT_DIR in the branch name at the moment. We could definitely tack those onto $GitStatus with a bit of refactoring, but we'd also have to rearrange quite a bit to make $GitStatus available at the point where we're calling Get-PromptPath.
Let's just check for a .git exact match for now. If we get feedback that it's insufficient, we can revisit.
I really don't have the full overview of how all the functions work together in the code base; maybe it is possible to receive this information somehow?
I don't know that we have an overview written up anywhere, but that would definitely be good to have. In short:
- Unless it has already been customized, we replace
promptwith$GitPromptScriptBlockLine 31 in b0cbffb
$GitPromptScriptBlockbuilds the actual prompt mostly by expanding strings defined in$global:GitPromptSettingsLine 225 in b0cbffb
- Git status comes into the prompt from
Write-GitStatusviaWrite-VcsStatus(added to support posh-hg long ago)Line 202 in b0cbffb
There was a problem hiding this comment.
Great, thanks for the walk-through!
fb69b09 to
8651bc6
Compare



No description provided.