Skip to content

Commit

Permalink
Can sync ignoring deps not present in lock file even if they are in d…
Browse files Browse the repository at this point in the history
…evelop file
  • Loading branch information
yyoncho authored and zah committed Jul 19, 2022
1 parent 25d6e4a commit aef6f4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nimble.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,9 @@ proc sync(options: Options) =
findValidationErrorsOfDevDepsWithLockFile(pkgInfo, options, errors)

for name, error in common.dup(errors):
if error.kind == vekWorkingCopyNeedsSync:
if not pkgInfo.lockedDeps.contains(name):
errors.del name
elif error.kind == vekWorkingCopyNeedsSync:
if not options.action.listOnly:
syncWorkingCopy(name, error.path, pkgInfo, options)
else:
Expand Down
12 changes: 12 additions & 0 deletions tests/tlockfile.nim
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,15 @@ requires "nim >= 1.5.1"
writeDevelopFile(developFileName, @[],
@[dep2PkgRepoPath, mainPkgRepoPath, dep1PkgRepoPath])
testLockFile(@[(dep1PkgName, dep1PkgRepoPath)], isNew = true)

test "can sync ignoring deps not present in lock file even if they are in develop file":
cleanUp()
withPkgListFile:
initNewNimblePackage(mainPkgOriginRepoPath, mainPkgRepoPath,
@[dep1PkgName])
initNewNimblePackage(dep1PkgOriginRepoPath, dep1PkgRepoPath)
cd mainPkgRepoPath:
testLockFile(@[(dep1PkgName, dep1PkgRepoPath)], isNew = true)
writeDevelopFile(developFileName, @[], @[dep1PkgRepoPath, mainPkgOriginRepoPath])
let (_, exitCode) = execNimbleYes("--debug", "--verbose", "sync")
check exitCode == QuitSuccess

0 comments on commit aef6f4f

Please sign in to comment.