commit 0f148cb77a71142fd9317f1a705b5f03903bb35b from: Stefan Sperling date: Mon May 13 21:30:57 2019 UTC revert c191ed664f6c437ebc3e0c859c53e48b445401f1 'got ref' should only work with naked ref names; implicitly putting things into 'refs/heads' is a job for something like a 'got branch' command. commit - 6e472abb219118bbb338c67086cf830c57de2c85 commit + 0f148cb77a71142fd9317f1a705b5f03903bb35b blob - 1ddd447e91d264e0d48cdf1ce2c7dd79af85be0d blob + e572d687ec4e83e49ea1d418f2c5a61f9f67cc3e --- lib/reference.c +++ lib/reference.c @@ -290,19 +290,10 @@ const struct got_error * got_ref_alloc(struct got_reference **ref, const char *name, struct got_object_id *id) { - const struct got_error *err; - char *absname = NULL; + if (!is_valid_ref_name(name)) + return got_error(GOT_ERR_BAD_REF_NAME); - if (!is_valid_ref_name(name)) { - if (strchr(name, '/') != NULL) - return got_error(GOT_ERR_BAD_REF_NAME); - if (asprintf(&absname, "refs/heads/%s", name) == -1) - return got_error_from_errno("asprintf"); - } - - err = alloc_ref(ref, absname ? absname : name, id, 0); - free(absname); - return err; + return alloc_ref(ref, name, id, 0); } static const struct got_error *