Commit 412a3808889de65d8f94f22502aba10b9afbf755

Carlos Martín Nieto 2015-01-15T15:31:23

push: remove reflog message override We always use "update by push".

diff --git a/include/git2/remote.h b/include/git2/remote.h
index c7411cc..f85c384 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -376,9 +376,10 @@ GIT_EXTERN(void) git_remote_free(git_remote *remote);
  * Update the tips to the new state
  *
  * @param remote the remote to update
- * @param reflog_message The message to insert into the reflogs. If NULL, the
- *                       default is "fetch <name>", where <name> is the name of
- *                       the remote (or its url, for in-memory remotes).
+ * @param reflog_message The message to insert into the reflogs. If
+ * NULL and fetching, the default is "fetch <name>", where <name> is
+ * the name of the remote (or its url, for in-memory remotes). This
+ * parameter is ignored when pushing.
  * @return 0 or an error code
  */
 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
  * passed, the configured refspecs will be used
  * @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,
 				const git_strarray *refspecs,
-				const git_push_options *opts,
-				const char *reflog_message);
+				const git_push_options *opts);
 
 /**
  * Get a list of the configured remotes for a repo
diff --git a/src/push.c b/src/push.c
index 8b3d38e..c6a93ba 100644
--- a/src/push.c
+++ b/src/push.c
@@ -167,9 +167,7 @@ int git_push_add_refspec(git_push *push, const char *refspec)
 	return 0;
 }
 
-int git_push_update_tips(
-		git_push *push,
-		const char *reflog_message)
+int git_push_update_tips(git_push *push)
 {
 	git_buf remote_ref_name = GIT_BUF_INIT;
 	size_t i, j;
@@ -213,7 +211,7 @@ int git_push_update_tips(
 			} else {
 				error = git_reference_create(NULL, push->remote->repo,
 							git_buf_cstr(&remote_ref_name), &push_spec->loid, 1,
-							reflog_message ? reflog_message : "update by push");
+							"update by push");
 			}
 		}
 
diff --git a/src/push.h b/src/push.h
index 16550a7..b19d40e 100644
--- a/src/push.h
+++ b/src/push.h
@@ -109,14 +109,10 @@ int git_push_add_refspec(git_push *push, const char *refspec);
  *
  * @param push The push object
  * @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
  */
-int git_push_update_tips(
-		git_push *push,
-		const char *reflog_message);
+int git_push_update_tips(git_push *push);
 
 /**
  * Perform the push
diff --git a/src/remote.c b/src/remote.c
index 9d48638..bc6d8a2 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1461,7 +1461,7 @@ int git_remote_update_tips(
 
 	/* push has its own logic hidden away in the push object */
 	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)
@@ -2370,8 +2370,7 @@ cleanup:
 	return error;
 }
 
-int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_push_options *opts,
-		    const char *reflog_message)
+int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_push_options *opts)
 {
 	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)
 		return error;
 
-	error = git_remote_update_tips(remote, reflog_message);
+	error = git_remote_update_tips(remote, NULL);
 
 	git_remote_disconnect(remote);
 	return error;
diff --git a/tests/network/remote/local.c b/tests/network/remote/local.c
index 54536e4..ba54de6 100644
--- a/tests/network/remote/local.c
+++ b/tests/network/remote/local.c
@@ -464,12 +464,12 @@ void test_network_remote_local__push_delete(void)
 	cl_git_pass(git_remote_create(&remote, src_repo, "origin", "./target.git"));
 
 	/* 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"));
 	git_reference_free(ref);
 
 	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"));
 
 	git_remote_free(remote);
diff --git a/tests/online/push.c b/tests/online/push.c
index b0ef250..9b98bc7 100644
--- a/tests/online/push.c
+++ b/tests/online/push.c
@@ -487,7 +487,7 @@ static void do_push(
 		if (check_progress_cb && expected_ret == 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);
 
 		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"));
 	entry = git_reflog_entry_byindex(log, 0);
 	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);
 	}