Skip to content

Commit

Permalink
Fix creation of .keep files when umask is 002
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Aug 22, 2021
1 parent 2913fd9 commit 8eef5e4
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions internal/chezmoi/sourcestate.go
Expand Up @@ -258,23 +258,21 @@ DESTABSPATH:

if _, ok := newSourceStateEntry.(*SourceStateDir); ok {
dotKeepFileRelPath := sourceEntryRelPath.Join(NewSourceRelPath(".keep"))
dotKeepFileTargetStateEntry := &TargetStateFile{
empty: true,
perm: 0o666,
}
dotKeepFileEntryState, err := dotKeepFileTargetStateEntry.EntryState(s.umask)
if err != nil {
return err
}

dotKeepFileSourceUpdate := sourceUpdate{
entryState: dotKeepFileEntryState,
entryState: &EntryState{
Type: EntryStateTypeFile,
Mode: 0o666 &^ s.umask,
},
sourceRelPaths: []SourceRelPath{dotKeepFileRelPath},
}
sourceUpdates = append(sourceUpdates, dotKeepFileSourceUpdate)

newSourceStateEntries[dotKeepFileRelPath] = &SourceStateFile{
targetStateEntry: dotKeepFileTargetStateEntry,
targetStateEntry: &TargetStateFile{
empty: true,
perm: 0o666 &^ s.umask,
},
}
}
}
Expand Down

0 comments on commit 8eef5e4

Please sign in to comment.