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

Commit 2cd2d64

Browse files
author
Nick Thomas
committed
Implement a NoTags mode for fetch that mimics git fetch --no-tags
1 parent 2d10f10 commit 2cd2d64

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ var (
113113
// AllTags fetch all tags from the remote (i.e., fetch remote tags
114114
// refs/tags/* into local tags with the same name)
115115
AllTags TagFetchMode = 1
116+
//NoTags fetch no tags from the remote at all
117+
NoTags TagFetchMode = 2
116118
)
117119

118120
// FetchOptions describes how a fetch should be performed

remote_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,22 @@ func (s *RemoteSuite) TestFetchWithAllTags(c *C) {
120120
})
121121
}
122122

123+
func (s *RemoteSuite) TestFetchWithNoTags(c *C) {
124+
r := newRemote(memory.NewStorage(), &config.RemoteConfig{
125+
URL: s.GetLocalRepositoryURL(fixtures.ByTag("tags").One()),
126+
})
127+
128+
s.testFetch(c, r, &FetchOptions{
129+
Tags: NoTags,
130+
RefSpecs: []config.RefSpec{
131+
config.RefSpec("+refs/heads/master:refs/remotes/origin/master"),
132+
},
133+
}, []*plumbing.Reference{
134+
plumbing.NewReferenceFromStrings("refs/remotes/origin/master", "f7b877701fbf855b44c0a9e86f3fdce2c298b07f"),
135+
})
136+
137+
}
138+
123139
func (s *RemoteSuite) TestFetchWithDepth(c *C) {
124140
r := newRemote(memory.NewStorage(), &config.RemoteConfig{
125141
URL: s.GetBasicLocalRepositoryURL(),

0 commit comments

Comments
 (0)