[giggle] Fix #628184 - Giggle does not display diff for files that have spaces in names



commit c4963107ee97b6bf045b805ed3b8f9f824c62ccb
Author: Guilhem Bonnefille <guilhem bonnefille gmail com>
Date:   Thu Apr 4 14:47:19 2013 +0100

    Fix #628184 - Giggle does not display diff for files that have spaces in names
    
    Git diff is compliant to GNU patch expected format:
    when a filename contains a SP a TAB is added.
    See Git's commit 1a9eb3b9d50367bee8fe85022684d812816fe531
    
    Signed-off-by: Guilhem Bonnefille <guilhem bonnefille gmail com>

 src/giggle-diff-view.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/giggle-diff-view.c b/src/giggle-diff-view.c
index ff6bbe3..2fbb8eb 100644
--- a/src/giggle-diff-view.c
+++ b/src/giggle-diff-view.c
@@ -665,6 +665,11 @@ diff_view_parse_patch (GiggleDiffView *view)
                        }
                } else if (g_str_has_prefix (line, "--- a/") || g_str_has_prefix (line, "+++ b/")) {
                        g_free (filename); filename = g_strdup (line + 6);
+                       if (strchr(filename, ' ')) {
+                               /* Remove trailing TAB added by git for GNU patch compatibility */
+                               size_t len = strlen (filename);
+                               filename[len-1] = '\0';
+                       }
                }
 
                g_free (line);


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