[gitg/wip/albfan/walk-shallow-clones: 9/9] Allow to read shallow clones



commit 954eec0206b27a1e9638bba84129ebb06c363a0c
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Tue Oct 15 22:25:20 2019 +0200

    Allow to read shallow clones
    
    patch libgit2 to allow traverse incomplete repos

 Allow-revwalk-to-traverse-shallow-clones.patch | 41 +++++++++++++++++
 org.gnome.gitgDevel.json                       | 62 ++++++++++++++------------
 2 files changed, 74 insertions(+), 29 deletions(-)
---
diff --git a/Allow-revwalk-to-traverse-shallow-clones.patch b/Allow-revwalk-to-traverse-shallow-clones.patch
new file mode 100644
index 00000000..0a8750e1
--- /dev/null
+++ b/Allow-revwalk-to-traverse-shallow-clones.patch
@@ -0,0 +1,41 @@
+From 064f59e2ff3a53d3b95082f395d88b1cc62f1fbe Mon Sep 17 00:00:00 2001
+From: Alberto Fanjul <albertofanjul gmail com>
+Date: Tue, 15 Oct 2019 21:37:25 +0200
+Subject: [PATCH] Allow revwalk to traverse shallow clones
+
+---
+ src/revwalk.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/src/revwalk.c b/src/revwalk.c
+index 6f49bf2dc..daa94ab23 100644
+--- a/src/revwalk.c
++++ b/src/revwalk.c
+@@ -441,6 +441,11 @@ static int still_interesting(git_commit_list *list, int64_t time, int slop)
+       return slop - 1;
+ }
+ 
++static int expected_fail(git_commit *commit) {
++      //TODO: Check commit is in $GIT_DIR/.git/shallow
++      return 1;
++}
++
+ static int limit_list(git_commit_list **out, git_revwalk *walk, git_commit_list *commits)
+ {
+       int error, slop = SLOP;
+@@ -452,8 +457,10 @@ static int limit_list(git_commit_list **out, git_revwalk *walk, git_commit_list
+       while (list) {
+               git_commit_list_node *commit = git_commit_list_pop(&list);
+ 
+-              if ((error = add_parents_to_list(walk, commit, &list)) < 0)
+-                      return error;
++              if ((error = add_parents_to_list(walk, commit, &list)) < 0) {
++                      if (!expected_fail(commit))
++                              return error;
++              }
+ 
+               if (commit->uninteresting) {
+                       mark_parents_uninteresting(commit);
+-- 
+2.23.0
+
diff --git a/org.gnome.gitgDevel.json b/org.gnome.gitgDevel.json
index bb1fd39e..41984810 100644
--- a/org.gnome.gitgDevel.json
+++ b/org.gnome.gitgDevel.json
@@ -52,35 +52,6 @@
                 }
             ]
         },
-        {
-            "name" : "libgit2",
-            "buildsystem" : "cmake",
-            "config-opts" : [
-                "-DBUILD_SHARED_LIBS:BOOL=ON",
-                "-DTHREADSAFE=ON"
-            ],
-            "sources" : [
-                {
-                    "type" : "git",
-                    "url" : "https://github.com/libgit2/libgit2.git";,
-                    "branch" : "maint/v0.28"
-                }
-            ]
-        },
-        {
-            "name" : "libgit2-glib",
-            "config-opts" : [
-                "--buildtype=debugoptimized"
-            ],
-            "buildsystem" : "meson",
-            "builddir" : true,
-            "sources" : [
-                {
-                    "type" : "git",
-                    "url" : "https://gitlab.gnome.org/GNOME/libgit2-glib.git";
-                }
-            ]
-        },
         {
             "name" : "libpeas",
             "buildsystem": "meson",
@@ -174,6 +145,39 @@
                 }
             ]
         },
+        {
+            "name" : "libgit2",
+            "buildsystem" : "cmake",
+            "config-opts" : [
+                "-DBUILD_SHARED_LIBS:BOOL=ON",
+                "-DTHREADSAFE=ON"
+            ],
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://github.com/libgit2/libgit2.git";,
+                    "branch" : "maint/v0.28"
+                },
+                {
+                    "type" : "patch",
+                    "path" : "Allow-revwalk-to-traverse-shallow-clones.patch"
+                }
+            ]
+        },
+        {
+            "name" : "libgit2-glib",
+            "config-opts" : [
+                "--buildtype=debugoptimized"
+            ],
+            "buildsystem" : "meson",
+            "builddir" : true,
+            "sources" : [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/libgit2-glib.git";
+                }
+            ]
+        },
         {
             "name" : "gitg",
             "buildsystem" : "meson",


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