From f7084948207e6248e09a8fd3a58f527cebf523d1 Mon Sep 17 00:00:00 2001 From: David LAURENT Date: Wed, 1 Feb 2017 16:44:40 +0100 Subject: [PATCH 1/2] Fix to work with windows --- lib/git/branch_shortcuts.sh | 2 +- lib/git/status_shortcuts.rb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/git/branch_shortcuts.sh b/lib/git/branch_shortcuts.sh index 25ee7f0..99c543c 100644 --- a/lib/git/branch_shortcuts.sh +++ b/lib/git/branch_shortcuts.sh @@ -22,7 +22,7 @@ function _scmb_git_branch_shortcuts { # Use ruby to inject numbers into ls output ruby -e "$( cat < 9 && i < 9 ? " " : " ") diff --git a/lib/git/status_shortcuts.rb b/lib/git/status_shortcuts.rb index e121b8b..6fdc5f5 100644 --- a/lib/git/status_shortcuts.rb +++ b/lib/git/status_shortcuts.rb @@ -20,17 +20,17 @@ # # groups => 1: staged, 2: unmerged, 3: unstaged, 4: untracked # -------------------------------------------------------------------- -@project_root = File.exist?(".git") ? Dir.pwd : `\git rev-parse --show-toplevel 2> /dev/null`.strip +@project_root = File.exist?(".git") ? Dir.pwd : `\git rev-parse --show-toplevel`.strip -@git_status = `\git status --porcelain -b 2> /dev/null` +@git_status = `\git status --porcelain` git_status_lines = @git_status.split("\n") -git_branch = git_status_lines[0] -@branch = git_branch[/^## (?:Initial commit on )?([^ \.]+)/, 1] -@ahead = git_branch[/\[ahead ?(\d+).*\]/, 1] -@behind = git_branch[/\[.*behind ?(\d+)\]/, 1] +git_branch = `\git branch -v` #git_status_lines[0] +@branch = git_branch[/^\* (?:Initial commit on )?([^ \.]+)/, 1] +@ahead = git_branch[/^\*.*\[ahead ?(\d+).*\]/, 1] +@behind = git_branch[/^\*.*\[.*behind ?(\d+)\]/, 1] -@changes = git_status_lines[1..-1] +@changes = git_status_lines[0..-1] # Exit if too many changes exit if @changes.size > ENV["gs_max_changes"].to_i From 7ceed4798df8a7f34638ac9245bd567496db122e Mon Sep 17 00:00:00 2001 From: David LAURENT Date: Wed, 1 Feb 2017 16:48:55 +0100 Subject: [PATCH 2/2] update readme --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 28e9643..435493c 100644 --- a/README.markdown +++ b/README.markdown @@ -1,5 +1,6 @@ # Now looking for help with maintainance. +## /!\ this version contain a fix to works with windows! ## Please post an issue if you would like to help out. --- @@ -407,4 +408,3 @@ project into an [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) for SCMs. ***Enjoy!*** -