mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 20:33:41 +00:00
push: remove reflog message override
We always use "update by push".
This commit is contained in:
parent
6bfb990dc7
commit
412a380888
@ -376,9 +376,10 @@ GIT_EXTERN(void) git_remote_free(git_remote *remote);
|
|||||||
* Update the tips to the new state
|
* Update the tips to the new state
|
||||||
*
|
*
|
||||||
* @param remote the remote to update
|
* @param remote the remote to update
|
||||||
* @param reflog_message The message to insert into the reflogs. If NULL, the
|
* @param reflog_message The message to insert into the reflogs. If
|
||||||
* default is "fetch <name>", where <name> is the name of
|
* NULL and fetching, the default is "fetch <name>", where <name> is
|
||||||
* the remote (or its url, for in-memory remotes).
|
* the name of the remote (or its url, for in-memory remotes). This
|
||||||
|
* parameter is ignored when pushing.
|
||||||
* @return 0 or an error code
|
* @return 0 or an error code
|
||||||
*/
|
*/
|
||||||
GIT_EXTERN(int) git_remote_update_tips(
|
GIT_EXTERN(int) git_remote_update_tips(
|
||||||
@ -420,12 +421,10 @@ GIT_EXTERN(int) git_remote_fetch(
|
|||||||
* @param refspecs the refspecs to use for pushing. If none are
|
* @param refspecs the refspecs to use for pushing. If none are
|
||||||
* passed, the configured refspecs will be used
|
* passed, the configured refspecs will be used
|
||||||
* @param opts the options
|
* @param opts the options
|
||||||
* @param reflog_message message to use for the reflog of upated references
|
|
||||||
*/
|
*/
|
||||||
GIT_EXTERN(int) git_remote_push(git_remote *remote,
|
GIT_EXTERN(int) git_remote_push(git_remote *remote,
|
||||||
const git_strarray *refspecs,
|
const git_strarray *refspecs,
|
||||||
const git_push_options *opts,
|
const git_push_options *opts);
|
||||||
const char *reflog_message);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of the configured remotes for a repo
|
* Get a list of the configured remotes for a repo
|
||||||
|
@ -167,9 +167,7 @@ int git_push_add_refspec(git_push *push, const char *refspec)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_push_update_tips(
|
int git_push_update_tips(git_push *push)
|
||||||
git_push *push,
|
|
||||||
const char *reflog_message)
|
|
||||||
{
|
{
|
||||||
git_buf remote_ref_name = GIT_BUF_INIT;
|
git_buf remote_ref_name = GIT_BUF_INIT;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
@ -213,7 +211,7 @@ int git_push_update_tips(
|
|||||||
} else {
|
} else {
|
||||||
error = git_reference_create(NULL, push->remote->repo,
|
error = git_reference_create(NULL, push->remote->repo,
|
||||||
git_buf_cstr(&remote_ref_name), &push_spec->loid, 1,
|
git_buf_cstr(&remote_ref_name), &push_spec->loid, 1,
|
||||||
reflog_message ? reflog_message : "update by push");
|
"update by push");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,14 +109,10 @@ int git_push_add_refspec(git_push *push, const char *refspec);
|
|||||||
*
|
*
|
||||||
* @param push The push object
|
* @param push The push object
|
||||||
* @param signature The identity to use when updating reflogs
|
* @param signature The identity to use when updating reflogs
|
||||||
* @param reflog_message The message to insert into the reflogs. If NULL, the
|
|
||||||
* default is "update by push".
|
|
||||||
*
|
*
|
||||||
* @return 0 or an error code
|
* @return 0 or an error code
|
||||||
*/
|
*/
|
||||||
int git_push_update_tips(
|
int git_push_update_tips(git_push *push);
|
||||||
git_push *push,
|
|
||||||
const char *reflog_message);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the push
|
* Perform the push
|
||||||
|
@ -1461,7 +1461,7 @@ int git_remote_update_tips(
|
|||||||
|
|
||||||
/* push has its own logic hidden away in the push object */
|
/* push has its own logic hidden away in the push object */
|
||||||
if (remote->push) {
|
if (remote->push) {
|
||||||
return git_push_update_tips(remote->push, reflog_message);
|
return git_push_update_tips(remote->push);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true) < 0)
|
if (git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true) < 0)
|
||||||
@ -2370,8 +2370,7 @@ cleanup:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_push_options *opts,
|
int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_push_options *opts)
|
||||||
const char *reflog_message)
|
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -2383,7 +2382,7 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
|
|||||||
if ((error = git_remote_upload(remote, refspecs, opts)) < 0)
|
if ((error = git_remote_upload(remote, refspecs, opts)) < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = git_remote_update_tips(remote, reflog_message);
|
error = git_remote_update_tips(remote, NULL);
|
||||||
|
|
||||||
git_remote_disconnect(remote);
|
git_remote_disconnect(remote);
|
||||||
return error;
|
return error;
|
||||||
|
@ -464,12 +464,12 @@ void test_network_remote_local__push_delete(void)
|
|||||||
cl_git_pass(git_remote_create(&remote, src_repo, "origin", "./target.git"));
|
cl_git_pass(git_remote_create(&remote, src_repo, "origin", "./target.git"));
|
||||||
|
|
||||||
/* Push the master branch and verify it's there */
|
/* Push the master branch and verify it's there */
|
||||||
cl_git_pass(git_remote_push(remote, &specs, NULL, NULL));
|
cl_git_pass(git_remote_push(remote, &specs, NULL));
|
||||||
cl_git_pass(git_reference_lookup(&ref, dst_repo, "refs/heads/master"));
|
cl_git_pass(git_reference_lookup(&ref, dst_repo, "refs/heads/master"));
|
||||||
git_reference_free(ref);
|
git_reference_free(ref);
|
||||||
|
|
||||||
specs.strings = spec_delete;
|
specs.strings = spec_delete;
|
||||||
cl_git_pass(git_remote_push(remote, &specs, NULL, NULL));
|
cl_git_pass(git_remote_push(remote, &specs, NULL));
|
||||||
cl_git_fail(git_reference_lookup(&ref, dst_repo, "refs/heads/master"));
|
cl_git_fail(git_reference_lookup(&ref, dst_repo, "refs/heads/master"));
|
||||||
|
|
||||||
git_remote_free(remote);
|
git_remote_free(remote);
|
||||||
|
@ -487,7 +487,7 @@ static void do_push(
|
|||||||
if (check_progress_cb && expected_ret == GIT_EUSER)
|
if (check_progress_cb && expected_ret == GIT_EUSER)
|
||||||
data->transfer_progress_calls = GIT_EUSER;
|
data->transfer_progress_calls = GIT_EUSER;
|
||||||
|
|
||||||
error = git_remote_push(_remote, &specs, &opts, "test push");
|
error = git_remote_push(_remote, &specs, &opts);
|
||||||
git__free(specs.strings);
|
git__free(specs.strings);
|
||||||
|
|
||||||
if (expected_ret < 0) {
|
if (expected_ret < 0) {
|
||||||
@ -608,7 +608,7 @@ void test_online_push__multi(void)
|
|||||||
cl_git_pass(git_reflog_read(&log, _repo, "refs/remotes/test/b1"));
|
cl_git_pass(git_reflog_read(&log, _repo, "refs/remotes/test/b1"));
|
||||||
entry = git_reflog_entry_byindex(log, 0);
|
entry = git_reflog_entry_byindex(log, 0);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
cl_assert_equal_s("test push", git_reflog_entry_message(entry));
|
cl_assert_equal_s("update by push", git_reflog_entry_message(entry));
|
||||||
cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email);
|
cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user