diff options
author | Paulo Gomes <pjbgf@linux.com> | 2023-04-17 23:05:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 23:05:06 +0100 |
commit | 0a1c5ab118998a22ef88d8e6c42970197d77413c (patch) | |
tree | 68ee12567f4ab297639e31fe1ebcf666a77c5531 /config/config.go | |
parent | 7cd387bd28a95590d9536b4344d4ff60b75d6590 (diff) | |
parent | 9a5b08f5c32bad31a35a53c045ebf6c8409f8b2c (diff) | |
download | go-git-0a1c5ab118998a22ef88d8e6c42970197d77413c.tar.gz |
Merge pull request #735 from aymanbagabas/clone-mirror
git: add mirror clone option
Diffstat (limited to 'config/config.go')
-rw-r--r-- | config/config.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go index 83629fc..60dfca4 100644 --- a/config/config.go +++ b/config/config.go @@ -264,6 +264,7 @@ const ( defaultBranchKey = "defaultBranch" repositoryFormatVersionKey = "repositoryformatversion" objectFormat = "objectformat" + mirrorKey = "mirror" // DefaultPackWindow holds the number of previous objects used to // generate deltas. The value 10 is the same used by git command. @@ -578,6 +579,8 @@ type RemoteConfig struct { // URLs the URLs of a remote repository. It must be non-empty. Fetch will // always use the first URL, while push will use all of them. URLs []string + // Mirror indicates that the repository is a mirror of remote. + Mirror bool // insteadOfRulesApplied have urls been modified insteadOfRulesApplied bool @@ -631,6 +634,7 @@ func (c *RemoteConfig) unmarshal(s *format.Subsection) error { c.Name = c.raw.Name c.URLs = append([]string(nil), c.raw.Options.GetAll(urlKey)...) c.Fetch = fetch + c.Mirror = c.raw.Options.Get(mirrorKey) == "true" return nil } @@ -663,6 +667,10 @@ func (c *RemoteConfig) marshal() *format.Subsection { c.raw.SetOption(fetchKey, values...) } + if c.Mirror { + c.raw.SetOption(mirrorKey, strconv.FormatBool(c.Mirror)) + } + return c.raw } |