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

version() fails on git compiled from source #852

Closed
bytestream opened this issue Sep 15, 2022 · 1 comment · Fixed by #853
Closed

version() fails on git compiled from source #852

bytestream opened this issue Sep 15, 2022 · 1 comment · Fixed by #853

Comments

@bytestream
Copy link

Compile git from source (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git#_installing_from_source) and then simpleGit().version() fails to parse the version string:

import { simpleGit } from 'simple-git'; 
 
console.log(await simpleGit().version());
{
  major: 0,
  minor: 0,
  patch: 0,
  agent: 'git version 2.37.GIT\n',
  installed: true
}

For ease of reproduction, example docker file to compile from source:

FROM debian:11

# Install latest version of git
RUN set -ex; \
    apt-get update; \
    # https://git-scm.com/book/en/v2/Getting-Started-Installing-Git#_installing_from_source
    apt-get install -y curl ca-certificates unzip build-essential dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev --no-install-recommends; \
    curl -o git.zip https://codeload.github.com/git/git/zip/refs/heads/master; \
    unzip git.zip; \
    cd git-master; \
    make configure; \
    ./configure --prefix=/usr ; \
    make all; \
    make install; \
    cd .. && rm -rf git-master git.zip; \
    git --version; \
    rm -rf /var/lib/apt/lists/*

ENTRYPOINT git --version
steveukx added a commit that referenced this issue Sep 17, 2022
steveukx added a commit that referenced this issue Sep 17, 2022
#853)

* Add version parsing support for non-numeric patches (to include built from source `d.d.SSS`)

Closes #852
@steveukx
Copy link
Owner

hi, thank you for the detailed issue... you should be able to update to version 3.14.1 on npm now to see your version parsed as

{
   installed: true,
   major: 2,
   minor: 37,
   patch: 'GIT',
   agent: '',
}

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

Successfully merging a pull request may close this issue.

2 participants