diff options
| author | Mike Frysinger <vapier@google.com> | 2019-09-30 23:59:27 -0400 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2019-10-01 05:44:09 +0000 |
| commit | 0a9265e2d633b608090eff79ab4553f0e1c8c7c4 (patch) | |
| tree | e82c95a7c44792af2e5848440f25be40ed4c00b3 /subcmds/diff.py | |
| parent | dc1b59d2c0a7ee00b7e6b111285360c4cff32d2b (diff) | |
| download | git-repo-0a9265e2d633b608090eff79ab4553f0e1c8c7c4.tar.gz | |
diff: handle errors gracefully
If `git diff` fails in any project checkout (e.g. an incomplete
sync), make sure we print that error clearly rather than blowing
up, and exit non-zero in the process.
Bug: https://crbug.com/gerrit/11613
Change-Id: I12f278427cced20f23f8047e7e3dba8f442ee25e
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239236
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/diff.py')
| -rw-r--r-- | subcmds/diff.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/subcmds/diff.py b/subcmds/diff.py index 1f3abd86..fa41e70e 100644 --- a/subcmds/diff.py +++ b/subcmds/diff.py | |||
| @@ -37,5 +37,8 @@ to the Unix 'patch' command. | |||
| 37 | help='Paths are relative to the repository root') | 37 | help='Paths are relative to the repository root') |
| 38 | 38 | ||
| 39 | def Execute(self, opt, args): | 39 | def Execute(self, opt, args): |
| 40 | ret = 0 | ||
| 40 | for project in self.GetProjects(args): | 41 | for project in self.GetProjects(args): |
| 41 | project.PrintWorkTreeDiff(opt.absolute) | 42 | if not project.PrintWorkTreeDiff(opt.absolute): |
| 43 | ret = 1 | ||
| 44 | return ret | ||
