Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions ensure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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{
Expand All @@ -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) {
Expand Down