Index: scm.py |
diff --git a/scm.py b/scm.py |
index 6f508c83ab2b7a2e3ec9e266028164c14e0c2735..30bb3d17ea49bd74c0a83af490bbc486d60e3f41 100644 |
--- a/scm.py |
+++ b/scm.py |
@@ -97,13 +97,14 @@ class GIT(object): |
current_version = None |
@staticmethod |
- def Capture(args, cwd, **kwargs): |
+ def Capture(args, cwd, strip_out=True, **kwargs): |
env = os.environ.copy() |
# 'cat' is a magical git string that disables pagers on all platforms. |
env['GIT_PAGER'] = 'cat' |
- return subprocess2.check_output( |
+ output = subprocess2.check_output( |
['git'] + args, |
- cwd=cwd, stderr=subprocess2.PIPE, env=env, **kwargs).strip() |
+ cwd=cwd, stderr=subprocess2.PIPE, env=env, **kwargs) |
+ return output.strip() if strip_out else output |
@staticmethod |
def CaptureStatus(files, cwd, upstream_branch): |
@@ -359,7 +360,7 @@ class GIT(object): |
if files: |
command.append('--') |
command.extend(files) |
- diff = GIT.Capture(command, cwd=cwd).splitlines(True) |
+ diff = GIT.Capture(command, cwd=cwd, strip_out=False).splitlines(True) |
for i in range(len(diff)): |
# In the case of added files, replace /dev/null with the path to the |
# file being added. |