"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Klemens Nanni <kn@openbsd.org>
Subject:
log: -C requires -p
To:
gameoftrees@openbsd.org
Date:
Fri, 29 Nov 2019 23:01:29 +0100

Download raw body.

Thread
  • Klemens Nanni:

    log: -C requires -p

"got log -C0" is invalid synopsis, so behave accordingly.

OK?
 
diff ed9efb3599fbb99d58b35bc58e27b9fb2b50242f e54952f1173d1a102a30a16c4405acced5d8bc4d
blob - a563bd3577b7aafe51ef56016983954041267f18
blob + 603a08dbce6fba185a792c4cb606fc4c9e482bce
--- got/got.c
+++ got/got.c
@@ -1840,7 +1840,7 @@ cmd_log(int argc, char *argv[])
 	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;
@@ -1896,6 +1896,11 @@ cmd_log(int argc, char *argv[])
 
 	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) {