10000 `remote.origin.fetch` is limited to the default branch · Issue #664 · ruby-git/ruby-git · GitHub
[go: up one dir, main page]

Skip to content
remote.origin.fetch is limited to the default branch #664
Open
@zedtux

Description

@zedtux

Subject of the issue

Given I clone a git repository using git on my local machine, so without this lib, the remote.origin.fetch targets +refs/heads/*:refs/remotes/origin/* while when I clone the same repo but with this lib the the remote.origin.fetch targets +refs/heads/master:refs/remotes/origin/master.

This makes the fetch method not being able to retrieve other branches references and therefore the reset_hard method to fail with:

fatal: ambiguous argument 'origin/8-missing-reference-language-translation-files-in-yml': unknown revision or path not in the working tree.

Your environment

  • version of git: 2.32.6
  • version of ruby-git: 1.18.0
  • version of ruby: 2.7.6

Steps to reproduce

git = Git.clone(URL, destination)

# Supposed to retrieve all the remote branch refs, but is not
git.remote(Git::GIT_REMOTE_NAME).fetch

# Switches to the desired branch
git.branch('8-missing-reference-language-translation-files-in-yml').checkout

# Here we want to be fully aligned with the remote branch
git.reset_hard("#{Git::GIT_REMOTE_NAME}/8-missing-reference-language-translation-files-in-yml")
#=> fatal: ambiguous argument 'origin/8-missing-reference-language-translation-files-in-yml': unknown revision or path not in the working tree.

Expected behaviour

The remote.origin.fetch should be changed from:

remote.origin.fetch=+refs/heads/master:refs/remotes/origin/master

to:

remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

Actual behaviour

See "Steps to reproduce"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0