mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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
This commit is contained in:
parent
74cfd2709b
commit
e1e0bd1f75
@ -249,7 +249,7 @@ class _LinkFile(object):
|
|||||||
if not os.path.islink(absDest) or (os.readlink(absDest) != relSrc):
|
if not os.path.islink(absDest) or (os.readlink(absDest) != relSrc):
|
||||||
try:
|
try:
|
||||||
# remove existing file first, since it might be read-only
|
# remove existing file first, since it might be read-only
|
||||||
if os.path.exists(absDest):
|
if os.path.lexists(absDest):
|
||||||
os.remove(absDest)
|
os.remove(absDest)
|
||||||
else:
|
else:
|
||||||
dest_dir = os.path.dirname(absDest)
|
dest_dir = os.path.dirname(absDest)
|
||||||
|
Loading…
Reference in New Issue
Block a user