Skip to content

Commit

Permalink
Ensured that .git folder is not included in skeletons\n\nAlso include…
Browse files Browse the repository at this point in the history
…s pattern for future similar exclusions.
  • Loading branch information
Knetic committed Sep 18, 2015
1 parent dec7b1b commit 5566662
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ test:
go test
go test -bench=.

integrate: build
@./.output/wisk -a ./samples/helloworld_ruby/
./.output/wisk helloworld_ruby ./.populatedSample

clean:
@rm -rf ./.output/

Expand All @@ -35,8 +39,6 @@ dist: build test
export GOARCH=amd64; \
go build -o ./.output/wisk.exe .



package: dist

ifeq ($(shell which fpm), )
Expand Down
17 changes: 17 additions & 0 deletions TemplatedProject.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,16 @@ func determineParameterSeparator(parameter string) (exists bool, name string, se
*/
func (this *TemplatedProject) getFolderWalker() func(string, os.FileInfo, error) error {

var scmPaths []string
var scmPath bytes.Buffer

scmPath.WriteString(".git")
scmPath.WriteRune(os.PathSeparator)

scmPaths = []string {
scmPath.String(),
}

return func(path string, fileStat os.FileInfo, err error) error {

var file TemplatedFile
Expand All @@ -388,6 +398,13 @@ func (this *TemplatedProject) getFolderWalker() func(string, os.FileInfo, error)
return nil
}

// Check to see if the path is underneath an SCM root (like ".git")
for _, forbiddenPath := range scmPaths {
if(strings.Contains(path, forbiddenPath)) {
return nil
}
}

file = NewTemplatedFile(path, this.rootDirectory, fileStat)
this.files = append(this.files, file)

Expand Down

0 comments on commit 5566662

Please sign in to comment.