aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
diff options
context:
space:
mode:
authorAyman Bagabas <ayman.bagabas@gmail.com>2023-04-04 01:13:21 -0400
committerAyman Bagabas <ayman.bagabas@gmail.com>2023-04-17 17:43:46 -0400
commit9a5b08f5c32bad31a35a53c045ebf6c8409f8b2c (patch)
treeef6d49278f14de59481e8e49ac8503c309f534c6 /options.go
parentb154dcce7059e4e02f8798db158b6a76ffc4a63e (diff)
downloadgo-git-9a5b08f5c32bad31a35a53c045ebf6c8409f8b2c.tar.gz
feat(clone): add mirror clone option
Clone remote as a mirror. This fetches all remote refs, implies bare repository, and sets the appropriate configs. Fixes: https://github.com/go-git/go-git/issues/293 Update options.go Co-authored-by: Paulo Gomes <paulo.gomes.uk@gmail.com> Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Diffstat (limited to 'options.go')
-rw-r--r--options.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/options.go b/options.go
index 738c1ce..6a38ad9 100644
--- a/options.go
+++ b/options.go
@@ -46,6 +46,14 @@ type CloneOptions struct {
ReferenceName plumbing.ReferenceName
// Fetch only ReferenceName if true.
SingleBranch bool
+ // Mirror clones the repository as a mirror.
+ //
+ // Compared to a bare clone, mirror not only maps local branches of the
+ // source to local branches of the target, it maps all refs (including
+ // remote-tracking branches, notes etc.) and sets up a refspec configuration
+ // such that all these refs are overwritten by a git remote update in the
+ // target repository.
+ Mirror bool
// No checkout of HEAD after clone if true.
NoCheckout bool
// Limit fetching to the specified number of commits.