Skip to content

Can't clone branch ref name with hash/number sign (#) #309

@jkblume

Description

@jkblume

I am cloning a repository in single branch mode with a branch name that contains a hash/number sign (#) into name. And get an error.

Steps to reproduce (created a public github repository for that):

_, err := git.PlainClone("/tmp/repo", false, &git.CloneOptions{
    URL:           "[email protected]:jkblume/gogit-hashtag-bug.git",
    ReferenceName: plumbing.ReferenceName("refs/heads/branch#name"),
    SingleBranch:  true,
})

fmt.Println(err.Error())

The command fails with error message: 'malformed refspec, separators are wrong' in file config/refspec.go line 35.

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