mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 20:42:23 +00:00
Merge pull request #3736 from libgit2/cmn/dwim-general-message
refs: provide a more general error message for dwim
This commit is contained in:
commit
0e00eecf83
@ -289,6 +289,9 @@ cleanup:
|
|||||||
"Could not use '%s' as valid reference name", git_buf_cstr(&name));
|
"Could not use '%s' as valid reference name", git_buf_cstr(&name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (error == GIT_ENOTFOUND)
|
||||||
|
giterr_set(GITERR_REFERENCE, "no reference found for shorthand '%s'", refname);
|
||||||
|
|
||||||
git_buf_free(&name);
|
git_buf_free(&name);
|
||||||
git_buf_free(&refnamebuf);
|
git_buf_free(&refnamebuf);
|
||||||
return error;
|
return error;
|
||||||
|
@ -58,3 +58,11 @@ void test_refs_lookup__namespace(void)
|
|||||||
error = git_reference_lookup(&ref, g_repo, "refs/heads/");
|
error = git_reference_lookup(&ref, g_repo, "refs/heads/");
|
||||||
cl_assert_equal_i(error, GIT_EINVALIDSPEC);
|
cl_assert_equal_i(error, GIT_EINVALIDSPEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_refs_lookup__dwim_notfound(void)
|
||||||
|
{
|
||||||
|
git_reference *ref;
|
||||||
|
|
||||||
|
cl_git_fail_with(GIT_ENOTFOUND, git_reference_dwim(&ref, g_repo, "idontexist"));
|
||||||
|
cl_assert_equal_s("no reference found for shorthand 'idontexist'", giterr_last()->message);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user