diff --git a/CMakeLists.txt b/CMakeLists.txt index 83b62185848..6e454816ef4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.5.1) -project(libgit2 VERSION "1.8.3" LANGUAGES C) +project(libgit2 VERSION "1.8.4" LANGUAGES C) # Add find modules to the path set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") diff --git a/docs/changelog.md b/docs/changelog.md index f4ac83fb406..02bad65e17c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,18 @@ +v1.8.4 +------ + +We erroneously shipped v1.8.3 without actually including the change +in v1.8.2. This release re-re-introduces the pre-v1.8.0 `commit` +constness behavior. + +## What's Changed + +### Bug fixes + +* Fix constness issue introduced in #6716 by @ethomson in https://github.com/libgit2/libgit2/pull/6829 + +**Full Changelog**: https://github.com/libgit2/libgit2/compare/v1.8.3...v1.8.4 + v1.8.3 ------ diff --git a/examples/merge.c b/examples/merge.c index 718c767d038..7a76912cd24 100644 --- a/examples/merge.c +++ b/examples/merge.c @@ -263,7 +263,7 @@ static int create_merge_commit(git_repository *repo, git_index *index, struct me sign, sign, NULL, msg, tree, - opts->annotated_count + 1, parents); + opts->annotated_count + 1, (const git_commit **)parents); check_lg2(err, "failed to create commit", NULL); /* We're done merging, cleanup the repository state */ diff --git a/include/git2/commit.h b/include/git2/commit.h index ef38c66e6cc..88c21e0c973 100644 --- a/include/git2/commit.h +++ b/include/git2/commit.h @@ -366,7 +366,7 @@ GIT_EXTERN(int) git_commit_create( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[]); + const git_commit *parents[]); /** * Create new commit in the repository using a variable argument list. @@ -512,7 +512,7 @@ GIT_EXTERN(int) git_commit_create_buffer( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[]); + const git_commit *parents[]); /** * Create a commit object from the given buffer and signature @@ -581,7 +581,7 @@ typedef int (*git_commit_create_cb)( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[], + const git_commit *parents[], void *payload); /** An array of commits returned from the library */ diff --git a/include/git2/version.h b/include/git2/version.h index 906fa61c642..65fd199cf09 100644 --- a/include/git2/version.h +++ b/include/git2/version.h @@ -11,7 +11,7 @@ * The version string for libgit2. This string follows semantic * versioning (v2) guidelines. */ -#define LIBGIT2_VERSION "1.8.3" +#define LIBGIT2_VERSION "1.8.4" /** The major version number for this version of libgit2. */ #define LIBGIT2_VER_MAJOR 1 @@ -20,7 +20,7 @@ #define LIBGIT2_VER_MINOR 8 /** The revision ("teeny") version number for this version of libgit2. */ -#define LIBGIT2_VER_REVISION 3 +#define LIBGIT2_VER_REVISION 4 /** The Windows DLL patch number for this version of libgit2. */ #define LIBGIT2_VER_PATCH 0 diff --git a/package.json b/package.json index b67c559024e..6b8106c43a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "libgit2", - "version": "1.8.3", + "version": "1.8.4", "repo": "https://github.com/libgit2/libgit2", "description": " A cross-platform, linkable library implementation of Git that you can use in your application.", "install": "mkdir build && cd build && cmake .. && cmake --build ." diff --git a/src/libgit2/commit.c b/src/libgit2/commit.c index 47f6fed892f..10df43623d2 100644 --- a/src/libgit2/commit.c +++ b/src/libgit2/commit.c @@ -281,7 +281,7 @@ int git_commit_create_from_ids( typedef struct { size_t total; - git_commit * const *parents; + const git_commit **parents; git_repository *repo; } commit_parent_data; @@ -307,7 +307,7 @@ int git_commit_create( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[]) + const git_commit *parents[]) { commit_parent_data data = { parent_count, parents, repo }; @@ -945,7 +945,7 @@ int git_commit_create_buffer( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[]) + const git_commit *parents[]) { GIT_BUF_WRAP_PRIVATE(out, git_commit__create_buffer, repo, author, committer, message_encoding, message, @@ -961,7 +961,7 @@ int git_commit__create_buffer( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[]) + const git_commit *parents[]) { int error; commit_parent_data data = { parent_count, parents, repo }; @@ -1150,7 +1150,8 @@ int git_commit_create_from_stage( error = git_commit_create(out, repo, "HEAD", author, committer, opts.message_encoding, message, - tree, parents.count, parents.commits); + tree, parents.count, + (const git_commit **)parents.commits); done: git_commitarray_dispose(&parents); diff --git a/src/libgit2/commit.h b/src/libgit2/commit.h index 53128ba5d83..c25fee327b8 100644 --- a/src/libgit2/commit.h +++ b/src/libgit2/commit.h @@ -64,7 +64,7 @@ int git_commit__create_buffer( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[]); + const git_commit *parents[]); int git_commit__parse( void *commit, diff --git a/src/libgit2/notes.c b/src/libgit2/notes.c index 2dd194581fd..13ca3824bf1 100644 --- a/src/libgit2/notes.c +++ b/src/libgit2/notes.c @@ -303,7 +303,7 @@ static int note_write( error = git_commit_create(&oid, repo, notes_ref, author, committer, NULL, GIT_NOTES_DEFAULT_MSG_ADD, - tree, *parents == NULL ? 0 : 1, parents); + tree, *parents == NULL ? 0 : 1, (const git_commit **) parents); if (notes_commit_out) git_oid_cpy(notes_commit_out, &oid); @@ -394,7 +394,7 @@ static int note_remove( NULL, GIT_NOTES_DEFAULT_MSG_RM, tree_after_removal, *parents == NULL ? 0 : 1, - parents); + (const git_commit **) parents); if (error < 0) goto cleanup; diff --git a/src/libgit2/rebase.c b/src/libgit2/rebase.c index 2fce3e7bc06..77e442e981d 100644 --- a/src/libgit2/rebase.c +++ b/src/libgit2/rebase.c @@ -952,7 +952,7 @@ static int create_signed( const char *message, git_tree *tree, size_t parent_count, - git_commit * const *parents) + const git_commit **parents) { git_str commit_content = GIT_STR_INIT; git_buf commit_signature = { NULL, 0, 0 }, @@ -1040,7 +1040,8 @@ static int rebase_commit__create( if (rebase->options.commit_create_cb) { error = rebase->options.commit_create_cb(&commit_id, author, committer, message_encoding, message, - tree, 1, &parent_commit, rebase->options.payload); + tree, 1, (const git_commit **)&parent_commit, + rebase->options.payload); git_error_set_after_callback_function(error, "commit_create_cb"); @@ -1049,14 +1050,14 @@ static int rebase_commit__create( else if (rebase->options.signing_cb) { error = create_signed(&commit_id, rebase, author, committer, message_encoding, message, tree, - 1, &parent_commit); + 1, (const git_commit **)&parent_commit); } #endif if (error == GIT_PASSTHROUGH) error = git_commit_create(&commit_id, rebase->repo, NULL, author, committer, message_encoding, message, - tree, 1, &parent_commit); + tree, 1, (const git_commit **)&parent_commit); if (error) goto done; diff --git a/src/libgit2/stash.c b/src/libgit2/stash.c index a0a72deacc6..b49e95cdb21 100644 --- a/src/libgit2/stash.c +++ b/src/libgit2/stash.c @@ -124,7 +124,7 @@ static int commit_index( git_index *index, const git_signature *stasher, const char *message, - git_commit *parent) + const git_commit *parent) { git_tree *i_tree = NULL; git_oid i_commit_oid; @@ -423,7 +423,7 @@ static int build_stash_commit_from_tree( git_commit *u_commit, const git_tree *tree) { - git_commit *parents[] = { NULL, NULL, NULL }; + const git_commit *parents[] = { NULL, NULL, NULL }; parents[0] = b_commit; parents[1] = i_commit; diff --git a/tests/libgit2/checkout/tree.c b/tests/libgit2/checkout/tree.c index 97935aaeaa1..65df00cd87b 100644 --- a/tests/libgit2/checkout/tree.c +++ b/tests/libgit2/checkout/tree.c @@ -1235,7 +1235,7 @@ void test_checkout_tree__case_changing_rename(void) cl_git_pass(git_signature_new(&signature, "Renamer", "rename@contoso.com", time(NULL), 0)); - cl_git_pass(git_commit_create(&commit_id, g_repo, "refs/heads/dir", signature, signature, NULL, "case-changing rename", tree, 1, &dir_commit)); + cl_git_pass(git_commit_create(&commit_id, g_repo, "refs/heads/dir", signature, signature, NULL, "case-changing rename", tree, 1, (const git_commit **)&dir_commit)); cl_assert(git_fs_path_isfile("testrepo/readme")); if (case_sensitive) diff --git a/tests/libgit2/cherrypick/workdir.c b/tests/libgit2/cherrypick/workdir.c index 9d9a3f49795..c16b7814ac0 100644 --- a/tests/libgit2/cherrypick/workdir.c +++ b/tests/libgit2/cherrypick/workdir.c @@ -77,7 +77,7 @@ void test_cherrypick_workdir__automerge(void) cl_git_pass(git_index_write_tree(&cherrypicked_tree_oid, repo_index)); cl_git_pass(git_tree_lookup(&cherrypicked_tree, repo, &cherrypicked_tree_oid)); cl_git_pass(git_commit_create(&cherrypicked_oid, repo, "HEAD", signature, signature, NULL, - "Cherry picked!", cherrypicked_tree, 1, &head)); + "Cherry picked!", cherrypicked_tree, 1, (const git_commit **)&head)); cl_assert(merge_test_index(repo_index, merge_index_entries + i * 3, 3)); diff --git a/tests/libgit2/commit/commit.c b/tests/libgit2/commit/commit.c index 923740f23af..140f87d0c72 100644 --- a/tests/libgit2/commit/commit.c +++ b/tests/libgit2/commit/commit.c @@ -36,11 +36,11 @@ void test_commit_commit__create_unexisting_update_ref(void) cl_git_fail(git_reference_lookup(&ref, _repo, "refs/heads/foo/bar")); cl_git_pass(git_commit_create(&oid, _repo, "refs/heads/foo/bar", s, s, - NULL, "some msg", tree, 1, &commit)); + NULL, "some msg", tree, 1, (const git_commit **) &commit)); /* fail because the parent isn't the tip of the branch anymore */ cl_git_fail(git_commit_create(&oid, _repo, "refs/heads/foo/bar", s, s, - NULL, "some msg", tree, 1, &commit)); + NULL, "some msg", tree, 1, (const git_commit **) &commit)); cl_git_pass(git_reference_lookup(&ref, _repo, "refs/heads/foo/bar")); cl_assert_equal_oid(&oid, git_reference_target(ref)); diff --git a/tests/libgit2/commit/write.c b/tests/libgit2/commit/write.c index d38b54d2077..890f7384b1a 100644 --- a/tests/libgit2/commit/write.c +++ b/tests/libgit2/commit/write.c @@ -118,7 +118,7 @@ void test_commit_write__into_buf(void) cl_git_pass(git_commit_lookup(&parent, g_repo, &parent_id)); cl_git_pass(git_commit_create_buffer(&commit, g_repo, author, committer, - NULL, root_commit_message, tree, 1, &parent)); + NULL, root_commit_message, tree, 1, (const git_commit **) &parent)); cl_assert_equal_s(commit.ptr, "tree 1810dff58d8a660512d4832e740f692884338ccd\n\ diff --git a/tests/libgit2/diff/rename.c b/tests/libgit2/diff/rename.c index 15dee5c97d5..61a2f839cb3 100644 --- a/tests/libgit2/diff/rename.c +++ b/tests/libgit2/diff/rename.c @@ -424,7 +424,7 @@ void test_diff_rename__test_small_files(void) cl_git_pass(git_index_write_tree(&oid, index)); cl_git_pass(git_tree_lookup(&commit_tree, g_repo, &oid)); cl_git_pass(git_signature_new(&signature, "Rename", "rename@example.com", 1404157834, 0)); - cl_git_pass(git_commit_create(&oid, g_repo, "HEAD", signature, signature, NULL, "Test commit", commit_tree, 1, &head_commit)); + cl_git_pass(git_commit_create(&oid, g_repo, "HEAD", signature, signature, NULL, "Test commit", commit_tree, 1, (const git_commit**)&head_commit)); cl_git_mkfile("renames/copy.txt", "Hello World!\n"); cl_git_rmfile("renames/small.txt"); diff --git a/tests/libgit2/odb/freshen.c b/tests/libgit2/odb/freshen.c index d0e0e3c3c04..e337c82b773 100644 --- a/tests/libgit2/odb/freshen.c +++ b/tests/libgit2/odb/freshen.c @@ -125,7 +125,7 @@ void test_odb_freshen__tree_during_commit(void) cl_git_pass(git_commit_create(&commit_id, repo, NULL, signature, signature, NULL, "New commit pointing to old tree", - tree, 1, &parent)); + tree, 1, (const git_commit **)&parent)); /* make sure we freshen the tree the commit points to */ cl_must_pass(p_lstat("testrepo.git/objects/" LOOSE_TREE_FN, &after)); diff --git a/tests/libgit2/rebase/sign.c b/tests/libgit2/rebase/sign.c index 45bac29d095..69bb1c6f998 100644 --- a/tests/libgit2/rebase/sign.c +++ b/tests/libgit2/rebase/sign.c @@ -26,7 +26,7 @@ static int create_cb_passthrough( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[], + const git_commit *parents[], void *payload) { GIT_UNUSED(out); @@ -94,7 +94,7 @@ static int create_cb_signed_gpg( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[], + const git_commit *parents[], void *payload) { git_buf commit_content = GIT_BUF_INIT; @@ -202,7 +202,7 @@ static int create_cb_error( const char *message, const git_tree *tree, size_t parent_count, - git_commit * const parents[], + const git_commit *parents[], void *payload) { GIT_UNUSED(out); diff --git a/tests/libgit2/refs/reflog/messages.c b/tests/libgit2/refs/reflog/messages.c index 4a2ecb02aed..647c00d0dfd 100644 --- a/tests/libgit2/refs/reflog/messages.c +++ b/tests/libgit2/refs/reflog/messages.c @@ -233,7 +233,7 @@ void test_refs_reflog_messages__show_merge_for_merge_commits(void) cl_git_pass(git_commit_create(&merge_commit_oid, g_repo, "HEAD", s, s, NULL, "Merge commit", tree, - 2, parent_commits)); + 2, (const struct git_commit **) parent_commits)); cl_reflog_check_entry(g_repo, GIT_HEAD_FILE, 0, NULL, diff --git a/tests/libgit2/revert/workdir.c b/tests/libgit2/revert/workdir.c index 6d74254e533..3e790b77f78 100644 --- a/tests/libgit2/revert/workdir.c +++ b/tests/libgit2/revert/workdir.c @@ -188,7 +188,7 @@ void test_revert_workdir__again(void) cl_git_pass(git_tree_lookup(&reverted_tree, repo, &reverted_tree_oid)); cl_git_pass(git_signature_new(&signature, "Reverter", "reverter@example.org", time(NULL), 0)); - cl_git_pass(git_commit_create(&reverted_commit_oid, repo, "HEAD", signature, signature, NULL, "Reverted!", reverted_tree, 1, &orig_head)); + cl_git_pass(git_commit_create(&reverted_commit_oid, repo, "HEAD", signature, signature, NULL, "Reverted!", reverted_tree, 1, (const git_commit **)&orig_head)); cl_git_pass(git_revert(repo, orig_head, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 4)); @@ -238,7 +238,7 @@ void test_revert_workdir__again_after_automerge(void) cl_git_pass(git_tree_lookup(&reverted_tree, repo, &reverted_tree_oid)); cl_git_pass(git_signature_new(&signature, "Reverter", "reverter@example.org", time(NULL), 0)); - cl_git_pass(git_commit_create(&reverted_commit_oid, repo, "HEAD", signature, signature, NULL, "Reverted!", reverted_tree, 1, &head)); + cl_git_pass(git_commit_create(&reverted_commit_oid, repo, "HEAD", signature, signature, NULL, "Reverted!", reverted_tree, 1, (const git_commit **)&head)); cl_git_pass(git_revert(repo, commit, NULL)); cl_assert(merge_test_index(repo_index, second_revert_entries, 6)); @@ -287,7 +287,7 @@ void test_revert_workdir__again_after_edit(void) cl_git_pass(git_tree_lookup(&reverted_tree, repo, &reverted_tree_oid)); cl_git_pass(git_signature_new(&signature, "Reverter", "reverter@example.org", time(NULL), 0)); - cl_git_pass(git_commit_create(&reverted_commit_oid, repo, "HEAD", signature, signature, NULL, "Reverted!", reverted_tree, 1, &orig_head)); + cl_git_pass(git_commit_create(&reverted_commit_oid, repo, "HEAD", signature, signature, NULL, "Reverted!", reverted_tree, 1, (const git_commit **)&orig_head)); cl_git_pass(git_revert(repo, commit, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 4)); diff --git a/tests/libgit2/revwalk/basic.c b/tests/libgit2/revwalk/basic.c index 5c53405051b..41090a1dac8 100644 --- a/tests/libgit2/revwalk/basic.c +++ b/tests/libgit2/revwalk/basic.c @@ -550,7 +550,8 @@ void test_revwalk_basic__big_timestamp(void) cl_git_pass(git_signature_new(&sig, "Joe", "joe@example.com", INT64_C(2399662595), 0)); cl_git_pass(git_commit_tree(&tree, tip)); - cl_git_pass(git_commit_create(&id, _repo, "HEAD", sig, sig, NULL, "some message", tree, 1, &tip)); + cl_git_pass(git_commit_create(&id, _repo, "HEAD", sig, sig, NULL, "some message", tree, 1, + (const git_commit **)&tip)); cl_git_pass(git_revwalk_push_head(_walk));