| Index: third_party/upload.py | 
| diff --git a/third_party/upload.py b/third_party/upload.py | 
| index ee2b4c2b4c4432bf84bee80226abc32bc27c2305..cdde7112a5de2c276e2b1b17a043fe0a8b93e376 100755 | 
| --- a/third_party/upload.py | 
| +++ b/third_party/upload.py | 
| @@ -1214,8 +1214,19 @@ class GitVCS(VersionControlSystem): | 
| # git config key "diff.external" is used). | 
| env = os.environ.copy() | 
| if 'GIT_EXTERNAL_DIFF' in env: del env['GIT_EXTERNAL_DIFF'] | 
| -    return RunShell(["git", "diff", "--no-ext-diff", "--full-index", "-M"] | 
| -                    + extra_args, env=env) | 
| +    # -M/-C will not print the diff for the deleted file when a file is renamed. | 
| +    # This is confusing because the original file will not be shown on the | 
| +    # review when a file is renamed. So first get the diff of all deleted files, | 
| +    # then the diff of everything except deleted files with rename and copy | 
| +    # support enabled. | 
| +    cmd = ["git", "diff", "--no-ext-diff", "--full-index"] | 
| +    diff = RunShell(cmd + ["--diff-filter=D"] + extra_args, env=env, | 
| +        silent_ok=True) | 
| +    diff += RunShell(cmd + ["-C", "--diff-filter=ACMRT"] + extra_args, env=env, | 
| +        silent_ok=True) | 
| +    if not diff: | 
| +      ErrorExit("No output from %s" % (cmd + extra_args)) | 
| +    return diff | 
|  | 
| def GetUnknownFiles(self): | 
| status = RunShell(["git", "ls-files", "--exclude-standard", "--others"], | 
| @@ -1871,7 +1882,7 @@ def GuessVCSName(options): | 
| if returncode == 0: | 
| return (VCS_CVS, None) | 
| except OSError, (errno, message): | 
| -    if error != 2: | 
| +    if errno != 2: | 
| raise | 
|  | 
| return (VCS_UNKNOWN, None) | 
|  |