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

dep gets confused by internal git environment variables #1871

Closed
sigma opened this issue May 22, 2018 · 0 comments · Fixed by #1872
Closed

dep gets confused by internal git environment variables #1871

sigma opened this issue May 22, 2018 · 0 comments · Fixed by #1872

Comments

@sigma
Copy link
Contributor

sigma commented May 22, 2018

What version of dep are you using (dep version)?

version 0.4.1

What dep command did you run?

~/tmp/gopath/src/github.com/sdboyer/deptestdos
❯ ls
deptestdos.go  README.md

~/tmp/gopath/src/github.com/sdboyer/deptestdos
❯ export GIT_DIR=`pwd`/.git

❯ dep init -v
Getting direct dependencies...
Checked 1 directories for packages.
Found 1 direct dependencies.
Root project is "github.com/sdboyer/deptestdos"
 1 transitively valid internal packages
 1 external packages imported from 1 projects
(0)   ✓ select (root)
(1)	? attempt github.com/sdboyer/deptest with 1 pkgs; 4 versions to try
(1)	    try github.com/sdboyer/[email protected]
(1)	✗   unable to update checked out version: fatal: reference is not a tree: ff2948a2ac8f538c4ecd55962e919d1e13e74baf
(1)	  : command failed: [git checkout ff2948a2ac8f538c4ecd55962e919d1e13e74baf]: exit status 128
(1)	    try github.com/sdboyer/[email protected]
(1)	✗   unable to update checked out version: fatal: reference is not a tree: 3f4c3bea144e112a69bbe5d8d01c1b09a544253f
(1)	  : command failed: [git checkout 3f4c3bea144e112a69bbe5d8d01c1b09a544253f]: exit status 128
(1)	    try github.com/sdboyer/[email protected]
(1)	✗   unable to update checked out version: fatal: reference is not a tree: ff2948a2ac8f538c4ecd55962e919d1e13e74baf
(1)	  : command failed: [git checkout ff2948a2ac8f538c4ecd55962e919d1e13e74baf]: exit status 128
(1)	    try github.com/sdboyer/deptest@master
(1)	✗   unable to update checked out version: fatal: reference is not a tree: 3f4c3bea144e112a69bbe5d8d01c1b09a544253f
(1)	  : command failed: [git checkout 3f4c3bea144e112a69bbe5d8d01c1b09a544253f]: exit status 128
(1)	  ← no more versions of github.com/sdboyer/deptest to try; begin backtrack
  ✗ solving failed

Solver wall times by segment:
     b-source-exists: 517.514251ms
         b-list-pkgs:  11.015016ms
            new-atom:    166.844µs
             satisfy:    108.747µs
         select-root:     68.589µs
     b-list-versions:     30.368µs
               other:     14.179µs
  b-deduce-proj-root:      3.584µs

  TOTAL: 528.921578ms

init failed: unable to solve the dependency graph: Solving failure: No versions of github.com/sdboyer/deptest met constraints:
	v1.0.0: unable to update checked out version: fatal: reference is not a tree: ff2948a2ac8f538c4ecd55962e919d1e13e74baf
: command failed: [git checkout ff2948a2ac8f538c4ecd55962e919d1e13e74baf]: exit status 128
	v0.8.1: unable to update checked out version: fatal: reference is not a tree: 3f4c3bea144e112a69bbe5d8d01c1b09a544253f
: command failed: [git checkout 3f4c3bea144e112a69bbe5d8d01c1b09a544253f]: exit status 128
	v0.8.0: unable to update checked out version: fatal: reference is not a tree: ff2948a2ac8f538c4ecd55962e919d1e13e74baf
: command failed: [git checkout ff2948a2ac8f538c4ecd55962e919d1e13e74baf]: exit status 128
	master: unable to update checked out version: fatal: reference is not a tree: 3f4c3bea144e112a69bbe5d8d01c1b09a544253f
: command failed: [git checkout 3f4c3bea144e112a69bbe5d8d01c1b09a544253f]: exit status 128

What did you expect to see?

dep init should succeed regardless of how the current git repository is handled (in this case, with an explicit $GIT_DIR).
Note that this is exactly what happens when running something like

git rebase -x ./hack/test.bash origin/master

in order to validate a series of commits.

And since some dep tests actually change the repo "under test", this has unfortunate side-effects (an innocent one being your user.name being changed to "Test author" because of gps/vcs_source_test.go, which is... pretty confusing at first)

What did you see instead?

dep gets very confused, and tries to find dependencies' objects in the main repository's $GIT_DIR, despite the fact that it cloned those dependencies elsewhere.
Note that messing with other GIT_* variables leads to different but related failures, so there's a need to selectively cleanup those.

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

Successfully merging a pull request may close this issue.

1 participant