[gitg] Show info on errors in command line about init option
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Show info on errors in command line about init option
- Date: Wed, 12 Oct 2022 10:26:09 +0000 (UTC)
commit 7760298b375ac0ff3beec59c1339bf1a5406227c
Author: Alexis De Bacco <alexis_de-bacco hotmail fr>
Date: Wed Oct 12 12:25:19 2022 +0200
Show info on errors in command line about init option
gitg/gitg-application.vala | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 6802dceb..30e396c6 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -542,32 +542,35 @@ public class Application : Gtk.Application
{
resolved = Ggit.Repository.discover(f);
}
- catch {
- if(!init)
+ catch (Error err) {
+ if (!init)
{
+ stderr.printf("Error: %s.\n", err.message);
continue;
}
+
try
{
- bool valid = f.query_exists ();
- if (valid)
- {
+ bool exists = f.query_exists ();
- FileType type = f.query_file_type
(FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
- valid = FileType.DIRECTORY == type;
- }
- else
- valid = f.make_directory_with_parents ();
+ bool valid = exists
+ ? FileType.DIRECTORY == f.query_file_type
(FileQueryInfoFlags.NOFOLLOW_SYMLINKS)
+ : f.make_directory_with_parents ();
+ string path = f.get_path();
if (!valid)
{
+ stderr.printf("Invalid location %s.\n", path);
continue;
}
+
Repository.init_repository(f, false);
resolved = Ggit.Repository.discover(f);
+ stdout.printf("Successfully initialized git repository at ā%sā.\n",
path);
}
- catch (Error err)
+ catch (Error err2)
{
+ stderr.printf("Error: %s.\n", err2.message);
continue;
}
}
@@ -591,7 +594,11 @@ public class Application : Gtk.Application
{
repo = new Repository(resolved, null);
}
- catch { continue; }
+ catch (Error err)
+ {
+ stderr.printf("Error: not able to open repository ā%sā.\n", err.message);
+ continue;
+ }
// Finally, create a window for the repository
new_window(repo, hint, command_lines);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]