From 9c3002bd2f1594901e7d8c2c0edc5c7ce30a9a76 Mon Sep 17 00:00:00 2001
From: Alberto Fanjul <albertofanjul@gmail.com>
Date: Mon, 3 Feb 2025 23:46:24 +0100
Subject: [PATCH] Compatibility changes for libgit2 >=1.8.0

Index: libgit2-glib/ggit-types.h
--- libgit2-glib/ggit-types.h.orig
+++ libgit2-glib/ggit-types.h
@@ -22,6 +22,13 @@
 #define __GGIT_TYPES_H__
 
 #include <glib.h>
+#if LIBGIT2_VER_MAJOR > 1 || (LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR >= 9)
+#include "ggit-types-19.h"
+#elif LIBGIT2_VER_MAJOR > 1 || (LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR >= 8)
+#include "ggit-types-18.h"
+#else
+#include "ggit-types-pre18.h"
+#endif
 
 G_BEGIN_DECLS
 
@@ -335,31 +342,6 @@ typedef enum
 } GgitBlameFlags;
 
 /**
- * GgitConfigLevel:
- * @GGIT_CONFIG_LEVEL_PROGRAMDATA: System-wide on Windows, for compatibility with portable git.
- * @GGIT_CONFIG_LEVEL_SYSTEM: System-wide configuration file.
- * @GGIT_CONFIG_LEVEL_XDG: XDG compatible configuration file (.config/git/config).
- * @GGIT_CONFIG_LEVEL_GLOBAL: User-specific configuration file, also called Global configuration file.
- * @GGIT_CONFIG_LEVEL_LOCAL: Repository specific configuration file.
- * @GGIT_CONFIG_LEVEL_APP: Application specific configuration file; freely defined by applications.
- * @GGIT_CONFIG_LEVEL_HIGHEST: Represents the highest level of a config file.
- *
- * Priority level of a config file.
- * These priority levels correspond to the natural escalation logic
- * (from higher to lower) when searching for config entries in git.git.
- */
-typedef enum
-{
-	GGIT_CONFIG_LEVEL_PROGRAMDATA = 1,
-	GGIT_CONFIG_LEVEL_SYSTEM      = 2,
-	GGIT_CONFIG_LEVEL_XDG         = 3,
-	GGIT_CONFIG_LEVEL_GLOBAL      = 4,
-	GGIT_CONFIG_LEVEL_LOCAL       = 5,
-	GGIT_CONFIG_LEVEL_APP         = 6,
-	GGIT_CONFIG_LEVEL_HIGHEST     = -1
-} GgitConfigLevel;
-
-/**
  * GgitCreateFlags:
  * @GGIT_CREATE_NONE: attempt to create.
  * @GGIT_CREATE_FORCE: force creation.
@@ -986,32 +968,6 @@ typedef enum
 	GGIT_PACKBUILDER_STAGE_ADDING_OBJECTS = 0,
 	GGIT_PACKBUILDER_STAGE_DELTAFICATION  = 1
 } GgitPackbuilderStage;
-
-typedef enum
-{
-	GGIT_CHECKOUT_NONE                    = 0,
-	GGIT_CHECKOUT_SAFE                    = (1u << 0),
-	GGIT_CHECKOUT_FORCE                   = (1u << 1),
-	GGIT_CHECKOUT_RECREATE_MISSING        = (1u << 2),
-	GGIT_CHECKOUT_ALLOW_CONFLICTS         = (1u << 4),
-	GGIT_CHECKOUT_REMOVE_UNTRACKED        = (1u << 5),
-	GGIT_CHECKOUT_REMOVE_IGNORED          = (1u << 6),
-	GGIT_CHECKOUT_UPDATE_ONLY             = (1u << 7),
-	GGIT_CHECKOUT_DONT_UPDATE_INDEX       = (1u << 8),
-	GGIT_CHECKOUT_NO_REFRESH              = (1u << 9),
-	GGIT_CHECKOUT_SKIP_UNMERGED           = (1u << 10),
-	GGIT_CHECKOUT_USE_OURS                = (1u << 11),
-	GGIT_CHECKOUT_USE_THEIRS              = (1u << 12),
-	GGIT_CHECKOUT_DISABLE_PATHSPEC_MATCH  = (1u << 13),
-	GGIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES = (1u << 18),
-	GGIT_CHECKOUT_DONT_OVERWRITE_IGNORED  = (1u << 19),
-	GGIT_CHECKOUT_CONFLICT_STYLE_MERGE    = (1u << 20),
-	GGIT_CHECKOUT_CONFLICT_STYLE_DIFF3    = (1u << 21),
-	GGIT_CHECKOUT_DONT_REMOVE_EXISTING    = (1u << 22),
-	GGIT_CHECKOUT_DONT_WRITE_INDEX        = (1u << 23),
-	GGIT_CHECKOUT_UPDATE_SUBMODULES       = (1u << 16),
-	GGIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17)
-} GgitCheckoutStrategy;
 
 typedef enum {
 	GGIT_CHECKOUT_NOTIFY_NONE      = 0,
