Skip to content

Compatibility with OSX #1

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

undecided
Copy link

Hi,

Thanks for writing this tool and making it public, saved me shaving one more yak!

Just a small tweak, since on the version of grep I have on osx (might be via homebrew) the -P option is not available. My research indicates that -E should be available on most versions of grep - if not, or if I've missed an edge case, please reject the request as I'd rather not mess up this very useful script for others.

Thanks again,
Matthew

@ascii-soup
Copy link
Owner

No problem! I'll test it out quickly on my machine and merge in a bit. Thanks for the PR.

@ascii-soup
Copy link
Owner

Turns out that it returns very different results when using this change; will have a quick look.

@@ -4,7 +4,7 @@ branch_limit = 10 if branch_limit == 0

show_current_branch = (`git config --get recent.showcurrent 2>/dev/null`.to_i == 1) ? true : false
current_branch = `git rev-parse --abbrev-ref HEAD 2>/dev/null`.chomp
all_branches = `git reflog 2>/dev/null | \\grep -Pio "moving from ([^\\s]+)" | \\awk '{ print $3 }' | \\grep -Piv "[0-9a-f]{40}"`.split("\n")
all_branches = `git reflog 2>/dev/null | \\grep -Eio "moving from ([^\\s]+)$" | \\awk '{ print $3 }' | \\grep -Eiv "[0-9a-f]{40}"`.split("\n")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ([^\\s]+)$ here needs to change to ([^[:space:]]+) - at least that makes it work as it did before.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants