diff options
author | Razon Yang <[email protected]> | 2023-10-22 22:32:01 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-10-22 16:32:01 +0200 |
commit | de4e466036026e9a5805155f00882b93267231b5 (patch) | |
tree | 804b6f73073205d3e23897cd32b4768d77e8c3c5 /modules | |
parent | c23a0c4a0f468c718f6783b3498d0aa9801d00bf (diff) | |
download | hugo-de4e466036026e9a5805155f00882b93267231b5.tar.gz hugo-de4e466036026e9a5805155f00882b93267231b5.zip |
Fix so hugo get -u updates transitively
Diffstat (limited to 'modules')
-rw-r--r-- | modules/client.go | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/modules/client.go b/modules/client.go index b41ca142a..b9a2a48d4 100644 --- a/modules/client.go +++ b/modules/client.go @@ -318,14 +318,33 @@ func (c *Client) Get(args ...string) error { patch := update && (args[0] == "-u=patch") // // We need to be explicit about the modules to get. - for _, m := range c.moduleConfig.Imports { - if !isProbablyModule(m.Path) { - // Skip themes/components stored below /themes etc. - // There may be false positives in the above, but those - // should be rare, and they will fail below with an - // "cannot find module providing ..." message. - continue + var modules []string + // Update all active modules if the -u flag presents. + if update { + mc, coll := c.collect(true) + if coll.err != nil { + return coll.err } + for _, m := range mc.AllModules { + if m.Owner() == nil { + continue + } + modules = append(modules, m.Path()) + } + } else { + for _, m := range c.moduleConfig.Imports { + if !isProbablyModule(m.Path) { + // Skip themes/components stored below /themes etc. + // There may be false positives in the above, but those + // should be rare, and they will fail below with an + // "cannot find module providing ..." message. + continue + } + modules = append(modules, m.Path) + } + } + + for _, m := range modules { var args []string if update && !patch { @@ -333,7 +352,7 @@ func (c *Client) Get(args ...string) error { } else if update && patch { args = append(args, "-u=patch") } - args = append(args, m.Path) + args = append(args, m) if err := c.get(args...); err != nil { return err |