1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
https://gitlab.gnome.org/GNOME/gitg/issues/213
https://gitlab.gnome.org/GNOME/gitg/merge_requests/83
--- libgitg/gitg-diff-view.vala.orig 2019-05-23 11:02:37 UTC
+++ libgitg/gitg-diff-view.vala
@@ -131,8 +131,11 @@ public class Gitg.DiffView : Gtk.Grid
get { return d_repository; }
set {
d_repository = value;
- config_file = "%s/.git/config".printf(d_repository.get_workdir().get_path());
- d_commit_details.config_file = config_file;
+ if (d_repository!=null)
+ {
+ config_file = "%s/.git/config".printf(d_repository.get_workdir().get_path());
+ d_commit_details.config_file = config_file;
+ }
}
}
public bool new_is_workdir { get; set; }
@@ -593,34 +596,37 @@ public class Gitg.DiffView : Gtk.Grid
private void read_ini_file(Gtk.TextBuffer buffer)
{
- GLib.KeyFile file = new GLib.KeyFile();
-
- try
+ if (config_file != null)
{
- if (file.load_from_file(config_file , GLib.KeyFileFlags.NONE))
+ try
{
- foreach (string group in file.get_groups())
+ GLib.KeyFile file = new GLib.KeyFile();
+ if (file.load_from_file(config_file , GLib.KeyFileFlags.NONE))
{
- if (group.has_prefix("gitg.custom-link"))
+ foreach (string group in file.get_groups())
{
- string custom_link_regexp = file.get_string (group, "regexp");
- string custom_link_replacement = file.get_string (group, "replacement");
- bool custom_color = file.has_key (group, "color");
- Gdk.RGBA color = d_color_link;
- if (custom_color)
+ if (group.has_prefix("gitg.custom-link"))
{
- string custom_link_color = file.get_string (group, "color");
- color = Gdk.RGBA();
- color.parse(custom_link_color);
+ string custom_link_regexp = file.get_string (group, "regexp");
+ string custom_link_replacement = file.get_string (group, "replacement");
+ bool custom_color = file.has_key (group, "color");
+ Gdk.RGBA color = d_color_link;
+ if (custom_color)
+ {
+ string custom_link_color = file.get_string (group, "color");
+ color = Gdk.RGBA();
+ color.parse(custom_link_color);
+ }
+ apply_link_tags(buffer, new Regex (custom_link_regexp), custom_link_replacement, color, custom_color, true);
}
- apply_link_tags(buffer, new Regex (custom_link_regexp), custom_link_replacement, color, custom_color, true);
}
}
+ } catch (Error e)
+ {
+ warning ("Cannot read %s: %s", config_file, e.message);
}
- } catch (Error e)
- {
- warning ("Cannot read %s: %s", config_file, e.message);
}
+
}
private void auto_change_expanded(bool expanded)
|