diff options
author | Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com> | 2023-05-25 08:56:17 +1000 |
---|---|---|
committer | Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com> | 2023-05-25 08:56:17 +1000 |
commit | 65a5c716353f81b20c70f4a2c6560590d9472b6e (patch) | |
tree | b5a0c837eb3afe02cb8f24d85846c6464616f655 /plumbing | |
parent | b98b813a17d32f4fa29a3ef2e9f4c38c5a97b440 (diff) | |
download | go-git-65a5c716353f81b20c70f4a2c6560590d9472b6e.tar.gz |
git: enable fetch with unqualified references
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/reference.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/plumbing/reference.go b/plumbing/reference.go index aeb4227..5a67f69 100644 --- a/plumbing/reference.go +++ b/plumbing/reference.go @@ -15,10 +15,11 @@ const ( symrefPrefix = "ref: " ) -// RefRevParseRules are a set of rules to parse references into short names. -// These are the same rules as used by git in shorten_unambiguous_ref. +// RefRevParseRules are a set of rules to parse references into short names, or expand into a full reference. +// These are the same rules as used by git in shorten_unambiguous_ref and expand_ref. // See: https://github.com/git/git/blob/e0aaa1b6532cfce93d87af9bc813fb2e7a7ce9d7/refs.c#L417 var RefRevParseRules = []string{ + "%s", "refs/%s", "refs/tags/%s", "refs/heads/%s", @@ -113,7 +114,7 @@ func (r ReferenceName) String() string { func (r ReferenceName) Short() string { s := string(r) res := s - for _, format := range RefRevParseRules { + for _, format := range RefRevParseRules[1:] { _, err := fmt.Sscanf(s, format, &res) if err == nil { continue |