Chromium Code Reviews| Index: client/isolated_format.py |
| diff --git a/client/isolated_format.py b/client/isolated_format.py |
| index 5c933095b20a09fd944e66904554729ddc34e741..0216a390eb4f6601d249d42afe308b8eb2a2ee9a 100644 |
| --- a/client/isolated_format.py |
| +++ b/client/isolated_format.py |
| @@ -309,7 +309,8 @@ def expand_directories_and_symlinks( |
| @tools.profile |
| -def file_to_metadata(filepath, prevdict, read_only, algo): |
| +def file_to_metadata( |
| + filepath, prevdict, read_only, algo, collapse_symlinks=False): |
|
M-A Ruel
2017/04/27 17:44:02
no default please
kjlubick
2017/04/27 17:55:37
Done.
|
| """Processes an input file, a dependency, and return meta data about it. |
| Behaviors: |
| @@ -340,7 +341,13 @@ def file_to_metadata(filepath, prevdict, read_only, algo): |
| # There is the risk of the file's timestamp being reset to its last value |
| # manually while its content changed. We don't protect against that use case. |
| try: |
| - filestats = os.lstat(filepath) |
| + filestats = None |
|
M-A Ruel
2017/04/27 17:44:02
not needed
kjlubick
2017/04/27 17:55:37
Done.
|
| + if collapse_symlinks: |
| + # os.stat follows symbolic links |
| + filestats = os.stat(filepath) |
| + else: |
| + # os.lstat does not follow symbolic links, and thus preserves them. |
| + filestats = os.lstat(filepath) |
| except OSError: |
| # The file is not present. |
| raise MappingError('%s is missing' % filepath) |