Skip to content
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

Added variables to make customizing the prompt easier. #277

Merged
merged 4 commits into from May 6, 2016

Conversation

Projects
None yet
2 participants
@9999years
Copy link
Contributor

9999years commented Apr 21, 2016

Added the following variables to $global:GitPromptSettings to make customizing the prompt easier.

  • AddedText, default '+'
    
  • ModifiedText, default '~'
    
  • RemovedText, default '-'
    
  • ConflictedText, default '!'
    

It may be noteworthy that LocalWorkingStatusSymbol and ConflictedText will have the same content by default (“!”), as will LocalStagedStatusSymbol and ModifiedText (“~”)—this could lead to confusion. However, I didn’t want to delete existing variables, so I left them alone for the time being.

I also realigned the indenting on the block of stash-related variables within GitPromptSettings.

Added variables to make customizing the prompt easier.
Added the following variables to $global:GitPromptSettings to make
customizing the prompt easier.
    AddedText, default '+'
    ModifiedText, default '~'
    RemovedText, default '-'
    ConflictedText, default '!'
@dahlbyk

This comment has been minimized.

Copy link
Owner

dahlbyk commented May 4, 2016

Thanks for this! Two suggestions:

  1. Add a "File" prefix to these properties to hopefully clear up some of the shared symbol confusion?
  2. Rather than concatenate strings ((" " + $s.AddedText + "$($status.Index.Added.Count)"), it's more idiomatic to use string expansion: (" $($s.AddedText)$($status.Index.Added.Count)").

9999years added some commits May 4, 2016

Changed variables, string concat to expansion.
Added "File" prefix to (now) FileAddedText, FileModifiedText,
FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol
and ConflictedText had the same content by default ("!"), as did
LocalStagedStatusSymbol and ModifiedText ("~").

Changed prompt output of the above variables to use string expansion
rather than concatenation.

Also re-aligned several indentation blocks from 2-space to 4-space
indents. In my opinion, tabs help avoid these issues, but I'll defer to the
lead coder here.

Several lines had nothing but spaces on them, so I removed the spaces
(keeping the empty double line-break).
Changed variables, string concat to expansion.
Added "File" prefix to (now) FileAddedText, FileModifiedText,
FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol
and ConflictedText had the same content by default ("!"), as did
LocalStagedStatusSymbol and ModifiedText ("~").

Changed prompt output of the above variables to use string expansion
rather than concatenation.

Also re-aligned several indentation blocks from 2-space to 4-space
indents. In my opinion, tabs help avoid these issues, but I'll defer to the
lead coder here.

Several lines had nothing but spaces on them, so I removed the spaces
(keeping the empty double line-break).
@9999years

This comment has been minimized.

Copy link
Contributor Author

9999years commented May 5, 2016

Okay, fixed that stuff. Check out commit 2e06383.

@dahlbyk

This comment has been minimized.

Copy link
Owner

dahlbyk commented May 5, 2016

Looks great! Would you mind rebasing this branch on latest master and --force pushing back to this PR branch? Some merge weirdness going on here.

@9999years

This comment has been minimized.

Copy link
Contributor Author

9999years commented May 5, 2016

Okay, I believe I rebased it correctly, but check to make sure.

@dahlbyk

This comment has been minimized.

Copy link
Owner

dahlbyk commented May 5, 2016

It changed, but still weird:

*   f3b3670 Merge remote-tracking branch 'refs/remotes/origin/promptVariables' into promptVariables
|\  
| * 2e06383 Changed variables, string concat to expansion. Added "File" prefix to (now) FileAddedText, FileModifiedText, FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol and ConflictedText had the same content by default ("!"), as did LocalStagedStatusSymbol and ModifiedText ("~").
* | 59069a5 Changed variables, string concat to expansion. Added "File" prefix to (now) FileAddedText, FileModifiedText, FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol and ConflictedText had the same content by default ("!"), as did LocalStagedStatusSymbol and ModifiedText ("~").
* | 6c500d0 Changed variables, string concat to expansion. Added "File" prefix to (now) FileAddedText, FileModifiedText, FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol and ConflictedText had the same content by default ("!"), as did LocalStagedStatusSymbol and ModifiedText ("~").
|/  
*   c916d10 Merge branch 'promptVariables' of https://github.com/9999years/posh-git
|\  
| * 85a59b5 Added variables to make customizing the prompt easier. Added the following variables to $global:GitPromptSettings to make customizing the prompt easier.     AddedText, default '+'     ModifiedText, default '~'     RemovedText, default '-'     ConflictedText, default '!'
* |   6bd5770 Merge pull request #255 from theaquamarine/keysfix
| |
| | // Back to master

You should be able to do something like this:

# Make sure you have latest
git checkout master
git pull https://github.com/dahlbyk/posh-git.git master

# Checkout promptVariables and rebase it onto master
git rebase master promptVariables

git push -f origin promptVariables

@9999years 9999years force-pushed the 9999years:promptVariables branch from 669ec5e to 59069a5 May 5, 2016

@9999years

This comment has been minimized.

Copy link
Contributor Author

9999years commented May 5, 2016

posh-git ⟬promptVariables ≡⟭ ✭ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
posh-git ⟬master ≡⟭ ✭ git pull https://github.com/dahlbyk/posh-git.git master
From https://github.com/dahlbyk/posh-git
 * branch            master     -> FETCH_HEAD
Already up-to-date.
posh-git ⟬master ≡⟭ ✭ git rebase master promptVariables
Current branch promptVariables is up to date.
posh-git ⟬promptVariables ≡⟭ ✭ git push -f origin promptVariables
Everything up-to-date
* 59069a5 Changed variables, string concat to expansion. Added "File" prefix to (now) FileAddedText, FileModifiedText, FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol and ConflictedText had the same content by default ("!"), as did LocalStagedStatusSymbol and ModifiedText ("~").
* 6c500d0 Changed variables, string concat to expansion. Added "File" prefix to (now) FileAddedText, FileModifiedText, FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol and ConflictedText had the same content by default ("!"), as did LocalStagedStatusSymbol and ModifiedText ("~").
*   c916d10 Merge branch 'promptVariables' of https://github.com/9999years/posh-git
|\
| * 85a59b5 Added variables to make customizing the prompt easier. Added the following variables to $global:GitPromptSettings to make customizing the prompt easier.     AddedText, default '+'     ModifiedText, default '~'     RemovedText, default '-'     ConflictedText, default '!'
* |   6bd5770 Merge pull request #255 from theaquamarine/keysfix
|\ \

Looks somewhat cleaner, is this what you were going for?

@dahlbyk

This comment has been minimized.

Copy link
Owner

dahlbyk commented May 6, 2016

Weird...I would expect a linear history:

* 95f6b34 Changed variables, string concat to expansion. Added "File" prefix to (now) FileAddedText, FileModifiedText, FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol and ConflictedText had the same content by default ("!"), as did LocalStagedStatusSymbol and ModifiedText ("~").
* 5321181 Changed variables, string concat to expansion. Added "File" prefix to (now) FileAddedText, FileModifiedText, FileRemovedText, and FileConflictedText--before, LocalWorkingStatusSymbol and ConflictedText had the same content by default ("!"), as did LocalStagedStatusSymbol and ModifiedText ("~").
* ca0d6b4 Added variables to make customizing the prompt easier. Added the following variables to $global:GitPromptSettings to make customizing the prompt easier.     AddedText, default '+'     ModifiedText, default '~'     RemovedText, default '-'     ConflictedText, default '!'

(And really, you can squash the second "Changed variables" commit into the first one.)

I wonder if part of your branch has been merged into your local master (git rev-parse master)? Try git branch -f master 6bd5770bc3d970927886232d82c518db798af247?

@dahlbyk dahlbyk merged commit 2faae5d into dahlbyk:master May 6, 2016

@dahlbyk

This comment has been minimized.

Copy link
Owner

dahlbyk commented May 6, 2016

Actually, this is fine. Thanks for the contribution!

@9999years 9999years deleted the 9999years:promptVariables branch Mar 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.