Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package chezmoi for openSUSE:Factory checked in at 2022-12-23 10:21:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/chezmoi (Old) and /work/SRC/openSUSE:Factory/.chezmoi.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "chezmoi" Fri Dec 23 10:21:36 2022 rev:8 rq:1044319 version:2.28.0 Changes: -------- --- /work/SRC/openSUSE:Factory/chezmoi/chezmoi.changes 2022-12-07 17:36:44.073120480 +0100 +++ /work/SRC/openSUSE:Factory/.chezmoi.new.1563/chezmoi.changes 2022-12-23 10:21:44.771564214 +0100 @@ -1,0 +2,9 @@ +Thu Dec 22 17:15:35 UTC 2022 - Filippo Bonazzi <filippo.bona...@suse.com> + +- Update to version 2.28.0: + * feat: Add lstat template function + * feat: Add --path-style option to managed and unmanaged commands + * feat: Add verification of external checksums + * chore: Update dependencies + +------------------------------------------------------------------- Old: ---- chezmoi-2.27.3.obscpio New: ---- chezmoi-2.28.0.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ chezmoi.spec ++++++ --- /var/tmp/diff_new_pack.c7Stzc/_old 2022-12-23 10:21:45.587568877 +0100 +++ /var/tmp/diff_new_pack.c7Stzc/_new 2022-12-23 10:21:45.591568900 +0100 @@ -17,7 +17,7 @@ Name: chezmoi -Version: 2.27.3 +Version: 2.28.0 Release: 0 Summary: A multi-host manager for dotfiles License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.c7Stzc/_old 2022-12-23 10:21:45.635569152 +0100 +++ /var/tmp/diff_new_pack.c7Stzc/_new 2022-12-23 10:21:45.639569174 +0100 @@ -2,7 +2,7 @@ <service name="obs_scm" mode="manual"> <param name="scm">git</param> <param name="url">https://github.com/twpayne/chezmoi.git</param> - <param name="revision">v2.27.3</param> + <param name="revision">v2.28.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.c7Stzc/_old 2022-12-23 10:21:45.667569334 +0100 +++ /var/tmp/diff_new_pack.c7Stzc/_new 2022-12-23 10:21:45.671569357 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/twpayne/chezmoi.git</param> - <param name="changesrevision">feab4e788831e803d84a544739dfb8188245deae</param></service></servicedata> + <param name="changesrevision">8e9ed2eee04b708b4d7531863e47b5c5a876050f</param></service></servicedata> (No newline at EOF) ++++++ chezmoi-2.27.3.obscpio -> chezmoi-2.28.0.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/.github/workflows/main.yml new/chezmoi-2.28.0/.github/workflows/main.yml --- old/chezmoi-2.27.3/.github/workflows/main.yml 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/.github/workflows/main.yml 2022-12-13 21:48:41.000000000 +0100 @@ -10,7 +10,7 @@ - v* env: AGE_VERSION: 1.0.0 - GO_VERSION: 1.19.3 + GO_VERSION: 1.19.4 GOFUMPT_VERSION: 0.4.0 GOLANGCI_LINT_VERSION: 1.50.1 GOVERSIONINFO_VERSION: 1.4.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/commands/managed.md new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/commands/managed.md --- old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/commands/managed.md 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/commands/managed.md 2022-12-13 21:48:41.000000000 +0100 @@ -4,6 +4,11 @@ alphabetical order. When no *path*s are supplied, list all managed entries in the destination directory in alphabetical order. +## `-p`, `--path-style` `absolute`|`relative` + +Print paths in the given style. Relative paths are relative to the destination +directory. The default is `relative`. + !!! example ```console diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/commands/unmanaged.md new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/commands/unmanaged.md --- old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/commands/unmanaged.md 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/commands/unmanaged.md 2022-12-13 21:48:41.000000000 +0100 @@ -5,6 +5,11 @@ It is an error to supply *path*s that are not found on the filesystem. +## `-p`, `--path-style` `absolute`|`relative` + +Print paths in the given style. Relative paths are relative to the destination +directory. The default is `relative`. + !!! example ```console diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiexternal-format.md new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiexternal-format.md --- old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiexternal-format.md 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/special-files-and-directories/chezmoiexternal-format.md 2022-12-13 21:48:41.000000000 +0100 @@ -35,6 +35,14 @@ | `refreshPeriod` | duration | `0` | Refresh period | | `stripComponents` | int | `0` | Number of leading directory components to strip from archives | | `url` | string | *none* | URL | +| `checksum.sha256` | string | *none* | Expected SHA256 checksum of data | +| `checksum.sha384` | string | *none* | Expected SHA384 checksum of data | +| `checksum.sha512` | string | *none* | Expected SHA512 checksum of data | +| `checksum.size` | int | *none* | Expected size of data | + +If any of the optional `checksum.sha256`, `checksum.sha384`, or +`checksum.sha512` fields are set, chezmoi will verify that the downloaded data +has the given checksum. The optional boolean `encrypted` field specifies whether the file or archive is encrypted. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/target-types.md new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/target-types.md --- old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/target-types.md 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/target-types.md 2022-12-13 21:48:41.000000000 +0100 @@ -161,7 +161,7 @@ If you intend to use PowerShell Core (`pwsh.exe`) as the `.ps1` interpreter, include the following in your config file: - ```toml title="~/.confg/chezmoi/chezmoi.toml" + ```toml title="~/.config/chezmoi/chezmoi.toml" [interpreters.ps1] command = "pwsh" args = ["-NoLogo"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/templates/functions/lstat.md new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/templates/functions/lstat.md --- old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/templates/functions/lstat.md 1970-01-01 01:00:00.000000000 +0100 +++ new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/templates/functions/lstat.md 2022-12-13 21:48:41.000000000 +0100 @@ -0,0 +1,19 @@ +# `lstat` *name* + +`lstat` runs [`os.Lstat`](https://pkg.go.dev/os#File.Lstat) on *name*. If *name* +exists it returns structured data. If *name* does not exist then it returns a +false value. If `os.Lstat` returns any other error then it raises an error. The +structured value returned if *name* exists contains the fields `name`, `size`, +`mode`, `perm`, `modTime`, `isDir`, and `type`. + +`lstat` is not hermetic: its return value depends on the state of the filesystem +at the moment the template is executed. Exercise caution when using it in your +templates. + +!!! example + + ``` + {{ if eq (joinPath .chezmoi.homeDir ".xinitrc" | lstat).type "symlink" }} + # ~/.xinitrc exists and is a symlink + {{ end }} + ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/templates/functions/stat.md new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/templates/functions/stat.md --- old/chezmoi-2.27.3/assets/chezmoi.io/docs/reference/templates/functions/stat.md 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/assets/chezmoi.io/docs/reference/templates/functions/stat.md 2022-12-13 21:48:41.000000000 +0100 @@ -4,7 +4,7 @@ exists it returns structured data. If *name* does not exist then it returns a false value. If `os.Stat` returns any other error then it raises an error. The structured value returned if *name* exists contains the fields `name`, `size`, -`mode`, `perm`, `modTime`, and `isDir`. +`mode`, `perm`, `modTime`, `isDir`, and `type`. `stat` is not hermetic: its return value depends on the state of the filesystem at the moment the template is executed. Exercise caution when using it in your diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/chezmoi.io/mkdocs.yml new/chezmoi-2.28.0/assets/chezmoi.io/mkdocs.yml --- old/chezmoi-2.27.3/assets/chezmoi.io/mkdocs.yml 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/assets/chezmoi.io/mkdocs.yml 2022-12-13 21:48:41.000000000 +0100 @@ -187,6 +187,7 @@ - ioreg: reference/templates/functions/ioreg.md - joinPath: reference/templates/functions/joinPath.md - lookPath: reference/templates/functions/lookPath.md + - lstat: reference/templates/functions/lstat.md - mozillaInstallHash: reference/templates/functions/mozillaInstallHash.md - output: reference/templates/functions/output.md - quoteList: reference/templates/functions/quoteList.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/docker/test.sh new/chezmoi-2.28.0/assets/docker/test.sh --- old/chezmoi-2.27.3/assets/docker/test.sh 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/assets/docker/test.sh 2022-12-13 21:48:41.000000000 +0100 @@ -4,7 +4,7 @@ cd ../.. for distribution in "$@"; do - echo ${distribution} + echo "${distribution}" dockerfile="assets/docker/${distribution}.Dockerfile" if [ ! -f "${dockerfile}" ]; then echo "${dockerfile} not found" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/assets/vagrant/test.sh new/chezmoi-2.28.0/assets/vagrant/test.sh --- old/chezmoi-2.27.3/assets/vagrant/test.sh 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/assets/vagrant/test.sh 2022-12-13 21:48:41.000000000 +0100 @@ -3,7 +3,7 @@ set -eufo pipefail for os in "$@"; do - echo ${os} + echo "${os}" if [ ! -f "${os}.Vagrantfile" ]; then echo "${os}.Vagrantfile not found" exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/go.mod new/chezmoi-2.28.0/go.mod --- old/chezmoi-2.27.3/go.mod 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/go.mod 2022-12-13 21:48:41.000000000 +0100 @@ -15,8 +15,8 @@ github.com/charmbracelet/glamour v0.6.0 github.com/coreos/go-semver v0.3.0 github.com/fsnotify/fsnotify v1.6.0 - github.com/go-git/go-git/v5 v5.5.0 - github.com/google/go-github/v48 v48.1.0 + github.com/go-git/go-git/v5 v5.5.1 + github.com/google/go-github/v48 v48.2.0 github.com/google/renameio/v2 v2.0.0 github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 github.com/mitchellh/mapstructure v1.5.0 @@ -37,15 +37,16 @@ github.com/zalando/go-keyring v0.2.1 go.etcd.io/bbolt v1.3.7-0.20220226045046-fd5535f71f48 go.uber.org/multierr v1.8.0 - golang.org/x/exp v0.0.0-20221204150635-6dcec336b2bb - golang.org/x/oauth2 v0.2.0 + golang.org/x/crypto v0.4.0 + golang.org/x/exp v0.0.0-20221211140036-ad323defaf05 + golang.org/x/oauth2 v0.3.0 golang.org/x/sync v0.1.0 golang.org/x/sys v0.3.0 - golang.org/x/term v0.2.0 + golang.org/x/term v0.3.0 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 howett.net/plist v1.0.0 - mvdan.cc/sh/v3 v3.5.1 + mvdan.cc/sh/v3 v3.6.0 ) require ( @@ -116,11 +117,10 @@ github.com/yuin/goldmark v1.5.3 // indirect github.com/yuin/goldmark-emoji v1.0.1 // indirect go.uber.org/atomic v1.10.0 // indirect - golang.org/x/crypto v0.3.0 // indirect golang.org/x/mod v0.7.0 // indirect - golang.org/x/net v0.2.0 // indirect + golang.org/x/net v0.4.0 // indirect golang.org/x/text v0.5.0 // indirect - golang.org/x/tools v0.3.0 // indirect + golang.org/x/tools v0.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/go.sum new/chezmoi-2.28.0/go.sum --- old/chezmoi-2.27.3/go.sum 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/go.sum 2022-12-13 21:48:41.000000000 +0100 @@ -88,7 +88,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7hqDjlFjiygg= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= @@ -100,7 +100,7 @@ github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= @@ -111,8 +111,8 @@ github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-git-fixtures/v4 v4.3.1 h1:y5z6dd3qi8Hl+stezc8p3JxDkoTRqMAlKnXHuzrfjTQ= github.com/go-git/go-git-fixtures/v4 v4.3.1/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo= -github.com/go-git/go-git/v5 v5.5.0 h1:StO/ASRvk1Pp74tr7XQ0pQwKlCFignzzTF/NLKdQzUE= -github.com/go-git/go-git/v5 v5.5.0/go.mod h1:g456XI30HAdt7GQtIf8JR6GDAdULGaR4KtfFtQa0uTg= +github.com/go-git/go-git/v5 v5.5.1 h1:5vtv2TB5PM/gPM+EvsHJ16hJh4uAkdGcKilcwY7FYwo= +github.com/go-git/go-git/v5 v5.5.1/go.mod h1:uz5PQ3d0gz7mSgzZhSJToM6ALPaKCdSnl58/Xb5hzr8= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= @@ -129,11 +129,10 @@ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v48 v48.1.0 h1:nqPqq+0oRY2AMR/SRskGrrP4nnewPB7e/m2+kbT/UvM= -github.com/google/go-github/v48 v48.1.0/go.mod h1:dDlehKBDo850ZPvCTK0sEqTCVWcrGl2LcDiajkYi89Y= +github.com/google/go-github/v48 v48.2.0 h1:68puzySE6WqUY9KWmpOsDEQfDZsso98rT6pZcz9HqcE= +github.com/google/go-github/v48 v48.2.0/go.mod h1:dDlehKBDo850ZPvCTK0sEqTCVWcrGl2LcDiajkYi89Y= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/renameio v1.0.1 h1:Lh/jXZmvZxb0BBeSY5VKEfidcbcbenKjZFzM/q0fSeU= github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg= github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -165,7 +164,7 @@ github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -224,7 +223,6 @@ github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pjbgf/sha1cd v0.2.0/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M= github.com/pjbgf/sha1cd v0.2.3 h1:uKQP/7QOzNtKYH7UTohZLcjF5/55EnTw0jO/Ru4jZwI= github.com/pjbgf/sha1cd v0.2.3/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= @@ -288,7 +286,6 @@ github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I= github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k= -github.com/xanzy/ssh-agent v0.3.2/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -312,10 +309,11 @@ golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/exp v0.0.0-20221204150635-6dcec336b2bb h1:QIsP/NmClBICkqnJ4rSIhnrGiGR7Yv9ZORGGnmmLTPk= -golang.org/x/exp v0.0.0-20221204150635-6dcec336b2bb/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= +golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= +golang.org/x/exp v0.0.0-20221211140036-ad323defaf05 h1:T8EldfGCcveFMewH5xAYxxoX3PSQMrsechlUGVFlQBU= +golang.org/x/exp v0.0.0-20221211140036-ad323defaf05/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= @@ -326,10 +324,11 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/oauth2 v0.2.0 h1:GtQkldQ9m7yvzCL1V+LrYow3Khe0eJH0w7RbX/VbaIU= -golang.org/x/oauth2 v0.2.0/go.mod h1:Cwn6afJ8jrQwYMxQDTpISoXmXW9I6qF6vDeuuoX3Ibs= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8= +golang.org/x/oauth2 v0.3.0/go.mod h1:rQrIauxkUhJ6CuwEXwymO2/eh4xz2ZWF1nBkcxS+tGk= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= @@ -362,8 +361,9 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -375,11 +375,11 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= -golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= +golang.org/x/tools v0.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= @@ -391,7 +391,6 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -412,5 +411,5 @@ howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= mvdan.cc/editorconfig v0.2.0 h1:XL+7ys6ls/RKrkUNFQvEwIvNHh+JKx8Mj1pUV5wQxQE= -mvdan.cc/sh/v3 v3.5.1 h1:hmP3UOw4f+EYexsJjFxvU38+kn+V/s2CclXHanIBkmQ= -mvdan.cc/sh/v3 v3.5.1/go.mod h1:1JcoyAKm1lZw/2bZje/iYKWicU/KMd0rsyJeKHnsK4E= +mvdan.cc/sh/v3 v3.6.0 h1:gtva4EXJ0dFNvl5bHjcUEvws+KRcDslT8VKheTYkbGU= +mvdan.cc/sh/v3 v3.6.0/go.mod h1:U4mhtBLZ32iWhif5/lD+ygy1zrgaQhUu+XFy7C8+TTA= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/chezmoi/chezmoi.go new/chezmoi-2.28.0/pkg/chezmoi/chezmoi.go --- old/chezmoi-2.27.3/pkg/chezmoi/chezmoi.go 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/chezmoi/chezmoi.go 2022-12-13 21:48:41.000000000 +0100 @@ -4,7 +4,10 @@ import ( "bufio" "bytes" + "crypto/md5" //nolint:gosec + "crypto/sha1" //nolint:gosec "crypto/sha256" + "crypto/sha512" "fmt" "io" "io/fs" @@ -17,6 +20,7 @@ "github.com/spf13/cobra" vfs "github.com/twpayne/go-vfs/v4" + "golang.org/x/crypto/ripemd160" //nolint:staticcheck "golang.org/x/exp/constraints" "golang.org/x/exp/maps" "golang.org/x/exp/slices" @@ -115,7 +119,7 @@ "chezmoistate.boltdb", ) -var modeTypeNames = map[fs.FileMode]string{ +var FileModeTypeNames = map[fs.FileMode]string{ 0: "file", fs.ModeDir: "dir", fs.ModeSymlink: "symlink", @@ -295,9 +299,15 @@ return len(bytes.TrimSpace(data)) == 0 } +// md5Sum returns the MD5 sum of data. +func md5Sum(data []byte) []byte { + md5SumArr := md5.Sum(data) //nolint:gosec + return md5SumArr[:] +} + // modeTypeName returns a string representation of mode. func modeTypeName(mode fs.FileMode) string { - if name, ok := modeTypeNames[mode.Type()]; ok { + if name, ok := FileModeTypeNames[mode.Type()]; ok { return name } return fmt.Sprintf("0o%o: unknown type", mode.Type()) @@ -321,6 +331,29 @@ return s[:len(s)-len(suffix)] } +// ripemd160Sum returns the RIPEMD-160 sum of data. +func ripemd160Sum(data []byte) []byte { + return ripemd160.New().Sum(data) +} + +// sha1Sum returns the SHA1 sum of data. +func sha1Sum(data []byte) []byte { + sha1SumArr := sha1.Sum(data) //nolint:gosec + return sha1SumArr[:] +} + +// sha384Sum returns the SHA384 sum of data. +func sha384Sum(data []byte) []byte { + sha384SumArr := sha512.Sum384(data) + return sha384SumArr[:] +} + +// sha512Sum returns the SHA512 sum of data. +func sha512Sum(data []byte) []byte { + sha512SumArr := sha512.Sum512(data) + return sha512SumArr[:] +} + // sortedKeys returns the keys of V in order. func sortedKeys[K constraints.Ordered, V any](m map[K]V) []K { keys := maps.Keys(m) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/chezmoi/sourcestate.go new/chezmoi-2.28.0/pkg/chezmoi/sourcestate.go --- old/chezmoi-2.27.3/pkg/chezmoi/sourcestate.go 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/chezmoi/sourcestate.go 2022-12-13 21:48:41.000000000 +0100 @@ -59,7 +59,16 @@ Encrypted bool `json:"encrypted" toml:"encrypted" yaml:"encrypted"` Exact bool `json:"exact" toml:"exact" yaml:"exact"` Executable bool `json:"executable" toml:"executable" yaml:"executable"` - Clone struct { + Checksum struct { + MD5 HexBytes `json:"md5" toml:"md5" yaml:"md5"` + RIPEMD160 HexBytes `json:"ripemd160" toml:"ripemd160" yaml:"ripemd160"` + SHA1 HexBytes `json:"sha1" toml:"sha1" yaml:"sha1"` + SHA256 HexBytes `json:"sha256" toml:"sha256" yaml:"sha256"` + SHA384 HexBytes `json:"sha384" toml:"sha384" yaml:"sha384"` + SHA512 HexBytes `json:"sha512" toml:"sha512" yaml:"sha512"` + Size int `json:"size" toml:"size" yaml:"size"` + } `json:"checksum" toml:"checksum" yaml:"checksum"` + Clone struct { Args []string `json:"args" toml:"args" yaml:"args"` } `json:"clone" toml:"clone" yaml:"clone"` Exclude []string `json:"exclude" toml:"exclude" yaml:"exclude"` @@ -1371,6 +1380,59 @@ return nil, err } + if external.Checksum.Size != 0 { + if len(data) != external.Checksum.Size { + err = multierr.Append(err, fmt.Errorf("size mismatch: expected %d, got %d", + external.Checksum.Size, len(data))) + } + } + + if external.Checksum.MD5 != nil { + if gotMD5Sum := md5Sum(data); !bytes.Equal(gotMD5Sum, external.Checksum.MD5) { + err = multierr.Append(err, fmt.Errorf("MD5 mismatch: expected %s, got %s", + external.Checksum.MD5, hex.EncodeToString(gotMD5Sum))) + } + } + + if external.Checksum.RIPEMD160 != nil { + if gotRIPEMD160Sum := ripemd160Sum(data); !bytes.Equal(gotRIPEMD160Sum, external.Checksum.RIPEMD160) { + err = multierr.Append(err, fmt.Errorf("RIPEMD-160 mismatch: expected %s, got %s", + external.Checksum.RIPEMD160, hex.EncodeToString(gotRIPEMD160Sum))) + } + } + + if external.Checksum.SHA1 != nil { + if gotSHA1Sum := sha1Sum(data); !bytes.Equal(gotSHA1Sum, external.Checksum.SHA1) { + err = multierr.Append(err, fmt.Errorf("SHA1 mismatch: expected %s, got %s", + external.Checksum.SHA1, hex.EncodeToString(gotSHA1Sum))) + } + } + + if external.Checksum.SHA256 != nil { + if gotSHA256Sum := SHA256Sum(data); !bytes.Equal(gotSHA256Sum, external.Checksum.SHA256) { + err = multierr.Append(err, fmt.Errorf("SHA256 mismatch: expected %s, got %s", + external.Checksum.SHA256, hex.EncodeToString(gotSHA256Sum))) + } + } + + if external.Checksum.SHA384 != nil { + if gotSHA384Sum := sha384Sum(data); !bytes.Equal(gotSHA384Sum, external.Checksum.SHA384) { + err = multierr.Append(err, fmt.Errorf("SHA384 mismatch: expected %s, got %s", + external.Checksum.SHA384, hex.EncodeToString(gotSHA384Sum))) + } + } + + if external.Checksum.SHA512 != nil { + if gotSHA512Sum := sha512Sum(data); !bytes.Equal(gotSHA512Sum, external.Checksum.SHA512) { + err = multierr.Append(err, fmt.Errorf("SHA512 mismatch: expected %s, got %s", + external.Checksum.SHA512, hex.EncodeToString(gotSHA512Sum))) + } + } + + if err != nil { + return nil, fmt.Errorf("%s: %w", externalRelPath, err) + } + if external.Encrypted { data, err = s.encryption.Decrypt(data) if err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/config.go new/chezmoi-2.28.0/pkg/cmd/config.go --- old/chezmoi-2.27.3/pkg/cmd/config.go 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/config.go 2022-12-13 21:48:41.000000000 +0100 @@ -168,6 +168,7 @@ remove removeCmdConfig secret secretCmdConfig state stateCmdConfig + unmanaged unmanagedCmdConfig upgrade upgradeCmdConfig // Version information. @@ -307,7 +308,8 @@ recurseSubmodules: true, }, managed: managedCmdConfig{ - filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone), + filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone), + pathStyle: pathStyleRelative, }, mergeAll: mergeAllCmdConfig{ recursive: true, @@ -315,6 +317,9 @@ reAdd: reAddCmdConfig{ filter: chezmoi.NewEntryTypeFilter(chezmoi.EntryTypesAll, chezmoi.EntryTypesNone), }, + unmanaged: unmanagedCmdConfig{ + pathStyle: pathStyleRelative, + }, upgrade: upgradeCmdConfig{ owner: gitHubOwner, repo: gitHubRepo, @@ -369,6 +374,7 @@ "lastpass": c.lastpassTemplateFunc, "lastpassRaw": c.lastpassRawTemplateFunc, "lookPath": c.lookPathTemplateFunc, + "lstat": c.lstatTemplateFunc, "mozillaInstallHash": c.mozillaInstallHashTemplateFunc, "onepassword": c.onepasswordTemplateFunc, "onepasswordDetailsFields": c.onepasswordDetailsFieldsTemplateFunc, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/managedcmd.go new/chezmoi-2.28.0/pkg/cmd/managedcmd.go --- old/chezmoi-2.27.3/pkg/cmd/managedcmd.go 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/managedcmd.go 2022-12-13 21:48:41.000000000 +0100 @@ -11,7 +11,8 @@ ) type managedCmdConfig struct { - filter *chezmoi.EntryTypeFilter + filter *chezmoi.EntryTypeFilter + pathStyle pathStyle } func (c *Config) newManagedCmd() *cobra.Command { @@ -28,8 +29,12 @@ flags := managedCmd.Flags() flags.VarP(c.managed.filter.Exclude, "exclude", "x", "Exclude entry types") flags.VarP(c.managed.filter.Include, "include", "i", "Include entry types") + flags.VarP(&c.managed.pathStyle, "path-style", "p", "Path style") registerExcludeIncludeFlagCompletionFuncs(managedCmd) + if err := managedCmd.RegisterFlagCompletionFunc("path-style", pathStyleFlagCompletionFunc); err != nil { + panic(err) + } return managedCmd } @@ -83,7 +88,12 @@ sort.Sort(targetRelPaths) builder := strings.Builder{} for _, targetRelPath := range targetRelPaths { - fmt.Fprintln(&builder, targetRelPath) + switch c.managed.pathStyle { + case pathStyleAbsolute: + fmt.Fprintln(&builder, c.DestDirAbsPath.Join(targetRelPath)) + case pathStyleRelative: + fmt.Fprintln(&builder, targetRelPath) + } } return c.writeOutputString(builder.String()) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/pathstyle.go new/chezmoi-2.28.0/pkg/cmd/pathstyle.go --- old/chezmoi-2.27.3/pkg/cmd/pathstyle.go 1970-01-01 01:00:00.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/pathstyle.go 2022-12-13 21:48:41.000000000 +0100 @@ -0,0 +1,43 @@ +package cmd + +import ( + "fmt" + + "github.com/twpayne/chezmoi/v2/pkg/chezmoi" +) + +type pathStyle string + +const ( + pathStyleAbsolute pathStyle = "absolute" + pathStyleRelative pathStyle = "relative" +) + +var ( + pathStyleStrings = []string{ + pathStyleAbsolute.String(), + pathStyleRelative.String(), + } + + pathStyleFlagCompletionFunc = chezmoi.FlagCompletionFunc(pathStyleStrings) +) + +// Set implements github.com/spf13/pflag.Value.Set. +func (p *pathStyle) Set(s string) error { + uniqueAbbreviations := chezmoi.UniqueAbbreviations(pathStyleStrings) + pathStyleStr, ok := uniqueAbbreviations[s] + if !ok { + return fmt.Errorf("%s: unknown path style", s) + } + *p = pathStyle(pathStyleStr) + return nil +} + +func (p pathStyle) String() string { + return string(p) +} + +// Type implements github.com/spf13/pflag.Value.Type. +func (p pathStyle) Type() string { + return "absolute|relative" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/templatefuncs.go new/chezmoi-2.28.0/pkg/cmd/templatefuncs.go --- old/chezmoi-2.27.3/pkg/cmd/templatefuncs.go 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/templatefuncs.go 2022-12-13 21:48:41.000000000 +0100 @@ -245,6 +245,17 @@ } } +func (c *Config) lstatTemplateFunc(name string) any { + switch fileInfo, err := c.fileSystem.Lstat(name); { + case err == nil: + return fileInfoToMap(fileInfo) + case errors.Is(err, fs.ErrNotExist): + return nil + default: + panic(err) + } +} + func (c *Config) mozillaInstallHashTemplateFunc(path string) string { mozillaInstallHash, err := mozillainstallhash.MozillaInstallHash(path) if err != nil { @@ -345,14 +356,7 @@ func (c *Config) statTemplateFunc(name string) any { switch fileInfo, err := c.fileSystem.Stat(name); { case err == nil: - return map[string]any{ - "name": fileInfo.Name(), - "size": fileInfo.Size(), - "mode": int(fileInfo.Mode()), - "perm": int(fileInfo.Mode().Perm()), - "modTime": fileInfo.ModTime().Unix(), - "isDir": fileInfo.IsDir(), - } + return fileInfoToMap(fileInfo) case errors.Is(err, fs.ErrNotExist): return nil default: @@ -384,6 +388,18 @@ return string(yaml) } +func fileInfoToMap(fileInfo fs.FileInfo) map[string]any { + return map[string]any{ + "name": fileInfo.Name(), + "size": fileInfo.Size(), + "mode": int(fileInfo.Mode()), + "perm": int(fileInfo.Mode().Perm()), + "modTime": fileInfo.ModTime().Unix(), + "isDir": fileInfo.IsDir(), + "type": chezmoi.FileModeTypeNames[fileInfo.Mode()&fs.ModeType], + } +} + func iniFileToMap(file *ini.File) map[string]any { m := make(map[string]any) for _, section := range file.Sections() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/external.txtar new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/external.txtar --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/external.txtar 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/external.txtar 2022-12-13 21:48:41.000000000 +0100 @@ -84,6 +84,19 @@ # test that duplicate equivalent directories are allowed exec chezmoi apply --force +chhome home10/user + +# test that checksums are verified +exec chezmoi apply --force +cp $HOME/.file golden/.file + +chhome home11/user + +# test that checksums detect corrupt files +! exec chezmoi apply --force +stderr 'MD5 mismatch' +stderr 'SHA256 mismatch' + -- archive/dir/file -- # contents of dir/file -- golden/.file -- @@ -99,6 +112,24 @@ [".file"] type = "file" url = "{{ env "HTTPD_URL" }}/.file" +-- home10/user/.local/share/chezmoi/.chezmoiexternal.yaml -- +.file: + type: file + url: {{ env "HTTPD_URL" }}/.file + checksum: + size: 20 + md5: 49fe9018f97349cdd0a0ac7b7f668b05 + ripemd160: 2320636f6e74656e7473206f66202e66696c650a9c1185a5c5e9fc54612808977ee8f548b2258d31 + sha1: cb91d72dc73f6d984b33ac5745f1cf6f76745bd2 + sha256: 634a4dd193c7b3b926d2e08026aa81a416fd41cec52854863b974af422495663 + sha384: f8545bb66433eb514727bbc61c4e4939c436d38079767f39f12b8803d6472ca1dfcd101675b20cd525f7e3d02c368b61 + sha512: a68814ec3d16e8bd28c9291bbc596f0282687c5ba5d1f4c26c4e427166666a03c11df1dab3577b4483142764c37d4887def77244c4a52cb9852a234fa8cb15ba +-- home11/user/.local/share/chezmoi/.chezmoiexternal.toml -- +[".file"] + type = "file" + url = "{{ env "HTTPD_URL" }}/.corrupt-file" + checksum.md5 = "49fe9018f97349cdd0a0ac7b7f668b05" + checksum.sha256 = "634a4dd193c7b3b926d2e08026aa81a416fd41cec52854863b974af422495663" -- home2/user/.local/share/chezmoi/.chezmoiexternal.toml -- [".file"] type = "file" @@ -157,5 +188,7 @@ stripComponents = 1 -- home9/user/.local/share/chezmoi/dot_dir/file2 -- # contents of .dir/file2 +-- www/.corrupt-file -- +# corrupt contents of .file -- www/.file -- # contents of .file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2427.txt new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2427.txt --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2427.txt 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2427.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,44 +0,0 @@ -symlink archive/dir/symlink -> file -exec tar czf www/archive.tar.gz archive - -httpd www - -# test that chezmoi managed lists all targets -exec chezmoi managed -cmp stdout golden/managed - -# test that chezmoi managed --include=encrypted lists encrypted files only -exec chezmoi managed --include=encrypted -cmp stdout golden/managed-encrypted - -# test that chezmoi managed --include=externals lists external targets only -exec chezmoi managed --include=externals -cmp stdout golden/managed-externals - --- archive/dir/file -- -# contents of dir/file --- golden/managed -- -.dir -.dir/dir -.dir/dir/file -.dir/dir/symlink -.encrypted -.file --- golden/managed-encrypted -- -.encrypted --- golden/managed-externals -- -.dir -.dir/dir -.dir/dir/file -.dir/dir/symlink --- home/user/.config/chezmoi/chezmoi.toml -- -encryption = "gpg" --- home/user/.local/share/chezmoi/.chezmoiexternal.yaml -- -.dir: - type: archive - url: {{ env "HTTPD_URL" }}/archive.tar.gz - stripComponents: 1 --- home/user/.local/share/chezmoi/dot_file -- --- home/user/.local/share/chezmoi/encrypted_dot_encrypted.asc -- --- www/.file -- -# contents of .file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2427.txtar new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2427.txtar --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2427.txtar 1970-01-01 01:00:00.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2427.txtar 2022-12-13 21:48:41.000000000 +0100 @@ -0,0 +1,44 @@ +symlink archive/dir/symlink -> file +exec tar czf www/archive.tar.gz archive + +httpd www + +# test that chezmoi managed lists all targets +exec chezmoi managed +cmp stdout golden/managed + +# test that chezmoi managed --include=encrypted lists encrypted files only +exec chezmoi managed --include=encrypted +cmp stdout golden/managed-encrypted + +# test that chezmoi managed --include=externals lists external targets only +exec chezmoi managed --include=externals +cmp stdout golden/managed-externals + +-- archive/dir/file -- +# contents of dir/file +-- golden/managed -- +.dir +.dir/dir +.dir/dir/file +.dir/dir/symlink +.encrypted +.file +-- golden/managed-encrypted -- +.encrypted +-- golden/managed-externals -- +.dir +.dir/dir +.dir/dir/file +.dir/dir/symlink +-- home/user/.config/chezmoi/chezmoi.toml -- +encryption = "gpg" +-- home/user/.local/share/chezmoi/.chezmoiexternal.yaml -- +.dir: + type: archive + url: {{ env "HTTPD_URL" }}/archive.tar.gz + stripComponents: 1 +-- home/user/.local/share/chezmoi/dot_file -- +-- home/user/.local/share/chezmoi/encrypted_dot_encrypted.asc -- +-- www/.file -- +# contents of .file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2573.txt new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2573.txt --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2573.txt 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2573.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -[windows] skip 'UNIX only' -chmod 755 bin/diff - -# test that chezmoi apply --verbose with an external diff command and dirs excluded does not run the diff command when a directory is removed -exec chezmoi apply --verbose -! stdout diff - --- bin/diff -- -#!/bin/sh - -echo diff $* --- home/user/.config/chezmoi/chezmoi.toml -- -[diff] - command = "diff" - exclude = ["dirs"] --- home/user/.dir/subdir/.keep -- --- home/user/.local/share/chezmoi/exact_dot_dir/.keep -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2573.txtar new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2573.txtar --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2573.txtar 1970-01-01 01:00:00.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2573.txtar 2022-12-13 21:48:41.000000000 +0100 @@ -0,0 +1,17 @@ +[windows] skip 'UNIX only' +chmod 755 bin/diff + +# test that chezmoi apply --verbose with an external diff command and dirs excluded does not run the diff command when a directory is removed +exec chezmoi apply --verbose +! stdout diff + +-- bin/diff -- +#!/bin/sh + +echo diff $* +-- home/user/.config/chezmoi/chezmoi.toml -- +[diff] + command = "diff" + exclude = ["dirs"] +-- home/user/.dir/subdir/.keep -- +-- home/user/.local/share/chezmoi/exact_dot_dir/.keep -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2577.txt new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2577.txt --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2577.txt 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2577.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ -[windows] skip 'UNIX only' -chmod 755 bin/fossil - -# test that chezmoi update runs a custom update command and applies changes -exec chezmoi update -cmp $HOME/.file golden/.file - --- bin/fossil -- -#!/bin/sh - -case "$*" in -"update") - echo "# contents of .file" > dot_file - ;; -*) - echo fossil: unknown command: $* - echo fossil: use "help" for more information - exit 1 - ;; -esac --- golden/.file -- -# contents of .file --- home/user/.config/chezmoi/chezmoi.toml -- -[update] - command = "fossil" - args = ["update"] --- home/user/.local/share/chezmoi/.keep -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2577.txtar new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2577.txtar --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/issue2577.txtar 1970-01-01 01:00:00.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/issue2577.txtar 2022-12-13 21:48:41.000000000 +0100 @@ -0,0 +1,27 @@ +[windows] skip 'UNIX only' +chmod 755 bin/fossil + +# test that chezmoi update runs a custom update command and applies changes +exec chezmoi update +cmp $HOME/.file golden/.file + +-- bin/fossil -- +#!/bin/sh + +case "$*" in +"update") + echo "# contents of .file" > dot_file + ;; +*) + echo fossil: unknown command: $* + echo fossil: use "help" for more information + exit 1 + ;; +esac +-- golden/.file -- +# contents of .file +-- home/user/.config/chezmoi/chezmoi.toml -- +[update] + command = "fossil" + args = ["update"] +-- home/user/.local/share/chezmoi/.keep -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/managed.txtar new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/managed.txtar --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/managed.txtar 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/managed.txtar 2022-12-13 21:48:41.000000000 +0100 @@ -60,6 +60,10 @@ exec chezmoi managed $HOME${/}.dir $HOME${/}.non-exist cmp stdout golden/managed-with-absent-args +# test chezmoi managed --path-style=absolute +[!windows] exec chezmoi managed --path-style=absolute +[!windows] cmpenv stdout golden/managed-absolute + chhome home2/user # test that chezmoi managed does not evaluate templates @@ -81,6 +85,21 @@ .remove .symlink .template +-- golden/managed-absolute -- +$WORK/home/user/.create +$WORK/home/user/.dir +$WORK/home/user/.dir/file +$WORK/home/user/.dir/subdir +$WORK/home/user/.dir/subdir/file +$WORK/home/user/.empty +$WORK/home/user/.encrypted +$WORK/home/user/.executable +$WORK/home/user/.file +$WORK/home/user/.private +$WORK/home/user/.readonly +$WORK/home/user/.remove +$WORK/home/user/.symlink +$WORK/home/user/.template -- golden/managed-exclude-encrypted -- .create .dir diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/templatefuncs.txtar new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/templatefuncs.txtar --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/templatefuncs.txtar 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/templatefuncs.txtar 2022-12-13 21:48:41.000000000 +0100 @@ -3,6 +3,8 @@ [!windows] chmod 755 bin/ioreg [windows] unix2dos bin/chezmoi-output-test.cmd +symlink $HOME/symlink -> dir + # test comment template function exec chezmoi execute-template '{{ "line1\nline2" | comment "# " }}' rmfinalnewline golden/comment @@ -52,6 +54,10 @@ exec chezmoi execute-template '{{ lookPath "/non-existing-file" }}' ! stdout . +# test lstat template function +exec chezmoi execute-template '{{ (joinPath .chezmoi.homeDir "symlink" | lstat).type }}' +stdout ^symlink$ + # test mozillaInstallHash template function exec chezmoi execute-template '{{ mozillaInstallHash "/Applications/Firefox.app/Contents/MacOS" }}' stdout 2656FF1E876E9973 @@ -79,7 +85,7 @@ cmp stdout golden/toIni # test stat template function -exec chezmoi execute-template '{{ (stat ".").isDir }}' +exec chezmoi execute-template '{{ (joinPath .chezmoi.homeDir "symlink" | stat).isDir }}' stdout true # test that the output template function returns a command's output @@ -187,5 +193,6 @@ chezmoi:template:left-delimiter=[[ right-delimiter=]] [[ . ]] -- home/user/.local/share/chezmoi/template -- +-- home/user/dir/.keep -- -- home/user/file1.txt -- -- home/user/file2.txt -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/unmanaged.txtar new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/unmanaged.txtar --- old/chezmoi-2.27.3/pkg/cmd/testdata/scripts/unmanaged.txtar 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/testdata/scripts/unmanaged.txtar 2022-12-13 21:48:41.000000000 +0100 @@ -27,8 +27,16 @@ # test that chezmoi unmanaged with absent paths should fail ! exec chezmoi unmanaged $HOME${/}absent-path +# test chezmoi unmanaged --path-style=absolute +[!windows] exec chezmoi unmanaged --path-style=absolute +[!windows] cmpenv stdout golden/unmanaged-absolute + -- golden/unmanaged -- .local +-- golden/unmanaged-absolute -- +$WORK/home/user/.dir +$WORK/home/user/.file +$WORK/home/user/.local -- golden/unmanaged-dir -- .dir .local diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.27.3/pkg/cmd/unmanagedcmd.go new/chezmoi-2.28.0/pkg/cmd/unmanagedcmd.go --- old/chezmoi-2.27.3/pkg/cmd/unmanagedcmd.go 2022-12-05 00:47:57.000000000 +0100 +++ new/chezmoi-2.28.0/pkg/cmd/unmanagedcmd.go 2022-12-13 21:48:41.000000000 +0100 @@ -1,6 +1,7 @@ package cmd import ( + "fmt" "io/fs" "sort" "strings" @@ -12,6 +13,10 @@ "github.com/twpayne/chezmoi/v2/pkg/chezmoi" ) +type unmanagedCmdConfig struct { + pathStyle pathStyle +} + func (c *Config) newUnmanagedCmd() *cobra.Command { unmanagedCmd := &cobra.Command{ Use: "unmanaged [path]...", @@ -22,6 +27,13 @@ RunE: c.makeRunEWithSourceState(c.runUnmanagedCmd), } + flags := unmanagedCmd.Flags() + flags.VarP(&c.unmanaged.pathStyle, "path-style", "p", "Path style") + + if err := unmanagedCmd.RegisterFlagCompletionFunc("path-style", pathStyleFlagCompletionFunc); err != nil { + panic(err) + } + return unmanagedCmd } @@ -76,8 +88,12 @@ sortedRelPaths := chezmoi.RelPaths(maps.Keys(unmanagedRelPaths)) sort.Sort(sortedRelPaths) for _, relPath := range sortedRelPaths { - builder.WriteString(relPath.String()) - builder.WriteByte('\n') + switch c.unmanaged.pathStyle { + case pathStyleAbsolute: + fmt.Fprintln(&builder, c.DestDirAbsPath.Join(relPath)) + case pathStyleRelative: + fmt.Fprintln(&builder, relPath) + } } return c.writeOutputString(builder.String()) } ++++++ chezmoi.obsinfo ++++++ --- /var/tmp/diff_new_pack.c7Stzc/_old 2022-12-23 10:21:46.055571552 +0100 +++ /var/tmp/diff_new_pack.c7Stzc/_new 2022-12-23 10:21:46.063571597 +0100 @@ -1,5 +1,5 @@ name: chezmoi -version: 2.27.3 -mtime: 1670197677 -commit: feab4e788831e803d84a544739dfb8188245deae +version: 2.28.0 +mtime: 1670964521 +commit: 8e9ed2eee04b708b4d7531863e47b5c5a876050f ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/chezmoi/vendor.tar.gz /work/SRC/openSUSE:Factory/.chezmoi.new.1563/vendor.tar.gz differ: char 5, line 1