Description: Remove libgit2
 Since libgit2 does not build on all debian archs, this patch removes
 it. Subsurface can normally operate on files, like the older versions.
 .
 This is a temporary solution, since in future versions libgit2 will be
 needed.
 .
 subsurface (4.2-3) unstable; urgency=medium
 .
   * Removed dependency on libgit2
Author: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>

--- subsurface-4.2.orig/CMakeLists.txt
+++ subsurface-4.2/CMakeLists.txt
@@ -25,7 +25,6 @@ ENDMACRO()
 
 pkg_config_library(LIBXML libxml-2.0)
 pkg_config_library(LIBSQLITE3 sqlite3)
-pkg_config_library(LIBGIT2 libgit2)
 pkg_config_library(LIBXSLT libxslt)
 
 SET(LIBDCDEVEL "" CACHE STRING "libraries")
@@ -84,13 +83,11 @@ SET(SUBSURFACE_CORE_LIB_SRCS
 	equipment.c
 	file.c
 	libdivecomputer.c
-	load-git.c
 	membuffer.c
 	parse-xml.c
 	planner.c
 	profile.c
 	worldmap-save.c
-	save-git.c
 	save-xml.c
 	save-html.c
 	sha1.c
@@ -206,4 +203,4 @@ ADD_TEST( NAME TestUnitConversion COMMAN
 
 ADD_EXECUTABLE( TestProfile tests/testprofile.cpp )
 TARGET_LINK_LIBRARIES( TestProfile ${QT_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} -lzip -ldivecomputer subsurface_corelib)
-ADD_TEST( NAME TestProfile COMMAND TestProfile)
\ No newline at end of file
+ADD_TEST( NAME TestProfile COMMAND TestProfile)
--- subsurface-4.2.orig/dive.h
+++ subsurface-4.2/dive.h
@@ -541,8 +541,8 @@ static inline int get_idx_by_uniq_id(int
 extern "C" {
 #endif
 
-extern int report_error(const char *fmt, ...);
-extern const char *get_error_string(void);
+static int report_error(const char *fmt, ...) {return -1;}
+static const char *get_error_string(void) { return ""; }
 
 extern struct dive *find_dive_including(timestamp_t when);
 extern bool dive_within_time_range(struct dive *dive, timestamp_t when, timestamp_t offset);
@@ -568,16 +568,6 @@ extern int save_dives_logic(const char *
 extern int save_dive(FILE *f, struct dive *dive);
 extern int export_dives_xslt(const char *filename, const bool selected, const char *export_xslt);
 
-struct git_oid;
-struct git_repository;
-#define dummy_git_repository ((git_repository *)3ul) /* Random bogus pointer, not NULL */
-extern struct git_repository *is_git_repository(const char *filename, const char **branchp);
-extern int git_save_dives(struct git_repository *, const char *, bool select_only);
-extern int git_load_dives(struct git_repository *, const char *);
-extern const char *saved_git_id;
-extern void clear_git_id(void);
-extern void set_git_id(const struct git_oid *);
-
 struct user_info {
 	const char *name;
 	const char *email;
--- subsurface-4.2.orig/file.c
+++ subsurface-4.2/file.c
@@ -352,15 +352,10 @@ static void parse_file_buffer(const char
 
 int parse_file(const char *filename)
 {
-	struct git_repository *git;
 	const char *branch;
 	struct memblock mem;
 	char *fmt;
 
-	git = is_git_repository(filename, &branch);
-	if (git && !git_load_dives(git, branch))
-		return 0;
-
 	if (readfile(filename, &mem) < 0) {
 		/* we don't want to display an error if this was the default file */
 		if (prefs.default_filename && !strcmp(filename, prefs.default_filename))
--- subsurface-4.2.orig/main.cpp
+++ subsurface-4.2/main.cpp
@@ -11,7 +11,6 @@
 #include "qt-ui/diveplanner.h"
 
 #include <QStringList>
-#include <git2.h>
 
 QTranslator *qtTranslator, *ssrfTranslator;
 
@@ -42,7 +41,6 @@ int main(int argc, char **argv)
 			files.push_back(a);
 		}
 	}
-	git_threads_init();
 	setup_system_prefs();
 	prefs = default_prefs;
 	fill_profile_color();
--- subsurface-4.2.orig/qt-ui/mainwindow.cpp
+++ subsurface-4.2/qt-ui/mainwindow.cpp
@@ -261,7 +261,6 @@ void MainWindow::closeCurrentFile()
 {
 	ui.newProfile->setEmptyState();
 	/* free the dives and trips */
-	clear_git_id();
 	while (dive_table.nr)
 		delete_single_dive(0);
 
--- subsurface-4.2.orig/save-xml.c
+++ subsurface-4.2/save-xml.c
@@ -562,14 +562,9 @@ int save_dives_logic(const char *filenam
 {
 	struct membuffer buf = { 0 };
 	FILE *f;
-	void *git;
 	const char *branch;
 	int error;
 
-	git = is_git_repository(filename, &branch);
-	if (git)
-		return git_save_dives(git, branch, select_only);
-
 	try_to_backup(filename);
 
 	save_dives_buffer(&buf, select_only);
--- subsurface-4.2.orig/subsurface-configure.pri
+++ subsurface-4.2/subsurface-configure.pri
@@ -129,10 +129,9 @@ LIBS *= $$XSLT_LIBS $$XML2_LIBS
 link_pkgconfig: PKGCONFIG += libzip sqlite3
 
 isEmpty(LIBGIT2DEVEL) {
-	PKGCONFIG += libgit2
 } else {
 	INCLUDEPATH += $$LIBGIT2DEVEL/include
-	LIBS += -L$$LIBGIT2DEVEL/build -lgit2 -lz -lcrypto
+	LIBS += -L$$LIBGIT2DEVEL/build -lz -lcrypto
 }
 
 # Add libiconv if needed
@@ -154,10 +153,6 @@ contains(QMAKE_PLATFORM, android): DEFIN
 	else: LIBS += -lmarblewidget
 }
 
-libgit21-api {
-	DEFINES += USE_LIBGIT21_API
-}
-
 win32: console {
 	DEFINES += WIN32_CONSOLE_APP
 }
--- subsurface-4.2.orig/subsurface.pro
+++ subsurface-4.2/subsurface.pro
@@ -103,7 +103,6 @@ SOURCES =  \
 	file.c \
 	gettextfromc.cpp \
 	libdivecomputer.c \
-	load-git.c \
 	main.cpp \
 	membuffer.c \
 	parse-xml.c \
@@ -137,7 +136,6 @@ SOURCES =  \
 	qt-ui/subsurfacewebservices.cpp \
 	qt-ui/tableview.cpp \
 	exif.cpp \
-	save-git.c \
 	save-xml.c \
 	sha1.c \
 	statistics.c \
