Commit Diff


commit - c060419155a593f55d2dac4aa7f4409fc590458f
commit + ef1538260f78376b6fb605ffb10d682f5877afc2
blob - 9c2fa4cf0f0253f379430b774f532e2e54e6ebc3
blob + 10a6aa7aa384b8d8773e28516972143fd0c7c93a
--- got/got.1
+++ got/got.1
@@ -1039,6 +1039,12 @@ option.
 Stop traversing commit history immediately after the specified
 .Ar commit
 has been traversed.
+Like
+.Fl c ,
+the expected
+.Ar commit
+argument is a commit ID SHA1 hash, or a reference name or a keyword
+which will be resolved to a commit ID.
 This option has no effect if the specified
 .Ar commit
 is never traversed.
blob - f9aa79fc98a4ac2f2417cf76d26f3979c6ee6959
blob + be4acc192b1d47a163f835688c0151e87c860101
--- got/got.c
+++ got/got.c
@@ -4593,6 +4593,7 @@ cmd_log(int argc, char *argv[])
 	struct got_worktree *worktree = NULL;
 	struct got_object_id *start_id = NULL, *end_id = NULL;
 	char *repo_path = NULL, *path = NULL, *cwd = NULL, *in_repo_path = NULL;
+	char *keyword_idstr = NULL;
 	const char *start_commit = NULL, *end_commit = NULL;
 	const char *search_pattern = NULL;
 	int diff_context = -1, ch;
@@ -4759,8 +4760,6 @@ cmd_log(int argc, char *argv[])
 			goto done;
 		got_object_commit_close(commit);
 	} else {
-		char *keyword_idstr = NULL;
-
 		error = got_keyword_to_idstr(&keyword_idstr, start_commit,
 		    repo, worktree);
 		if (error != NULL)
@@ -4770,11 +4769,17 @@ cmd_log(int argc, char *argv[])
 
 		error = got_repo_match_object_id(&start_id, NULL,
 		    start_commit, GOT_OBJ_TYPE_COMMIT, &refs, repo);
-		free(keyword_idstr);
 		if (error != NULL)
 			goto done;
 	}
 	if (end_commit != NULL) {
+		error = got_keyword_to_idstr(&keyword_idstr, end_commit,
+		    repo, worktree);
+		if (error != NULL)
+			goto done;
+		if (keyword_idstr != NULL)
+			end_commit = keyword_idstr;
+
 		error = got_repo_match_object_id(&end_id, NULL,
 		    end_commit, GOT_OBJ_TYPE_COMMIT, &refs, repo);
 		if (error != NULL)
@@ -4830,6 +4835,7 @@ done:
 	free(cwd);
 	free(start_id);
 	free(end_id);
+	free(keyword_idstr);
 	if (worktree)
 		got_worktree_close(worktree);
 	if (repo) {