Adjust fsmonitor alert for Mac
Version 2.43 contains a fix for fsmonitor. Google managed git already
contains the fix.
R=aravindvasudev
Fixed: 1475405
Change-Id: I388b1e14e070595b8b0c6bca046dd3af2248a0ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4892305
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
diff --git a/git_common.py b/git_common.py
index a538534..f814ed1 100644
--- a/git_common.py
+++ b/git_common.py
@@ -423,6 +423,13 @@
# TODO(crbug.com/1475405): Warn users if the project uses submodules and
# they have fsmonitor enabled.
if sys.platform.startswith('darwin') and is_fsmonitor_enabled():
+ version_string = run('--version')
+ if version_string.endswith('goog'):
+ return
+ version_tuple = _extract_git_tuple(version_string)
+ if version_tuple >= (2, 43):
+ return
+
print(colorama.Fore.RED)
print('WARNING: You have fsmonitor enabled. There is a major issue '
'resulting in git diff-index returning wrong results. Please '
@@ -1119,6 +1126,10 @@
"""Returns a tuple that contains the numeric components of the current git
version."""
version_string = run('--version')
+ return _extract_git_tuple(version_string)
+
+
+def _extract_git_tuple(version_string):
version_match = re.search(r'(\d+.)+(\d+)', version_string)
version = version_match.group() if version_match else ''