Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package chezmoi for openSUSE:Factory checked in at 2023-05-16 14:16:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/chezmoi (Old) and /work/SRC/openSUSE:Factory/.chezmoi.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "chezmoi" Tue May 16 14:16:47 2023 rev:24 rq:1087349 version:2.33.6 Changes: -------- --- /work/SRC/openSUSE:Factory/chezmoi/chezmoi.changes 2023-05-12 20:41:36.791293786 +0200 +++ /work/SRC/openSUSE:Factory/.chezmoi.new.1533/chezmoi.changes 2023-05-16 14:28:11.456004282 +0200 @@ -1,0 +2,10 @@ +Tue May 16 07:33:30 UTC 2023 - Filippo Bonazzi <filippo.bona...@suse.com> + +- Update to version 2.33.6: + * fix: Only create empty files if they have the empty_ attribute + * chore: Refactor internal handling of remove_ directories + * chore(editorconfig): Remove quotes from editorconfig file + * fix: Set CHEZMOI_SOURCE_DIR env var in init when using .chezmoiroot + * chore: Update dependencies + +------------------------------------------------------------------- Old: ---- chezmoi-2.33.5.obscpio New: ---- chezmoi-2.33.6.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ chezmoi.spec ++++++ --- /var/tmp/diff_new_pack.eAFGTW/_old 2023-05-16 14:28:12.216008628 +0200 +++ /var/tmp/diff_new_pack.eAFGTW/_new 2023-05-16 14:28:12.220008651 +0200 @@ -17,7 +17,7 @@ Name: chezmoi -Version: 2.33.5 +Version: 2.33.6 Release: 0 Summary: A multi-host manager for dotfiles License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.eAFGTW/_old 2023-05-16 14:28:12.256008857 +0200 +++ /var/tmp/diff_new_pack.eAFGTW/_new 2023-05-16 14:28:12.260008880 +0200 @@ -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.33.5</param> + <param name="revision">v2.33.6</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> </service> ++++++ chezmoi-2.33.5.obscpio -> chezmoi-2.33.6.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/.editorconfig new/chezmoi-2.33.6/.editorconfig --- old/chezmoi-2.33.5/.editorconfig 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/.editorconfig 2023-05-15 19:36:14.000000000 +0200 @@ -1,13 +1,13 @@ root = true [*] -charset = "utf-8" -end_of_line = "lf" +charset = utf-8 +end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true [*.ps1] -charset = "utf-8" -end_of_line = "crlf" +charset = utf-8 +end_of_line = crlf insert_final_newline = true trim_trailing_whitespace = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/assets/chezmoi.io/docs/reference/source-state-attributes.md new/chezmoi-2.33.6/assets/chezmoi.io/docs/reference/source-state-attributes.md --- old/chezmoi-2.33.5/assets/chezmoi.io/docs/reference/source-state-attributes.md 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/assets/chezmoi.io/docs/reference/source-state-attributes.md 2023-05-15 19:36:14.000000000 +0200 @@ -40,15 +40,16 @@ Different target types allow different prefixes and suffixes. The order of prefixes is important. -| Target type | Source type | Allowed prefixes in order | Allowed suffixes | -| ------------- | ----------- | ----------------------------------------------------------------------- | ---------------- | -| Directory | Directory | `external_` or `remove_`, `exact_`, `private_`, `readonly_`, `dot_` | *none* | -| Regular file | File | `encrypted_`, `private_`, `executable_`, `dot_` | `.tmpl` | -| Create file | File | `create_`, `encrypted_`, `private_`, `readonly_`, `executable_`, `dot_` | `.tmpl` | -| Modify file | File | `modify_`, `encrypted_`, `private_`, `readonly_`, `executable_`, `dot_` | `.tmpl` | -| Remove | File | `remove_`, `dot_` | *none* | -| Script | File | `run_`, `once_` or `onchange_`, `before_` or `after_` | `.tmpl` | -| Symbolic link | File | `symlink_`, `dot_` | `.tmpl` | +| Target type | Source type | Allowed prefixes in order | Allowed suffixes | +| ---------------- | ----------- | --------------------------------------------------------------------------------- | ---------------- | +| Directory | Directory | `external_`, `exact_`, `private_`, `readonly_`, `dot_` | *none* | +| Remove directory | Directory | `remove_`, `dot_` | *none* | +| Regular file | File | `encrypted_`, `private_`, `executable_`, `empty_`, `dot_` | `.tmpl` | +| Create file | File | `create_`, `encrypted_`, `private_`, `readonly_`, `empty_`, `executable_`, `dot_` | `.tmpl` | +| Modify file | File | `modify_`, `encrypted_`, `private_`, `readonly_`, `executable_`, `dot_` | `.tmpl` | +| Remove file | File | `remove_`, `dot_` | *none* | +| Script | File | `run_`, `once_` or `onchange_`, `before_` or `after_` | `.tmpl` | +| Symbolic link | File | `symlink_`, `dot_` | `.tmpl` | The `literal_` prefix and `.literal` suffix can appear anywhere and stop attribute parsing. This permits filenames that would otherwise conflict with diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/go.mod new/chezmoi-2.33.6/go.mod --- old/chezmoi-2.33.5/go.mod 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/go.mod 2023-05-15 19:36:14.000000000 +0200 @@ -42,7 +42,7 @@ go.etcd.io/bbolt v1.3.7 go.uber.org/multierr v1.11.0 golang.org/x/crypto v0.9.0 - golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 + golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea golang.org/x/oauth2 v0.8.0 golang.org/x/sync v0.2.0 golang.org/x/sys v0.8.0 @@ -78,10 +78,10 @@ github.com/bradenhilton/cityhash v1.0.0 // indirect github.com/charmbracelet/harmonica v0.2.0 // indirect github.com/charmbracelet/lipgloss v0.7.1 // indirect - github.com/cloudflare/circl v1.3.2 // indirect + github.com/cloudflare/circl v1.3.3 // indirect github.com/containerd/console v1.0.3 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect - github.com/dlclark/regexp2 v1.9.0 // indirect + github.com/danieljoos/wincred v1.2.0 // indirect + github.com/dlclark/regexp2 v1.10.0 // indirect github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/go-git/gcfg v1.5.0 // indirect @@ -116,8 +116,8 @@ github.com/pkg/errors v0.9.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/shopspring/decimal v1.3.1 // indirect - github.com/skeema/knownhosts v1.1.0 // indirect - github.com/spf13/cast v1.5.0 // indirect + github.com/skeema/knownhosts v1.1.1 // indirect + github.com/spf13/cast v1.5.1 // indirect github.com/stretchr/testify v1.8.2 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/yuin/goldmark v1.5.4 // indirect @@ -125,13 +125,14 @@ golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect - golang.org/x/tools v0.8.0 // indirect + golang.org/x/tools v0.9.1 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect ) exclude ( + github.com/charmbracelet/bubbletea v0.24.0 // https://github.com/charmbracelet/bubbletea/issues/737 github.com/sergi/go-diff v1.2.0 // https://github.com/sergi/go-diff/issues/123 github.com/sergi/go-diff v1.3.0 github.com/sergi/go-diff v1.3.1 // https://github.com/twpayne/chezmoi/issues/2706 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/go.sum new/chezmoi-2.33.6/go.sum --- old/chezmoi-2.33.5/go.sum 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/go.sum 2023-05-15 19:36:14.000000000 +0200 @@ -73,7 +73,7 @@ github.com/bradenhilton/mozillainstallhash v1.0.1 h1:JVAVsItiWlLoudJX4L+tIuml+hoxjlzCwkhlENi9yS4= github.com/bradenhilton/mozillainstallhash v1.0.1/go.mod h1:J6cA36kUZrgaTkDl2bHRqI+4i2UKO1ImDB1P1x1PyOA= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/bwesterb/go-ristretto v1.2.2 h1:S2C0mmSjCLS3H9+zfXoIoKzl+cOncvBvt6pE+zTm5Ms= +github.com/bwesterb/go-ristretto v1.2.3 h1:1w53tCkGhCQ5djbat3+MH0BAQ5Kfgbt56UZQ/JMzngw= github.com/charmbracelet/bubbles v0.15.0 h1:c5vZ3woHV5W2b8YZI1q7v4ZNQaPetfHuoHzx+56Z6TI= github.com/charmbracelet/bubbles v0.15.0/go.mod h1:Y7gSFbBzlMpUDR/XM9MhZI374Q+1p1kluf1uLl8iK74= github.com/charmbracelet/bubbletea v0.23.1/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61BjWTQY57RbT25aMXU= @@ -87,8 +87,8 @@ github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E= github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= -github.com/cloudflare/circl v1.3.2 h1:VWp8dY3yH69fdM7lM6A1+NhhVoDu9vqK0jOgmkQHFWk= -github.com/cloudflare/circl v1.3.2/go.mod h1:+CauBF6R70Jqcyl8N2hC8pAXYbWkGIezuSbuGLtRhnw= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= @@ -99,14 +99,14 @@ 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.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= -github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= -github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= +github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= +github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dlclark/regexp2 v1.9.0 h1:pTK/l/3qYIKaRXuHnEnIf7Y5NxfRPfpb7dis6/gdlVI= -github.com/dlclark/regexp2 v1.9.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= +github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad h1:Qk76DOWdOp+GlyDKBAG3Klr9cn7N+LcYc82AZ2S7+cA= github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad/go.mod h1:mPKfmRa823oBIgl2r20LeMSpTAteW5j7FLkc0vjmzyQ= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= @@ -278,13 +278,14 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= +github.com/skeema/knownhosts v1.1.1 h1:MTk78x9FPgDFVFkDLTrsnnfCJl7g1C/nnKvePgrIngE= +github.com/skeema/knownhosts v1.1.1/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= +github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -345,8 +346,8 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o= -golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea h1:vLCWI/yYrdEHyN2JzIzPO3aaQJHQdp89IZBA/+azVC4= +golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= @@ -382,7 +383,6 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -424,8 +424,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= -golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= 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= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/chezmoi/attr.go new/chezmoi-2.33.6/pkg/chezmoi/attr.go --- old/chezmoi-2.33.5/pkg/chezmoi/attr.go 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/pkg/chezmoi/attr.go 2023-05-15 19:36:14.000000000 +0200 @@ -7,6 +7,21 @@ "github.com/rs/zerolog" ) +// A SourceDirTargetType is the type of a target represented by a directory in +// the source state. +type SourceDirTargetType int + +// Source dir types. +const ( + SourceDirTypeDir SourceDirTargetType = iota + SourceDirTypeRemove +) + +var sourceDirTypeStrs = map[SourceDirTargetType]string{ + SourceDirTypeDir: "dir", + SourceDirTypeRemove: "remove", +} + // A SourceFileTargetType is a the type of a target represented by a file in the // source state. A file in the source state can represent a file, script, or // symlink in the target state. @@ -55,11 +70,11 @@ // DirAttr holds attributes parsed from a source directory name. type DirAttr struct { TargetName string + Type SourceDirTargetType Exact bool External bool Private bool ReadOnly bool - Remove bool } // A FileAttr holds attributes parsed from a source file name. @@ -78,12 +93,24 @@ // parseDirAttr parses a single directory name in the source state. func parseDirAttr(sourceName string) DirAttr { - name := sourceName - name, external := CutPrefix(name, externalPrefix) - name, remove := CutPrefix(name, removePrefix) - name, exact := CutPrefix(name, exactPrefix) - name, private := CutPrefix(name, privatePrefix) - name, readOnly := CutPrefix(name, readOnlyPrefix) + var ( + sourceDirType = SourceDirTypeDir + name = sourceName + external = false + exact = false + private = false + readOnly = false + ) + switch { + case strings.HasPrefix(name, removePrefix): + sourceDirType = SourceDirTypeRemove + name = name[len(removePrefix):] + default: + name, external = CutPrefix(name, externalPrefix) + name, exact = CutPrefix(name, exactPrefix) + name, private = CutPrefix(name, privatePrefix) + name, readOnly = CutPrefix(name, readOnlyPrefix) + } switch { case strings.HasPrefix(name, dotPrefix): name = "." + name[len(dotPrefix):] @@ -92,43 +119,45 @@ } return DirAttr{ TargetName: name, + Type: sourceDirType, Exact: exact, External: external, Private: private, ReadOnly: readOnly, - Remove: remove, } } // MarshalZerologObject implements // github.com/rs/zerolog.ObjectMarshaler.MarshalZerologObject. func (da DirAttr) MarshalZerologObject(e *zerolog.Event) { - e.Str("targetName", da.TargetName) - e.Bool("exact", da.Exact) - e.Bool("external", da.External) - e.Bool("private", da.Private) - e.Bool("readOnly", da.ReadOnly) - e.Bool("remove", da.Remove) + e.Str("TargetName", da.TargetName) + e.Str("Type", sourceDirTypeStrs[da.Type]) + e.Bool("Exact", da.Exact) + e.Bool("External", da.External) + e.Bool("Private", da.Private) + e.Bool("ReadOnly", da.ReadOnly) } // SourceName returns da's source name. func (da DirAttr) SourceName() string { sourceName := "" - if da.External { - sourceName += externalPrefix - } - if da.Remove { + switch da.Type { + case SourceDirTypeDir: + if da.External { + sourceName += externalPrefix + } + if da.Exact { + sourceName += exactPrefix + } + if da.Private { + sourceName += privatePrefix + } + if da.ReadOnly { + sourceName += readOnlyPrefix + } + case SourceDirTypeRemove: sourceName += removePrefix } - if da.Exact { - sourceName += exactPrefix - } - if da.Private { - sourceName += privatePrefix - } - if da.ReadOnly { - sourceName += readOnlyPrefix - } switch { case strings.HasPrefix(da.TargetName, "."): sourceName += dotPrefix + da.TargetName[len("."):] @@ -173,6 +202,7 @@ name, encrypted = CutPrefix(name, encryptedPrefix) name, private = CutPrefix(name, privatePrefix) name, readOnly = CutPrefix(name, readOnlyPrefix) + name, empty = CutPrefix(name, emptyPrefix) name, executable = CutPrefix(name, executablePrefix) case strings.HasPrefix(name, removePrefix): sourceFileType = SourceFileTypeRemove @@ -276,6 +306,9 @@ if fa.ReadOnly { sourceName += readOnlyPrefix } + if fa.Empty { + sourceName += emptyPrefix + } if fa.Executable { sourceName += executablePrefix } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/chezmoi/attr_test.go new/chezmoi-2.33.6/pkg/chezmoi/attr_test.go --- old/chezmoi-2.33.5/pkg/chezmoi/attr_test.go 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/pkg/chezmoi/attr_test.go 2023-05-15 19:36:14.000000000 +0200 @@ -9,35 +9,42 @@ ) func TestDirAttr(t *testing.T) { - testData := struct { + var dirAttrs []DirAttr + targetNames := []string{ + ".dir", + "dir.tmpl", + "dir", + "exact_dir", + "empty_dir", + "encrypted_dir", + "executable_dir", + "once_dir", + "run_dir", + "run_once_dir", + "symlink_dir", + } + assert.NoError(t, combinator.Generate(&dirAttrs, struct { + Type SourceDirTargetType TargetName []string Exact []bool External []bool Private []bool ReadOnly []bool - Remove []bool }{ - TargetName: []string{ - ".dir", - "dir.tmpl", - "dir", - "exact_dir", - "empty_dir", - "encrypted_dir", - "executable_dir", - "once_dir", - "run_dir", - "run_once_dir", - "symlink_dir", - }, - Exact: []bool{false, true}, - External: []bool{false, true}, - Private: []bool{false, true}, - ReadOnly: []bool{false, true}, - Remove: []bool{false, true}, - } - var dirAttrs []DirAttr - assert.NoError(t, combinator.Generate(&dirAttrs, testData)) + Type: SourceDirTypeDir, + TargetName: targetNames, + Exact: []bool{false, true}, + External: []bool{false, true}, + Private: []bool{false, true}, + ReadOnly: []bool{false, true}, + })) + assert.NoError(t, combinator.Generate(&dirAttrs, struct { + Type SourceDirTargetType + TargetName []string + }{ + Type: SourceDirTypeRemove, + TargetName: targetNames, + })) for _, dirAttr := range dirAttrs { actualSourceName := dirAttr.SourceName() actualDirAttr := parseDirAttr(actualSourceName) @@ -90,6 +97,7 @@ "modify_name", "name.literal", "name", + "remove_", "run_name", "symlink_name", "template.tmpl", @@ -97,6 +105,7 @@ assert.NoError(t, combinator.Generate(&fileAttrs, struct { Type SourceFileTargetType TargetName []string + Empty []bool Encrypted []bool Executable []bool Private []bool @@ -105,6 +114,7 @@ }{ Type: SourceFileTypeCreate, TargetName: []string{}, + Empty: []bool{false, true}, Encrypted: []bool{false, true}, Executable: []bool{false, true}, Private: []bool{false, true}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/chezmoi/sourcestate.go new/chezmoi-2.33.6/pkg/chezmoi/sourcestate.go --- old/chezmoi-2.33.5/pkg/chezmoi/sourcestate.go 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/pkg/chezmoi/sourcestate.go 2023-05-15 19:36:14.000000000 +0200 @@ -911,7 +911,7 @@ allSourceStateEntriesMu.Unlock() return fs.SkipDir } - if sourceStateDir.Attr.Remove { + if sourceStateDir.Attr.Type == SourceDirTypeRemove { s.Lock() s.removeDirs[targetRelPath] = struct{}{} s.Unlock() @@ -1537,7 +1537,7 @@ } return &TargetStateFile{ lazyContents: lazyContents, - empty: true, + empty: fileAttr.Empty, perm: fileAttr.perm() &^ s.umask, sourceAttr: SourceAttr{ Encrypted: fileAttr.Encrypted, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/cmd/addcmd.go new/chezmoi-2.33.6/pkg/cmd/addcmd.go --- old/chezmoi-2.33.5/pkg/cmd/addcmd.go 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/pkg/cmd/addcmd.go 2023-05-15 19:36:14.000000000 +0200 @@ -58,7 +58,7 @@ func (c *Config) defaultOnIgnoreFunc(targetRelPath chezmoi.RelPath) { if !c.Add.quiet { - c.errorf("warning: ignoring %s", targetRelPath) + c.errorf("warning: ignoring %s\n", targetRelPath) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/cmd/chattrcmd.go new/chezmoi-2.33.6/pkg/cmd/chattrcmd.go --- old/chezmoi-2.33.5/pkg/cmd/chattrcmd.go 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/pkg/cmd/chattrcmd.go 2023-05-15 19:36:14.000000000 +0200 @@ -42,6 +42,14 @@ orderModifierSetAfter orderModifier = 2 ) +type sourceDirTypeModifier int + +const ( + sourceDirTypeModifierLeaveUnchanged sourceDirTypeModifier = iota + sourceDirTypeModifierSetRemove + sourceDirTypeModifierClearRemove +) + type sourceFileTypeModifier int const ( @@ -50,6 +58,8 @@ sourceFileTypeModifierClearCreate sourceFileTypeModifierSetModify sourceFileTypeModifierClearModify + sourceFileTypeModifierSetRemove + sourceFileTypeModifierClearRemove sourceFileTypeModifierSetScript sourceFileTypeModifierClearScript sourceFileTypeModifierSetSymlink @@ -57,6 +67,7 @@ ) type modifier struct { + sourceDirType sourceDirTypeModifier sourceFileType sourceFileTypeModifier condition conditionModifier empty boolModifier @@ -67,7 +78,6 @@ order orderModifier private boolModifier readOnly boolModifier - remove boolModifier template boolModifier } @@ -289,6 +299,23 @@ } // modify returns the modified value of type. +func (m sourceDirTypeModifier) modify(sourceDirType chezmoi.SourceDirTargetType) chezmoi.SourceDirTargetType { + switch m { + case sourceDirTypeModifierLeaveUnchanged: + return sourceDirType + case sourceDirTypeModifierSetRemove: + return chezmoi.SourceDirTypeRemove + case sourceDirTypeModifierClearRemove: + if sourceDirType == chezmoi.SourceDirTypeRemove { + return chezmoi.SourceDirTypeDir + } + return sourceDirType + default: + panic(fmt.Sprintf("%d: unknown type modifier", m)) + } +} + +// modify returns the modified value of type. func (m sourceFileTypeModifier) modify(sourceFileType chezmoi.SourceFileTargetType) chezmoi.SourceFileTargetType { switch m { case sourceFileTypeModifierLeaveUnchanged: @@ -300,6 +327,13 @@ return chezmoi.SourceFileTypeFile } return sourceFileType + case sourceFileTypeModifierSetRemove: + return chezmoi.SourceFileTypeRemove + case sourceFileTypeModifierClearRemove: + if sourceFileType == chezmoi.SourceFileTypeRemove { + return chezmoi.SourceFileTypeFile + } + return sourceFileType case sourceFileTypeModifierSetModify: return chezmoi.SourceFileTypeModify case sourceFileTypeModifierClearModify: @@ -412,7 +446,14 @@ case "readonly", "r": m.readOnly = bm case "remove": - m.remove = bm + switch bm { + case boolModifierClear: + m.sourceDirType = sourceDirTypeModifierClearRemove + m.sourceFileType = sourceFileTypeModifierClearRemove + case boolModifierSet: + m.sourceDirType = sourceDirTypeModifierSetRemove + m.sourceFileType = sourceFileTypeModifierSetRemove + } case "script": switch bm { case boolModifierClear: @@ -438,13 +479,23 @@ // modifyDirAttr returns the modified value of dirAttr. func (m *modifier) modifyDirAttr(dirAttr chezmoi.DirAttr) chezmoi.DirAttr { - return chezmoi.DirAttr{ - TargetName: dirAttr.TargetName, - Exact: m.exact.modify(dirAttr.Exact), - External: m.external.modify(dirAttr.External), - Private: m.private.modify(dirAttr.Private), - ReadOnly: m.readOnly.modify(dirAttr.ReadOnly), - Remove: m.remove.modify(dirAttr.Remove), + switch m.sourceDirType.modify(dirAttr.Type) { + case chezmoi.SourceDirTypeDir: + return chezmoi.DirAttr{ + TargetName: dirAttr.TargetName, + Type: chezmoi.SourceDirTypeDir, + Exact: m.exact.modify(dirAttr.Exact), + External: m.external.modify(dirAttr.External), + Private: m.private.modify(dirAttr.Private), + ReadOnly: m.readOnly.modify(dirAttr.ReadOnly), + } + case chezmoi.SourceDirTypeRemove: + return chezmoi.DirAttr{ + TargetName: dirAttr.TargetName, + Type: chezmoi.SourceDirTypeRemove, + } + default: + panic(fmt.Sprintf("%d: unknown source dir type", dirAttr.Type)) } } @@ -475,6 +526,7 @@ return chezmoi.FileAttr{ TargetName: fileAttr.TargetName, Type: chezmoi.SourceFileTypeCreate, + Empty: m.encrypted.modify(fileAttr.Empty), Encrypted: m.encrypted.modify(fileAttr.Encrypted), Executable: m.executable.modify(fileAttr.Executable), Private: m.private.modify(fileAttr.Private), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/cmd/config.go new/chezmoi-2.33.6/pkg/cmd/config.go --- old/chezmoi-2.33.5/pkg/cmd/config.go 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/pkg/cmd/config.go 2023-05-15 19:36:14.000000000 +0200 @@ -674,6 +674,9 @@ return err } c.templateData.sourceDir = sourceDirAbsPath + c.runEnv = append(c.runEnv, "CHEZMOI_SOURCE_DIR="+sourceDirAbsPath.String()) + realSystem := c.baseSystem.(*chezmoi.RealSystem) //nolint:forcetypeassert + realSystem.SetScriptEnv(c.runEnv) // Find config template, execute it, and create config file. configTemplate, err := c.findConfigTemplate() @@ -690,7 +693,7 @@ return err } - // Validate the configMap. + // Validate the config file. var configFile ConfigFile if err := c.decodeConfigBytes(configTemplate.format, configFileContents, &configFile); err != nil { return fmt.Errorf("%s: %w", configTemplate.sourceAbsPath, err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/cmd/testdata/scripts/chattr.txtar new/chezmoi-2.33.6/pkg/cmd/testdata/scripts/chattr.txtar --- old/chezmoi-2.33.5/pkg/cmd/testdata/scripts/chattr.txtar 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/pkg/cmd/testdata/scripts/chattr.txtar 2023-05-15 19:36:14.000000000 +0200 @@ -78,6 +78,21 @@ ! exists $CHEZMOISOURCEDIR/exact_dot_dir exists $CHEZMOISOURCEDIR/exact_readonly_dot_dir +# test that chezmoi chattr remove sets the remove attribute on a directory +exec chezmoi chattr remove $HOME${/}.dir +! exists $CHEZMOISOURCEDIR/exact_readonly_dot_dir +exists $CHEZMOISOURCEDIR/remove_dot_dir + +# test that chezmoi chattr noremove removes the remove attribute on a directory +exec chezmoi chattr noremove $HOME${/}.dir +! exists $CHEZMOISOURCEDIR/remove_dot_dir +exists $CHEZMOISOURCEDIR/dot_dir + +# test that chezmoi chattr exact,readonly sets the exact and readonly attributes on a directory +exec chezmoi chattr exact,readonly $HOME${/}.dir +! exists $CHEZMOISOURCEDIR/dot_dir +exists $CHEZMOISOURCEDIR/exact_readonly_dot_dir + # test that chezmoi chattr +t sets the template attribute on a symlink exists $CHEZMOISOURCEDIR/symlink_dot_symlink exec chezmoi chattr +t $HOME${/}.symlink diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/cmd/testdata/scripts/issue2865.txtar new/chezmoi-2.33.6/pkg/cmd/testdata/scripts/issue2865.txtar --- old/chezmoi-2.33.5/pkg/cmd/testdata/scripts/issue2865.txtar 2023-05-11 18:48:51.000000000 +0200 +++ new/chezmoi-2.33.6/pkg/cmd/testdata/scripts/issue2865.txtar 2023-05-15 19:36:14.000000000 +0200 @@ -12,7 +12,8 @@ # test that .chezmoi.sourceDir is set correctly when .chezmoiroot is present (chezmoi init --apply in a clean home directory) mkgitconfig exec chezmoi init --apply file://$WORK/home/user/.local/share/chezmoi -stdout '/.local/share/chezmoi/home$' +stdout '\.chezmoi\.sourceDir=.*/\.local/share/chezmoi/home$' +stdout 'CHEZMOI_SOURCE_DIR=.*/\.local/share/chezmoi/home$' # test that .chezmoi.sourceDir is set correctly in config file exec chezmoi execute-template '{{ .testDir }}' @@ -30,8 +31,10 @@ .chezmoiscripts/echo.ps1 {{- end }} -- home/user/.local/share/chezmoi/home/.chezmoiscripts/run_once_echo.ps1.tmpl -- -Write-Host {{ .chezmoi.sourceDir | quote }} +Write-Host .chezmoi.sourceDir={{ .chezmoi.sourceDir }} +Write-Host CHEZMOI_SOURCE_DIR=$Env:CHEZMOI_SOURCE_DIR -- home/user/.local/share/chezmoi/home/.chezmoiscripts/run_once_echo.sh.tmpl -- #!/bin/sh -echo {{ .chezmoi.sourceDir | quote }} +echo .chezmoi.sourceDir={{ .chezmoi.sourceDir }} +echo CHEZMOI_SOURCE_DIR=${CHEZMOI_SOURCE_DIR} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/chezmoi-2.33.5/pkg/cmd/testdata/scripts/issue2995.txtar new/chezmoi-2.33.6/pkg/cmd/testdata/scripts/issue2995.txtar --- old/chezmoi-2.33.5/pkg/cmd/testdata/scripts/issue2995.txtar 1970-01-01 01:00:00.000000000 +0100 +++ new/chezmoi-2.33.6/pkg/cmd/testdata/scripts/issue2995.txtar 2023-05-15 19:36:14.000000000 +0200 @@ -0,0 +1,17 @@ +# test that chezmoi apply only creates empty files if they have the empty_ attribute +exec chezmoi apply +! exists $HOME/new.txt +exists $HOME/create-new.txt +cmp $HOME/existing.txt golden/existing.txt +cmp $HOME/existing-empty.txt golden/existing-empty.txt + +-- golden/existing-empty.txt -- +-- golden/existing.txt -- +# contents of existing.txt +-- home/user/.local/share/chezmoi/create_empty_create-new.txt -- +-- home/user/.local/share/chezmoi/create_empty_existing-empty.txt -- +-- home/user/.local/share/chezmoi/create_existing.txt -- +-- home/user/.local/share/chezmoi/create_new.txt -- +-- home/user/existing-empty.txt -- +-- home/user/existing.txt -- +# contents of existing.txt ++++++ chezmoi.obsinfo ++++++ --- /var/tmp/diff_new_pack.eAFGTW/_old 2023-05-16 14:28:12.676011258 +0200 +++ /var/tmp/diff_new_pack.eAFGTW/_new 2023-05-16 14:28:12.680011281 +0200 @@ -1,5 +1,5 @@ name: chezmoi -version: 2.33.5 -mtime: 1683823731 -commit: a06f7661068cb258007e4736290d2b80966f2525 +version: 2.33.6 +mtime: 1684172174 +commit: 5bea2f925fc2b6fcf2ee116a20bae68869746787 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/chezmoi/vendor.tar.gz /work/SRC/openSUSE:Factory/.chezmoi.new.1533/vendor.tar.gz differ: char 5, line 1