Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
95ed7da0
Commit
95ed7da0
authored
May 09, 2015
by
Pablo Santiago Blum de Aguiar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refact(scorphish): show number of commits ahead for all remotes
parent
31b0f12f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
themes/scorphish/fish_prompt.fish
themes/scorphish/fish_prompt.fish
+15
-18
No files found.
themes/scorphish/fish_prompt.fish
View file @
95ed7da0
...
@@ -28,32 +28,29 @@ function _is_git_dirty
...
@@ -28,32 +28,29 @@ function _is_git_dirty
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
end
function _git_ahead_count -a branch_name
function _git_ahead_count -a
remote -a
branch_name
echo (command git log
origin
/$branch_name..HEAD ^/dev/null | \
echo (command git log
$remote
/$branch_name..HEAD ^/dev/null | \
grep '^commit' | wc -l | tr -d ' ')
grep '^commit' | wc -l | tr -d ' ')
end
end
function _git_dirty_remotes -a ahead_color
function _git_dirty_remotes -a
remote_color -a
ahead_color
set current_branch (git rev-parse --abbrev-ref HEAD)
set current_branch (git rev-parse --abbrev-ref HEAD)
set current_ref (git rev-parse HEAD)
set current_ref (git rev-parse HEAD)
set -l git_ahead_count (_git_ahead_count $current_branch
)
for remote in (git remote
)
if [ $git_ahead_count != 0 ]
set -l git_ahead_count (_git_ahead_count $remote $current_branch)
set ahead_count "$ahead_color+$git_ahead_count$normal"
end
for remote in (git remote)
set remote_branch "refs/remotes/$remote/$current_branch"
# if test $remote != 'origin'
set remote_ref (git for-each-ref --format='%(objectname)' $remote_branch)
set remote_ref_branch "refs/remotes/$remote/$current_branch"
if test "$remote_ref" != ''
set remote_ref (git for-each-ref --format='%(objectname)' $remote_ref_branch)
if test "$remote_ref" != $current_ref
if test "$remote_ref" != ''
echo -n "$remote_color!"
if test "$remote_ref" != $current_ref
if [ $git_ahead_count != 0 ]
echo !
echo -n "$ahead_color+$git_ahead_count$normal"
echo "$ahead_count"
end
end
end
# end
end
end
end
end
end
end
...
@@ -90,7 +87,7 @@ function fish_prompt
...
@@ -90,7 +87,7 @@ function fish_prompt
if [ (_git_branch_name) ]
if [ (_git_branch_name) ]
set -l git_branch (_git_branch_name)
set -l git_branch (_git_branch_name)
set dirty_remotes (_git_dirty_remotes $orange)
set dirty_remotes (_git_dirty_remotes $
red $
orange)
if [ (_is_git_dirty) ]
if [ (_is_git_dirty) ]
echo -n -s $gray '‹' $yellow $git_branch $red '*' $dirty_remotes $gray '›' $normal
echo -n -s $gray '‹' $yellow $git_branch $red '*' $dirty_remotes $gray '›' $normal
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment