[libgit2-glib/wip/albfan/stage-windows] Invalid path resolving relative path on windows




commit 49beff7e0bc1e666320c411e5b762b2bfcc6da79
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Tue May 18 08:56:03 2021 +0200

    Invalid path resolving relative path on windows

 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]