diff options
author | Justin Tobler <jtobler@gitlab.com> | 2023-07-05 19:38:59 +0300 |
---|---|---|
committer | Justin Tobler <jtobler@gitlab.com> | 2023-07-05 19:59:41 +0300 |
commit | 53fc9be54227ed2b1b89822bb62fbfa7a0f69beb (patch) | |
tree | 145146a722db2319389451eb094bdbe8e4f01cc5 | |
parent | 3bb1afd6ca345bc37dd9021ca65846a696f1f924 (diff) |
git: Remove `HashObjectFsck()`
The `HashObjectFsck()` function detects whether or not the given Git
version will do fsck. Since the required minimum Git version has been
increased to v2.41, this check always return true.
Remove the function and clean up its call sites.
-rw-r--r-- | internal/git/localrepo/tree_test.go | 17 | ||||
-rw-r--r-- | internal/git/version.go | 8 |
2 files changed, 6 insertions, 19 deletions
diff --git a/internal/git/localrepo/tree_test.go b/internal/git/localrepo/tree_test.go index a907a22e7..7a4f3fcdd 100644 --- a/internal/git/localrepo/tree_test.go +++ b/internal/git/localrepo/tree_test.go @@ -22,9 +22,6 @@ func TestTreeEntry_Write(t *testing.T) { cfg := testcfg.Build(t) ctx := testhelper.Context(t) - gitVersion, err := gittest.NewCommandFactory(t, cfg).GitVersion(ctx) - require.NoError(t, err) - repoProto, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ SkipCreationViaService: true, }) @@ -201,14 +198,12 @@ func TestTreeEntry_Write(t *testing.T) { err := tree.Write(ctx, repo) oid := tree.OID if tc.expectedErrString != "" { - if gitVersion.HashObjectFsck() { - switch e := err.(type) { - case structerr.Error: - stderr := e.Metadata()["stderr"].(string) - strings.Contains(stderr, tc.expectedErrString) - default: - strings.Contains(err.Error(), tc.expectedErrString) - } + switch e := err.(type) { + case structerr.Error: + stderr := e.Metadata()["stderr"].(string) + strings.Contains(stderr, tc.expectedErrString) + default: + strings.Contains(err.Error(), tc.expectedErrString) } return } diff --git a/internal/git/version.go b/internal/git/version.go index f7eefc738..5a7093e48 100644 --- a/internal/git/version.go +++ b/internal/git/version.go @@ -75,14 +75,6 @@ func (v Version) IsSupported() bool { return !v.LessThan(minimumVersion) } -// HashObjectFsck detects whether or not the given Git version will do fsck -// checks when git-hash-object writes objects. -func (v Version) HashObjectFsck() bool { - return !v.LessThan(Version{ - major: 2, minor: 40, patch: 0, - }) -} - // PatchIDRespectsBinaries detects whether the given Git version correctly handles binary diffs when // computing a patch ID. Previous to Git v2.39.0, git-patch-id(1) just completely ignored any binary // diffs and thus would consider two diffs the same even if a binary changed. |