build errors with save-git.c and upstream libgit2

Linus Torvalds torvalds at linux-foundation.org
Fri Mar 21 10:41:26 PDT 2014


On Fri, Mar 21, 2014 at 6:19 AM, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>
> today today i've tried pulling the latest libgit2 and got the
> following set of errors.
> i don't find 'git_checkout_opts opts' or ' GIT_CHECKOUT_OPTS_INIT'
> declared in the libgit2 tree or in our sources.

Christ.

Looks like they renamed the "opts" part to "options".

At least this time we have a preprocessor symbol to test. Does this
trivial patch work for you?

                    Linus
-------------- next part --------------
 save-git.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/save-git.c b/save-git.c
index 1488b43bb0dd..d9955a89b74f 100644
--- a/save-git.c
+++ b/save-git.c
@@ -797,9 +797,15 @@ static git_tree *get_git_tree(git_repository *repo, git_object *parent)
 	return tree;
 }
 
+/* Idiotic libgit2 developers don't care if they break interfaces */
+#ifndef GIT_CHECKOUT_OPTIONS_INIT
+  #define GIT_CHECKOUT_OPTIONS_INIT GIT_CHECKOUT_OPTS_INIT
+  #define git_checkout_options git_checkout_opts
+#endif
+
 static int update_git_checkout(git_repository *repo, git_object *parent, git_tree *tree)
 {
-	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
+	git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
 
 	opts.checkout_strategy = GIT_CHECKOUT_SAFE;
 	opts.notify_flags = GIT_CHECKOUT_NOTIFY_CONFLICT | GIT_CHECKOUT_NOTIFY_DIRTY;


More information about the subsurface mailing list