baseline

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

commit 9ecd584711c6e08a89f24604621bbfc2e341dfd2
parent eb8814dd1c59a478b2d3a3e496dbad576d00517c
Author: Mohamed Aslan <maslan@sce.carleton.ca>
Date:   Wed, 18 Jun 2014 04:34:46 -0400

do not create a new branch from current unless it already has some commits

Diffstat:
Mcmd-branch.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/cmd-branch.c b/cmd-branch.c @@ -74,6 +74,11 @@ cmd_branch(int argc, char **argv) switch (op) { case O_CREATE: + /* get current branch's head */ + if (s.db_ops->branch_get_head(s.db_ctx, s.branch, &head) == EXIT_FAILURE) + errx(EXIT_FAILURE, "error, failed to find branch head."); + if (head == NULL) + errx(EXIT_FAILURE, "error, branch \'%s\' does not contain any commits.", s.branch); /* create a new branch from the current one */ if (s.db_ops->branch_create_from(s.db_ctx, branch, s.branch) == EXIT_FAILURE) errx(EXIT_FAILURE, "error, failed to create branch \'%s\'.", branch);