40 lines
1.2 KiB
Diff
40 lines
1.2 KiB
Diff
From 49beff7e0bc1e666320c411e5b762b2bfcc6da79 Mon Sep 17 00:00:00 2001
|
|
From: Alberto Fanjul <albertofanjul@gmail.com>
|
|
Date: Tue, 18 May 2021 08:56:03 +0200
|
|
Subject: [PATCH] Invalid path resolving relative path on windows
|
|
|
|
related with https://gitlab.gnome.org/GNOME/libgit2-glib/-/merge_requests/27
|
|
---
|
|
libgit2-glib/ggit-index.c | 8 ++++++++
|
|
1 file changed, 8 insertions(+)
|
|
|
|
diff --git a/libgit2-glib/ggit-index.c b/libgit2-glib/ggit-index.c
|
|
index 20cb8cd..d873c0b 100644
|
|
--- a/libgit2-glib/ggit-index.c
|
|
+++ b/libgit2-glib/ggit-index.c
|
|
@@ -341,6 +341,10 @@ ggit_index_remove (GgitIndex *idx,
|
|
g_object_unref (repo);
|
|
|
|
path = g_file_get_relative_path (wd, file);
|
|
+ char **split = g_strsplit(path, "\\", -1);
|
|
+ g_free(path);
|
|
+ path = g_strjoinv("/", split);
|
|
+ g_strfreev(split);
|
|
g_object_unref (wd);
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
|
@@ -456,6 +460,10 @@ ggit_index_add_file (GgitIndex *idx,
|
|
|
|
wd = ggit_repository_get_workdir (repo);
|
|
path = g_file_get_relative_path (wd, file);
|
|
+ char **split = g_strsplit(path, "\\", -1);
|
|
+ g_free(path);
|
|
+ path = g_strjoinv("/", split);
|
|
+ g_strfreev(split);
|
|
|
|
g_object_unref (wd);
|
|
g_object_unref (repo);
|
|
--
|
|
2.30.1
|
|
|