Warn when fsmonitor is enabled and git submodules are used

Change-Id: I181bf180f762282d5b4bc614d12a91125f56e063
Bug: 1475405
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4814429
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
diff --git a/gclient.py b/gclient.py
index eb8a25e..0e2fa2e 100755
--- a/gclient.py
+++ b/gclient.py
@@ -97,6 +97,7 @@
 
 import detect_host_arch
 import fix_encoding
+import git_common
 import gclient_eval
 import gclient_paths
 import gclient_scm
@@ -2137,6 +2138,17 @@
               patch_repo + '@' + patch_ref
               for patch_repo, patch_ref in patch_refs.items())))
 
+    # TODO(crbug.com/1475405): Warn users if the project uses submodules and
+    # they have fsmonitor enabled.
+    if command == 'update':
+      # Check if any of the root dependency have submodules.
+      is_submoduled = any(
+          map(
+              lambda d: d.git_dependencies_state in
+              (gclient_eval.SUBMODULES, gclient_eval.SYNC), self.dependencies))
+      if is_submoduled:
+        git_common.warn_submodule()
+
     # Once all the dependencies have been processed, it's now safe to write
     # out the gn_args_file and run the hooks.
     removed_cipd_entries = []