diff options
author | Dan Willemsen <dwillemsen@google.com> | 2015-11-18 16:49:38 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2015-11-18 16:51:51 -0800 |
commit | e1e0bd1f75e64ba4854f288741aa88dfe2f3cf61 (patch) | |
tree | 1fd4d5261bf03d509db6b24fe849c3557895e63b | |
parent | 74cfd2709b0bc23fc3efb8951b4b5abb2bf4e4a7 (diff) | |
download | git-repo-e1e0bd1f75e64ba4854f288741aa88dfe2f3cf61.tar.gz |
Check for broken links when updating linkfiles
If a linkfile is a broken link (destination does not exist), and it
needs to be updated, we didn't notice that it needed to be removed
first. Use lexists instead of exists to check for this condition.
Change-Id: I1f6a1f0193d3fd2b9f7a647836044997f6ab32eb
-rw-r--r-- | project.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -249,7 +249,7 @@ class _LinkFile(object): | |||
249 | if not os.path.islink(absDest) or (os.readlink(absDest) != relSrc): | 249 | if not os.path.islink(absDest) or (os.readlink(absDest) != relSrc): |
250 | try: | 250 | try: |
251 | # remove existing file first, since it might be read-only | 251 | # remove existing file first, since it might be read-only |
252 | if os.path.exists(absDest): | 252 | if os.path.lexists(absDest): |
253 | os.remove(absDest) | 253 | os.remove(absDest) |
254 | else: | 254 | else: |
255 | dest_dir = os.path.dirname(absDest) | 255 | dest_dir = os.path.dirname(absDest) |