[gitg/init] Added init option




commit 2b5205ffec63ba07cbbcfe90e0c916c8adba0db9
Author: Xalares <xalares xalares tk>
Date:   Tue Feb 15 01:13:40 2022 +0100

    Added init option

 gitg/gitg-application.vala | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 5fb76068..d2930360 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -540,32 +540,33 @@ public class Application : Gtk.Application
                                resolved = Ggit.Repository.discover(f);
                        }
                        catch {
-                               if(init)
+                               if(!init)
                                {
-                                       try
+                                       continue;
+                               }
+                               try
+                               {
+                                       bool valid = f.query_exists ();
+                                       if (valid)
                                        {
-                                               if (f.query_exists ()){
-
-                                                       FileType type = f.query_file_type 
(FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
-                                                       if (FileType.DIRECTORY == type)
-                                                       {
-                                                               Repository.init_repository(f, false);
-                                                       }
-
-                                               } else
-                                               {
-                                                       if (f.make_directory_with_parents ())
-                                                       {
-                                                               Repository.init_repository(f, false);
-                                                       }
-                                               }
+
+                                               FileType type = f.query_file_type 
(FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
+                                               valid = FileType.DIRECTORY == type;
                                        }
-                                       catch (Error err)
+                                       else
+                                               valid = f.make_directory_with_parents ();
+
+                                       if (!valid)
                                        {
                                                continue;
                                        }
+                                       Repository.init_repository(f, false);
+                                       resolved = Ggit.Repository.discover(f);
+                               }
+                               catch (Error err)
+                               {
+                                       continue;
                                }
-                               continue;
                        }
 
 


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