Skip to content

Commit 40b3f81

Browse files
Jonathan D.A. Jewellclaude
andcommitted
fix: sync-all-parallel.exs — handle single-segment paths and remove unused attr
- Guard is_submodule? for top-level repos (length <= 1) - Use explicit step //1 on range to avoid descending range warning - Remove unused @skip_dirs module attribute Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 104b365 commit 40b3f81

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

scripts/sync-all-parallel.exs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ defmodule SyncAll do
3131

3232
@ignored_dirs ~w[logs monitoring .git-private-farm]
3333

34-
@skip_dirs ~w[
35-
winget-pkgs compiler-source node_modules target _build
36-
.lake deps vendor __pycache__
37-
]
38-
3934
defstruct [
4035
:repos_dir,
4136
:dry_run,
@@ -165,24 +160,30 @@ defmodule SyncAll do
165160

166161
defp is_submodule?(rel, repos_dir) do
167162
parts = Path.split(rel)
163+
num_parts = length(parts)
168164

169-
# Walk parent directories looking for .gitmodules
170-
1..(length(parts) - 1)
171-
|> Enum.any?(fn n ->
172-
parent = parts |> Enum.take(n) |> Path.join()
173-
parent_abs = Path.join(repos_dir, parent)
174-
gitmodules = Path.join(parent_abs, ".gitmodules")
175-
176-
if File.exists?(gitmodules) do
177-
subpath = parts |> Enum.drop(n) |> Path.join()
178-
case File.read(gitmodules) do
179-
{:ok, content} -> String.contains?(content, "path = #{subpath}")
180-
_ -> false
165+
# Top-level repos can't be submodules
166+
if num_parts <= 1 do
167+
false
168+
else
169+
# Walk parent directories looking for .gitmodules
170+
1..(num_parts - 1)//1
171+
|> Enum.any?(fn n ->
172+
parent = parts |> Enum.take(n) |> Path.join()
173+
parent_abs = Path.join(repos_dir, parent)
174+
gitmodules = Path.join(parent_abs, ".gitmodules")
175+
176+
if File.exists?(gitmodules) do
177+
subpath = parts |> Enum.drop(n) |> Path.join()
178+
case File.read(gitmodules) do
179+
{:ok, content} -> String.contains?(content, "path = #{subpath}")
180+
_ -> false
181+
end
182+
else
183+
false
181184
end
182-
else
183-
false
184-
end
185-
end)
185+
end)
186+
end
186187
end
187188

188189
# --- Phase 1: Parallel Sync ---

0 commit comments

Comments
 (0)