[gitg] Also accept bare repositories when adding from dash
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Also accept bare repositories when adding from dash
- Date: Sat, 8 Aug 2015 09:08:26 +0000 (UTC)
commit 2b0add90a380eee2385f15d64a803cf17f86e404
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sat Aug 8 11:08:00 2015 +0200
Also accept bare repositories when adding from dash
gitg/gitg-dash-view.vala | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-dash-view.vala b/gitg/gitg-dash-view.vala
index ae30075..3ab30fb 100644
--- a/gitg/gitg-dash-view.vala
+++ b/gitg/gitg-dash-view.vala
@@ -471,6 +471,19 @@ class DashView : Gtk.Grid, GitgExt.UIElement, GitgExt.Activity, GitgExt.Selectab
application.user_query(q);
}
+ private bool looks_like_git(File location)
+ {
+ if (location.get_child(".git").query_exists())
+ {
+ return true;
+ }
+
+ // Check for bare repo
+ return location.get_child("objects").query_exists() &&
+ location.get_child("HEAD").query_exists() &&
+ location.get_child("refs").query_exists();
+ }
+
[GtkCallback]
private void add_repository_clicked()
{
@@ -493,7 +506,7 @@ class DashView : Gtk.Grid, GitgExt.UIElement, GitgExt.Activity, GitgExt.Selectab
file = chooser.get_current_folder_file();
}
- if (!file.get_child(".git").query_exists())
+ if (!looks_like_git(file))
{
query_create_repository(file);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]