Hi,
Based on feedback from Daniel Shahaf, I've made the build system care
about which version of libgit2 we're trying to link against. I copied
what apache.m4 was doing, which I figured was a good template.
[[[
On the ‘ra-git’ branch: update to libgit2 v0.21
* build/ac-macros/libgit2.m4:
Check for the exact version we need to build against
* subversion/libsvn_ra_git/ra_plugin.c:
(split_url): remotes which are not in the config are now called
anonymous.
(do_git_fetch): pass NULL to git_remote_fetch() to get default reflog
entries.
(remote_progress_cb, svn_ra_git__open): the progress callback has been
renamed to sideband_progress. Rename our callback function to
remote_sideband_progress_cb to match libgit2 naming.
(compare_git_tree_entries): git_tree_entry_byoid is now
git_tree_entry_byid.
* subversion/libsvn_ra_git/reporter.c:
(blob_relatedness_cb): delta file field oid has been renamed to id.
]]]
Index: build/ac-macros/libgit2.m4
===================================================================
--- build/ac-macros/libgit2.m4 (revision 1606591)
+++ build/ac-macros/libgit2.m4 (working copy)
@@ -26,6 +26,8 @@ dnl
AC_DEFUN(SVN_LIB_GIT2,
[
libgit2_found=no
+ LIBGIT2_WANTED_MAJOR_VERSION=0
+ LIBGIT2_WANTED_MINOR_VERSION=21
AC_ARG_WITH(libgit2,AS_HELP_STRING([--with-libgit2=PREFIX],
[libgit2 library]),
@@ -57,6 +59,17 @@ AC_DEFUN(SVN_LIB_GIT2,
LDFLAGS="$LDFLAGS `SVN_REMOVE_STANDARD_LIB_DIRS(-L$libgit2_prefix/lib)`"
fi
+ AC_MSG_CHECKING([libgit2 version])
+ AC_EGREP_CPP(VERSION_OKAY,
+ [
+#include "$libgit2_prefix/include/git2/version.h"
+#if LIBGIT2_VER_MAJOR == $LIBGIT2_WANTED_MAJOR_VERSION && LIBGIT2_VER_MINOR == $LIBGIT2_WANTED_MINOR_VERSION
+VERSION_OKAY
+#endif],
+ [AC_MSG_RESULT([correct])],
+ [AC_MSG_ERROR([wrong version, need $LIBGIT2_WANTED_MAJOR_VERSION.$LIBGIT2_WANTED_MINOR_VERSION])]
+ )
+
SVN_LIBGIT2_LIBS="-lgit2"
AC_SUBST(SVN_LIBGIT2_INCLUDES)
Index: subversion/libsvn_ra_git/ra_plugin.c
===================================================================
--- subversion/libsvn_ra_git/ra_plugin.c (revision 1606591)
+++ subversion/libsvn_ra_git/ra_plugin.c (working copy)
@@ -144,9 +144,9 @@ split_url(const char **remote_url,
SVN_DBG(("trying remote url '%s'", remote_url_buf->data));
/* Create an in-memory remote... */
- git_err = git_remote_create_inmemory(&remote, repos,
- RA_GIT_DEFAULT_REFSPEC,
- remote_url_buf->data);
+ git_err = git_remote_create_anonymous(&remote, repos,
+ remote_url_buf->data,
+ RA_GIT_DEFAULT_REFSPEC);
if (git_err)
return svn_error_trace(svn_ra_git__wrap_git_error());
@@ -205,7 +205,7 @@ do_git_fetch(svn_ra_git__session_baton_t *sess)
SVN_DBG(("fetching from %s\n", git_remote_url(sess->remote)));
- git_err = git_remote_fetch(sess->remote);
+ git_err = git_remote_fetch(sess->remote, NULL, NULL);
if (git_err)
return svn_error_trace(svn_ra_git__wrap_git_error());
@@ -609,7 +609,7 @@ check_cancel_stop_remote(svn_ra_git__session_baton
}
}
-static int remote_progress_cb(const char *str, int len, void *data)
+static int remote_sideband_progress_cb(const char *str, int len, void *data)
{
svn_ra_git__session_baton_t *sess = data;
svn_string_t *s;
@@ -981,7 +981,7 @@ svn_ra_git__open(svn_ra_session_t *session,
remote_callbacks = apr_pcalloc(session->pool, sizeof(*remote_callbacks));
remote_callbacks->version = GIT_REMOTE_CALLBACKS_VERSION;
- remote_callbacks->progress = remote_progress_cb;
+ remote_callbacks->sideband_progress = remote_sideband_progress_cb;
remote_callbacks->transfer_progress = remote_transfer_progress_cb;
remote_callbacks->update_tips = remote_update_tips_cb;
remote_callbacks->payload = sess;
@@ -1475,7 +1475,7 @@ compare_git_tree_entries(apr_hash_t *changed_paths
const char *entry_relpath;
changed_path = svn_log_changed_path2_create(pool);
- other_entry = git_tree_entry_byoid(other_tree, other_oid);
+ other_entry = git_tree_entry_byid(other_tree, other_oid);
if (git_tree_entry_type(other_entry) == GIT_OBJ_BLOB)
changed_path->action = 'M';
else
@@ -1526,7 +1526,7 @@ compare_git_tree_entries(apr_hash_t *changed_paths
other_entry_name, pool),
svn_hash_sets(changed_paths, other_entry_relpath, changed_path);
- other_entry = git_tree_entry_byoid(other_tree, other_entry_id);
+ other_entry = git_tree_entry_byid(other_tree, other_entry_id);
if (git_tree_entry_type(other_entry) == GIT_OBJ_TREE)
{
git_tree *added_tree;
Index: subversion/libsvn_ra_git/reporter.c
===================================================================
--- subversion/libsvn_ra_git/reporter.c (revision 1606591)
+++ subversion/libsvn_ra_git/reporter.c (working copy)
@@ -780,12 +780,12 @@ blob_relatedness_cb(const git_diff_delta *delta, f
/* At least one of the oids should match, else we're not looking
* at the right blob. */
- if (!git_oid_equal(&delta->old_file.oid, git_blob_id(b->blob)) &&
- !git_oid_equal(&delta->new_file.oid, git_blob_id(b->other_blob)))
+ if (!git_oid_equal(&delta->old_file.id, git_blob_id(b->blob)) &&
+ !git_oid_equal(&delta->new_file.id, git_blob_id(b->other_blob)))
return 0;
- if (git_oid_iszero(&delta->old_file.oid) ||
- git_oid_iszero(&delta->new_file.oid))
+ if (git_oid_iszero(&delta->old_file.id) ||
+ git_oid_iszero(&delta->new_file.id))
{
/* A zero oid means the blob doesn't actually exist on one side. */
b->distance = -1;