summaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2014-11-07 11:42:01 -0800
committerJunio C Hamano <gitster@pobox.com>2014-11-07 15:46:56 -0800
commiteeb3f55c165e1a92d8fc85819035247fefe7971a (patch)
tree00482fe976a9cbb4c6a5771e89fab04266a41748 /builtin/checkout.c
parent688b1310ed3277e9578495f816a7caffeb15f0e5 (diff)
downloadgit-rs/ref-transaction-send-pack.tar.gz
refs.c: add an err argument to create_symrefrs/ref-transaction-send-pack
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index d9cb9c348b..1efe353728 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -634,7 +634,10 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
describe_detached_head(_("HEAD is now at"), new->commit);
}
} else if (new->path) { /* Switch branches. */
- create_symref("HEAD", new->path, msg.buf);
+ if (create_symref("HEAD", new->path, msg.buf, &err)) {
+ error("%s", err.buf);
+ strbuf_release(&err);
+ }
if (!opts->quiet) {
if (old->path && !strcmp(new->path, old->path)) {
if (opts->new_branch_force)
@@ -1020,12 +1023,16 @@ static int parse_branchname_arg(int argc, const char **argv,
static int switch_unborn_to_new_branch(const struct checkout_opts *opts)
{
int status;
- struct strbuf branch_ref = STRBUF_INIT;
+ struct strbuf branch_ref = STRBUF_INIT, err = STRBUF_INIT;
if (!opts->new_branch)
die(_("You are on a branch yet to be born"));
strbuf_addf(&branch_ref, "refs/heads/%s", opts->new_branch);
- status = create_symref("HEAD", branch_ref.buf, "checkout -b");
+ status = create_symref("HEAD", branch_ref.buf, "checkout -b", &err);
+ if (status) {
+ error("%s", err.buf);
+ strbuf_release(&err);
+ }
strbuf_release(&branch_ref);
if (!opts->quiet)
fprintf(stderr, _("Switched to a new branch '%s'\n"),