diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-07-17 09:15:44 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-07-17 10:54:28 +0200 |
commit | 7be03775051371df88dc0400cccc20be5e9632c8 (patch) | |
tree | 52a91e3d84f6d98d3e55b2778dcea8b96b3d1bdd /hugolib | |
parent | 439f07eac4706eb11fcaea259f04b3a4e4493fa1 (diff) | |
download | hugo-7be03775051371df88dc0400cccc20be5e9632c8.tar.gz hugo-7be03775051371df88dc0400cccc20be5e9632c8.zip |
deps: Upgrade github.com/bep/gitmap v1.4.0 => v1.6.0 (note)
Closes #8627
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/gitinfo.go | 24 | ||||
-rw-r--r-- | hugolib/hugo_sites.go | 2 |
2 files changed, 21 insertions, 5 deletions
diff --git a/hugolib/gitinfo.go b/hugolib/gitinfo.go index f0c5dfa27..6b5261084 100644 --- a/hugolib/gitinfo.go +++ b/hugolib/gitinfo.go @@ -14,11 +14,13 @@ package hugolib import ( + "io" "path/filepath" "strings" "github.com/bep/gitmap" - "github.com/gohugoio/hugo/config" + "github.com/gohugoio/hugo/common/hexec" + "github.com/gohugoio/hugo/deps" "github.com/gohugoio/hugo/resources/page" "github.com/gohugoio/hugo/source" ) @@ -38,10 +40,24 @@ func (g *gitInfo) forPage(p page.Page) source.GitInfo { return source.NewGitInfo(*gi) } -func newGitInfo(conf config.AllProvider) (*gitInfo, error) { - workingDir := conf.BaseConfig().WorkingDir +func newGitInfo(d *deps.Deps) (*gitInfo, error) { + opts := gitmap.Options{ + Repository: d.Conf.BaseConfig().WorkingDir, + GetGitCommandFunc: func(stdout, stderr io.Writer, args ...string) (gitmap.Runner, error) { + var argsv []any + for _, arg := range args { + argsv = append(argsv, arg) + } + argsv = append( + argsv, + hexec.WithStdout(stdout), + hexec.WithStderr(stderr), + ) + return d.ExecHelper.New("git", argsv...) + }, + } - gitRepo, err := gitmap.Map(workingDir, "") + gitRepo, err := gitmap.Map(opts) if err != nil { return nil, err } diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index 25a79d65a..659a772f2 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -346,7 +346,7 @@ func (h *HugoSites) GetContentPage(filename string) page.Page { func (h *HugoSites) loadGitInfo() error { if h.Configs.Base.EnableGitInfo { - gi, err := newGitInfo(h.Conf) + gi, err := newGitInfo(h.Deps) if err != nil { h.Log.Errorln("Failed to read Git log:", err) } else { |