The Wayback Machine - https://web.archive.org/web/20200916183753/https://github.com/nodegit/nodegit/issues/1782
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 remote prune origin` equivalent operation is not working #1782

Open
dilipkumar2k6 opened this issue Jul 17, 2020 · 0 comments
Open

`git remote prune origin` equivalent operation is not working #1782

dilipkumar2k6 opened this issue Jul 17, 2020 · 0 comments

Comments

@dilipkumar2k6
Copy link

@dilipkumar2k6 dilipkumar2k6 commented Jul 17, 2020

System information

  • node version:10.11.0
  • npm or yarn version: yarn 1.13.0
  • OS/version/architecture: MAC Mojave
  • Applicable nodegit version:0.23.0-alpha.1

simulate git remote prune origin

After running node-git for 2+ years, now we see issues with few repos related to unused refs. This is causing issue as below

cannot lock ref 'refs/remotes/origin/release', there are refs beneath that folder

Issue is caused by loose refs which needs to be prune.
When I manually run following followed by git fetch --prune then it works

git remote prune origin

However trying to similar using node-git is not working. Following is code to prune using node-git

  async pruneAndFetch() {
    // const remote = await repo.getRemote("origin");  This also didn't work
    const remote = await git.Remote.lookup(repo,'origin');
    await remote.prune(new git.RemoteCallbacks()); 
    await remote.pruneRefs(); // This also didn't help
 
   // Now fetch
    await this._repo.fetchAll({
      callbacks: globalFetchCallbacks,
      downloadTags: git.Remote.AUTOTAG_OPTION.DOWNLOAD_TAGS_ALL,
      prune: git.Fetch.PRUNE.GIT_FETCH_PRUNE,
    });
  }

Note: prune step doesn't throw any error, it pass but don't see it really does anything
Any help to simulate git remote prune origin will be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.