Skip to content

Commit

Permalink
Add .keep files for empty directories and ignore them in tests
Browse files Browse the repository at this point in the history
Ignore those .keep file which are to keep an empty generated directory alive
to compare with newly generated branch.
  • Loading branch information
didrocks committed Apr 14, 2017
1 parent 7499061 commit 592aee9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions codelab/codelab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ func compareAll(t *testing.T, original, generated string, ignoresf []string) {
relp = relp[1:]
p := path.Join(generated, relp)

// .keep files are only for keeping directory creations in remote git repo
if filepath.Base(p) == ".keep" {
return nil
}

fo, err := os.Stat(p)
if err != nil {
t.Fatalf("%s doesn't exist while %s does", p, f)
Expand Down Expand Up @@ -230,6 +235,11 @@ func compareAll(t *testing.T, original, generated string, ignoresf []string) {
relp = relp[1:]
p := path.Join(original, relp)

// .keep files are only for keeping directory creations in remote git repo
if filepath.Base(p) == ".keep" {
return nil
}

if _, err := os.Stat(p); err != nil {
difff = append(difff, relp)
if !testtools.StringContains(ignoresf, relp) {
Expand Down
File renamed without changes.
File renamed without changes.
Empty file added paths/testdata/nosite/.keep
Empty file.
Empty file.

0 comments on commit 592aee9

Please sign in to comment.