Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

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

Open
@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. I take a little deep dive into the code and debugged it. It seems, that in gcfg/scanner/scanner.go the hashtag sign is interpreted as comment sign.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions