Skip to content

Commit

Permalink
Merge pull request #540 from Masterminds/fix/529
Browse files Browse the repository at this point in the history
Fixed #529: --delete flag deletes and redownloads transitive deps
  • Loading branch information
mattfarina authored Aug 8, 2016
2 parents f3388d1 + e205789 commit 015133a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
This skips unnecessary network requests (thanks @hori-ryota)

## Fixed
- #529: --delete flag deleted and re-downloaded transitive dependencies
- #535: Resolve vendor directory symlinks (thanks @Fugiman)

# Release 0.11.1 (2016-07-21)
Expand Down
15 changes: 7 additions & 8 deletions action/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ func Install(installer *repo.Installer, strip, stripVendor bool) {
msg.Warn("Lock file may be out of date. Hash check of YAML failed. You may need to run 'update'")
}

// Delete unused packages
if installer.DeleteUnused {
// It's unclear whether this should operate off of the lock, or off
// of the glide.yaml file. I'd think that doing this based on the
// lock would be much more reliable.
dependency.DeleteUnused(conf)
}

// Install
newConf, err := installer.Install(lock, conf)
if err != nil {
Expand All @@ -63,6 +55,13 @@ func Install(installer *repo.Installer, strip, stripVendor bool) {
msg.Err("Failed to set references: %s (Skip to cleanup)", err)
}

// Delete unused packages
if installer.DeleteUnused {
// newConf is calculated based on the lock file so it should be
// accurate to the project list.
dependency.DeleteUnused(newConf)
}

// VendoredCleanup. This should ONLY be run if UpdateVendored was specified.
// When stripping VCS happens this will happen as well. No need for double
// effort.
Expand Down
11 changes: 6 additions & 5 deletions action/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ func Update(installer *repo.Installer, skipRecursive, strip, stripVendor bool) {
EnsureVendorDir()
conf := EnsureConfig()

// Delete unused packages
if installer.DeleteUnused {
dependency.DeleteUnused(conf)
}

// Try to check out the initial dependencies.
if err := installer.Checkout(conf); err != nil {
msg.Die("Failed to do initial checkout of config: %s", err)
Expand Down Expand Up @@ -59,6 +54,12 @@ func Update(installer *repo.Installer, skipRecursive, strip, stripVendor bool) {
msg.Err("Failed to set references: %s (Skip to cleanup)", err)
}
}

// Delete unused packages
if installer.DeleteUnused {
dependency.DeleteUnused(confcopy)
}

// Vendored cleanup
// VendoredCleanup. This should ONLY be run if UpdateVendored was specified.
// When stripping VCS happens this will happen as well. No need for double
Expand Down
3 changes: 3 additions & 0 deletions dependency/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func DeleteUnused(conf *cfg.Config) error {
for _, dep := range conf.Imports {
pkgList = append(pkgList, dep.Name)
}
for _, dep := range conf.DevImports {
pkgList = append(pkgList, dep.Name)
}

var searchPath string
var markForDelete []string
Expand Down

0 comments on commit 015133a

Please sign in to comment.