@matheusbsbs / matheus-bagliano / commits / 7b64d0b7d6
Fork 0

git-gui: Correct bugs in font config handling.

Apparently Tcl is being helpful on Windows during exec and is throwing a \ in front of every { it finds in the string. I'm guessing they think the value might be read by another Tcl program? Anyway, Git faithfully stores the \{ sequence and sends it back that way to Tcl, at which point Tcl parses the list wrong and starts to break it in the middle of any element which contains spaces. Therefore a list such as: -family {Times New Roman} gets broken up into the pairs: {-family \{Times} {New Roman} which is very incorrect. So now we replace all { and } with "", at which point Tcl doesn't throw \ in front of the " on the way out to Git yet it reads it correctly as a list on the way back in. I also found and fixed a bug in the way we restored the fonts when the user presses Restore Defaults in the options dialog. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 12, 2006 at 15:45 UTC 7b64d0b7d62ec0eb6e8b37f0be2e62f2a719de16
1 file changed +6 -4
git-gui
+6 -4
@@ -91,7 +91,8 @@ proc save_config {} {
91 if {$value == $default_config($name)} {
92 catch {exec git repo-config --global --unset $name}
93 } else {
94 - catch {exec git repo-config --global $name $value}
94 + regsub -all "\[{}\]" $value {"} value
95 + exec git repo-config --global $name $value
96 }
97 set global_config($name) $value
98 if {$value == $repo_config($name)} {
@@ -107,7 +108,8 @@ proc save_config {} {
108 if {$value == $global_config($name)} {
109 catch {exec git repo-config --unset $name}
110 } else {
110 - catch {exec git repo-config $name $value}
111 + regsub -all "\[{}\]" $value {"} value
112 + exec git repo-config $name $value
113 }
114 set repo_config($name) $value
115 }
@@ -1803,7 +1805,7 @@ proc do_options {} {
1805 }
1806
1807 proc do_restore_defaults {} {
1806 - global font_descs default_config
1808 + global font_descs default_config repo_config
1809 global repo_config_new global_config_new
1810
1811 foreach name [array names default_config] {
@@ -1813,7 +1815,7 @@ proc do_restore_defaults {} {
1815
1816 foreach option $font_descs {
1817 set name [lindex $option 0]
1816 - set repo_config($name) $default_config(gui.$name)
1818 + set repo_config(gui.$name) $default_config(gui.$name)
1819 }
1820 apply_config
1821