Diff between 0b527f29faa2f2e2c09ee32bcdde0b605c57dc40 and 5ade245c6e519517645c82910f3599893e96fcca

Changed Files

File Additions Deletions Status
app.py +3 -1 modified
git/misc.py +4 -0 added
git/ref.py +1 -0 modified
git/repo.py +1 -0 modified
templates/index.html +3 -0 modified

Full Patch

diff --git a/app.py b/app.py
index 290e17b..727d544 100644
--- a/app.py
+++ b/app.py
@@ -5,6 +5,7 @@ from git.commit import get_commits, get_commit
 from git.ref import get_refs
 from git.tree import get_tree_items
 from git.blob import get_blob
+from git.misc import get_version
 
 app = Flask(__name__)
 
@@ -12,7 +13,8 @@ repo_path = "/home/lhietala/git-webview/repos-example"
 @app.route("/")
 def index():
     repos = get_bare_repos(repo_path)
-    return render_template("index.html", repos=repos)
+    version = get_version()
+    return render_template("index.html", repos=repos, version=version)
 
 @app.route("/<repo_name>/commits")
 def repo_commits(repo_name):
diff --git a/git/misc.py b/git/misc.py
new file mode 100644
index 0000000..4fc917e
--- /dev/null
+++ b/git/misc.py
@@ -0,0 +1,4 @@
+import pygit2 as git
+
+def get_version():
+    return git.LIBGIT2_VERSION
\ No newline at end of file
diff --git a/git/ref.py b/git/ref.py
index 40a8312..626987f 100644
--- a/git/ref.py
+++ b/git/ref.py
@@ -1,6 +1,7 @@
 import pygit2 as git
 
 # retrieves all refs (branches, tags) for given repo path
+# TODO: handle symbolic refs and situation when HEAD is unborn or pointing to nothing
 def get_refs(path):
     repo = git.Repository(path)
     refs = []
diff --git a/git/repo.py b/git/repo.py
index 389b4c5..3fe2e7a 100644
--- a/git/repo.py
+++ b/git/repo.py
@@ -6,6 +6,7 @@ def get_bare_repos(path):
     repos = []
 
     repo_path = Path(path)
+
     for item in repo_path.iterdir():
         if item.is_dir():
             try:
diff --git a/templates/index.html b/templates/index.html
index c70ffad..346e088 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -5,4 +5,7 @@
             <li><a href="{{ url_for('repo_commits', repo_name=repo.name) }}">{{ repo.name }}</a></li>
         {% endfor %}
     </ul>
+    <small>
+        Libgit2 - {{ version }}  git 
+    </small>
 {% endblock %}
\ No newline at end of file