commit - b00d56cde51fc646b2b3055ff80e6f5b2b8cccb1
commit + d142fc4582a55b3d8550935f8546bfa080f2bd98
blob - 84b212f11bdf093996b9fad66acea32f441cf7b2
blob + e776aa41a89bdb1de0da979d24c3588f0c344152
--- got/got.1
+++ got/got.1
be checked out.
.\".It Cm status
.\"Show current status of files.
-.It Cm log
+.It Cm log [ Fl p ] [ Fl c Ar commit ] [ Ar repository-path ]
Display history of the repository.
If the
.Fl p
flag is given, display the patch of modifications made in each commit.
+If a
+.Ar commit
+is specified with the
+.Fl c
+option, start traversing history at this commit.
+If the
+.Ar repository path
+is omitted, use the current working directory.
.El
.Sh EXIT STATUS
.Ex -std got
blob - 41ca7c9696379c1899dc721f39eb4c60a8f672df
blob + ba1a257980d1b9f0e7bebe84ebcfc64c904caf32
--- got/got.c
+++ got/got.c
__dead void
usage_log(void)
{
- fprintf(stderr, "usage: %s log [-p] [repository-path] [commit]\n",
+ fprintf(stderr, "usage: %s log [-p] [-c commit] [repository-path]\n",
getprogname());
exit(1);
}
struct got_object_id *id = NULL;
struct got_object *obj;
char *repo_path = NULL;
- char *commit_id_str = NULL;
+ char *start_commit = NULL;
int ch;
int show_patch = 0;
err(1, "pledge");
#endif
- while ((ch = getopt(argc, argv, "p")) != -1) {
+ while ((ch = getopt(argc, argv, "pc:")) != -1) {
switch (ch) {
case 'p':
show_patch = 1;
+ break;
+ case 'c':
+ start_commit = optarg;
break;
default:
usage();
err(1, "getcwd");
} else if (argc == 1) {
repo_path = argv[0];
- } else if (argc == 2) {
- repo_path = argv[0];
- commit_id_str = argv[1];
} else
usage_log();
if (error != NULL)
return error;
- if (commit_id_str == NULL) {
+ if (start_commit == NULL) {
struct got_reference *head_ref;
error = got_ref_open(&head_ref, repo, GOT_REF_HEAD);
if (error != NULL)
return error;
error = got_object_open(&obj, repo, id);
} else {
- error = got_object_open_by_id_str(&obj, repo, commit_id_str);
+ error = got_object_open_by_id_str(&obj, repo, start_commit);
if (error == NULL) {
id = got_object_get_id(obj);
if (id == NULL)