Index: gclient_scm.py |
diff --git a/gclient_scm.py b/gclient_scm.py |
index 4a4e6015461582fbf28a1034f63e66aba1e26770..49e53f6bfbd3945ebdf2308fbc2db8ec80d9a376 100644 |
--- a/gclient_scm.py |
+++ b/gclient_scm.py |
@@ -534,6 +534,13 @@ class GitWrapper(SCMWrapper): |
target = 'HEAD' |
if options.upstream and upstream_branch: |
target = upstream_branch |
+ |
+ # Builds can create hard links which update source files' ctimes, causing |
+ # git to become confused over what files are out-of-date. Calling |
+ # `git status` resynchronizes git and allows `git reset --hard` to not |
+ # re-checkout files (and thus forcing unnecessary rebuilds)". |
+ self._Run(['status'], options) |
+ |
self._Run(['reset', '--hard', target], options) |
if current_type == 'detached': |