Skip to content

Commit

Permalink
Export ParseSourceDirName
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Dec 3, 2018
1 parent 6a33cdc commit a05d9c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/chezmoi/chezmoi.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ func ReturnTemplateFuncError(err error) {
})
}

// parseSourceDirName parses a single directory name.
func parseSourceDirName(dirName string) ParsedSourceDirName {
// ParseSourceDirName parses a single directory name.
func ParseSourceDirName(dirName string) ParsedSourceDirName {
perm := os.FileMode(0777)
if strings.HasPrefix(dirName, privatePrefix) {
dirName = strings.TrimPrefix(dirName, privatePrefix)
Expand Down Expand Up @@ -801,7 +801,7 @@ func parseDirNameComponents(components []string) ([]string, []os.FileMode) {
dirNames := []string{}
perms := []os.FileMode{}
for _, component := range components {
psdn := parseSourceDirName(component)
psdn := ParseSourceDirName(component)
dirNames = append(dirNames, psdn.DirName)
perms = append(perms, psdn.Perm)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/chezmoi/chezmoi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func TestSourceDirName(t *testing.T) {
},
} {
t.Run(tc.sourceDirName, func(t *testing.T) {
gotPSDN := parseSourceDirName(tc.sourceDirName)
gotPSDN := ParseSourceDirName(tc.sourceDirName)
if diff, equal := messagediff.PrettyDiff(tc.psdn, gotPSDN); !equal {
t.Errorf("parseSourceDirName(%q) == %+v, want %+v, diff:\n%s", tc.sourceDirName, gotPSDN, tc.psdn, diff)
t.Errorf("ParseSourceDirName(%q) == %+v, want %+v, diff:\n%s", tc.sourceDirName, gotPSDN, tc.psdn, diff)
}
if gotSourceDirName := tc.psdn.SourceDirName(); gotSourceDirName != tc.sourceDirName {
t.Errorf("%+v.SourceDirName() == %q, want %q", tc.psdn, gotSourceDirName, tc.sourceDirName)
Expand Down

0 comments on commit a05d9c1

Please sign in to comment.