-
-
Notifications
You must be signed in to change notification settings - Fork 803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If abbreviating git dir, display correct path on a bare repo #797
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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
prompt
with$GitPromptScriptBlock
Line 31 in b0cbffb
$GitPromptScriptBlock = { $GitPromptScriptBlock
builds the actual prompt mostly by expanding strings defined in$global:GitPromptSettings
Line 225 in b0cbffb
class PoshGitPromptSettings { - Git status comes into the prompt from
Write-GitStatus
viaWrite-VcsStatus
(added to support posh-hg long ago)Line 202 in b0cbffb
function Write-GitStatus {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for the walk-through!
fb69b09
to
8651bc6
Compare
No description provided.