Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more integration tests #747

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Append trailing slash to directories in tar archives
  • Loading branch information
twpayne committed May 12, 2020
commit 49dbc31eeb1f3bd38f5920bfbe05977cfd9805f3
2 changes: 1 addition & 1 deletion cmd/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestArchiveCmd(t *testing.T) {

h, err := r.Next()
assert.NoError(t, err)
assert.Equal(t, "dir", h.Name)
assert.Equal(t, "dir/", h.Name)

h, err = r.Next()
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/chezmoi/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (d *Dir) archive(w *tar.Writer, ignore func(string) bool, headerTemplate *t
}
header := *headerTemplate
header.Typeflag = tar.TypeDir
header.Name = d.targetName
header.Name = d.targetName + "/"
header.Mode = int64(d.Perm &^ umask)
if err := w.WriteHeader(&header); err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions testdata/scripts/archive.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[windows] stop 'https://github.com/twpayne/chezmoi/issues/745'
[!exec:tar] stop

chezmoi archive --output=user.tar
exec tar -tf user.tar
chezmoi archive --output=archive.tar
exec tar -tf archive.tar
cmp stdout golden/archive

-- golden/archive --
.bashrc
.ssh
.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
# contents of .ssh/config