Skip to content

Commit

Permalink
added fullpath to fix path concat issue with files when not in git ro…
Browse files Browse the repository at this point in the history
…ot (#6331)

### Problem
As described in #6301 , when the git root and the build root is not the same, `changed` functionalities can be messed up because `git` returns path relative to the working directory, which produces bad paths when it is [concatenated with the git root](https://github.com/pantsbuild/pants/blob/c9f3af460a7504e082931a4b5a668b66f0cd4ed0/src/python/pants/scm/git.py#L161).

### Solution
By adding the `--full-name` tag to [`git ls-files`](https://github.com/pantsbuild/pants/blob/c9f3af460a7504e082931a4b5a668b66f0cd4ed0/src/python/pants/scm/git.py#L178), the file concatenation is done properly

### Result
Doing `./pants list --changed...` will concatenate file names correctly when it is not run from the git root.
  • Loading branch information
yaup authored and stuhood committed Aug 29, 2018
1 parent ab5aeeb commit 63857b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/pants/scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def changed_files(self, from_commit=None, include_untracked=False, relative_to=N
raise_type=Scm.LocalException)
files.update(committed_changes.split())
if include_untracked:
untracked_cmd = ['ls-files', '--other', '--exclude-standard'] + rel_suffix
untracked_cmd = ['ls-files', '--other', '--exclude-standard', '--full-name'] + rel_suffix
untracked = self._check_output(untracked_cmd,
raise_type=Scm.LocalException)
files.update(untracked.split())
Expand Down

0 comments on commit 63857b1

Please sign in to comment.