Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py

Issue 2605933002: In Git.unstaged_files, handle the case when there are no changes. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
index dc790442463defccbd0b90f9f4ab79a8fd9d93aa..1f8effd8d9d03f9957efce860a00aa0c98980d77 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
@@ -121,9 +121,12 @@ class Git(SCM):
"""
# `git status -z` is a version of `git status -s`, that's recommended
# for machine parsing. Lines are terminated with NUL rather than LF.
+ change_lines = self._run_git(['status', '-z']).rstrip('\x00')
+ if not change_lines:
+ return {} # No changes.
unstaged_changes = {}
qyearsley 2016/12/28 18:47:20 Here, if there are no changes, then change_lines i
- change_lines = self._run_git(['status', '-z']).rstrip('\x00').split('\x00')
- for line in change_lines:
+ for line in change_lines.split('\x00'):
+ assert len(line) > 4, 'Unexpected change line format %s' % line
if line[1] == ' ':
continue # Already staged for commit.
path = line[3:]
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698