Fix squash_current_branch on dirty submodules

If there are dirty submodules, git commit -a will commit those which is
not desired. Turns out we don't need to use -a, since reset --soft
stages all changes anyways and we can just use git commit. Note that
there is a check prior to commit to ensure we are not creating an empty
commit.

R=jojwang

Fixed: 1478668
Change-Id: Iaa1ff8e638b7431511e6e194ad59e3c4adb39deb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4858836
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
diff --git a/git_common.py b/git_common.py
index 592e931..a538534 100644
--- a/git_common.py
+++ b/git_common.py
@@ -980,9 +980,13 @@
         # is nothing to commit at this point.
         print('Nothing to commit; squashed branch is empty')
         return False
+
+    # git reset --soft will stage all changes so we can just commit those.
+    # Note: Just before reset --soft is called, we may have git submodules
+    # checked to an old commit (not latest state). We don't want to include
+    # those in our commit.
     run('commit',
         '--no-verify',
-        '-a',
         '-F',
         '-',
         indata=log_msg.encode('utf-8'))