Skip to content

Commit

Permalink
fix: exclude symlinks to directories from hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
10ko committed Jul 29, 2019
1 parent a1dfaba commit d3bbc05
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion garden-service/src/vcs/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ export class GitHandler extends VcsHandler {
// If we can't compute the hash, i.e. the file is gone, we filter it out below
let hash = ""
try {
hash = await this.hashObject(resolvedPath) || ""
// "git ls-files" returns a symlink even if it points to a directory.
// We filter symlinked directories out, since hashObject() will fail to
// process them.
if (!(await stat(resolvedPath)).isDirectory()) {
hash = await this.hashObject(resolvedPath) || ""
}
} catch (err) {
// 128 = File no longer exists
if (err.code !== 128 && err.code !== "ENOENT") {
Expand Down

0 comments on commit d3bbc05

Please sign in to comment.