Commit fc1c6f4c authored by Pierre-Antoine Manzagol's avatar Pierre-Antoine Manzagol Committed by Commit Bot

Correct Git show's path format on Windows

_CalculateAddedDeps calls into depot tools' scm.py GetOldContents to
compare previous and current versions of the DEPS file. GetOldContents
attempts to 'git show <sha>:<path>'. The problem on Windows is that path
uses '\' but git show seems to want a posix path. Git show therefore
doesn't find the file and returns an empty output, leading presubmit to
think all the deps are new.

Bug:725933
Change-Id: Ifbbfbcba4be466d9be623826818fd191bd2ca525
Reviewed-on: https://chromium-review.googlesource.com/514142
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: 's avatarNodir Turakulov <nodir@chromium.org>
parent 07dbac24
......@@ -8,6 +8,7 @@ import cStringIO
import glob
import logging
import os
import platform
import re
import sys
import tempfile
......@@ -258,6 +259,9 @@ class GIT(object):
def GetOldContents(cwd, filename, branch=None):
if not branch:
branch = GIT.GetUpstreamBranch(cwd)
if platform.system() == 'Windows':
# git show <sha>:<path> wants a posix path.
filename = filename.replace('\\', '/')
command = ['show', '%s:%s' % (branch, filename)]
try:
return GIT.Capture(command, cwd=cwd, strip_out=False)
......
......@@ -58,6 +58,7 @@ class RootTestCase(BaseSCMTestCase):
'logging',
'only_int',
'os',
'platform',
're',
'subprocess2',
'sys',
......
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