const char *old_target UNUSED,
const char *new_target UNUSED,
enum ref_transaction_error err,
- const char *details UNUSED,
+ const char *details,
void *cb_data)
{
struct ref_rejection_data *data = cb_data;
"branches"), data->remote_name);
data->conflict_msg_shown = true;
} else {
- const char *reason = ref_transaction_error_msg(err);
-
- error(_("fetching ref %s failed: %s"), refname, reason);
+ if (details)
+ error("%s", details);
+ else
+ error(_("fetching ref %s failed: %s"),
+ refname, ref_transaction_error_msg(err));
}
*data->retcode = 1;
git remote add origin ../base &&
touch refs/heads/foo.lock &&
test_must_fail git fetch -f origin "refs/heads/*:refs/heads/*" 2>err &&
- test_grep "error: fetching ref refs/heads/foo failed: reference already exists" err &&
+ test_grep -e "error: cannot lock ref ${SQ}refs/heads/foo${SQ}: Unable to create" -e "refs/heads/foo.lock${SQ}: File exists." err &&
git rev-parse refs/heads/main >expect &&
git rev-parse refs/heads/branch >actual &&
test_cmp expect actual
cd case_insensitive &&
git remote add origin -- ../case_sensitive_fd &&
test_must_fail git fetch -f origin "refs/heads/*:refs/heads/*" 2>err &&
- test_grep "failed: refname conflict" err &&
+ test_grep "cannot process ${SQ}refs/remotes/origin/foo${SQ} and ${SQ}refs/remotes/origin/foo/bar${SQ} at the same time" err &&
git rev-parse refs/heads/main >expect &&
git rev-parse refs/heads/foo/bar >actual &&
test_cmp expect actual
cd case_insensitive &&
git remote add origin -- ../case_sensitive_df &&
test_must_fail git fetch -f origin "refs/heads/*:refs/heads/*" 2>err &&
- test_grep "failed: refname conflict" err &&
+ test_grep "cannot lock ref ${SQ}refs/remotes/origin/foo${SQ}: there is a non-empty directory ${SQ}./refs/remotes/origin/foo${SQ} blocking reference ${SQ}refs/remotes/origin/foo${SQ}" err &&
git rev-parse refs/heads/main >expect &&
git rev-parse refs/heads/Foo/bar >actual &&
test_cmp expect actual
git remote add origin ../base &&
>refs/heads/foo.lock &&
test_must_fail git fetch -f origin "refs/heads/*:refs/heads/*" 2>err &&
- test_grep "error: fetching ref refs/heads/foo failed: reference already exists" err &&
+ test_grep -e "error: cannot lock ref ${SQ}refs/heads/foo${SQ}: Unable to create" -e "refs/heads/foo.lock${SQ}: File exists." err &&
test_grep "branch ${SQ}branch${SQ} of ../base" FETCH_HEAD &&
test_grep "branch ${SQ}foo${SQ} of ../base" FETCH_HEAD
)