Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index 4edb6a0af8e1ee834f7f8305e92e435a3c1f9cee..46f1199ce1385c2df58c515d3ecb767a7a0dfdb1 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -2401,6 +2401,9 @@ def CMDpatch(parser, args): |
| return 1 |
| issue_arg = args[0] |
| + if is_dirty_git_tree('patch'): |
| + return 1 |
| + |
| # TODO(maruel): Use apply_issue.py |
| # TODO(ukai): use gerrit-cherry-pick for gerrit repository? |
| @@ -2464,6 +2467,7 @@ def PatchIssue(issue_arg, reject, nocommit, directory): |
| subprocess2.check_call(cmd, env=GetNoGitPagerEnv(), |
| stdin=patch_data, stdout=subprocess2.VOID) |
| except subprocess2.CalledProcessError: |
| + RunGit(['reset', '--hard']) |
| DieWithError('Failed to apply the patch') |
| # If we had an issue, commit the current state and register the issue. |
| @@ -2769,6 +2773,9 @@ def CMDset_close(parser, args): |
| def CMDdiff(parser, args): |
| """shows differences between local tree and last upload.""" |
| + if is_dirty_git_tree('diff'): |
| + return 1 |
|
iannucci
2015/02/02 15:49:42
Hm... why is this necessary?
wychen
2015/02/02 17:09:25
This is basically a safety measure. If the user ha
|
| + |
| cl = Changelist() |
| issue = cl.GetIssue() |
| branch = cl.GetBranch() |