Commit 4380c80d authored by ilevy@chromium.org's avatar ilevy@chromium.org

Fix GenerateDiff -- don't strip whitespace.

BUG=259434
R=iannucci

Review URL: https://chromiumcodereview.appspot.com/18408006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@211483 0039d316-1c4b-4281-b951-d872f2087c98
parent ecb75423
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment