This new type defers computation of the actual prune value for a given
project until the method is called, rather than trying to precompute it.
By deferring computation, we retain full fidelity on the original
cascading inputs.
Still a WIP hack - need to clean up, and make everything actually use this.
This merge incorporates the long-running branch that consolidated all
the work related to absorbing dep prune into dep ensure. As of this
commit, dep prune is now a hidden dummy command, and dep ensure does all
the heavy lifting automatically.
This allows people to run go test ./... -update, without this
in order to do a mass update of golden files you need to run the
update against individual packages which is a huge pain.
The precise underlying causes of the problem with bzr on Windows is
unclear - it could be just about bzr with Windows, or the version of
bzr, or some underlying system interaction. But it's causing appveyor
tests to erroneously fail, and bzr is so little-used that it's
acceptable to just skip the tests, for now.
We now delete anything that looks like a symlink if its called
"vendor" while pruning.
Hopefully, you didn't make a bad decision by relying on the magical
properties of symlinks.
Signed-off-by: Ibrahim AshShohail <ibra.sho@gmail.com>
source
- main.go: Try to ensure directory for given `cachedir` path.
- context.go: Create the default cache directory, `$GOPATH/pkg/dep`, if the
user did not override it.
- source_manager.go: Use `fs.EnsureDir` instead of `os.MkdirAll` for creating
sources folder in cache directory.
- fs.go:
- Add func `EnsureDir` to create a directory if it does not exist.
- Remove func `IsValidPath`.
test
- integration_test.go: Improve tests for invalid cache directory.
- fs_test.go: Add test for `EnsureDir`, remove test for `IsValidPath`.
- manager_test.go: fix TestSourceManagerInit
- Re-create cache directory before trying to call `NewSourceManager` the 2nd
time and defer it's removal.
- If `NewSourceManager` fails the 2nd time, exit the error using `t.Fatal` to
avoid panic in `sm.Release`
misc
- language - {fallback => default} for cachedir
source
- main.go: Read and use env var `DEPCACHEDIR` for instantiating dep context.
- context.go:
- Add field `Cachedir` to struct `Ctx`. This holds the value of env var
`DEPCACHEDIR`.
- Use `Ctx.Cachedir` while instantiating `gps.SourceMgr` if present, fallback
to `$GOPATH/pkg/dep` otherwise.
- source_manager.go: Add a getter func `Cachedir` to facilitate testing in
`context_test.go`.
test
- context_test.go Add test to check `gps.SourceMgr` is instantiated with
appropriate `cachedir`.
- integration_test.go: Add test to check environment variable `DEPCACHEDIR` is
loaded and used if present.
misc
- update changelog
This is crude, but it will restore output context to various git errors,
which has been crippling. We desperately need to work on formatting
these errors better.
`git ls-remote` was being run without a current working directory, which
- for some versions of git - has the unfortunate side effect of still
looking for a local .git in the cwd hierarchy, and failing if that .git
is a file instead of a directory (as it might be if the user is working
beneath a git submodule).
This relocates the call to somewhere safer, under gps' control, so that
we've a better (though not foolproof) guarantee of not colliding with a
.git file.
Fixes#1338.
In some places, we assume that the error returned
from another call is already wrapped with a clear error message.
These extra wraps make it clear that init failed.