From f7163c64a9dfa46d22a81945486c0199d90b015f Mon Sep 17 00:00:00 2001
From: Ingo Weinhold <ingo_weinhold@gmx.de>
Date: Tue, 13 Aug 2013 08:07:25 +0200
Subject: git-web--browse.sh: use "open" on Haiku


diff --git a/git-web--browse.sh b/git-web--browse.sh
index 1d72ec7..e3f254c 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -132,6 +132,10 @@ if test -z "$browser" ; then
 	if test -x /usr/bin/cygstart; then
 		browser_candidates="cygstart $browser_candidates"
 	fi
+	# /boot/system/haiku_loader indicates Haiku
+	if test -f /boot/system/haiku_loader; then
+		browser_candidates="open $browser_candidates"
+	fi
 
 	for i in $browser_candidates; do
 		init_browser_path $i
-- 
1.8.3.4


From b88713702e6a551f36a85afae6eba95e84976392 Mon Sep 17 00:00:00 2001
From: Ingo Weinhold <ingo_weinhold@gmx.de>
Date: Tue, 13 Aug 2013 21:03:59 +0200
Subject: On Haiku use the user settings directory instead of HOME


diff --git a/path.c b/path.c
index 04ff148..8668534 100644
--- a/path.c
+++ b/path.c
@@ -5,6 +5,11 @@
 #include "strbuf.h"
 #include "string-list.h"
 
+#ifdef __HAIKU__
+#	include <FindDirectory.h>
+#	include <StorageDefs.h>
+#endif
+
 #ifndef get_st_mode_bits
 /*
  * The replacement lstat(2) we use on Cygwin is incomplete and
@@ -139,6 +144,19 @@ char *git_path(const char *fmt, ...)
 
 void home_config_paths(char **global, char **xdg, char *file)
 {
+#ifdef __HAIKU__
+	char settingsPath[B_PATH_NAME_LENGTH];
+
+	*xdg = NULL;
+
+	if (global) {
+		if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, true, settingsPath,
+			sizeof(settingsPath)) == B_OK) {
+			*global = mkpathdup("%s/git/%s", settingsPath, file);
+		} else
+			*global = NULL;
+	}
+#else
 	char *xdg_home = getenv("XDG_CONFIG_HOME");
 	char *home = getenv("HOME");
 	char *to_free = NULL;
@@ -161,6 +179,7 @@ void home_config_paths(char **global, char **xdg, char *file)
 		*xdg = mkpathdup("%s/git/%s", xdg_home, file);
 
 	free(to_free);
+#endif
 }
 
 char *git_path_submodule(const char *path, const char *fmt, ...)
-- 
1.8.3.4


From 5f5ff9533c6ef8729088056c0399269e939cb248 Mon Sep 17 00:00:00 2001
From: Oliver Tappe <zooey@hirschkaefer.de>
Date: Tue, 15 Oct 2013 21:34:09 +0200
Subject: Ensure config-directory exists before using it.


diff --git a/config.c b/config.c
index 7a85ebd..10be1af 100644
--- a/config.c
+++ b/config.c
@@ -1343,6 +1343,7 @@ int git_config_set_multivar_in_file(const char *config_filename,
 	int ret;
 	struct lock_file *lock = NULL;
 	char *filename_buf = NULL;
+	char *config_dir = NULL;
 
 	/* parse-key returns negative; flip the sign to feed exit(3) */
 	ret = 0 - git_config_parse_key(key, &store.key, &store.baselen);
@@ -1354,6 +1355,12 @@ int git_config_set_multivar_in_file(const char *config_filename,
 	if (!config_filename)
 		config_filename = filename_buf = git_pathdup("config");
 
+	config_dir = xstrdup(config_filename);
+	* find_last_dir_sep(config_dir) = '\0';
+	if (access(config_dir, F_OK) != 0)
+		mkdir(config_dir, 0755);
+	free(config_dir);
+		
 	/*
 	 * The lock serves a purpose in addition to locking: the new
 	 * contents of .git/config will be written into it.
-- 
1.8.3.4


From 38c0f4ef61601e810a1060861ce5d6b281c44656 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Wed, 17 Sep 2014 09:35:49 +0200
Subject: strings.h fix.


diff --git a/mailmap.c b/mailmap.c
index 2a7b366..feaf37a 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -2,6 +2,8 @@
 #include "string-list.h"
 #include "mailmap.h"
 
+#include <strings.h>
+
 #define DEBUG_MAILMAP 0
 #if DEBUG_MAILMAP
 #define debug_mm(...) fprintf(stderr, __VA_ARGS__)
-- 
1.8.3.4

