Commit 2d929194 by Russell Belfer

Merge pull request #2099 from libgit2/bs/more-reflog-stuff

More reflogness
parents 57c47af1 db55bb73
...@@ -156,7 +156,7 @@ int fetch(git_repository *repo, int argc, char **argv) ...@@ -156,7 +156,7 @@ int fetch(git_repository *repo, int argc, char **argv)
// right commits. This may be needed even if there was no packfile // right commits. This may be needed even if there was no packfile
// to download, which can happen e.g. when the branches have been // to download, which can happen e.g. when the branches have been
// changed but all the neede objects are available locally. // changed but all the neede objects are available locally.
if (git_remote_update_tips(remote) < 0) if (git_remote_update_tips(remote, NULL, NULL) < 0)
return -1; return -1;
git_remote_free(remote); git_remote_free(remote);
......
...@@ -103,10 +103,16 @@ GIT_EXTERN(int) git_push_add_refspec(git_push *push, const char *refspec); ...@@ -103,10 +103,16 @@ GIT_EXTERN(int) git_push_add_refspec(git_push *push, const char *refspec);
* Update remote tips after a push * Update remote tips after a push
* *
* @param push The push object * @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 * @return 0 or an error code
*/ */
GIT_EXTERN(int) git_push_update_tips(git_push *push); GIT_EXTERN(int) git_push_update_tips(
git_push *push,
const git_signature *signature,
const char *reflog_message);
/** /**
* Actually push all given refspecs * Actually push all given refspecs
......
...@@ -355,9 +355,16 @@ GIT_EXTERN(void) git_remote_free(git_remote *remote); ...@@ -355,9 +355,16 @@ 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 signature The identity to use when updating reflogs
* @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).
* @return 0 or an error code * @return 0 or an error code
*/ */
GIT_EXTERN(int) git_remote_update_tips(git_remote *remote); GIT_EXTERN(int) git_remote_update_tips(
git_remote *remote,
const git_signature *signature,
const char *reflog_message);
/** /**
* Download new data and update tips * Download new data and update tips
...@@ -366,9 +373,15 @@ GIT_EXTERN(int) git_remote_update_tips(git_remote *remote); ...@@ -366,9 +373,15 @@ GIT_EXTERN(int) git_remote_update_tips(git_remote *remote);
* disconnect and update the remote-tracking branches. * disconnect and update the remote-tracking branches.
* *
* @param remote the remote to fetch from * @param remote the remote to fetch from
* @param signature The identity to use when updating reflogs
* @param reflog_message The message to insert into the reflogs. If NULL, the
* default is "fetch"
* @return 0 or an error code * @return 0 or an error code
*/ */
GIT_EXTERN(int) git_remote_fetch(git_remote *remote); GIT_EXTERN(int) git_remote_fetch(
git_remote *remote,
const git_signature *signature,
const char *reflog_message);
/** /**
* Return whether a string is a valid remote URL * Return whether a string is a valid remote URL
......
...@@ -615,11 +615,15 @@ GIT_EXTERN(int) git_repository_set_head_detached( ...@@ -615,11 +615,15 @@ GIT_EXTERN(int) git_repository_set_head_detached(
* Otherwise, the HEAD will be detached and point to the peeled Commit. * Otherwise, the HEAD will be detached and point to the peeled Commit.
* *
* @param repo Repository pointer * @param repo Repository pointer
* @param signature The identity that will used to populate the reflog entry
* @param log_message The one line long message to be appended to the reflog
* @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing * @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing
* branch or an error code * branch or an error code
*/ */
GIT_EXTERN(int) git_repository_detach_head( GIT_EXTERN(int) git_repository_detach_head(
git_repository* repo); git_repository* repo,
const git_signature *signature,
const char *reflog_message);
typedef enum { typedef enum {
GIT_REPOSITORY_STATE_NONE, GIT_REPOSITORY_STATE_NONE,
......
...@@ -48,10 +48,21 @@ typedef enum { ...@@ -48,10 +48,21 @@ typedef enum {
* *
* @param reset_type Kind of reset operation to perform. * @param reset_type Kind of reset operation to perform.
* *
* @param signature The identity that will used to populate the reflog entry
*
* @param log_message The one line long message to be appended to the reflog.
* The reflog is only updated if the affected direct reference is actually
* changing. If NULL, the default is "reset: moving"; if you want something more
* useful, provide a message.
*
* @return 0 on success or an error code * @return 0 on success or an error code
*/ */
GIT_EXTERN(int) git_reset( GIT_EXTERN(int) git_reset(
git_repository *repo, git_object *target, git_reset_t reset_type); git_repository *repo,
git_object *target,
git_reset_t reset_type,
git_signature *signature,
const char *log_message);
/** /**
* Updates some entries in the index from the target commit tree. * Updates some entries in the index from the target commit tree.
......
...@@ -34,5 +34,5 @@ export GITTEST_REMOTE_SSH_PUBKEY="$HOME/.ssh/id_rsa.pub" ...@@ -34,5 +34,5 @@ export GITTEST_REMOTE_SSH_PUBKEY="$HOME/.ssh/id_rsa.pub"
export GITTEST_REMOTE_SSH_PASSPHRASE="" export GITTEST_REMOTE_SSH_PASSPHRASE=""
if [ -e ./libgit2_clar ]; then if [ -e ./libgit2_clar ]; then
./libgit2_clar -sonline::push ./libgit2_clar -sonline::push -sonline::clone::cred_callback_failure
fi fi
...@@ -360,7 +360,7 @@ int git_clone_into(git_repository *repo, git_remote *remote, const git_checkout_ ...@@ -360,7 +360,7 @@ int git_clone_into(git_repository *repo, git_remote *remote, const git_checkout_
git_remote_set_update_fetchhead(remote, 0); git_remote_set_update_fetchhead(remote, 0);
git_buf_printf(&reflog_message, "clone: from %s", git_remote_url(remote)); git_buf_printf(&reflog_message, "clone: from %s", git_remote_url(remote));
if ((error = git_remote_fetch(remote)) != 0) if ((error = git_remote_fetch(remote, signature, git_buf_cstr(&reflog_message))) != 0)
goto cleanup; goto cleanup;
if (branch) if (branch)
......
...@@ -111,8 +111,27 @@ int git_commit_create_from_ids( ...@@ -111,8 +111,27 @@ int git_commit_create_from_ids(
git_buf_free(&commit); git_buf_free(&commit);
if (update_ref != NULL) if (update_ref != NULL) {
return git_reference__update_terminal(repo, update_ref, oid, NULL, NULL); int error;
git_commit *c;
const char *shortmsg;
git_buf reflog_msg = GIT_BUF_INIT;
if (git_commit_lookup(&c, repo, oid) < 0)
goto on_error;
shortmsg = git_commit_summary(c);
git_buf_printf(&reflog_msg, "commit%s: %s",
git_commit_parentcount(c) == 0 ? " (initial)" : "",
shortmsg);
git_commit_free(c);
error = git_reference__update_terminal(repo, update_ref, oid,
committer, git_buf_cstr(&reflog_msg));
git_buf_free(&reflog_msg);
return error;
}
return 0; return 0;
......
...@@ -194,7 +194,10 @@ int git_push_add_refspec(git_push *push, const char *refspec) ...@@ -194,7 +194,10 @@ int git_push_add_refspec(git_push *push, const char *refspec)
return 0; return 0;
} }
int git_push_update_tips(git_push *push) int git_push_update_tips(
git_push *push,
const git_signature *signature,
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;
...@@ -241,7 +244,9 @@ int git_push_update_tips(git_push *push) ...@@ -241,7 +244,9 @@ int git_push_update_tips(git_push *push)
giterr_clear(); giterr_clear();
else else
goto on_error; goto on_error;
} else if ((error = git_reference_create(NULL, push->remote->repo, git_buf_cstr(&remote_ref_name), &push_spec->loid, 1, NULL, NULL)) < 0) } else if ((error = git_reference_create(NULL, push->remote->repo,
git_buf_cstr(&remote_ref_name), &push_spec->loid, 1, signature,
reflog_message ? reflog_message : "update by push")) < 0)
goto on_error; goto on_error;
} }
......
...@@ -1082,8 +1082,10 @@ static int reference__update_terminal( ...@@ -1082,8 +1082,10 @@ static int reference__update_terminal(
nesting+1, signature, log_message); nesting+1, signature, log_message);
git_reference_free(ref); git_reference_free(ref);
} else { } else {
git_reference_free(ref); /* If we're not moving the target, don't recreate the ref */
if (0 != git_oid_cmp(git_reference_target(ref), oid))
error = git_reference_create(NULL, repo, ref_name, oid, 1, signature, log_message); error = git_reference_create(NULL, repo, ref_name, oid, 1, signature, log_message);
git_reference_free(ref);
} }
return error; return error;
......
...@@ -845,9 +845,13 @@ int git_remote_download(git_remote *remote) ...@@ -845,9 +845,13 @@ int git_remote_download(git_remote *remote)
return git_fetch_download_pack(remote); return git_fetch_download_pack(remote);
} }
int git_remote_fetch(git_remote *remote) int git_remote_fetch(
git_remote *remote,
const git_signature *signature,
const char *reflog_message)
{ {
int error; int error;
git_buf reflog_msg_buf = GIT_BUF_INIT;
/* Connect and download everything */ /* Connect and download everything */
if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH)) != 0) if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH)) != 0)
...@@ -859,8 +863,18 @@ int git_remote_fetch(git_remote *remote) ...@@ -859,8 +863,18 @@ int git_remote_fetch(git_remote *remote)
/* We don't need to be connected anymore */ /* We don't need to be connected anymore */
git_remote_disconnect(remote); git_remote_disconnect(remote);
/* Default reflog message */
if (reflog_message)
git_buf_sets(&reflog_msg_buf, reflog_message);
else {
git_buf_printf(&reflog_msg_buf, "fetch %s",
remote->name ? remote->name : remote->url);
}
/* Create "remote/foo" branches for all remote branches */ /* Create "remote/foo" branches for all remote branches */
return git_remote_update_tips(remote); error = git_remote_update_tips(remote, signature, git_buf_cstr(&reflog_msg_buf));
git_buf_free(&reflog_msg_buf);
return error;
} }
static int remote_head_for_fetchspec_src(git_remote_head **out, git_vector *update_heads, const char *fetchspec_src) static int remote_head_for_fetchspec_src(git_remote_head **out, git_vector *update_heads, const char *fetchspec_src)
...@@ -978,7 +992,12 @@ cleanup: ...@@ -978,7 +992,12 @@ cleanup:
return error; return error;
} }
static int update_tips_for_spec(git_remote *remote, git_refspec *spec, git_vector *refs) static int update_tips_for_spec(
git_remote *remote,
git_refspec *spec,
git_vector *refs,
const git_signature *signature,
const char *log_message)
{ {
int error = 0, autotag; int error = 0, autotag;
unsigned int i = 0; unsigned int i = 0;
...@@ -1045,7 +1064,8 @@ static int update_tips_for_spec(git_remote *remote, git_refspec *spec, git_vecto ...@@ -1045,7 +1064,8 @@ static int update_tips_for_spec(git_remote *remote, git_refspec *spec, git_vecto
continue; continue;
/* In autotag mode, don't overwrite any locally-existing tags */ /* In autotag mode, don't overwrite any locally-existing tags */
error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag, NULL, NULL); error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag,
signature, log_message);
if (error < 0 && error != GIT_EEXISTS) if (error < 0 && error != GIT_EEXISTS)
goto on_error; goto on_error;
...@@ -1074,7 +1094,10 @@ on_error: ...@@ -1074,7 +1094,10 @@ on_error:
} }
int git_remote_update_tips(git_remote *remote) int git_remote_update_tips(
git_remote *remote,
const git_signature *signature,
const char *reflog_message)
{ {
git_refspec *spec, tagspec; git_refspec *spec, tagspec;
git_vector refs; git_vector refs;
...@@ -1089,7 +1112,7 @@ int git_remote_update_tips(git_remote *remote) ...@@ -1089,7 +1112,7 @@ int git_remote_update_tips(git_remote *remote)
goto out; goto out;
if (remote->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_ALL) { if (remote->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
error = update_tips_for_spec(remote, &tagspec, &refs); error = update_tips_for_spec(remote, &tagspec, &refs, signature, reflog_message);
goto out; goto out;
} }
...@@ -1097,7 +1120,7 @@ int git_remote_update_tips(git_remote *remote) ...@@ -1097,7 +1120,7 @@ int git_remote_update_tips(git_remote *remote)
if (spec->push) if (spec->push)
continue; continue;
if ((error = update_tips_for_spec(remote, spec, &refs)) < 0) if ((error = update_tips_for_spec(remote, spec, &refs, signature, reflog_message)) < 0)
goto out; goto out;
} }
......
...@@ -1891,7 +1891,9 @@ cleanup: ...@@ -1891,7 +1891,9 @@ cleanup:
} }
int git_repository_detach_head( int git_repository_detach_head(
git_repository* repo) git_repository* repo,
const git_signature *signature,
const char *reflog_message)
{ {
git_reference *old_head = NULL, git_reference *old_head = NULL,
*new_head = NULL; *new_head = NULL;
...@@ -1906,7 +1908,8 @@ int git_repository_detach_head( ...@@ -1906,7 +1908,8 @@ int git_repository_detach_head(
if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJ_COMMIT)) < 0) if ((error = git_object_lookup(&object, repo, git_reference_target(old_head), GIT_OBJ_COMMIT)) < 0)
goto cleanup; goto cleanup;
error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_reference_target(old_head), 1, NULL, NULL); error = git_reference_create(&new_head, repo, GIT_HEAD_FILE, git_reference_target(old_head),
1, signature, reflog_message);
cleanup: cleanup:
git_object_free(object); git_object_free(object);
......
...@@ -94,13 +94,16 @@ cleanup: ...@@ -94,13 +94,16 @@ cleanup:
int git_reset( int git_reset(
git_repository *repo, git_repository *repo,
git_object *target, git_object *target,
git_reset_t reset_type) git_reset_t reset_type,
git_signature *signature,
const char *log_message)
{ {
git_object *commit = NULL; git_object *commit = NULL;
git_index *index = NULL; git_index *index = NULL;
git_tree *tree = NULL; git_tree *tree = NULL;
int error = 0; int error = 0;
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT; git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
git_buf log_message_buf = GIT_BUF_INIT;
assert(repo && target); assert(repo && target);
...@@ -129,9 +132,14 @@ int git_reset( ...@@ -129,9 +132,14 @@ int git_reset(
goto cleanup; goto cleanup;
} }
if (log_message)
git_buf_sets(&log_message_buf, log_message);
else
git_buf_sets(&log_message_buf, "reset: moving");
/* move HEAD to the new target */ /* move HEAD to the new target */
if ((error = git_reference__update_terminal(repo, GIT_HEAD_FILE, if ((error = git_reference__update_terminal(repo, GIT_HEAD_FILE,
git_object_id(commit), NULL, NULL)) < 0) git_object_id(commit), signature, git_buf_cstr(&log_message_buf))) < 0)
goto cleanup; goto cleanup;
if (reset_type == GIT_RESET_HARD) { if (reset_type == GIT_RESET_HARD) {
......
...@@ -61,12 +61,19 @@ struct checkout_name_entry { ...@@ -61,12 +61,19 @@ struct checkout_name_entry {
void test_checkout_conflict__initialize(void) void test_checkout_conflict__initialize(void)
{ {
git_config *cfg;
g_repo = cl_git_sandbox_init(TEST_REPO_PATH); g_repo = cl_git_sandbox_init(TEST_REPO_PATH);
git_repository_index(&g_index, g_repo); git_repository_index(&g_index, g_repo);
cl_git_rewritefile( cl_git_rewritefile(
TEST_REPO_PATH "/.gitattributes", TEST_REPO_PATH "/.gitattributes",
"* text eol=lf\n"); "* text eol=lf\n");
/* Ensure that the user's merge.conflictstyle doesn't interfere */
cl_git_pass(git_repository_config(&cfg, g_repo));
cl_git_pass(git_config_set_string(cfg, "merge.conflictstyle", "merge"));
git_config_free(cfg);
} }
void test_checkout_conflict__cleanup(void) void test_checkout_conflict__cleanup(void)
......
...@@ -571,7 +571,7 @@ void test_checkout_tree__donot_update_deleted_file_by_default(void) ...@@ -571,7 +571,7 @@ void test_checkout_tree__donot_update_deleted_file_by_default(void)
cl_git_pass(git_oid_fromstr(&old_id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); cl_git_pass(git_oid_fromstr(&old_id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
cl_git_pass(git_commit_lookup(&old_commit, g_repo, &old_id)); cl_git_pass(git_commit_lookup(&old_commit, g_repo, &old_id));
cl_git_pass(git_reset(g_repo, (git_object *)old_commit, GIT_RESET_HARD)); cl_git_pass(git_reset(g_repo, (git_object *)old_commit, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(p_unlink("testrepo/branch_file.txt")); cl_git_pass(p_unlink("testrepo/branch_file.txt"));
cl_git_pass(git_index_remove_bypath(index ,"branch_file.txt")); cl_git_pass(git_index_remove_bypath(index ,"branch_file.txt"));
......
...@@ -7,6 +7,8 @@ static const char *commit_message = "This commit has been created in memory\n\ ...@@ -7,6 +7,8 @@ static const char *commit_message = "This commit has been created in memory\n\
static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd"; static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
static const char *root_commit_message = "This is a root commit\n\ static const char *root_commit_message = "This is a root commit\n\
This is a root commit and should be the only one in this branch\n"; This is a root commit and should be the only one in this branch\n";
static const char *root_reflog_message = "commit (initial): This is a root commit \
This is a root commit and should be the only one in this branch";
static char *head_old; static char *head_old;
static git_reference *head, *branch; static git_reference *head, *branch;
static git_commit *commit; static git_commit *commit;
...@@ -101,6 +103,8 @@ void test_commit_write__root(void) ...@@ -101,6 +103,8 @@ void test_commit_write__root(void)
git_signature *author, *committer; git_signature *author, *committer;
const char *branch_name = "refs/heads/root-commit-branch"; const char *branch_name = "refs/heads/root-commit-branch";
git_tree *tree; git_tree *tree;
git_reflog *log;
const git_reflog_entry *entry;
git_oid_fromstr(&tree_id, tree_oid); git_oid_fromstr(&tree_id, tree_oid);
cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id)); cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id));
...@@ -130,7 +134,6 @@ void test_commit_write__root(void) ...@@ -130,7 +134,6 @@ void test_commit_write__root(void)
0)); 0));
git_object_free((git_object *)tree); git_object_free((git_object *)tree);
git_signature_free(committer);
git_signature_free(author); git_signature_free(author);
/* /*
...@@ -144,4 +147,14 @@ void test_commit_write__root(void) ...@@ -144,4 +147,14 @@ void test_commit_write__root(void)
branch_oid = git_reference_target(branch); branch_oid = git_reference_target(branch);
cl_git_pass(git_oid_cmp(branch_oid, &commit_id)); cl_git_pass(git_oid_cmp(branch_oid, &commit_id));
cl_assert_equal_s(root_commit_message, git_commit_message(commit)); cl_assert_equal_s(root_commit_message, git_commit_message(commit));
cl_git_pass(git_reflog_read(&log, g_repo, branch_name));
cl_assert_equal_i(1, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s(committer->email, git_reflog_entry_committer(entry)->email);
cl_assert_equal_s(committer->name, git_reflog_entry_committer(entry)->name);
cl_assert_equal_s(root_reflog_message, git_reflog_entry_message(entry));
git_signature_free(committer);
git_reflog_free(log);
} }
...@@ -86,10 +86,10 @@ void test_index_names__cleaned_on_reset_hard(void) ...@@ -86,10 +86,10 @@ void test_index_names__cleaned_on_reset_hard(void)
{ {
git_object *target; git_object *target;
retrieve_target_from_oid(&target, repo, "3a34580a35add43a4cf361e8e9a30060a905c876"); cl_git_pass(git_revparse_single(&target, repo, "3a34580"));
test_index_names__add(); test_index_names__add();
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
cl_assert(git_index_name_entrycount(repo_index) == 0); cl_assert(git_index_name_entrycount(repo_index) == 0);
git_object_free(target); git_object_free(target);
...@@ -99,10 +99,10 @@ void test_index_names__cleaned_on_reset_mixed(void) ...@@ -99,10 +99,10 @@ void test_index_names__cleaned_on_reset_mixed(void)
{ {
git_object *target; git_object *target;
retrieve_target_from_oid(&target, repo, "3a34580a35add43a4cf361e8e9a30060a905c876"); cl_git_pass(git_revparse_single(&target, repo, "3a34580"));
test_index_names__add(); test_index_names__add();
cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED)); cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL));
cl_assert(git_index_name_entrycount(repo_index) == 0); cl_assert(git_index_name_entrycount(repo_index) == 0);
git_object_free(target); git_object_free(target);
......
...@@ -295,10 +295,10 @@ void test_index_reuc__cleaned_on_reset_hard(void) ...@@ -295,10 +295,10 @@ void test_index_reuc__cleaned_on_reset_hard(void)
{ {
git_object *target; git_object *target;
retrieve_target_from_oid(&target, repo, "3a34580a35add43a4cf361e8e9a30060a905c876"); cl_git_pass(git_revparse_single(&target, repo, "3a34580"));
test_index_reuc__add(); test_index_reuc__add();
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
cl_assert(reuc_entry_exists() == false); cl_assert(reuc_entry_exists() == false);
git_object_free(target); git_object_free(target);
...@@ -308,10 +308,10 @@ void test_index_reuc__cleaned_on_reset_mixed(void) ...@@ -308,10 +308,10 @@ void test_index_reuc__cleaned_on_reset_mixed(void)
{ {
git_object *target; git_object *target;
retrieve_target_from_oid(&target, repo, "3a34580a35add43a4cf361e8e9a30060a905c876"); cl_git_pass(git_revparse_single(&target, repo, "3a34580"));
test_index_reuc__add(); test_index_reuc__add();
cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED)); cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL));
cl_assert(reuc_entry_exists() == false); cl_assert(reuc_entry_exists() == false);
git_object_free(target); git_object_free(target);
...@@ -321,12 +321,12 @@ void test_index_reuc__retained_on_reset_soft(void) ...@@ -321,12 +321,12 @@ void test_index_reuc__retained_on_reset_soft(void)
{ {
git_object *target; git_object *target;
retrieve_target_from_oid(&target, repo, "3a34580a35add43a4cf361e8e9a30060a905c876"); cl_git_pass(git_revparse_single(&target, repo, "3a34580"));
git_reset(repo, target, GIT_RESET_HARD); git_reset(repo, target, GIT_RESET_HARD, NULL, NULL);
test_index_reuc__add(); test_index_reuc__add();
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_assert(reuc_entry_exists() == true); cl_assert(reuc_entry_exists() == true);
git_object_free(target); git_object_free(target);
......
...@@ -183,7 +183,7 @@ static void stage_content(char *content[]) ...@@ -183,7 +183,7 @@ static void stage_content(char *content[])
cl_git_pass(git_repository_head(&head, repo)); cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL, NULL));
for (i = 0, filename = content[i], text = content[++i]; for (i = 0, filename = content[i], text = content[++i];
filename && text; filename && text;
...@@ -212,7 +212,7 @@ static int merge_dirty_files(char *dirty_files[]) ...@@ -212,7 +212,7 @@ static int merge_dirty_files(char *dirty_files[])
cl_git_pass(git_repository_head(&head, repo)); cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL, NULL));
write_files(dirty_files); write_files(dirty_files);
...@@ -234,7 +234,7 @@ static int merge_differently_filtered_files(char *files[]) ...@@ -234,7 +234,7 @@ static int merge_differently_filtered_files(char *files[])
cl_git_pass(git_repository_head(&head, repo)); cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT)); cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL, NULL));
write_files(files); write_files(files);
hack_index(files); hack_index(files);
......
...@@ -17,7 +17,14 @@ static git_repository *repo; ...@@ -17,7 +17,14 @@ static git_repository *repo;
// Fixture setup and teardown // Fixture setup and teardown
void test_merge_workdir_renames__initialize(void) void test_merge_workdir_renames__initialize(void)
{ {
git_config *cfg;
repo = cl_git_sandbox_init(TEST_REPO_PATH); repo = cl_git_sandbox_init(TEST_REPO_PATH);
/* Ensure that the user's merge.conflictstyle doesn't interfere */
cl_git_pass(git_repository_config(&cfg, repo));
cl_git_pass(git_config_set_string(cfg, "merge.conflictstyle", "merge"));
git_config_free(cfg);
} }
void test_merge_workdir_renames__cleanup(void) void test_merge_workdir_renames__cleanup(void)
......
...@@ -116,8 +116,15 @@ static git_index *repo_index; ...@@ -116,8 +116,15 @@ static git_index *repo_index;
// Fixture setup and teardown // Fixture setup and teardown
void test_merge_workdir_simple__initialize(void) void test_merge_workdir_simple__initialize(void)
{ {
git_config *cfg;
repo = cl_git_sandbox_init(TEST_REPO_PATH); repo = cl_git_sandbox_init(TEST_REPO_PATH);
git_repository_index(&repo_index, repo); git_repository_index(&repo_index, repo);
/* Ensure that the user's merge.conflictstyle doesn't interfere */
cl_git_pass(git_repository_config(&cfg, repo));
cl_git_pass(git_config_set_string(cfg, "merge.conflictstyle", "merge"));
git_config_free(cfg);
} }
void test_merge_workdir_simple__cleanup(void) void test_merge_workdir_simple__cleanup(void)
...@@ -585,7 +592,7 @@ void test_merge_workdir_simple__directory_file(void) ...@@ -585,7 +592,7 @@ void test_merge_workdir_simple__directory_file(void)
cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, GIT_REFS_HEADS_DIR OURS_DIRECTORY_FILE, 1, NULL, NULL)); cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, GIT_REFS_HEADS_DIR OURS_DIRECTORY_FILE, 1, NULL, NULL));
cl_git_pass(git_reference_name_to_id(&head_commit_id, repo, GIT_HEAD_FILE)); cl_git_pass(git_reference_name_to_id(&head_commit_id, repo, GIT_HEAD_FILE));
cl_git_pass(git_commit_lookup(&head_commit, repo, &head_commit_id)); cl_git_pass(git_commit_lookup(&head_commit, repo, &head_commit_id));
cl_git_pass(git_reset(repo, (git_object *)head_commit, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head_commit, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_DIRECTORY_FILE)); cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_DIRECTORY_FILE));
cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &their_oids[0])); cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &their_oids[0]));
...@@ -684,7 +691,7 @@ void test_merge_workdir_simple__binary(void) ...@@ -684,7 +691,7 @@ void test_merge_workdir_simple__binary(void)
cl_git_pass(git_oid_fromstr(&their_oid, "ad01aebfdf2ac13145efafe3f9fcf798882f1730")); cl_git_pass(git_oid_fromstr(&their_oid, "ad01aebfdf2ac13145efafe3f9fcf798882f1730"));
cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid)); cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid));
cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_merge_head_from_id(&their_head, repo, &their_oid)); cl_git_pass(git_merge_head_from_id(&their_head, repo, &their_oid));
......
...@@ -46,7 +46,7 @@ void test_merge_workdir_submodules__automerge(void) ...@@ -46,7 +46,7 @@ void test_merge_workdir_submodules__automerge(void)
cl_git_pass(git_reference_lookup(&our_ref, repo, "refs/heads/" SUBMODULE_MAIN_BRANCH)); cl_git_pass(git_reference_lookup(&our_ref, repo, "refs/heads/" SUBMODULE_MAIN_BRANCH));
cl_git_pass(git_commit_lookup(&our_commit, repo, git_reference_target(our_ref))); cl_git_pass(git_commit_lookup(&our_commit, repo, git_reference_target(our_ref)));
cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_reference_lookup(&their_ref, repo, "refs/heads/" SUBMODULE_OTHER_BRANCH)); cl_git_pass(git_reference_lookup(&their_ref, repo, "refs/heads/" SUBMODULE_OTHER_BRANCH));
cl_git_pass(git_merge_head_from_ref(&their_head, repo, their_ref)); cl_git_pass(git_merge_head_from_ref(&their_head, repo, their_ref));
...@@ -82,7 +82,7 @@ void test_merge_workdir_submodules__take_changed(void) ...@@ -82,7 +82,7 @@ void test_merge_workdir_submodules__take_changed(void)
cl_git_pass(git_reference_lookup(&our_ref, repo, "refs/heads/" SUBMODULE_MAIN_BRANCH)); cl_git_pass(git_reference_lookup(&our_ref, repo, "refs/heads/" SUBMODULE_MAIN_BRANCH));
cl_git_pass(git_commit_lookup(&our_commit, repo, git_reference_target(our_ref))); cl_git_pass(git_commit_lookup(&our_commit, repo, git_reference_target(our_ref)));
cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_reference_lookup(&their_ref, repo, "refs/heads/" SUBMODULE_OTHER2_BRANCH)); cl_git_pass(git_reference_lookup(&their_ref, repo, "refs/heads/" SUBMODULE_OTHER2_BRANCH));
cl_git_pass(git_merge_head_from_ref(&their_head, repo, their_ref)); cl_git_pass(git_merge_head_from_ref(&their_head, repo, their_ref));
......
...@@ -37,7 +37,7 @@ void test_network_fetchlocal__complete(void) ...@@ -37,7 +37,7 @@ void test_network_fetchlocal__complete(void)
git_remote_set_callbacks(origin, &callbacks); git_remote_set_callbacks(origin, &callbacks);
cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH));
cl_git_pass(git_remote_download(origin)); cl_git_pass(git_remote_download(origin));
cl_git_pass(git_remote_update_tips(origin)); cl_git_pass(git_remote_update_tips(origin, NULL, NULL));
cl_git_pass(git_reference_list(&refnames, repo)); cl_git_pass(git_reference_list(&refnames, repo));
cl_assert_equal_i(19, (int)refnames.count); cl_assert_equal_i(19, (int)refnames.count);
...@@ -75,7 +75,7 @@ void test_network_fetchlocal__partial(void) ...@@ -75,7 +75,7 @@ void test_network_fetchlocal__partial(void)
git_remote_set_callbacks(origin, &callbacks); git_remote_set_callbacks(origin, &callbacks);
cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_connect(origin, GIT_DIRECTION_FETCH));
cl_git_pass(git_remote_download(origin)); cl_git_pass(git_remote_download(origin));
cl_git_pass(git_remote_update_tips(origin)); cl_git_pass(git_remote_update_tips(origin, NULL, NULL));
git_strarray_free(&refnames); git_strarray_free(&refnames);
......
...@@ -115,7 +115,7 @@ void test_network_remote_local__shorthand_fetch_refspec0(void) ...@@ -115,7 +115,7 @@ void test_network_remote_local__shorthand_fetch_refspec0(void)
cl_git_pass(git_remote_add_fetch(remote, refspec2)); cl_git_pass(git_remote_add_fetch(remote, refspec2));
cl_git_pass(git_remote_download(remote)); cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master")); cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master"));
git_reference_free(ref); git_reference_free(ref);
...@@ -137,7 +137,7 @@ void test_network_remote_local__shorthand_fetch_refspec1(void) ...@@ -137,7 +137,7 @@ void test_network_remote_local__shorthand_fetch_refspec1(void)
cl_git_pass(git_remote_add_fetch(remote, refspec2)); cl_git_pass(git_remote_add_fetch(remote, refspec2));
cl_git_pass(git_remote_download(remote)); cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master")); cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master"));
...@@ -152,7 +152,7 @@ void test_network_remote_local__tagopt(void) ...@@ -152,7 +152,7 @@ void test_network_remote_local__tagopt(void)
git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_ALL); git_remote_set_autotag(remote, GIT_REMOTE_DOWNLOAD_TAGS_ALL);
cl_git_pass(git_remote_download(remote)); cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master")); cl_git_fail(git_reference_lookup(&ref, repo, "refs/remotes/master"));
...@@ -171,7 +171,7 @@ void test_network_remote_local__push_to_bare_remote(void) ...@@ -171,7 +171,7 @@ void test_network_remote_local__push_to_bare_remote(void)
connect_to_local_repository(cl_fixture("testrepo.git")); connect_to_local_repository(cl_fixture("testrepo.git"));
cl_git_pass(git_remote_add_fetch(remote, "master:master")); cl_git_pass(git_remote_add_fetch(remote, "master:master"));
cl_git_pass(git_remote_download(remote)); cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
git_remote_disconnect(remote); git_remote_disconnect(remote);
/* Set up an empty bare repo to push into */ /* Set up an empty bare repo to push into */
...@@ -208,7 +208,7 @@ void test_network_remote_local__push_to_bare_remote_with_file_url(void) ...@@ -208,7 +208,7 @@ void test_network_remote_local__push_to_bare_remote_with_file_url(void)
connect_to_local_repository(cl_fixture("testrepo.git")); connect_to_local_repository(cl_fixture("testrepo.git"));
cl_git_pass(git_remote_add_fetch(remote, "master:master")); cl_git_pass(git_remote_add_fetch(remote, "master:master"));
cl_git_pass(git_remote_download(remote)); cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
git_remote_disconnect(remote); git_remote_disconnect(remote);
/* Set up an empty bare repo to push into */ /* Set up an empty bare repo to push into */
...@@ -248,7 +248,7 @@ void test_network_remote_local__push_to_non_bare_remote(void) ...@@ -248,7 +248,7 @@ void test_network_remote_local__push_to_non_bare_remote(void)
connect_to_local_repository(cl_fixture("testrepo.git")); connect_to_local_repository(cl_fixture("testrepo.git"));
cl_git_pass(git_remote_add_fetch(remote, "master:master")); cl_git_pass(git_remote_add_fetch(remote, "master:master"));
cl_git_pass(git_remote_download(remote)); cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
git_remote_disconnect(remote); git_remote_disconnect(remote);
/* Set up an empty non-bare repo to push into */ /* Set up an empty non-bare repo to push into */
...@@ -273,3 +273,86 @@ void test_network_remote_local__push_to_non_bare_remote(void) ...@@ -273,3 +273,86 @@ void test_network_remote_local__push_to_non_bare_remote(void)
git_remote_free(localremote); git_remote_free(localremote);
cl_fixture_cleanup("localbare.git"); cl_fixture_cleanup("localbare.git");
} }
void test_network_remote_local__fetch(void)
{
const char *refspec = "master:remotes/sloppy/master";
git_reflog *log;
const git_reflog_entry *entry;
git_signature *sig;
git_reference *ref;
cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com"));
connect_to_local_repository(cl_fixture("testrepo.git"));
cl_git_pass(git_remote_add_fetch(remote, refspec));
cl_git_pass(git_remote_fetch(remote, sig, "UPDAAAAAATE!!"));
cl_git_pass(git_reference_lookup(&ref, repo, "refs/remotes/sloppy/master"));
git_reference_free(ref);
cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master"));
cl_assert_equal_i(1, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email);
cl_assert_equal_s("UPDAAAAAATE!!", git_reflog_entry_message(entry));
git_reflog_free(log);
git_signature_free(sig);
}
void test_network_remote_local__reflog(void)
{
const char *refspec = "master:remotes/sloppy/master";
git_reflog *log;
const git_reflog_entry *entry;
git_signature *sig;
cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com"));
connect_to_local_repository(cl_fixture("testrepo.git"));
cl_git_pass(git_remote_add_fetch(remote, refspec));
cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote, sig, "UPDAAAAAATE!!"));
cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master"));
cl_assert_equal_i(1, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email);
cl_assert_equal_s("UPDAAAAAATE!!", git_reflog_entry_message(entry));
git_reflog_free(log);
git_signature_free(sig);
}
void test_network_remote_local__fetch_default_reflog_message(void)
{
const char *refspec = "master:remotes/sloppy/master";
git_reflog *log;
const git_reflog_entry *entry;
git_signature *sig;
char expected_reflog_msg[1024];
cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com"));
connect_to_local_repository(cl_fixture("testrepo.git"));
cl_git_pass(git_remote_add_fetch(remote, refspec));
cl_git_pass(git_remote_fetch(remote, sig, NULL));
cl_git_pass(git_reflog_read(&log, repo, "refs/remotes/sloppy/master"));
cl_assert_equal_i(1, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
cl_assert_equal_s("foo@example.com", git_reflog_entry_committer(entry)->email);
sprintf(expected_reflog_msg, "fetch %s", git_remote_url(remote));
cl_assert_equal_s(expected_reflog_msg, git_reflog_entry_message(entry));
git_reflog_free(log);
git_signature_free(sig);
}
...@@ -192,30 +192,28 @@ static int cred_failure_cb( ...@@ -192,30 +192,28 @@ static int cred_failure_cb(
{ {
GIT_UNUSED(cred); GIT_UNUSED(url); GIT_UNUSED(username_from_url); GIT_UNUSED(cred); GIT_UNUSED(url); GIT_UNUSED(username_from_url);
GIT_UNUSED(allowed_types); GIT_UNUSED(data); GIT_UNUSED(allowed_types); GIT_UNUSED(data);
return -1; return -172;
} }
void test_online_clone__cred_callback_failure_is_euser(void) void test_online_clone__cred_callback_failure_return_code_is_tunnelled(void)
{ {
const char *remote_url = cl_getenv("GITTEST_REMOTE_URL"); const char *remote_url = cl_getenv("GITTEST_REMOTE_URL");
const char *remote_user = cl_getenv("GITTEST_REMOTE_USER"); const char *remote_user = cl_getenv("GITTEST_REMOTE_USER");
const char *remote_default = cl_getenv("GITTEST_REMOTE_DEFAULT");
int error;
if (!remote_url) { if (!remote_url) {
printf("GITTEST_REMOTE_URL unset; skipping clone test\n"); printf("GITTEST_REMOTE_URL unset; skipping clone test\n");
return; return;
} }
if (!remote_user && !remote_default) { if (!remote_user) {
printf("GITTEST_REMOTE_USER and GITTEST_REMOTE_DEFAULT unset; skipping clone test\n"); printf("GITTEST_REMOTE_USER unset; skipping clone test\n");
return; return;
} }
g_options.remote_callbacks.credentials = cred_failure_cb; g_options.remote_callbacks.credentials = cred_failure_cb;
cl_git_fail(error = git_clone(&g_repo, remote_url, "./foo", &g_options)); /* TODO: this should expect -172. */
cl_assert_equal_i(error, GIT_EUSER); cl_git_fail_with(git_clone(&g_repo, remote_url, "./foo", &g_options), -1);
} }
void test_online_clone__credentials(void) void test_online_clone__credentials(void)
......
...@@ -48,7 +48,7 @@ static void do_fetch(const char *url, git_remote_autotag_option_t flag, int n) ...@@ -48,7 +48,7 @@ static void do_fetch(const char *url, git_remote_autotag_option_t flag, int n)
git_remote_set_autotag(remote, flag); git_remote_set_autotag(remote, flag);
cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH));
cl_git_pass(git_remote_download(remote)); cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
git_remote_disconnect(remote); git_remote_disconnect(remote);
cl_assert_equal_i(counter, n); cl_assert_equal_i(counter, n);
cl_assert(bytes_received > 0); cl_assert(bytes_received > 0);
...@@ -117,7 +117,7 @@ void test_online_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date ...@@ -117,7 +117,7 @@ void test_online_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date
cl_assert_equal_i(false, invoked); cl_assert_equal_i(false, invoked);
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
git_remote_disconnect(remote); git_remote_disconnect(remote);
git_remote_free(remote); git_remote_free(remote);
......
...@@ -51,7 +51,7 @@ static void fetchhead_test_fetch(const char *fetchspec, const char *expected_fet ...@@ -51,7 +51,7 @@ static void fetchhead_test_fetch(const char *fetchspec, const char *expected_fet
cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_connect(remote, GIT_DIRECTION_FETCH));
cl_git_pass(git_remote_download(remote)); cl_git_pass(git_remote_download(remote));
cl_git_pass(git_remote_update_tips(remote)); cl_git_pass(git_remote_update_tips(remote, NULL, NULL));
git_remote_disconnect(remote); git_remote_disconnect(remote);
git_remote_free(remote); git_remote_free(remote);
......
...@@ -351,7 +351,7 @@ void test_online_push__initialize(void) ...@@ -351,7 +351,7 @@ void test_online_push__initialize(void)
/* Now that we've deleted everything, fetch from the remote */ /* Now that we've deleted everything, fetch from the remote */
cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_FETCH)); cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_FETCH));
cl_git_pass(git_remote_download(_remote)); cl_git_pass(git_remote_download(_remote));
cl_git_pass(git_remote_update_tips(_remote)); cl_git_pass(git_remote_update_tips(_remote, NULL, NULL));
git_remote_disconnect(_remote); git_remote_disconnect(_remote);
} else } else
printf("GITTEST_REMOTE_URL unset; skipping push test\n"); printf("GITTEST_REMOTE_URL unset; skipping push test\n");
...@@ -414,11 +414,13 @@ static void do_push( ...@@ -414,11 +414,13 @@ static void do_push(
git_push_options opts = GIT_PUSH_OPTIONS_INIT; git_push_options opts = GIT_PUSH_OPTIONS_INIT;
size_t i; size_t i;
int pack_progress_calls = 0, transfer_progress_calls = 0; int pack_progress_calls = 0, transfer_progress_calls = 0;
git_signature *pusher;
if (_remote) { if (_remote) {
/* Auto-detect the number of threads to use */ /* Auto-detect the number of threads to use */
opts.pb_parallelism = 0; opts.pb_parallelism = 0;
cl_git_pass(git_signature_now(&pusher, "Foo Bar", "foo@example.com"));
cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_PUSH)); cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_PUSH));
cl_git_pass(git_push_new(&push, _remote)); cl_git_pass(git_push_new(&push, _remote));
...@@ -455,13 +457,15 @@ static void do_push( ...@@ -455,13 +457,15 @@ static void do_push(
verify_refs(_remote, expected_refs, expected_refs_len); verify_refs(_remote, expected_refs, expected_refs_len);
cl_git_pass(git_push_update_tips(push)); cl_git_pass(git_push_update_tips(push, pusher, "test push"));
verify_tracking_branches(_remote, expected_refs, expected_refs_len); verify_tracking_branches(_remote, expected_refs, expected_refs_len);
git_push_free(push); git_push_free(push);
git_remote_disconnect(_remote); git_remote_disconnect(_remote);
git_signature_free(pusher);
} }
} }
/* Call push_finish() without ever calling git_push_add_refspec() */ /* Call push_finish() without ever calling git_push_add_refspec() */
...@@ -528,6 +532,9 @@ void test_online_push__b5_cancel(void) ...@@ -528,6 +532,9 @@ void test_online_push__b5_cancel(void)
void test_online_push__multi(void) void test_online_push__multi(void)
{ {
git_reflog *log;
const git_reflog_entry *entry;
const char *specs[] = { const char *specs[] = {
"refs/heads/b1:refs/heads/b1", "refs/heads/b1:refs/heads/b1",
"refs/heads/b2:refs/heads/b2", "refs/heads/b2:refs/heads/b2",
...@@ -552,6 +559,15 @@ void test_online_push__multi(void) ...@@ -552,6 +559,15 @@ void test_online_push__multi(void)
do_push(specs, ARRAY_SIZE(specs), do_push(specs, ARRAY_SIZE(specs),
exp_stats, ARRAY_SIZE(exp_stats), exp_stats, ARRAY_SIZE(exp_stats),
exp_refs, ARRAY_SIZE(exp_refs), 0, 1); exp_refs, ARRAY_SIZE(exp_refs), 0, 1);
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("foo@example.com", git_reflog_entry_committer(entry)->email);
}
git_reflog_free(log);
} }
void test_online_push__implicit_tgt(void) void test_online_push__implicit_tgt(void)
......
...@@ -29,15 +29,16 @@ void test_refs_branches_create__cleanup(void) ...@@ -29,15 +29,16 @@ void test_refs_branches_create__cleanup(void)
static void retrieve_target_from_oid(git_commit **out, git_repository *repo, const char *sha) static void retrieve_target_from_oid(git_commit **out, git_repository *repo, const char *sha)
{ {
git_oid oid; git_object *obj;
cl_git_pass(git_oid_fromstr(&oid, sha)); cl_git_pass(git_revparse_single(&obj, repo, sha));
cl_git_pass(git_commit_lookup(out, repo, &oid)); cl_git_pass(git_commit_lookup(out, repo, git_object_id(obj)));
git_object_free(obj);
} }
static void retrieve_known_commit(git_commit **commit, git_repository *repo) static void retrieve_known_commit(git_commit **commit, git_repository *repo)
{ {
retrieve_target_from_oid(commit, repo, "e90810b8df3e80c413d903f631643c716887138d"); retrieve_target_from_oid(commit, repo, "e90810b8df3");
} }
#define NEW_BRANCH_NAME "new-branch-on-the-block" #define NEW_BRANCH_NAME "new-branch-on-the-block"
......
...@@ -78,7 +78,7 @@ void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD( ...@@ -78,7 +78,7 @@ void test_refs_branches_delete__can_delete_a_branch_pointed_at_by_detached_HEAD(
git_reference_free(head); git_reference_free(head);
/* Detach HEAD and make it target the commit that "master" points to */ /* Detach HEAD and make it target the commit that "master" points to */
git_repository_detach_head(repo); git_repository_detach_head(repo, NULL, NULL);
cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL)); cl_git_pass(git_branch_lookup(&branch, repo, "master", GIT_BRANCH_LOCAL));
cl_git_pass(git_branch_delete(branch)); cl_git_pass(git_branch_delete(branch));
......
...@@ -15,21 +15,42 @@ void test_repo_head__cleanup(void) ...@@ -15,21 +15,42 @@ void test_repo_head__cleanup(void)
cl_git_sandbox_cleanup(); cl_git_sandbox_cleanup();
} }
static void check_last_reflog_entry(const char *email, const char *message)
{
git_reflog *log;
const git_reflog_entry *entry;
cl_git_pass(git_reflog_read(&log, repo, GIT_HEAD_FILE));
cl_assert(git_reflog_entrycount(log) > 0);
entry = git_reflog_entry_byindex(log, 0);
if (email)
cl_assert_equal_s(email, git_reflog_entry_committer(entry)->email);
if (message)
cl_assert_equal_s(message, git_reflog_entry_message(entry));
git_reflog_free(log);
}
void test_repo_head__head_detached(void) void test_repo_head__head_detached(void)
{ {
git_reference *ref; git_reference *ref;
git_signature *sig;
cl_git_pass(git_repository_head_detached(repo)); cl_git_pass(git_signature_now(&sig, "Foo Bar", "foo@example.com"));
cl_git_pass(git_repository_detach_head(repo)); cl_assert_equal_i(false, git_repository_head_detached(repo));
cl_git_pass(git_repository_detach_head(repo, sig, "CABLE DETACHED"));
check_last_reflog_entry(sig->email, "CABLE DETACHED");
cl_assert_equal_i(true, git_repository_head_detached(repo)); cl_assert_equal_i(true, git_repository_head_detached(repo));
/* take the reop back to it's original state */ /* take the repo back to it's original state */
cl_git_pass(git_reference_symbolic_create(&ref, repo, "HEAD", "refs/heads/master", 1, NULL, NULL)); cl_git_pass(git_reference_symbolic_create(&ref, repo, "HEAD", "refs/heads/master",
true, sig, "REATTACH"));
git_reference_free(ref); git_reference_free(ref);
check_last_reflog_entry(sig->email, "REATTACH");
cl_assert_equal_i(false, git_repository_head_detached(repo)); cl_assert_equal_i(false, git_repository_head_detached(repo));
git_signature_free(sig);
} }
void test_repo_head__unborn_head(void) void test_repo_head__unborn_head(void)
...@@ -147,7 +168,7 @@ void test_repo_head__detach_head_Detaches_HEAD_and_make_it_point_to_the_peeled_c ...@@ -147,7 +168,7 @@ void test_repo_head__detach_head_Detaches_HEAD_and_make_it_point_to_the_peeled_c
{ {
cl_assert_equal_i(false, git_repository_head_detached(repo)); cl_assert_equal_i(false, git_repository_head_detached(repo));
cl_git_pass(git_repository_detach_head(repo)); cl_git_pass(git_repository_detach_head(repo, NULL, NULL));
assert_head_is_correctly_detached(); assert_head_is_correctly_detached();
} }
...@@ -158,7 +179,7 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void ...@@ -158,7 +179,7 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void
cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, "refs/tags/point_to_blob", 1, NULL, NULL)); cl_git_pass(git_reference_symbolic_create(&head, repo, GIT_HEAD_FILE, "refs/tags/point_to_blob", 1, NULL, NULL));
cl_git_fail(git_repository_detach_head(repo)); cl_git_fail(git_repository_detach_head(repo, NULL, NULL));
git_reference_free(head); git_reference_free(head);
} }
...@@ -167,7 +188,7 @@ void test_repo_head__detaching_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void) ...@@ -167,7 +188,7 @@ void test_repo_head__detaching_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void)
{ {
make_head_unborn(repo, NON_EXISTING_HEAD); make_head_unborn(repo, NON_EXISTING_HEAD);
cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_detach_head(repo)); cl_assert_equal_i(GIT_EUNBORNBRANCH, git_repository_detach_head(repo, NULL, NULL));
} }
void test_repo_head__retrieving_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void) void test_repo_head__retrieving_an_unborn_branch_returns_GIT_EUNBORNBRANCH(void)
......
...@@ -20,7 +20,7 @@ void test_repo_headtree__cleanup(void) ...@@ -20,7 +20,7 @@ void test_repo_headtree__cleanup(void)
void test_repo_headtree__can_retrieve_the_root_tree_from_a_detached_head(void) void test_repo_headtree__can_retrieve_the_root_tree_from_a_detached_head(void)
{ {
cl_git_pass(git_repository_detach_head(repo)); cl_git_pass(git_repository_detach_head(repo, NULL, NULL));
cl_git_pass(git_repository_head_tree(&tree, repo)); cl_git_pass(git_repository_head_tree(&tree, repo));
......
...@@ -37,7 +37,7 @@ void test_repo_state__none_with_HEAD_attached(void) ...@@ -37,7 +37,7 @@ void test_repo_state__none_with_HEAD_attached(void)
void test_repo_state__none_with_HEAD_detached(void) void test_repo_state__none_with_HEAD_detached(void)
{ {
cl_git_pass(git_repository_detach_head(_repo)); cl_git_pass(git_repository_detach_head(_repo, NULL, NULL));
assert_repo_state(GIT_REPOSITORY_STATE_NONE); assert_repo_state(GIT_REPOSITORY_STATE_NONE);
} }
......
...@@ -69,10 +69,9 @@ void test_reset_hard__resetting_reverts_modified_files(void) ...@@ -69,10 +69,9 @@ void test_reset_hard__resetting_reverts_modified_files(void)
cl_assert_equal_s(before[i], content.ptr); cl_assert_equal_s(before[i], content.ptr);
} }
retrieve_target_from_oid( cl_git_pass(git_revparse_single(&target, repo, "26a125e"));
&target, repo, "26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f");
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
for (i = 0; i < 4; ++i) { for (i = 0; i < 4; ++i) {
cl_git_pass(git_buf_joinpath(&path, wd, files[i])); cl_git_pass(git_buf_joinpath(&path, wd, files[i]));
...@@ -95,9 +94,9 @@ void test_reset_hard__cannot_reset_in_a_bare_repository(void) ...@@ -95,9 +94,9 @@ void test_reset_hard__cannot_reset_in_a_bare_repository(void)
cl_git_pass(git_repository_open(&bare, cl_fixture("testrepo.git"))); cl_git_pass(git_repository_open(&bare, cl_fixture("testrepo.git")));
cl_assert(git_repository_is_bare(bare) == true); cl_assert(git_repository_is_bare(bare) == true);
retrieve_target_from_oid(&target, bare, KNOWN_COMMIT_IN_BARE_REPO); cl_git_pass(git_revparse_single(&target, bare, KNOWN_COMMIT_IN_BARE_REPO));
cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_HARD)); cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_HARD, NULL, NULL));
git_repository_free(bare); git_repository_free(bare);
} }
...@@ -152,8 +151,8 @@ void test_reset_hard__resetting_reverts_unmerged(void) ...@@ -152,8 +151,8 @@ void test_reset_hard__resetting_reverts_unmerged(void)
unmerged_index_init(index, entries); unmerged_index_init(index, entries);
cl_git_pass(git_index_write(index)); cl_git_pass(git_index_write(index));
retrieve_target_from_oid(&target, repo, "26a125ee1bfc5df1e1b2e9441bbe63c8a7ae989f"); cl_git_pass(git_revparse_single(&target, repo, "26a125e"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
cl_assert(git_path_exists("status/conflicting_file") == 0); cl_assert(git_path_exists("status/conflicting_file") == 0);
...@@ -183,8 +182,8 @@ void test_reset_hard__cleans_up_merge(void) ...@@ -183,8 +182,8 @@ void test_reset_hard__cleans_up_merge(void)
cl_git_pass(git_buf_joinpath(&orig_head_path, git_repository_path(repo), "ORIG_HEAD")); cl_git_pass(git_buf_joinpath(&orig_head_path, git_repository_path(repo), "ORIG_HEAD"));
cl_git_mkfile(git_buf_cstr(&orig_head_path), "0017bd4ab1ec30440b17bae1680cff124ab5f1f6"); cl_git_mkfile(git_buf_cstr(&orig_head_path), "0017bd4ab1ec30440b17bae1680cff124ab5f1f6");
retrieve_target_from_oid(&target, repo, "0017bd4ab1ec30440b17bae1680cff124ab5f1f6"); cl_git_pass(git_revparse_single(&target, repo, "0017bd4"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
cl_assert(!git_path_exists(git_buf_cstr(&merge_head_path))); cl_assert(!git_path_exists(git_buf_cstr(&merge_head_path)));
cl_assert(!git_path_exists(git_buf_cstr(&merge_msg_path))); cl_assert(!git_path_exists(git_buf_cstr(&merge_msg_path)));
...@@ -198,3 +197,30 @@ void test_reset_hard__cleans_up_merge(void) ...@@ -198,3 +197,30 @@ void test_reset_hard__cleans_up_merge(void)
git_buf_free(&merge_mode_path); git_buf_free(&merge_mode_path);
git_buf_free(&orig_head_path); git_buf_free(&orig_head_path);
} }
void test_reset_hard__reflog_is_correct(void)
{
const char *exp_msg = "commit: Add a file which name should appear before the "
"\"subdir/\" folder while being dealt with by the treewalker";
reflog_check(repo, "HEAD", 3, "emeric.fermas@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 3, "emeric.fermas@gmail.com", exp_msg);
/* Branch not moving, no reflog entry */
cl_git_pass(git_revparse_single(&target, repo, "HEAD^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
reflog_check(repo, "HEAD", 3, "emeric.fermas@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 3, "emeric.fermas@gmail.com", exp_msg);
/* Moved branch, expect default message */
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, NULL));
reflog_check(repo, "HEAD", 3, "emeric.fermas@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 4, NULL, "reset: moving");
/* Moved branch, expect custom message */
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_HARD, NULL, "message1"));
reflog_check(repo, "HEAD", 3, "emeric.fermas@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 5, NULL, "message1");
}
...@@ -27,9 +27,9 @@ void test_reset_mixed__cannot_reset_in_a_bare_repository(void) ...@@ -27,9 +27,9 @@ void test_reset_mixed__cannot_reset_in_a_bare_repository(void)
cl_git_pass(git_repository_open(&bare, cl_fixture("testrepo.git"))); cl_git_pass(git_repository_open(&bare, cl_fixture("testrepo.git")));
cl_assert(git_repository_is_bare(bare) == true); cl_assert(git_repository_is_bare(bare) == true);
retrieve_target_from_oid(&target, bare, KNOWN_COMMIT_IN_BARE_REPO); cl_git_pass(git_revparse_single(&target, bare, KNOWN_COMMIT_IN_BARE_REPO));
cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_MIXED)); cl_assert_equal_i(GIT_EBAREREPO, git_reset(bare, target, GIT_RESET_MIXED, NULL, NULL));
git_repository_free(bare); git_repository_free(bare);
} }
...@@ -40,10 +40,36 @@ void test_reset_mixed__resetting_refreshes_the_index_to_the_commit_tree(void) ...@@ -40,10 +40,36 @@ void test_reset_mixed__resetting_refreshes_the_index_to_the_commit_tree(void)
cl_git_pass(git_status_file(&status, repo, "macro_bad")); cl_git_pass(git_status_file(&status, repo, "macro_bad"));
cl_assert(status == GIT_STATUS_CURRENT); cl_assert(status == GIT_STATUS_CURRENT);
retrieve_target_from_oid(&target, repo, "605812ab7fe421fdd325a935d35cb06a9234a7d7"); cl_git_pass(git_revparse_single(&target, repo, "605812a"));
cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED)); cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL));
cl_git_pass(git_status_file(&status, repo, "macro_bad")); cl_git_pass(git_status_file(&status, repo, "macro_bad"));
cl_assert(status == GIT_STATUS_WT_NEW); cl_assert(status == GIT_STATUS_WT_NEW);
} }
void test_reset_mixed__reflog_is_correct(void)
{
const char *exp_msg = "commit: Updating test data so we can test inter-hunk-context";
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 9, "yoram.harmelin@gmail.com", exp_msg);
/* Branch not moving, no reflog entry */
cl_git_pass(git_revparse_single(&target, repo, "HEAD^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 9, "yoram.harmelin@gmail.com", exp_msg);
/* Moved branch, expect default message */
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, NULL));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 10, NULL, "reset: moving");
/* Moved branch, expect custom message */
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_MIXED, NULL, "message1"));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 11, NULL, "message1");
}
#include "clar_libgit2.h" #include "clar_libgit2.h"
#include "reset_helpers.h" #include "reset_helpers.h"
void retrieve_target_from_oid(git_object **object_out, git_repository *repo, const char *sha) void reflog_check(git_repository *repo, const char *refname,
size_t exp_count, const char *exp_email, const char *exp_msg)
{ {
git_oid oid; git_reflog *log;
const git_reflog_entry *entry;
cl_git_pass(git_oid_fromstr(&oid, sha)); cl_git_pass(git_reflog_read(&log, repo, refname));
cl_git_pass(git_object_lookup(object_out, repo, &oid, GIT_OBJ_ANY)); cl_assert_equal_i(exp_count, git_reflog_entrycount(log));
entry = git_reflog_entry_byindex(log, 0);
if (exp_email)
cl_assert_equal_s(exp_email, git_reflog_entry_committer(entry)->email);
if (exp_msg)
cl_assert_equal_s(exp_msg, git_reflog_entry_message(entry));
git_reflog_free(log);
} }
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
#define KNOWN_COMMIT_IN_BARE_REPO "e90810b8df3e80c413d903f631643c716887138d" #define KNOWN_COMMIT_IN_BARE_REPO "e90810b8df3e80c413d903f631643c716887138d"
#define KNOWN_COMMIT_IN_ATTR_REPO "217878ab49e1314388ea2e32dc6fdb58a1b969e0" #define KNOWN_COMMIT_IN_ATTR_REPO "217878ab49e1314388ea2e32dc6fdb58a1b969e0"
extern void retrieve_target_from_oid(git_object **object_out, git_repository *repo, const char *sha); void reflog_check(git_repository *repo, const char *refname,
size_t exp_count, const char *exp_email, const char *exp_msg);
...@@ -26,12 +26,11 @@ static void assert_reset_soft(bool should_be_detached) ...@@ -26,12 +26,11 @@ static void assert_reset_soft(bool should_be_detached)
cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_fail(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO)); cl_git_fail(git_oid_streq(&oid, KNOWN_COMMIT_IN_BARE_REPO));
cl_git_pass(git_revparse_single(&target, repo, KNOWN_COMMIT_IN_BARE_REPO));
retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO);
cl_assert(git_repository_head_detached(repo) == should_be_detached); cl_assert(git_repository_head_detached(repo) == should_be_detached);
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_assert(git_repository_head_detached(repo) == should_be_detached); cl_assert(git_repository_head_detached(repo) == should_be_detached);
...@@ -46,7 +45,7 @@ void test_reset_soft__can_reset_the_non_detached_Head_to_the_specified_commit(vo ...@@ -46,7 +45,7 @@ void test_reset_soft__can_reset_the_non_detached_Head_to_the_specified_commit(vo
void test_reset_soft__can_reset_the_detached_Head_to_the_specified_commit(void) void test_reset_soft__can_reset_the_detached_Head_to_the_specified_commit(void)
{ {
git_repository_detach_head(repo); git_repository_detach_head(repo, NULL, NULL);
assert_reset_soft(true); assert_reset_soft(true);
} }
...@@ -60,9 +59,9 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch ...@@ -60,9 +59,9 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch
git_oid_fmt(raw_head_oid, &oid); git_oid_fmt(raw_head_oid, &oid);
raw_head_oid[GIT_OID_HEXSZ] = '\0'; raw_head_oid[GIT_OID_HEXSZ] = '\0';
retrieve_target_from_oid(&target, repo, raw_head_oid); cl_git_pass(git_revparse_single(&target, repo, raw_head_oid));
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
cl_git_pass(git_oid_streq(&oid, raw_head_oid)); cl_git_pass(git_oid_streq(&oid, raw_head_oid));
...@@ -73,9 +72,9 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void ...@@ -73,9 +72,9 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void
git_oid oid; git_oid oid;
/* b25fa35 is a tag, pointing to another tag which points to commit e90810b */ /* b25fa35 is a tag, pointing to another tag which points to commit e90810b */
retrieve_target_from_oid(&target, repo, "b25fa35b38051e4ae45d4222e795f9df2e43f1d1"); cl_git_pass(git_revparse_single(&target, repo, "b25fa35"));
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_assert(git_repository_head_detached(repo) == false); cl_assert(git_repository_head_detached(repo) == false);
cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD")); cl_git_pass(git_reference_name_to_id(&oid, repo, "HEAD"));
...@@ -85,27 +84,27 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void ...@@ -85,27 +84,27 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void
void test_reset_soft__cannot_reset_to_a_tag_not_pointing_at_a_commit(void) void test_reset_soft__cannot_reset_to_a_tag_not_pointing_at_a_commit(void)
{ {
/* 53fc32d is the tree of commit e90810b */ /* 53fc32d is the tree of commit e90810b */
retrieve_target_from_oid(&target, repo, "53fc32d17276939fc79ed05badaef2db09990016"); cl_git_pass(git_revparse_single(&target, repo, "53fc32d"));
cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT)); cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
git_object_free(target); git_object_free(target);
/* 521d87c is an annotated tag pointing to a blob */ /* 521d87c is an annotated tag pointing to a blob */
retrieve_target_from_oid(&target, repo, "521d87c1ec3aef9824daf6d96cc0ae3710766d91"); cl_git_pass(git_revparse_single(&target, repo, "521d87c"));
cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT)); cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
} }
void test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_longer_unborn(void) void test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_longer_unborn(void)
{ {
git_reference *head; git_reference *head;
retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO); cl_git_pass(git_revparse_single(&target, repo, KNOWN_COMMIT_IN_BARE_REPO));
make_head_unborn(repo, NON_EXISTING_HEAD); make_head_unborn(repo, NON_EXISTING_HEAD);
cl_assert_equal_i(true, git_repository_head_unborn(repo)); cl_assert_equal_i(true, git_repository_head_unborn(repo));
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT)); cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_assert_equal_i(false, git_repository_head_unborn(repo)); cl_assert_equal_i(false, git_repository_head_unborn(repo));
...@@ -119,13 +118,13 @@ void test_reset_soft__fails_when_merging(void) ...@@ -119,13 +118,13 @@ void test_reset_soft__fails_when_merging(void)
{ {
git_buf merge_head_path = GIT_BUF_INIT; git_buf merge_head_path = GIT_BUF_INIT;
cl_git_pass(git_repository_detach_head(repo)); cl_git_pass(git_repository_detach_head(repo, NULL, NULL));
cl_git_pass(git_buf_joinpath(&merge_head_path, git_repository_path(repo), "MERGE_HEAD")); cl_git_pass(git_buf_joinpath(&merge_head_path, git_repository_path(repo), "MERGE_HEAD"));
cl_git_mkfile(git_buf_cstr(&merge_head_path), "beefbeefbeefbeefbeefbeefbeefbeefbeefbeef\n"); cl_git_mkfile(git_buf_cstr(&merge_head_path), "beefbeefbeefbeefbeefbeefbeefbeefbeefbeef\n");
retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO); cl_git_pass(git_revparse_single(&target, repo, KNOWN_COMMIT_IN_BARE_REPO));
cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT)); cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
cl_git_pass(p_unlink(git_buf_cstr(&merge_head_path))); cl_git_pass(p_unlink(git_buf_cstr(&merge_head_path)));
git_buf_free(&merge_head_path); git_buf_free(&merge_head_path);
...@@ -153,5 +152,31 @@ void test_reset_soft__fails_when_index_contains_conflicts_independently_of_MERGE ...@@ -153,5 +152,31 @@ void test_reset_soft__fails_when_index_contains_conflicts_independently_of_MERGE
cl_git_pass(git_reference_peel(&target, head, GIT_OBJ_COMMIT)); cl_git_pass(git_reference_peel(&target, head, GIT_OBJ_COMMIT));
git_reference_free(head); git_reference_free(head);
cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT)); cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
}
void test_reset_soft_reflog_is_correct(void)
{
const char *exp_msg = "commit: Updating test data so we can test inter-hunk-context";
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 9, "yoram.harmelin@gmail.com", exp_msg);
/* Branch not moving, no reflog entry */
cl_git_pass(git_revparse_single(&target, repo, "HEAD^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 9, "yoram.harmelin@gmail.com", exp_msg);
/* Moved branch, expect default message */
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, NULL));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 10, NULL, "reset: moving");
/* Moved branch, expect custom message */
cl_git_pass(git_revparse_single(&target, repo, "HEAD~^{commit}"));
cl_git_pass(git_reset(repo, target, GIT_RESET_SOFT, NULL, "message1"));
reflog_check(repo, "HEAD", 9, "yoram.harmelin@gmail.com", exp_msg);
reflog_check(repo, "refs/heads/master", 11, NULL, "message1");
} }
...@@ -15,8 +15,15 @@ static git_index *repo_index; ...@@ -15,8 +15,15 @@ static git_index *repo_index;
// Fixture setup and teardown // Fixture setup and teardown
void test_revert_workdir__initialize(void) void test_revert_workdir__initialize(void)
{ {
git_config *cfg;
repo = cl_git_sandbox_init(TEST_REPO_PATH); repo = cl_git_sandbox_init(TEST_REPO_PATH);
git_repository_index(&repo_index, repo); git_repository_index(&repo_index, repo);
/* Ensure that the user's merge.conflictstyle doesn't interfere */
cl_git_pass(git_repository_config(&cfg, repo));
cl_git_pass(git_config_set_string(cfg, "merge.conflictstyle", "merge"));
git_config_free(cfg);
} }
void test_revert_workdir__cleanup(void) void test_revert_workdir__cleanup(void)
...@@ -41,7 +48,7 @@ void test_revert_workdir__automerge(void) ...@@ -41,7 +48,7 @@ void test_revert_workdir__automerge(void)
git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45"); git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac"); git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac");
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
...@@ -74,7 +81,7 @@ void test_revert_workdir__conflicts(void) ...@@ -74,7 +81,7 @@ void test_revert_workdir__conflicts(void)
cl_git_pass(git_repository_head(&head_ref, repo)); cl_git_pass(git_repository_head(&head_ref, repo));
cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJ_COMMIT)); cl_git_pass(git_reference_peel((git_object **)&head, head_ref, GIT_OBJ_COMMIT));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
cl_git_pass(git_revert(repo, commit, NULL)); cl_git_pass(git_revert(repo, commit, NULL));
...@@ -125,7 +132,7 @@ void test_revert_workdir__orphan(void) ...@@ -125,7 +132,7 @@ void test_revert_workdir__orphan(void)
git_oid_fromstr(&head_oid, "39467716290f6df775a91cdb9a4eb39295018145"); git_oid_fromstr(&head_oid, "39467716290f6df775a91cdb9a4eb39295018145");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
git_oid_fromstr(&revert_oid, "ebb03002cee5d66c7732dd06241119fe72ab96a5"); git_oid_fromstr(&revert_oid, "ebb03002cee5d66c7732dd06241119fe72ab96a5");
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
...@@ -160,7 +167,7 @@ void test_revert_workdir__again(void) ...@@ -160,7 +167,7 @@ void test_revert_workdir__again(void)
cl_git_pass(git_repository_head(&head_ref, repo)); cl_git_pass(git_repository_head(&head_ref, repo));
cl_git_pass(git_reference_peel((git_object **)&orig_head, head_ref, GIT_OBJ_COMMIT)); cl_git_pass(git_reference_peel((git_object **)&orig_head, head_ref, GIT_OBJ_COMMIT));
cl_git_pass(git_reset(repo, (git_object *)orig_head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)orig_head, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_revert(repo, orig_head, NULL)); cl_git_pass(git_revert(repo, orig_head, NULL));
...@@ -208,7 +215,7 @@ void test_revert_workdir__again_after_automerge(void) ...@@ -208,7 +215,7 @@ void test_revert_workdir__again_after_automerge(void)
git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45"); git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac"); git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac");
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
...@@ -256,7 +263,7 @@ void test_revert_workdir__again_after_edit(void) ...@@ -256,7 +263,7 @@ void test_revert_workdir__again_after_edit(void)
cl_git_pass(git_oid_fromstr(&orig_head_oid, "399fb3aba3d9d13f7d40a9254ce4402067ef3149")); cl_git_pass(git_oid_fromstr(&orig_head_oid, "399fb3aba3d9d13f7d40a9254ce4402067ef3149"));
cl_git_pass(git_commit_lookup(&orig_head, repo, &orig_head_oid)); cl_git_pass(git_commit_lookup(&orig_head, repo, &orig_head_oid));
cl_git_pass(git_reset(repo, (git_object *)orig_head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)orig_head, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_oid_fromstr(&revert_oid, "2d440f2b3147d3dc7ad1085813478d6d869d5a4d")); cl_git_pass(git_oid_fromstr(&revert_oid, "2d440f2b3147d3dc7ad1085813478d6d869d5a4d"));
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
...@@ -307,7 +314,7 @@ void test_revert_workdir__again_after_edit_two(void) ...@@ -307,7 +314,7 @@ void test_revert_workdir__again_after_edit_two(void)
cl_git_pass(git_oid_fromstr(&head_commit_oid, "e34ef1afe54eb526fd92eec66084125f340f1d65")); cl_git_pass(git_oid_fromstr(&head_commit_oid, "e34ef1afe54eb526fd92eec66084125f340f1d65"));
cl_git_pass(git_commit_lookup(&head_commit, repo, &head_commit_oid)); cl_git_pass(git_commit_lookup(&head_commit, repo, &head_commit_oid));
cl_git_pass(git_reset(repo, (git_object *)head_commit, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head_commit, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_oid_fromstr(&revert_commit_oid, "71eb9c2b53dbbf3c45fb28b27c850db4b7fb8011")); cl_git_pass(git_oid_fromstr(&revert_commit_oid, "71eb9c2b53dbbf3c45fb28b27c850db4b7fb8011"));
cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_commit_oid)); cl_git_pass(git_commit_lookup(&revert_commit, repo, &revert_commit_oid));
...@@ -360,7 +367,7 @@ void test_revert_workdir__conflict_use_ours(void) ...@@ -360,7 +367,7 @@ void test_revert_workdir__conflict_use_ours(void)
git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45"); git_oid_fromstr(&head_oid, "72333f47d4e83616630ff3b0ffe4c0faebcc3c45");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac"); git_oid_fromstr(&revert_oid, "d1d403d22cbe24592d725f442835cf46fe60c8ac");
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
...@@ -396,7 +403,7 @@ void test_revert_workdir__rename_1_of_2(void) ...@@ -396,7 +403,7 @@ void test_revert_workdir__rename_1_of_2(void)
git_oid_fromstr(&head_oid, "cef56612d71a6af8d8015691e4865f7fece905b5"); git_oid_fromstr(&head_oid, "cef56612d71a6af8d8015691e4865f7fece905b5");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
git_oid_fromstr(&revert_oid, "55568c8de5322ff9a95d72747a239cdb64a19965"); git_oid_fromstr(&revert_oid, "55568c8de5322ff9a95d72747a239cdb64a19965");
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
...@@ -430,7 +437,7 @@ void test_revert_workdir__rename(void) ...@@ -430,7 +437,7 @@ void test_revert_workdir__rename(void)
git_oid_fromstr(&head_oid, "55568c8de5322ff9a95d72747a239cdb64a19965"); git_oid_fromstr(&head_oid, "55568c8de5322ff9a95d72747a239cdb64a19965");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
git_oid_fromstr(&revert_oid, "0aa8c7e40d342fff78d60b29a4ba8e993ed79c51"); git_oid_fromstr(&revert_oid, "0aa8c7e40d342fff78d60b29a4ba8e993ed79c51");
cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid)); cl_git_pass(git_commit_lookup(&commit, repo, &revert_oid));
...@@ -459,7 +466,7 @@ void test_revert_workdir__head(void) ...@@ -459,7 +466,7 @@ void test_revert_workdir__head(void)
/* HEAD is 2d440f2b3147d3dc7ad1085813478d6d869d5a4d */ /* HEAD is 2d440f2b3147d3dc7ad1085813478d6d869d5a4d */
cl_git_pass(git_repository_head(&head, repo)); cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT)); cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT));
cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)commit, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_revert(repo, commit, NULL)); cl_git_pass(git_revert(repo, commit, NULL));
cl_assert(merge_test_index(repo_index, merge_index_entries, 4)); cl_assert(merge_test_index(repo_index, merge_index_entries, 4));
...@@ -496,7 +503,7 @@ void test_revert_workdir__merge_fails_without_mainline_specified(void) ...@@ -496,7 +503,7 @@ void test_revert_workdir__merge_fails_without_mainline_specified(void)
git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579"); git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
cl_must_fail(git_revert(repo, head, NULL)); cl_must_fail(git_revert(repo, head, NULL));
cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG")); cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
...@@ -523,7 +530,7 @@ void test_revert_workdir__merge_first_parent(void) ...@@ -523,7 +530,7 @@ void test_revert_workdir__merge_first_parent(void)
git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579"); git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_revert(repo, head, &opts)); cl_git_pass(git_revert(repo, head, &opts));
...@@ -548,7 +555,7 @@ void test_revert_workdir__merge_second_parent(void) ...@@ -548,7 +555,7 @@ void test_revert_workdir__merge_second_parent(void)
git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579"); git_oid_fromstr(&head_oid, "5acdc74af27172ec491d213ee36cea7eb9ef2579");
cl_git_pass(git_commit_lookup(&head, repo, &head_oid)); cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD)); cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_revert(repo, head, &opts)); cl_git_pass(git_revert(repo, head, &opts));
......
...@@ -196,7 +196,7 @@ void test_stash_save__cannot_stash_against_a_bare_repository(void) ...@@ -196,7 +196,7 @@ void test_stash_save__cannot_stash_against_a_bare_repository(void)
void test_stash_save__can_stash_against_a_detached_head(void) void test_stash_save__can_stash_against_a_detached_head(void)
{ {
git_repository_detach_head(repo); git_repository_detach_head(repo, NULL, NULL);
cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT)); cl_git_pass(git_stash_save(&stash_tip_oid, repo, signature, NULL, GIT_STASH_DEFAULT));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment