Skip to content

Use os.SameFile() to check for mvnw working-dir echo bug #1167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions pkg/skaffold/jib/jib.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func getDependencies(cmd *exec.Cmd) ([]string, error) {
return nil, err
}

cmdDirInfo, err := os.Stat(cmd.Dir)
if err != nil {
return nil, err
}

// Parses stdout for the dependencies, one per line
lines := strings.Split(string(stdout), "\n")

Expand All @@ -44,12 +49,6 @@ func getDependencies(cmd *exec.Cmd) ([]string, error) {
continue
}

// TODO(coollog): Remove this once Jib deps are prepended with special sequence.
// Skips the project directory itself. This is necessary as some wrappers print the project directory for some reason.
if dep == cmd.Dir {
continue
}

// Resolves directories recursively.
info, err := os.Stat(dep)
if err != nil {
Expand All @@ -60,6 +59,12 @@ func getDependencies(cmd *exec.Cmd) ([]string, error) {
return nil, errors.Wrapf(err, "unable to stat file %s", dep)
}

// TODO(coollog): Remove this once Jib deps are prepended with special sequence.
// Skips the project directory itself. This is necessary as some wrappers print the project directory for some reason.
if os.SameFile(cmdDirInfo, info) {
continue
}

if !info.IsDir() {
deps = append(deps, dep)
continue
Expand Down