Skip to content

Commit

Permalink
Merge pull request #1363 from twpayne/fix-keep-umask
Browse files Browse the repository at this point in the history
Fix creation of .keep files when umask is 002
  • Loading branch information
twpayne authored Aug 22, 2021
2 parents 2913fd9 + 8eef5e4 commit 1a9e2af
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions internal/chezmoi/sourcestate.go
Original file line number Diff line number Diff line change
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 1a9e2af

Please sign in to comment.