Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2019-03-26 20:32:36 +0300
committerJohn Cai <jcai@gitlab.com>2019-03-26 20:32:36 +0300
commit58a49bb8a863ec71fe83150df83bba6c9c2fcbd0 (patch)
tree4d4d292d8898c89f2a470d2d5e238a6c668b9064 /internal/git/proto.go
parent3f54bb55ad2873ecb0581bd3365ee6ca35a25924 (diff)
Use delta islands in RepackFull and GarbageCollect
Diffstat (limited to 'internal/git/proto.go')
-rw-r--r--internal/git/proto.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/git/proto.go b/internal/git/proto.go
index 99e4629fe..9f2a43f24 100644
--- a/internal/git/proto.go
+++ b/internal/git/proto.go
@@ -5,6 +5,7 @@ import (
"context"
"fmt"
"path/filepath"
+ "strconv"
"strings"
"time"
@@ -61,6 +62,27 @@ func Version() (string, error) {
return ver[2], nil
}
+// SupportsDeltaIslands checks if a version string (e.g. "2.20.0")
+// corresponds to a Git version that supports delta islands.
+func SupportsDeltaIslands(version string) (bool, error) {
+ versionSplit := strings.SplitN(version, ".", 3)
+ if len(versionSplit) < 3 {
+ return false, fmt.Errorf("expected major.minor.patch in %q", version)
+ }
+
+ var major, minor uint32
+ for i, v := range []*uint32{&major, &minor} {
+ n64, err := strconv.ParseUint(versionSplit[i], 10, 32)
+ if err != nil {
+ return false, err
+ }
+
+ *v = uint32(n64)
+ }
+
+ return major >= 2 && minor >= 20, nil
+}
+
// BuildGitOptions helps to generate options to the git command.
// If gitOpts is not empty then its values are passed as part of
// the "-c" option of the git command, the other values are passed along with the subcommand.