diff --git a/Makefile b/Makefile index 5132f4e7774..4808b1aca4a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -GOLANGCI_LINT_VERSION=1.25.0 +GOLANGCI_LINT_VERSION=1.26.0 .PHONY: default default: generate run test lint format diff --git a/main_test.go b/main_test.go index 04e5bbe2c6d..c9b53332ba7 100644 --- a/main_test.go +++ b/main_test.go @@ -86,6 +86,7 @@ func edit(ts *testscript.TestScript, neg bool, args []string) { ts.Fatalf("edit: %v", err) } data = append(data, []byte("# edited\n")...) + //nolint:gosec if err := ioutil.WriteFile(filename, data, 0o666); err != nil { ts.Fatalf("edit: %v", err) } diff --git a/testdata/scripts/archive.txt b/testdata/scripts/archive.txt index 03641626b90..a05aff662c4 100644 --- a/testdata/scripts/archive.txt +++ b/testdata/scripts/archive.txt @@ -1,9 +1,15 @@ +[windows] stop 'https://github.com/twpayne/chezmoi/issues/745' [!exec:tar] stop -chezmoi add $HOME${/}.bashrc chezmoi archive --output=user.tar exec tar -tf user.tar -stdout ^\.bashrc\s*$ +cmp stdout golden/archive --- home/user/.bashrc -- +-- golden/archive -- +.bashrc +.ssh +.ssh/config +-- home/user/.local/share/chezmoi/dot_bashrc -- # contents of .bashrc +-- home/user/.local/share/chezmoi/private_dot_ssh/config -- +# contents .ssh/config diff --git a/testdata/scripts/chattr.txt b/testdata/scripts/chattr.txt index 7c57041c1ba..50fc82a314a 100644 --- a/testdata/scripts/chattr.txt +++ b/testdata/scripts/chattr.txt @@ -1,6 +1,3 @@ -chezmoi add $HOME${/}.bashrc -exists ${CHEZMOISOURCEDIR}${/}dot_bashrc - chezmoi chattr +empty $HOME${/}.bashrc exists ${CHEZMOISOURCEDIR}${/}empty_dot_bashrc @@ -19,5 +16,5 @@ exists ${CHEZMOISOURCEDIR}${/}private_dot_bashrc chezmoi chattr nop $HOME${/}.bashrc exists ${CHEZMOISOURCEDIR}${/}dot_bashrc --- home/user/.bashrc -- +-- home/user/.local/share/chezmoi/dot_bashrc -- # contents of .bashrc diff --git a/testdata/scripts/forget.txt b/testdata/scripts/forget.txt index 306a60c5c9d..c159b4f61dd 100644 --- a/testdata/scripts/forget.txt +++ b/testdata/scripts/forget.txt @@ -1,6 +1,3 @@ -chezmoi add $HOME${/}.bashrc -cmp ${CHEZMOISOURCEDIR}${/}dot_bashrc $HOME${/}.bashrc - edit ${CHEZMOISOURCEDIR}/dot_bashrc grep -count=1 '# edited' ${CHEZMOISOURCEDIR}${/}dot_bashrc @@ -16,5 +13,5 @@ chezmoi forget $HOME${/}.bashrc chezmoi apply grep -count=1 '# edited' $HOME${/}.bashrc --- home/user/.bashrc -- +-- home/user/.local/share/chezmoi/dot_bashrc -- # contents of .bashrc diff --git a/testdata/scripts/managed.txt b/testdata/scripts/managed.txt index aaac6741dce..4e1ca72081d 100644 --- a/testdata/scripts/managed.txt +++ b/testdata/scripts/managed.txt @@ -1,6 +1,24 @@ -chezmoi add $HOME${/}.bashrc +[windows] stop 'https://github.com/twpayne/chezmoi/issues/745' + chezmoi managed -stdout '.bashrc' +cmpenv stdout golden/managed + +chezmoi --include=dirs managed +cmpenv stdout golden/managed-dirs + +chezmoi --include=files managed +cmpenv stdout golden/managed-files --- home/user/.bashrc -- +-- golden/managed -- +$HOME/.bashrc +$HOME/.ssh +$HOME/.ssh/config +-- golden/managed-dirs -- +$HOME/.ssh +-- golden/managed-files -- +$HOME/.bashrc +$HOME/.ssh/config +-- home/user/.local/share/chezmoi/dot_bashrc -- # contents of .bashrc +-- home/user/.local/share/chezmoi/dot_ssh/config -- +# contents of .ssh/config diff --git a/testdata/scripts/purge.txt b/testdata/scripts/purge.txt index bbd6d248d74..a6b579da8ae 100644 --- a/testdata/scripts/purge.txt +++ b/testdata/scripts/purge.txt @@ -1,12 +1,9 @@ -chezmoi add $HOME${/}.bashrc -exists ${CHEZMOISOURCEDIR}${/}dot_bashrc - chezmoi purge --force ! exists ${CHEZMOICONFIGDIR} ! exists ${CHEZMOISOURCEDIR} --- home/user/.bashrc -- -# contents of .bashrc -- home/user/.config/chezmoi/chezmoi.toml -- [data] email = "user@home.org" +-- home/user/.local/share/chezmoi/dot_bashrc -- +# contents of .bashrc diff --git a/testdata/scripts/secretlastpass.txt b/testdata/scripts/secretlastpass.txt index 4fe01699a77..6a333324d9b 100644 --- a/testdata/scripts/secretlastpass.txt +++ b/testdata/scripts/secretlastpass.txt @@ -52,6 +52,9 @@ IF "%*" == "--version" ( echo. "note": "" echo. } echo.] +) ELSE ( + echo lpass: invalid command: %* + exit /b 1 ) -- home/user/.local/share/chezmoi/private_dot_netrc.tmpl -- machine example.com diff --git a/testdata/scripts/sourcepath.txt b/testdata/scripts/sourcepath.txt index b95b24246d4..95739eeb8af 100644 --- a/testdata/scripts/sourcepath.txt +++ b/testdata/scripts/sourcepath.txt @@ -1,5 +1,3 @@ -chezmoi init - chezmoi source-path stdout ${CHEZMOISOURCEDIR@R}