commit - 6841bf1343d4d3bbafbc1db614429635309c20d4
commit + dc1edbfa7b55d670ad2e36df81a084cc8498085b
blob - a563bd3577b7aafe51ef56016983954041267f18
blob + 603a08dbce6fba185a792c4cb606fc4c9e482bce
--- got/got.c
+++ got/got.c
struct got_object_id *id = NULL;
char *repo_path = NULL, *path = NULL, *cwd = NULL, *in_repo_path = NULL;
char *start_commit = NULL, *search_pattern = NULL;
- int diff_context = 3, ch;
+ int diff_context = -1, ch;
int show_patch = 0, limit = 0, first_parent_traversal = 0;
const char *errstr;
struct got_reflist_head refs;
argc -= optind;
argv += optind;
+ if (diff_context == -1)
+ diff_context = 3;
+ else if (!show_patch)
+ errx(1, "-C reguires -p");
+
cwd = getcwd(NULL, 0);
if (cwd == NULL) {
error = got_error_from_errno("getcwd");