Showing with 87 additions and 17 deletions.
  1. +2 −2 README.md
  2. +1 −1 cmake/SelectHTTPParser.cmake
  3. +17 −0 docs/changelog.md
  4. +8 −6 examples/commit.c
  5. +2 −2 include/git2/version.h
  6. +1 −1 src/remote.c
  7. +1 −1 src/win32/findfile.c
  8. +2 −2 src/xdiff/xdiff.h
  9. +2 −2 src/xdiff/xmerge.c
  10. +41 −0 tests/network/fetchlocal.c
  11. +10 −0 tests/win32/systemdir.c
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ libgit2 - the Git linkable library
| Build Status | |
| ------------ | - |
| **main** branch CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush) |
| **v1.2 branch** CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?branch=maint%2Fv1.2&event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.2) |
| **v1.1 branch** CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?branch=maint%2Fv1.1&event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.1) |
| **v1.4 branch** CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?branch=maint%2Fv1.4&event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.4) |
| **v1.3 branch** CI builds | [![CI Build](https://github.com/libgit2/libgit2/workflows/CI%20Build/badge.svg?branch=maint%2Fv1.3&event=push)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22CI+Build%22+event%3Apush+branch%3Amaint%2Fv1.3) |
| **Nightly** builds | [![Nightly Build](https://github.com/libgit2/libgit2/workflows/Nightly%20Build/badge.svg)](https://github.com/libgit2/libgit2/actions?query=workflow%3A%22Nightly+Build%22) [![Coverity Scan Status](https://scan.coverity.com/projects/639/badge.svg)](https://scan.coverity.com/projects/639) |

`libgit2` is a portable, pure C implementation of the Git core methods
Expand Down
2 changes: 1 addition & 1 deletion cmake/SelectHTTPParser.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Optional external dependency: http-parser
if(USE_HTTP_PARSER STREQUAL "system")
find_package(HTTP_Parser)
find_package(HTTPParser)

if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
Expand Down
17 changes: 17 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
v1.4.2
------

This is a bugfix release with the following changes:

* remote: do store the update_tips callback error value by @carlosmn in https://github.com/libgit2/libgit2/pull/6226
* win32: `find_system_dirs` does not return `GIT_ENOTFOUND` by @ethomson in https://github.com/libgit2/libgit2/pull/6228

v1.4.1
------

This is a bugfix release with the following changes:

* xdiff: use xdl_free not free by @ethomson
* cmake: Fix package name for system http-parser by @mgorny
* Free parent and ref in lg2_commit before returning by @apnadkarni

v1.4
----

Expand Down
14 changes: 8 additions & 6 deletions examples/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* This does have:
*
* - Example of performing a git commit with a comment
*
*
*/
int lg2_commit(git_repository *repo, int argc, char **argv)
{
Expand All @@ -36,10 +36,10 @@ int lg2_commit(git_repository *repo, int argc, char **argv)

git_oid commit_oid,tree_oid;
git_tree *tree;
git_index *index;
git_index *index;
git_object *parent = NULL;
git_reference *ref = NULL;
git_signature *signature;
git_signature *signature;

/* Validate args */
if (argc < 3 || strcmp(opt, "-m") != 0) {
Expand All @@ -62,9 +62,9 @@ int lg2_commit(git_repository *repo, int argc, char **argv)
check_lg2(git_index_write(index), "Could not write index", NULL);;

check_lg2(git_tree_lookup(&tree, repo, &tree_oid), "Error looking up tree", NULL);

check_lg2(git_signature_default(&signature, repo), "Error creating signature", NULL);

check_lg2(git_commit_create_v(
&commit_oid,
repo,
Expand All @@ -78,7 +78,9 @@ int lg2_commit(git_repository *repo, int argc, char **argv)

git_index_free(index);
git_signature_free(signature);
git_tree_free(tree);
git_tree_free(tree);
git_object_free(parent);
git_reference_free(ref);

return error;
}
4 changes: 2 additions & 2 deletions include/git2/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#ifndef INCLUDE_git_version_h__
#define INCLUDE_git_version_h__

#define LIBGIT2_VERSION "1.4.0"
#define LIBGIT2_VERSION "1.4.2"
#define LIBGIT2_VER_MAJOR 1
#define LIBGIT2_VER_MINOR 4
#define LIBGIT2_VER_REVISION 0
#define LIBGIT2_VER_REVISION 2
#define LIBGIT2_VER_PATCH 0

#define LIBGIT2_SOVERSION "1.4"
Expand Down
2 changes: 1 addition & 1 deletion src/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ static int update_one_tip(
}

if (callbacks && callbacks->update_tips != NULL &&
callbacks->update_tips(refname.ptr, &old, &head->oid, callbacks->payload) < 0)
(error = callbacks->update_tips(refname.ptr, &old, &head->oid, callbacks->payload)) < 0)
git_error_set_after_callback_function(error, "git_remote_fetch");

done:
Expand Down
2 changes: 1 addition & 1 deletion src/win32/findfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ int git_win32__find_system_dirs(git_str *out, const char *subdir)
has_regdir = (find_sysdir_in_registry(regdir) == 0);

if (!has_pathdir && !has_regdir)
return GIT_ENOTFOUND;
return 0;

/*
* Usually the git in the path is the same git in the registry,
Expand Down
4 changes: 2 additions & 2 deletions src/xdiff/xdiff.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
#if !defined(XDIFF_H)
#define XDIFF_H

#include "git-xdiff.h"

#ifdef __cplusplus
extern "C" {
#endif /* #ifdef __cplusplus */

#include "git-xdiff.h"

/* xpparm_t.flags */
#define XDF_NEED_MINIMAL (1 << 0)

Expand Down
4 changes: 2 additions & 2 deletions src/xdiff/xmerge.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static int xdl_cleanup_merge(xdmerge_t *c)
if (c->mode == 0)
count++;
next_c = c->next;
free(c);
xdl_free(c);
}
return count;
}
Expand Down Expand Up @@ -456,7 +456,7 @@ static void xdl_merge_two_conflicts(xdmerge_t *m)
m->chg1 = next_m->i1 + next_m->chg1 - m->i1;
m->chg2 = next_m->i2 + next_m->chg2 - m->i2;
m->next = next_m->next;
free(next_m);
xdl_free(next_m);
}

/*
Expand Down
41 changes: 41 additions & 0 deletions tests/network/fetchlocal.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,44 @@ void test_network_fetchlocal__prune_load_fetch_prune_config(void)
git_remote_free(origin);
git_repository_free(repo);
}

static int update_tips_error(const char *ref, const git_oid *old, const git_oid *new, void *data)
{
int *callcount = (int *) data;

GIT_UNUSED(ref);
GIT_UNUSED(old);
GIT_UNUSED(new);

(*callcount)++;

return -1;
}

void test_network_fetchlocal__update_tips_error_is_propagated(void)
{
git_repository *repo;
git_reference_iterator *iterator;
git_reference *ref;
git_remote *remote;
git_fetch_options options = GIT_FETCH_OPTIONS_INIT;
int callcount = 0;

cl_git_pass(git_repository_init(&repo, "foo.git", true));
cl_set_cleanup(cleanup_local_repo, "foo.git");

cl_git_pass(git_remote_create_with_fetchspec(&remote, repo, "origin", cl_git_fixture_url("testrepo.git"), "+refs/heads/*:refs/remotes/update-tips/*"));

options.callbacks.update_tips = update_tips_error;
options.callbacks.payload = &callcount;

cl_git_fail(git_remote_fetch(remote, NULL, &options, NULL));
cl_assert_equal_i(1, callcount);

cl_git_pass(git_reference_iterator_glob_new(&iterator, repo, "refs/remotes/update-tips/**/"));
cl_assert_equal_i(GIT_ITEROVER, git_reference_next(&ref, iterator));

git_reference_iterator_free(iterator);
git_remote_free(remote);
git_repository_free(repo);
}
10 changes: 10 additions & 0 deletions tests/win32/systemdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,13 @@ void test_win32_systemdir__prefers_path_to_registry(void)
git_config_free(cfg);
#endif
}

void test_win32_systemdir__no_git_installed(void)
{
#ifdef GIT_WIN32
git_str out = GIT_STR_INIT;

cl_git_pass(git_win32__find_system_dirs(&out, "etc"));
cl_assert_equal_s(out.ptr, "");
#endif
}