Skip to content

Commit ea7db2e

Browse files
authored
Merge pull request #975 from bobeff/bugfix/submodules-update
Fix Git sub-modules handling
2 parents 5673273 + daa0e69 commit ea7db2e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/nimblepkg/download.nim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ type
1515
version: Version
1616
vcsRevision: Sha1Hash
1717

18+
proc updateSubmodules(dir: string) =
19+
discard tryDoCmdEx(
20+
&"git -C {dir} submodule update --init --recursive --depth 1")
21+
1822
proc doCheckout(meth: DownloadMethod, downloadDir, branch: string) =
1923
case meth
2024
of DownloadMethod.git:
2125
# Force is used here because local changes may appear straight after a clone
2226
# has happened. Like in the case of git on Windows where it messes up the
2327
# damn line endings.
24-
discard tryDoCmdEx(&"git -C {downloadDir} checkout --force {branch}")
25-
discard tryDoCmdEx(
26-
&"git -C {downloadDir} submodule update --recursive --depth 1")
28+
discard tryDoCmdEx(&"git -C {downloadDir} checkout --force {branch}")
29+
downloadDir.updateSubmodules
2730
of DownloadMethod.hg:
2831
discard tryDoCmdEx(&"hg --cwd {downloadDir} checkout {branch}")
2932

@@ -149,6 +152,7 @@ proc cloneSpecificRevision(downloadMethod: DownloadMethod,
149152
discard tryDoCmdEx(
150153
&"git -C {downloadDir} fetch --depth 1 origin {vcsRevision}")
151154
discard tryDoCmdEx(&"git -C {downloadDir} reset --hard FETCH_HEAD")
155+
downloadDir.updateSubmodules
152156
of DownloadMethod.hg:
153157
discard tryDoCmdEx(&"hg clone {url} -r {vcsRevision}")
154158

0 commit comments

Comments
 (0)