Skip to content

Commit

Permalink
Submodule tweaks (#58)
Browse files Browse the repository at this point in the history
* fixup submodule handling

* revert debugging change
  • Loading branch information
elcritch authored Aug 1, 2023
1 parent b00fd8d commit e9907d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/atlas.nim
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,9 @@ proc installDependencies(c: var AtlasContext; nimbleFile: string; startIsDep: bo
proc updateDir(c: var AtlasContext; dir, filter: string) =
## update the package's VCS
for kind, file in walkDir(dir):
debug c, toRepo(c.workspace / "updating"), "checking directory: " & $kind & " file: " & file.absolutePath
if kind == pcDir and isGitDir(file):
trace c, toRepo(file), "updating directory"
gitops.updateDir(c, file, filter)

proc patchNimbleFile(c: var AtlasContext; dep: string): string =
Expand Down
6 changes: 4 additions & 2 deletions src/gitops.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ type
GitMergeBase = "git merge-base"
GitLsFiles = "git -C $1 ls-files",

proc isGitDir*(path: string): bool = dirExists(path / ".git")
proc isGitDir*(path: string): bool =
let gitPath = path / ".git"
dirExists(gitPath) or fileExists(gitPath)

proc sameVersionAs*(tag, ver: string): bool =
const VersionChars = {'0'..'9', '.'}
Expand Down Expand Up @@ -61,7 +63,7 @@ proc exec*(c: var AtlasContext;
inc c.step
else:
let cmd = if execDir.len() == 0: $cmd else: $(cmd) % [execDir]
if dirExists(".git"):
if isGitDir(if execDir.len() == 0: getCurrentDir() else: execDir):
result = silentExec(cmd, args)
else:
result = ("not a git repository", 1)
Expand Down

0 comments on commit e9907d7

Please sign in to comment.