From 710ceca85bb8ca9f2850a632e68ded3f5bd61642 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 21 Sep 2026 14:37:09 +0200 Subject: [PATCH 1/2] Enable Git long paths for submodule commands --- ensure.go | 4 ++-- ensure_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ensure.go b/ensure.go index 22d4365..01b1800 100644 --- a/ensure.go +++ b/ensure.go @@ -103,7 +103,7 @@ func updateSubmodules(ctx context.Context, retry Retry, dst string, enabled bool return nil } policy := retry.Resolved() - if _, err := policy.Run(ctx, dst, remoteEnv(), "submodule", "sync", "--recursive"); err != nil { + if _, err := policy.Run(ctx, dst, remoteEnv(), longPathArgs("submodule", "sync", "--recursive")...); err != nil { if ctxErr := ctx.Err(); ctxErr != nil { return ctxErr } @@ -112,7 +112,7 @@ func updateSubmodules(ctx context.Context, retry Retry, dst string, enabled bool Label: "submodule", Dir: dst, Env: remoteEnv(), - Args: []string{"submodule", "update", "--init", "--recursive", "--depth", "1"}, + Args: longPathArgs("submodule", "update", "--init", "--recursive", "--depth", "1"), }); err != nil { if ctxErr := ctx.Err(); ctxErr != nil { return ctxErr diff --git a/ensure_test.go b/ensure_test.go index 0863acc..48639be 100644 --- a/ensure_test.go +++ b/ensure_test.go @@ -244,11 +244,11 @@ func TestEnsureWithOptionsIgnoresSubmoduleFailure(t *testing.T) { ); err != nil { t.Fatalf("EnsureWithOptions: %v", err) } - wantSyncArgs := []string{"submodule", "sync", "--recursive"} + wantSyncArgs := []string{"-c", "core.longpaths=true", "submodule", "sync", "--recursive"} if !slices.Equal(syncArgs, wantSyncArgs) { t.Errorf("submodule sync args = %v, want %v", syncArgs, wantSyncArgs) } - wantUpdateArgs := []string{"submodule", "update", "--init", "--recursive", "--depth", "1"} + wantUpdateArgs := []string{"-c", "core.longpaths=true", "submodule", "update", "--init", "--recursive", "--depth", "1"} if !slices.Equal(updateArgs, wantUpdateArgs) { t.Errorf("submodule update args = %v, want %v", updateArgs, wantUpdateArgs) } From 2831e6afef58473ece40832da9e1960ca97cbd72 Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Mon, 21 Sep 2026 15:09:37 +0100 Subject: [PATCH 2/2] Enable Git long paths for fetchRef reset reset --hard materializes the working tree, so it needs core.longpaths like clone and fetch do. --- ensure.go | 2 +- ensure_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ensure.go b/ensure.go index 01b1800..9f0855f 100644 --- a/ensure.go +++ b/ensure.go @@ -147,7 +147,7 @@ func fetchRef(ctx context.Context, retry Retry, url, dst, ref string, full bool) return fmt.Errorf("%s: %w", strings.TrimSpace(out), err) } out, err = policy.Run(ctx, "", nil, - "-C", dst, "reset", "--quiet", "--hard", "--no-recurse-submodules", "FETCH_HEAD", + longPathArgs("-C", dst, "reset", "--quiet", "--hard", "--no-recurse-submodules", "FETCH_HEAD")..., ) if err != nil { return fmt.Errorf("%s: %w", strings.TrimSpace(out), err) diff --git a/ensure_test.go b/ensure_test.go index 48639be..beb3e1d 100644 --- a/ensure_test.go +++ b/ensure_test.go @@ -379,7 +379,7 @@ func TestEnsureRetriesCloneAndResetsPartialDestination(t *testing.T) { } } -func TestEnsureConfiguresLongPathsForCloneAndFetch(t *testing.T) { +func TestEnsureConfiguresLongPathsForCloneFetchAndReset(t *testing.T) { dst := filepath.Join(t.TempDir(), "checkout") commands := make(map[string][]string) retry := Retry{ @@ -393,7 +393,7 @@ func TestEnsureConfiguresLongPathsForCloneAndFetch(t *testing.T) { if err != nil { t.Fatalf("Ensure: %v", err) } - for _, command := range []string{"clone", "fetch"} { + for _, command := range []string{"clone", "fetch", "reset"} { args := commands[command] want := []string{"-c", "core.longpaths=true"} if len(args) < len(want) || !slices.Equal(args[:len(want)], want) {