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

[git] Alias gsta is broken for git 2.7 #7754

Closed
flohw opened this issue Apr 10, 2019 · 5 comments
Closed

[git] Alias gsta is broken for git 2.7 #7754

flohw opened this issue Apr 10, 2019 · 5 comments

Comments

@flohw
Copy link

flohw commented Apr 10, 2019

Hello there!

I often use gsta alias to stash some modification within a project for later.
After the update this morning, it didn't work anymore.
I think the check on the version number of git is wrong.
I am on git 2.7 wich is considered greater than 2.13 (float number comparisn instead of text) and the alias set is git stash push instead of git stash save.

Why not using only git stash which is cross version compatible ?

Sorry to not be able to provide a PR as I am not that good with zsh tests.

Thaks!

@mcornella
Copy link
Member

This was changed in #7486 because parameters past to just git stash weren't the same. I pushed a patch that should again make your alias use save instead. Thanks for reporting

@flohw
Copy link
Author

flohw commented Apr 10, 2019

Thank you @mcornella, just pulled and works fine.
Thanks for explanation about alias too.

@brainplot
Copy link
Contributor

brainplot commented Apr 10, 2019

@mcornella I think the root of the problem is that you got the comparison terms wrong when you merged the PR. I just realized that. When you use =~ for regex matching, $match contains the whole string, so $match -ge '2.13' will likely perform lexicographic string comparison.
$match[1] contains only what's been captured in the capturing group, resulting in this (after expansion): 2.13 -ge '2.7' and that should work as expected.
I'm pretty sure of this because I tested my solution with hardcoded versions and it worked.
I think this is the proper fix for this issue.

@mcornella
Copy link
Member

mcornella commented Apr 10, 2019

$match is a single-element array, so it's the same $match[1] than $match (you're confusing it with $MATCH). The conditional should be, is version greater or equal than 2.13, which is [[ 2.7 -ge 2.13 ]], which fails because it's true (the number 2.7, arithmetically, is greater than 2.13).

@brainplot
Copy link
Contributor

Yes, you're right, sorry. I sent a PR with a version that doesn't use awk.
Feel free to accept/reject it :)

atsuya pushed a commit to atsuya/oh-my-zsh that referenced this issue Jun 9, 2019
dukegod pushed a commit to dukegod/oh-my-zsh that referenced this issue Jul 16, 2019
chihchun pushed a commit to chihchun/oh-my-zsh that referenced this issue Aug 6, 2019
lewg pushed a commit to lewg/oh-my-zsh that referenced this issue Nov 25, 2019
spiliopoulos pushed a commit to spiliopoulos/zsh-config that referenced this issue Jun 17, 2020
Luxcium added a commit to LuxciumProject/ahmyzsh that referenced this issue Sep 20, 2020
https://github.com/ohmyzsh/ohmyzsh/blob/93c837fec8e9fe61509b9dff9e909e84f7ebe32d/plugins/git/git.plugin.zsh#L1-L293

Copyright (c) 2009-2020 Robby Russell and
[contributors](https://github.com/ohmyzsh/ohmyzsh/contributors)

TAnks to those who have contributed to fix those 20+ issues:

ohmyzsh/ohmyzsh#1790
ohmyzsh/ohmyzsh#3535
ohmyzsh/ohmyzsh#3682
ohmyzsh/ohmyzsh#3962
ohmyzsh/ohmyzsh#3972
ohmyzsh/ohmyzsh#3977
ohmyzsh/ohmyzsh#3991
ohmyzsh/ohmyzsh#4085
ohmyzsh/ohmyzsh#4727
ohmyzsh/ohmyzsh#5130
ohmyzsh/ohmyzsh#5179
ohmyzsh/ohmyzsh#5362
ohmyzsh/ohmyzsh#5442
ohmyzsh/ohmyzsh#6329
ohmyzsh/ohmyzsh#6793
ohmyzsh/ohmyzsh#7682
ohmyzsh/ohmyzsh#7716
ohmyzsh/ohmyzsh#7754
ohmyzsh/ohmyzsh#867
ohmyzsh/ohmyzsh#9103
ohmyzsh/ohmyzsh#9114

and those who help develop
theses aliases and function
whith theses Pull 40+ Requests:

ohmyzsh/ohmyzsh#2790
ohmyzsh/ohmyzsh#3167
ohmyzsh/ohmyzsh#4304
ohmyzsh/ohmyzsh#4751
ohmyzsh/ohmyzsh#4830
ohmyzsh/ohmyzsh#4993
ohmyzsh/ohmyzsh#5025
ohmyzsh/ohmyzsh#5178
ohmyzsh/ohmyzsh#5271
ohmyzsh/ohmyzsh#5287
ohmyzsh/ohmyzsh#5306
ohmyzsh/ohmyzsh#5307
ohmyzsh/ohmyzsh#5390
ohmyzsh/ohmyzsh#5417
ohmyzsh/ohmyzsh#5433
ohmyzsh/ohmyzsh#5511
ohmyzsh/ohmyzsh#5591
ohmyzsh/ohmyzsh#5643
ohmyzsh/ohmyzsh#5729
ohmyzsh/ohmyzsh#5844
ohmyzsh/ohmyzsh#5849
ohmyzsh/ohmyzsh#5871
ohmyzsh/ohmyzsh#6006
ohmyzsh/ohmyzsh#6031
ohmyzsh/ohmyzsh#6059
ohmyzsh/ohmyzsh#6079
ohmyzsh/ohmyzsh#6297
ohmyzsh/ohmyzsh#6378
ohmyzsh/ohmyzsh#6789
ohmyzsh/ohmyzsh#6791
ohmyzsh/ohmyzsh#6893
ohmyzsh/ohmyzsh#7064
ohmyzsh/ohmyzsh#7472
ohmyzsh/ohmyzsh#7556
ohmyzsh/ohmyzsh#7629
ohmyzsh/ohmyzsh#7630
ohmyzsh/ohmyzsh#7724
ohmyzsh/ohmyzsh#7841
ohmyzsh/ohmyzsh#8089
ohmyzsh/ohmyzsh#8563
ohmyzsh/ohmyzsh#8617
ohmyzsh/ohmyzsh#8622
ohmyzsh/ohmyzsh#8697
ohmyzsh/ohmyzsh#8902
ohmyzsh/ohmyzsh#8935
ohmyzsh/ohmyzsh#8957
ohmyzsh/ohmyzsh#9049
Signed-off-by: Benjamin Vincent (Luxcium) <luxcium@neb401.com>
crdant referenced this issue in crdant/oh-my-zsh-custom Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants