Fix "git freeze" failing on broken symlinks
Fixed by switching "stat()" to "lstat()".
Does not seem to be a python3 vs python2 thing (fails on py2 as well).
Bug: 1071066
Change-Id: I7eea9ed39b43e09ae2f7558bf23c12581f02e4a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2150507
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
diff --git a/git_common.py b/git_common.py
index 16e4ce8..d4f2497 100644
--- a/git_common.py
+++ b/git_common.py
@@ -454,7 +454,7 @@
die("Cannot freeze unmerged changes!")
if limit_mb > 0:
if s.lstat == '?':
- untracked_bytes += os.stat(os.path.join(root_path, f)).st_size
+ untracked_bytes += os.lstat(os.path.join(root_path, f)).st_size
if limit_mb > 0 and untracked_bytes > limit_mb * MB:
die("""\
You appear to have too much untracked+unignored data in your git