From b65ceb60b2e5e3bf5ef4d504534afdca9f8eea49 Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <seth@kipro-pcb.com>
Date: Fri, 21 Mar 2025 17:03:28 -0700
Subject: [PATCH] Fix builds for newer libgit2 (1.8.0 and newer)

---
 common/git/kicad_git_common.cpp | 1 +
 common/git/kicad_git_compat.h   | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/common/git/kicad_git_common.cpp b/common/git/kicad_git_common.cpp
index 9a2ea404fc..ba8c85970f 100644
--- a/common/git/kicad_git_common.cpp
+++ b/common/git/kicad_git_common.cpp
@@ -26,6 +26,7 @@
 #include "git_repo_mixin.h"
 
 #include <git/git_progress.h>
+#include <kicad_git_compat.h>
 #include <kiplatform/secrets.h>
 #include <trace_helpers.h>
 
diff --git a/common/git/kicad_git_compat.h b/common/git/kicad_git_compat.h
index 6892ef56f6..d811b0a4a5 100644
--- a/common/git/kicad_git_compat.h
+++ b/common/git/kicad_git_compat.h
@@ -31,4 +31,8 @@
 #define GIT_BUF_INIT { NULL, 0, 0 }
 #endif
 
+#if LIBGIT2_VER_MAJOR > 1 || ( LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR >= 8 )
+#include <git2/sys/errors.h>
+#endif
+
 #endif // KICAD_GIT_COMPAT_H_
\ No newline at end of file