Code

Added two upstream patches to fix a segfault and an infinite loop.
[pkg-tig.git] / debian / patches / splitview.dpatch
diff --git a/debian/patches/splitview.dpatch b/debian/patches/splitview.dpatch
new file mode 100644 (file)
index 0000000..57c0f16
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## splitview.dpatch by Jonas Fonseca <fonseca@diku.dk>
+##
+## DP: Never split the tree view when opening another tree view.
+## DP:
+## DP: The resulting bogus display[] state ment that the blob view was not
+## DP: initialized causing segmentation faults in the redrawing code.
+## DP:
+## DP: Reported by Alexey Tourbin <at@altlinux.ru>, Josh Triplett
+## DP: <josh@freedesktop.org> and Jamey Sharp <sharpone@debian.org>
+
+@DPATCH@
+
+diff --git a/tig.c b/tig.c
+index fcfbc43..3b320e6 100644
+--- a/tig.c
++++ b/tig.c
+@@ -2580,7 +2580,7 @@ tree_read(struct view *view, char *text)
+ static bool
+ tree_enter(struct view *view, struct line *line)
+ {
+-      enum open_flags flags = display[0] == view ? OPEN_SPLIT : OPEN_DEFAULT;
++      enum open_flags flags;
+       enum request request;
+       switch (line->type) {
+@@ -2610,11 +2610,12 @@ tree_enter(struct view *view, struct lin
+               /* Trees and subtrees share the same ID, so they are not not
+                * unique like blobs. */
+-              flags |= OPEN_RELOAD;
++              flags = OPEN_RELOAD;
+               request = REQ_VIEW_TREE;
+               break;
+       case LINE_TREE_FILE:
++              flags = display[0] == view ? OPEN_SPLIT : OPEN_DEFAULT;
+               request = REQ_VIEW_BLOB;
+               break;