backout 499d7ecc534806c7daf8795b1c9f76575520921f It is better to use another option code for first-parent log. Having a -b option which takes no argument is too confusing. E.g. 'got log -b foo' would log the path 'foo', not branch 'foo' and I got confused by that myself already...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
diff --git a/got/got.1 b/got/got.1
index 1103aa2..4b86514 100644
--- a/got/got.1
+++ b/got/got.1
@@ -253,6 +253,11 @@ if invoked in a work tree, or to the repository's HEAD reference.
Set the number of context lines shown in diffs with
.Fl p .
By default, 3 lines of context are shown.
+.It Fl f
+Restrict history traversal to the first parent of each commit.
+This shows the linear history of the current branch only.
+Merge commits which affected the current branch will be shown but
+individual commits which originated on other branches will be omitted.
.It Fl l Ar N
Limit history traversal to a given number of commits.
.It Fl p
@@ -744,7 +749,7 @@ In a work tree or a git repository directory, view changes committed in
the 3 most recent commits to the work tree's branch, or the branch resolved
via the repository's HEAD reference, respectively:
.Pp
-.Dl $ got log -p -l 3 -b
+.Dl $ got log -p -l 3 -f
.Pp
Add new files and remove obsolete files in a work tree directory:
.Pp
diff --git a/got/got.c b/got/got.c
index 2f7d8b5..25dbaaa 100644
--- a/got/got.c
+++ b/got/got.c
@@ -1366,7 +1366,7 @@ done:
__dead static void
usage_log(void)
{
- fprintf(stderr, "usage: %s log [-b] [-c commit] [-C number] [ -l N ] [-p] "
+ fprintf(stderr, "usage: %s log [-c commit] [-C number] [-f] [ -l N ] [-p] "
"[-r repository-path] [path]\n", getprogname());
exit(1);
}
@@ -1395,11 +1395,8 @@ cmd_log(int argc, char *argv[])
err(1, "pledge");
#endif
- while ((ch = getopt(argc, argv, "bpc:C:l:r:")) != -1) {
+ while ((ch = getopt(argc, argv, "b:pc:C:l:fr:")) != -1) {
switch (ch) {
- case 'b':
- first_parent_traversal = 1;
- break;
case 'p':
show_patch = 1;
break;
@@ -1417,6 +1414,9 @@ cmd_log(int argc, char *argv[])
if (errstr != NULL)
err(1, "-l option %s", errstr);
break;
+ case 'f':
+ first_parent_traversal = 1;
+ break;
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)