GithubHelp home page GithubHelp logo

Error with Git 1.8.2.1 about homeshick HOT 11 CLOSED

andsens avatar andsens commented on June 9, 2024
Error with Git 1.8.2.1

from homeshick.

Comments (11)

andsens avatar andsens commented on June 9, 2024

Going to take a look at this tonight

from homeshick.

andsens avatar andsens commented on June 9, 2024

This should do the trick. I did some half-assed version grepping as if I committed mid-code or something.

from homeshick.

mroth avatar mroth commented on June 9, 2024

I believe this change introduced a new error if the user has hub installed/aliased.

$ homeshick check
        error could not determine git version

$ git --version | cut -d ' ' -f 3
1.8.2
1.10.6

$ git --version
git version 1.8.2
hub version 1.10.6

Perhaps it just needs a head -n1 in the pipeline?

from homeshick.

andsens avatar andsens commented on June 9, 2024

hah, oh wow. I didn't think of that one :-)
the head -n1 is just a patch, I think I need to find a git plumbing command for this.

from homeshick.

andsens avatar andsens commented on June 9, 2024

Hold on, isn't this because you have aliased hub as git?!
I couldn't help but think that adding the version number of an extension to the extended program is bad practice and from what I can tell, hub doesn't extend git in any way.

from homeshick.

mroth avatar mroth commented on June 9, 2024

@andsens yes, hub is specifically designed to "wrap" git to extend it's functionality, and most installations recommend aliasing it in that way (in fact, oh-my-zsh automatically does that, Github's boxen program automatically does it, etc). see http://defunkt.io/hub/ and that's how it's recommended to be used

I agree wrapping the --version output like that is a bit weird... but that's what they've done for whatever reason.

from homeshick.

andsens avatar andsens commented on June 9, 2024

Hm ok. I think we go at it with grep though (so a bit like before the fix)

git_version=$(git --version | grep 'git version' | grep -oE '([0-9]+\.){3}([0-9]+)?')

Like this?

from homeshick.

mroth avatar mroth commented on June 9, 2024

Hmm.. that regex doesn't seem to match on vanilla git 1.8.2, since it expects each digit to end in a period (e.g. it matches 1.8.2. but not 1.8.2). My regex fu isn't quite up to knowing what would fix that most simply...

What about git --version | grep 'git version' | cut -d' ' -f3 ? That should find the git version line no matter what order it appears in and then just grab the version column despite what characters it contains (which would be good if there ever exists version numbers such as 1.8.3a -- not sure if that is likely or not.)

BTW, it looks like the line which may also really have to be modified is not the shell capture itself but the following line
if [[ ! $GIT_VERSION =~ ([0-9]\.){3}[0-9] ]]; then
becauseI believe it has that same problem with requiring three .s when a three-arg version number only has two.

from homeshick.

andsens avatar andsens commented on June 9, 2024

which would be good if there ever exists version numbers such as 1.8.3a -- not sure if that is likely or not

Trouble is, then version_compare won't work anyways... So this check is really only to make sure users don't get a weird error in the middle of the script.

from homeshick.

andsens avatar andsens commented on June 9, 2024

This should do it.

from homeshick.

mroth avatar mroth commented on June 9, 2024

Seems to be working here, thanks! 👍

from homeshick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.