RFC: Initial git save format

Dirk Hohndel dirk at hohndel.org
Fri Mar 7 08:44:23 PST 2014


On Fri, 2014-03-07 at 08:30 -0800, Dirk Hohndel wrote:
> On Fri, 2014-03-07 at 08:12 -0800, Linus Torvalds wrote:
> > 
> > On Mar 7, 2014 5:42 AM, "Tomaz Canabrava" <tcanabrava at kde.org> wrote:
> > >
> > > can anybody recheck this for me? from what Linus wrote, this should
> > work for libgit2  0.20, but I had to extend his macro to check the
> > libgitversion to be <= 20.
> > 
> > You are probably right that it should be <= 20.
> > 
> > I only tested 0.19 and my self-built libgit tree, and the libgit
> > versioning is horrible. The API documentation on the web tries to show
> > when the API changed, but when you click on the different version
> > numbers to see the actual API for that version, it seems to randomly
> > give some random version.
> > 
> > But the color coding on the API web docs does imply that the change
> > happened between 0.20 and current HEAD. So I think <= 20 is OK, but
> > breaks HEAD because the version hasn't been incremented to 21 yet.
> > 
> > But let's aim to primarily support actual releases rather than Git
> > tree of the day.
> 
> Yes, please. Maybe we can make this something where you can say "use
> libgit21 API" on the qmake command line. Let me play with this.

I think this (likely whitespace damaged) patch should do the trick.
You now add "CONFIG+=libgit21-api" to your qmake command line and it
should work on tip of git.

Linus, can you check this?

diff --git a/save-git.c b/save-git.c
index 6e0d989c0184..619e08630cb8 100644
--- a/save-git.c
+++ b/save-git.c
@@ -527,10 +527,10 @@ static int create_git_tree(git_repository *repo, struct dir *tree, bool select_o
 }
 
 /*
- * libgit2 revision 0.19 and earlier do not have the signature and
+ * libgit2 revision 0.20 and earlier do not have the signature and
  * message log arguments.
  */
-#if !LIBGIT2_VER_MAJOR && LIBGIT2_VER_MINOR <= 19
+#if !LIBGIT2_VER_MAJOR && LIBGIT2_VER_MINOR <= 20 && !defined(USE_LIBGIT21_API)
   #define git_branch_create(out,repo,branch_name,target,force,sig,msg) \
        git_branch_create(out,repo,branch_name,target,force)
   #define git_reference_set_target(out,ref,target,signature,log_message) \
diff --git a/subsurface-configure.pri b/subsurface-configure.pri
index a211113b2061..712b2272a025 100644
--- a/subsurface-configure.pri
+++ b/subsurface-configure.pri
@@ -140,6 +140,9 @@ link_pkgconfig: packagesExist(libiconv): PKGCONFIG += libiconv
 win32: CONFIG(debug, debug|release): LIBS += -lmarblewidgetd
 else: LIBS += -lmarblewidget
 
+libgit21-api {
+       DEFINES += USE_LIBGIT21_API
+}
 #
 # Platform-specific changes
 #




More information about the subsurface mailing list