commit 24b5452abe8f7dca6abf6cc0199101c2b950d141 from: Stefan Sperling date: Wed Oct 09 06:50:28 2019 UTC show bad reference names in error messages to make such errors more clear commit - d4fc9a6260fe59ce46d184c584e4cdfea36d5944 commit + 24b5452abe8f7dca6abf6cc0199101c2b950d141 blob - 0c7661cb83bd74a19bc65dabb5d4ecf110143c1b blob + 2f092a4352782fe9d85630c9c9866ed4dd91112b --- got/got.c +++ got/got.c @@ -3035,7 +3035,7 @@ add_ref(struct got_repository *repo, const char *refna * an unintended typo. */ if (refname[0] == '-' && refname[1] == '\0') - return got_error(GOT_ERR_BAD_REF_NAME); + return got_error_path(refname, GOT_ERR_BAD_REF_NAME); err = got_repo_match_object_id_prefix(&id, target, GOT_OBJ_TYPE_ANY, repo); @@ -3078,7 +3078,7 @@ add_symref(struct got_repository *repo, const char *re * an unintended typo. */ if (refname[0] == '-' && refname[1] == '\0') - return got_error(GOT_ERR_BAD_REF_NAME); + return got_error_path(refname, GOT_ERR_BAD_REF_NAME); err = got_ref_open(&target_ref, repo, target, 0); if (err) @@ -3370,7 +3370,7 @@ add_branch(struct got_repository *repo, const char *br * an unintended typo. */ if (branch_name[0] == '-' && branch_name[1] == '\0') - return got_error(GOT_ERR_BAD_REF_NAME); + return got_error_path(branch_name, GOT_ERR_BAD_REF_NAME); err = match_object_id(&id, &label, base_branch, GOT_OBJ_TYPE_COMMIT, 1, repo); @@ -3791,7 +3791,7 @@ add_tag(struct got_repository *repo, const char *tag_n * an unintended typo. */ if (tag_name[0] == '-' && tag_name[1] == '\0') - return got_error(GOT_ERR_BAD_REF_NAME); + return got_error_path(tag_name, GOT_ERR_BAD_REF_NAME); err = get_author(&tagger, repo); if (err) blob - 54de181c72e65698c248f4642fb3545e3491cf0a blob + 162f19c9a7709ee0d04c1f0748dc276fda48d502 --- lib/reference.c +++ lib/reference.c @@ -294,7 +294,7 @@ got_ref_alloc(struct got_reference **ref, const char * struct got_object_id *id) { if (!is_valid_ref_name(name)) - return got_error(GOT_ERR_BAD_REF_NAME); + return got_error_path(name, GOT_ERR_BAD_REF_NAME); return alloc_ref(ref, name, id, 0); } @@ -304,7 +304,7 @@ got_ref_alloc_symref(struct got_reference **ref, const struct got_reference *target_ref) { if (!is_valid_ref_name(name)) - return got_error(GOT_ERR_BAD_REF_NAME); + return got_error_path(name, GOT_ERR_BAD_REF_NAME); return alloc_symref(ref, name, got_ref_get_name(target_ref), 0); }