Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
cmd/dep: make out-of-sync ensure less strict
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel250 committed Sep 29, 2017
1 parent 82b3908 commit 66f279e
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 28 deletions.
6 changes: 2 additions & 4 deletions cmd/dep/ensure.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,8 @@ func (cmd *ensureCommand) runUpdate(ctx *dep.Ctx, args []string, p *dep.Project,
// user a bit, but the extra effort required is minimal, and it ensures the
// user is isolating variables in the event of solve problems (was it the
// "pending" changes, or the -update that caused the problem?).
// TODO(sdboyer) reduce this to a warning?
if !bytes.Equal(p.Lock.InputHash(), solver.HashInputs()) {
return errors.Errorf("%s is out of sync with %s or the project's imports. Run \"dep ensure\" to resync them first before running \"dep ensure -update\"", dep.LockName, dep.ManifestName)
ctx.Out.Printf("Warning: %s is out of sync with %s or the project's imports.", dep.LockName, dep.ManifestName)
}

// When -update is specified without args, allow every dependency to change
Expand Down Expand Up @@ -406,9 +405,8 @@ func (cmd *ensureCommand) runAdd(ctx *dep.Ctx, args []string, p *dep.Project, sm
// user a bit, but the extra effort required is minimal, and it ensures the
// user is isolating variables in the event of solve problems (was it the
// "pending" changes, or the -add that caused the problem?).
// TODO(sdboyer) reduce this to a warning?
if p.Lock != nil && !bytes.Equal(p.Lock.InputHash(), solver.HashInputs()) {
return errors.Errorf("%s is out of sync with %s or the project's imports. Run \"dep ensure\" to resync them first before running \"dep ensure -add\"", dep.LockName, dep.ManifestName)
ctx.Out.Printf("Warning: %s is out of sync with %s or the project's imports.", dep.LockName, dep.ManifestName)
}

rm, _ := params.RootPackageTree.ToReachMap(true, true, false, p.Manifest.IgnoredPackages())
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[constraint]]
name = "github.com/sdboyer/deptest"
version = "~0.8.0"
[[constraint]]
branch = "master"
name = "github.com/sdboyer/deptesttres"
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main
import (
"github.com/sdboyer/deptest"
"github.com/sdboyer/deptestdos"
"github.com/sdboyer/deptesttres"
)

func main() {
Expand All @@ -15,4 +16,6 @@ func main() {
deptest.Map["yo yo!"]
}
deptestdos.diMeLo("whatev")

type a deptesttres.Bar
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports.
10 changes: 10 additions & 0 deletions cmd/dep/testdata/harness_tests/ensure/add/desync/testcase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"commands": [
["ensure", "-add", "github.com/sdboyer/deptesttres"]
],
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos",
"github.com/sdboyer/deptesttres"
]
}

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Warning: Gopkg.lock is out of sync with Gopkg.toml or the project's imports.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"commands": [
["ensure", "-update"]
],
"vendor-final": [
"github.com/sdboyer/deptest",
"github.com/sdboyer/deptestdos"
]
}

This file was deleted.

This file was deleted.

0 comments on commit 66f279e

Please sign in to comment.