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

No tag info visible #44

Open
rturam opened this issue Feb 4, 2019 · 7 comments
Open

No tag info visible #44

rturam opened this issue Feb 4, 2019 · 7 comments

Comments

@rturam
Copy link

rturam commented Feb 4, 2019

Hello,

For one repository the tag information is shown correctly on mac and windows but not on Amazon Linux. What can be the issue? How to debug?

I am running this code:

var getRepoInfo = require('git-repo-info');
var info = getRepoInfo();
console.log(info);

ON MAC:

{ sha: '3cbf8687a1290700841cd151b69ef4327c744d76',
  abbreviatedSha: '3cbf8687a1',
  branch: null,
  tag: '2.0.0',
  committer: null,
  committerDate: null,
  author: null,
  authorDate: null,
  commitMessage: null,
  root: '/Users/rt/projects/tmp/client-app',
  commonGitDir: '/Users/rt/projects/tmp/client-app/.git',
  worktreeGitDir: '/Users/rt/projects/tmp/client-app/.git',
  lastTag: '2.0.0',
  commitsSinceLastTag: 0 }

On Amazon linux (this is run jenkins slave machine - the code checkout and everything done in jenkisfile.)

{ sha: '3cbf8687a1290700841cd151b69ef4327c744d76',
  abbreviatedSha: '3cbf8687a1',
  branch: null,
  tag: null,
  committer: null,
  committerDate: null,
  author: null,
  authorDate: null,
  commitMessage: null,
  root: '/data/jenkins/workspace/FRONTEND-JOBS/deploy-job' }
@rwjblue
Copy link
Owner

rwjblue commented Feb 28, 2019

What are the git --versions on each of the machines?

@charlyoleg
Copy link

I have the same issue on fresh cloned repos. If I commit anything in the same repo where I use git-repo-info, the issue disappear.
With other words, on the same machine (Ubuntu 18.04), cloning the repo twice in two different directories, if I don't commit any thing in a repo-instance, I get the issue within this repo-instance.

Copy link
Owner

rwjblue commented Jul 3, 2019

Seems plausible that the clone doesn't include tags by default? Can you try git pull --tags on the machine that isn't showing them?

@charlyoleg
Copy link

charlyoleg commented Jul 3, 2019

After a fresh cloning and some git-pulls, I see the bug:

git clone https://github.com/charlyoleg/rouleau
git pull
git pull --tags

Then git-repo-info provides:
{ sha: '39af95c9d6db684a914601971a1a1c5a9da8824e',
abbreviatedSha: '39af95c9d6',
branch: 'master',
tag: null,
committer: null,
committerDate: null,
author: null,
authorDate: null,
commitMessage: null,
root: '/home/charli/Bis/Tmp/test_bug_repo_info/client7/rouleau',
commonGitDir: '/home/charli/Bis/Tmp/test_bug_repo_info/client7/rouleau/.git',
worktreeGitDir: '/home/charli/Bis/Tmp/test_bug_repo_info/client7/rouleau/.git',
lastTag: null,
commitsSinceLastTag: Infinity }

More interesting, if the git-pull contains new commits, the bug is then gone:
{ sha: '822fa931f759b4f6523de6b576485b796c6d8a67',
abbreviatedSha: '822fa931f7',
branch: 'master',
tag: null,
committer: 'charli [email protected]',
committerDate: '2019-07-03T20:28:39.000Z',
author: 'charli [email protected]',
authorDate: '2019-07-03T20:28:39.000Z',
commitMessage: 'a dummy commit for bug investigation',
root: '/home/charli/Bis/Tmp/test_bug_repo_info/client7/rouleau',
commonGitDir: '/home/charli/Bis/Tmp/test_bug_repo_info/client7/rouleau/.git',
worktreeGitDir: '/home/charli/Bis/Tmp/test_bug_repo_info/client7/rouleau/.git',
lastTag: null,
commitsSinceLastTag: Infinity,
parents: [ '39af95c9d6db684a914601971a1a1c5a9da8824e' ] }

Might it be something related to the missing parents after a fresh clone?

@charlyoleg
Copy link

charlyoleg commented Jul 4, 2019

A short way to reproduce the issue:
bash> git clone https://github.com/rwjblue/git-repo-info
bash> cd git-repo-info
bash> npm i
bash> nodejs
nodejs> const gitRepoInfo = require('./index');
nodejs> a=gitRepoInfo();

You will see:
{ sha: '416f9816d4883c74f91ac44c7bfbb956d569675a',
abbreviatedSha: '416f9816d4',
branch: 'master',
tag: null,
committer: null,
committerDate: null,
author: null,
authorDate: null,
commitMessage: null,
root: '/home/charli/Bis/Tmp/ttt/git-repo-info',
commonGitDir: '/home/charli/Bis/Tmp/ttt/git-repo-info/.git',
worktreeGitDir: '/home/charli/Bis/Tmp/ttt/git-repo-info/.git',
lastTag: null,
commitsSinceLastTag: Infinity }

Using
git version 2.17.1
nodejs v8.10.0

@TomaszWegrzyn
Copy link

Doesn't work for me either - lastTag is always null

I am using git-rev-sync-js as a replacement.

@LightSeekerSC
Copy link

LightSeekerSC commented Mar 8, 2024

Any new information on this? This was working for me and then suddenly only lastTag is null now

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

5 participants