cm_crowdin_sync: Fix commit creation

Tested myself.

Change-Id: I17ed304b4842aad4aba4a17a4d275b321de5b781
diff --git a/cm_crowdin_aosp_sync.py b/cm_crowdin_aosp_sync.py
index 3bf67eb..00dd42f 100755
--- a/cm_crowdin_aosp_sync.py
+++ b/cm_crowdin_aosp_sync.py
@@ -149,20 +149,19 @@
 
     # Create git commit
     repo = git.Repo(path)
-    repo.git.add(path)
     removed_files = repo.git.ls_files(d=True).split('\n')
     try:
         repo.git.rm(removed_files)
     except:
         pass
+    repo.git.add('-A')
     try:
         repo.git.commit(m='Automatic translation import')
-        repo.git.push('ssh://' + username + '@review.cyanogenmod.org:29418/' + name, 'HEAD:refs/for/' + branch)
-        print('Succesfully pushed commit for ' + name)
     except:
-        # If git commit fails, it's probably because of no changes.
-        # Just continue.
-        print('No commit pushed (probably empty?) for ' + name)
+        print('Failed to create commit for ' + name + ', probably empty: skipping')
+        return
+    repo.git.push('ssh://' + username + '@review.cyanogenmod.org:29418/' + name, 'HEAD:refs/for/' + branch)
+    print('Succesfully pushed commit for ' + name)
 
 print('Welcome to the CM Crowdin sync script!')
 
diff --git a/cm_crowdin_sync.py b/cm_crowdin_sync.py
index f70bb76..a19d5b9 100755
--- a/cm_crowdin_sync.py
+++ b/cm_crowdin_sync.py
@@ -185,20 +185,19 @@
 
     # Create git commit
     repo = git.Repo(path)
-    repo.git.add(path)
     removed_files = repo.git.ls_files(d=True).split('\n')
     try:
         repo.git.rm(removed_files)
     except:
         pass
+    repo.git.add('-A')
     try:
         repo.git.commit(m='Automatic translation import')
-        repo.git.push('ssh://' + username + '@review.cyanogenmod.org:29418/' + name, 'HEAD:refs/for/' + branch)
-        print('Succesfully pushed commit for ' + name)
     except:
-        # If git commit fails, it's probably because of no changes.
-        # Just continue.
-        print('No commit pushed (probably empty?) for ' + name)
+        print('Failed to create commit for ' + name + ', probably empty: skipping')
+        return
+    repo.git.push('ssh://' + username + '@review.cyanogenmod.org:29418/' + name, 'HEAD:refs/for/' + branch)
+    print('Succesfully pushed commit for ' + name)
 
 print('Welcome to the CM Crowdin sync script!')