commit - 4bd3f2bbb76e22f763d47c525de6f91eafb0c53d
commit + a0603db24cfd80ddb6d903450ed46baacbbd677e
blob - f7418de1cab9d4429b9f143c2ef006c90b0acab7
blob + 3bcc62f94215ced3a11d5b3b47ed4887026df706
--- got/got.1
+++ got/got.1
.Ar path prefix .
.\".It Cm status
.\"Show current status of files.
-.It Cm log [ Fl p ] [ Fl c Ar commit ] [ Fl l Ar N ] [ Ar repository-path ]
+.It Cm log [ Fl p ] [ Fl c Ar commit ] [ Fl l Ar N ] [ Fl v ] [ Ar repository-path ]
Display history of the repository.
If the
.Fl p
option limits the output to a number of
.Ar N
commits.
+The
+.Fl v
+option enables verbose output.
If the
.Ar repository path
is omitted, use the current working directory.
blob - df469a9624a297e45ad069d5fe8cea1eb52d064a
blob + 0402e69c5ab82d8c2b0edd44b7545eabda924099
--- got/got.c
+++ got/got.c
static const struct got_error *
print_commit(struct got_commit_object *commit, struct got_object_id *id,
- struct got_repository *repo, int show_patch)
+ struct got_repository *repo, int show_patch, int verbose)
{
const struct got_error *err = NULL;
char *id_str, *logmsg, *line;
printf("author: %s\n", commit->author);
if (strcmp(commit->author, commit->committer) != 0)
printf("committer: %s\n", commit->committer);
+ if (verbose) {
+ struct got_parent_id *pid;
+ SIMPLEQ_FOREACH(pid, &commit->parent_ids, entry) {
+ err = got_object_id_str(&id_str, pid->id);
+ if (err)
+ return err;
+ printf("parent commit: %s\n", id_str);
+ free(id_str);
+ }
+ }
logmsg = strdup(commit->logmsg);
if (logmsg == NULL)
static const struct got_error *
print_commits(struct got_object *root_obj, struct got_object_id *root_id,
- struct got_repository *repo, int show_patch, int limit)
+ struct got_repository *repo, int show_patch, int limit, int verbose)
{
const struct got_error *err;
struct got_commit_graph *graph;
}
if (commit == NULL)
break;
- err = print_commit(commit, id, repo, show_patch);
+ err = print_commit(commit, id, repo, show_patch, verbose);
if (err || (limit && --limit == 0))
break;
} while (ncommits > 0);
char *repo_path = NULL;
char *start_commit = NULL;
int ch;
- int show_patch = 0, limit = 0;
+ int show_patch = 0, limit = 0, verbose = 0;
const char *errstr;
#ifndef PROFILE
err(1, "pledge");
#endif
- while ((ch = getopt(argc, argv, "pc:l:")) != -1) {
+ while ((ch = getopt(argc, argv, "pc:l:v")) != -1) {
switch (ch) {
case 'p':
show_patch = 1;
if (errstr != NULL)
err(1, "-l option %s", errstr);
break;
+ case 'v':
+ verbose = 1;
+ break;
default:
usage();
/* NOTREACHED */
if (error != NULL)
return error;
if (got_object_get_type(obj) == GOT_OBJ_TYPE_COMMIT)
- error = print_commits(obj, id, repo, show_patch, limit);
+ error = print_commits(obj, id, repo, show_patch, limit,
+ verbose);
else
error = got_error(GOT_ERR_OBJ_TYPE);
got_object_close(obj);