baseline

yet another open-source distributed versioning control system
Log | Files | Refs

commit 29c7b7899ae541d1cd83d3fb141130824513c1ab
parent f29503c149da6bec13915f2e9baa98bd70b2edb4
Author: Mohamed Aslan <maslan@sce.carleton.ca>
Date:   Mon,  6 Oct 2014 15:30:03 -0600

add support for -c flag in cmd-ls

Diffstat:
Mcmd-ls.c | 18++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/cmd-ls.c b/cmd-ls.c @@ -58,9 +58,9 @@ ls(struct session *s, struct dir* d, const char *prefix, int is_recursive) int cmd_ls(int argc, char **argv) { - char *head; + char *head = NULL; int ch; - int recursive = 0; + int recursive = 0, explicit = 0; struct session s; struct commit *comm; struct dir *dir; @@ -68,11 +68,15 @@ cmd_ls(int argc, char **argv) baseline_session_begin(&s, 0); /* parse command line options */ - while ((ch = getopt(argc, argv, "R")) != -1) { + while ((ch = getopt(argc, argv, "Rc:")) != -1) { switch (ch) { case 'R': recursive = 1; break; + case 'c': + explicit = 1; + head = strdup(optarg); + break; default: exit(EXIT_FAILURE); } @@ -80,9 +84,11 @@ cmd_ls(int argc, char **argv) argc -= optind; argv += optind; - s.db_ops->branch_get_head(s.db_ctx, s.branch, &head); - if (head == NULL) - goto ret; + if (!explicit) { + s.db_ops->branch_get_head(s.db_ctx, s.branch, &head); + if (head == NULL) + goto ret; + } comm = baseline_commit_new(); s.db_ops->select_commit(s.db_ctx, head, comm);