diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-11-07 11:42:01 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-11-07 15:46:56 -0800 |
commit | eeb3f55c165e1a92d8fc85819035247fefe7971a (patch) | |
tree | 00482fe976a9cbb4c6a5771e89fab04266a41748 /builtin/init-db.c | |
parent | 688b1310ed3277e9578495f816a7caffeb15f0e5 (diff) | |
download | git-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/init-db.c')
-rw-r--r-- | builtin/init-db.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c index 587a5055ed..d6cdee8a39 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -7,6 +7,7 @@ #include "builtin.h" #include "exec_cmd.h" #include "parse-options.h" +#include "refs.h" #ifndef DEFAULT_GIT_TEMPLATE_DIR #define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates" @@ -187,6 +188,7 @@ static int create_default_files(const char *template_path) char junk[2]; int reinit; int filemode; + struct strbuf err = STRBUF_INIT; if (len > sizeof(path)-50) die(_("insane git directory %s"), git_dir); @@ -236,8 +238,10 @@ static int create_default_files(const char *template_path) strcpy(path + len, "HEAD"); reinit = (!access(path, R_OK) || readlink(path, junk, sizeof(junk)-1) != -1); - if (!reinit) { - if (create_symref("HEAD", "refs/heads/master", NULL) < 0) + if (!reinit && + create_symref("HEAD", "refs/heads/master", NULL, &err)) { + error("%s", err.buf); + strbuf_release(&err); exit(1); } |