Skip to content

Commit

Permalink
Merge branch 'dpb587-pivotal-patch-2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatcuk committed Sep 19, 2016
2 parents 0dc18b2 + dfce09e commit c49c773
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doublestar.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ func doGlob(basedir string, components, matches []string) (m []string, e error)
if components[patIdx] == "**" {
// if the current component is a doublestar, we'll try depth-first
for _, file := range files {
// if symlink, we may want to follow
if file.Mode() & os.ModeSymlink != 0 {
file, err = os.Stat(filepath.Join(basedir, file.Name()))
if err != nil { continue }
}

if file.IsDir() {
if lastComponent {
m = append(m, filepath.Join(basedir, file.Name()))
Expand Down
1 change: 1 addition & 0 deletions doublestar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ var matchTests = []MatchTest{
{"broken-symlink", "broken-symlink", true, nil, true},
{"working-symlink/c/*", "working-symlink/c/d", true, nil, true},
{"working-sym*/*", "working-symlink/c", true, nil, true},
{"b/**/f", "b/symlink-dir/f", true, nil, true},
}

func TestMatch(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions test/b/symlink-dir

0 comments on commit c49c773

Please sign in to comment.