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

dep ensure: Unable to update checked out version #618

Closed
elliots opened this issue May 22, 2017 · 8 comments · Fixed by #1279
Closed

dep ensure: Unable to update checked out version #618

elliots opened this issue May 22, 2017 · 8 comments · Fixed by #1279

Comments

@elliots
Copy link

elliots commented May 22, 2017

The error message is Unable to update checked out version: error: The following untracked working tree files would be overwritten by checkout

Tried newer versions of the package, which failed in the same way.

Gopkg.toml

[[dependencies]]
  name = "github.com/Azure/azure-sdk-for-go"
  version = "^8.1.1-beta" 

Output

$ dep ensure
ensure Solve(): No versions of github.com/Azure/azure-sdk-for-go met constraints:
       	v1.2: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v1.1: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v1.0: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v10.0.3-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v10.0.2-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v10.0.1-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v10.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v9.0.1-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v9.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v8.1.1-beta: Unable to update checked out version: error: The following untracked working tree files would be overwritten by checkout:
       	storage/README.md
       	storage/authorization.go
       	storage/authorization_test.go
       	storage/blob.go
       	storage/blob_test.go
       	storage/client.go
       	storage/client_test.go
       	storage/directory.go
       	storage/directory_test.go
       	storage/file.go
       	storage/file_test.go
       	storage/fileserviceclient.go
       	storage/queue.go
       	storage/queue_test.go
       	storage/share.go
       	storage/share_test.go
       	storage/storagepolicy.go
       	storage/table.go
       	storage/table_entities.go
       	storage/table_test.go
       	storage/util.go
       	storage/util_test.go
       	storage/version.go
Please move or remove them before you switch branches.
Aborting

       	v8.1.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v8.0.1-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	8.0.1-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v8.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v7.0.1-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v7.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v6.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v5.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v4.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v3.2.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v3.1.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v3.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v2.2.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v2.1.1-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v2.1.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v2.0.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	v0.2.0-beta: Could not introduce github.com/Azure/[email protected], as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	master: Could not introduce github.com/Azure/azure-sdk-for-go@master, as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	dev: Could not introduce github.com/Azure/azure-sdk-for-go@dev, as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.
       	experimental/allAPIVersions: Could not introduce github.com/Azure/azure-sdk-for-go@experimental/allAPIVersions, as it is not allowed by constraint ^8.1.1-beta from project myorg.com/myapp.

Versions

go version go1.8 darwin/amd64
git version 2.11.0 (Apple Git-81)
Darwin thor 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

@carolynvs
Copy link
Collaborator

When the vendored or local copy of a dependency has been dirtied, in this case with untracked files, I would think that dep shouldn't care, and just repave it with the desired revision?

I dug through Masterminds/vcs and didn't find anything that would fix a dirty local copy, e.g. git reset --hard. My first guess on how best to fix this was to add a Reset function to Masterminds/vcs, and then call it invcs_repo.go before calling UpdateVersion. Though another alternative would be to handle this error by deleting/re-cloning. @sdboyer Am I on the right track?

@elliots
Copy link
Author

elliots commented May 23, 2017

I think this may have something to do with the file mode changing. I saw something similar when changing branches on my own repo, with the same files vendored.

@sdboyer
Copy link
Member

sdboyer commented May 23, 2017

Hmm...those errors aren't coming out of anything on GOPATH/src. They're coming from the repo in the source cache - GOPATH/pkg/dep/sources/https---github.com-Azure-azure-sdk-for-go. It appears that somehow, normal checkout operations caused that repo to dirty its working tree. This should not be possible.

My first thought is something like #553. @elliots, could you have a look at that directory and see what the actual state of the dirty tree is?

Though another alternative would be to handle this error by deleting/re-cloning.

Yeah, I hope we can add this - #596.

@mikijov
Copy link
Contributor

mikijov commented Jun 27, 2017

@carolynvs, from what I can see, we are calling git directly in vcs_repo.go. You should be able to call git clean -fxd :/ or anything you want. I see runFromCwd and runFromRepoDir being used for this purpose.

@elliots I am unable to reproduce this either by following your steps, nor by manually adding and editing files in the azure vendor or GOPATH location. Can you plese confirm if you still see this. BTW, I am using latest dep.

@thomastaylor312
Copy link

I am having the same problem with 0.3.0:

ensure Solve(): No versions of k8s.io/kubernetes met constraints:
        v1.7.5: Unable to update checked out version: error: Your local changes to the following files would be overwritten by checkout:

@d1vyank
Copy link

d1vyank commented Oct 16, 2017

Possible workaround: rm -rf $GOPATH/pkg/dep/sources/

@sdboyer
Copy link
Member

sdboyer commented Oct 16, 2017

Possible workaround: rm -rf $GOPATH/pkg/dep/sources/

yeah, this is nigh-guaranteed to work if you have this problem - this is a symptom of corruption in the cache area, which can happen if you ctrl-C at a moment when underlying git processes are unhappy with it (i don't know why git can't clean up better after itself 😢).

we're thinking about putting some adaptive bad-state detection processes into place which should help a lot of these problems go away.

@sdboyer
Copy link
Member

sdboyer commented Oct 17, 2017

i just threw up #1279, which takes a stab at doing the adaptive cleaning.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants