@matheusbsbs / matheus-bagliano / commits / 85f7a94b3c
Fork 0

git-gui: Support LFs embedded in config file values

Using the new --null option added to git-config in git 1.5.3 we can safely accept LFs that are embedded in configuration options. This does require a completely different configuration file parser then the pre 1.5.3 version as we are splitting on very different values. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Oct 12, 2007 at 00:54 UTC 85f7a94b3c1e4289827f2529d2e8447f3678c619
1 file changed +20
git-gui.sh
+20
@@ -749,6 +749,26 @@ unset -nocomplain idx fd
749 ## config file parsing
750
751 git-version proc _parse_config {arr_name args} {
752 + >= 1.5.3 {
753 + upvar $arr_name arr
754 + array unset arr
755 + set buf {}
756 + catch {
757 + set fd_rc [eval [list git_read config --null --list] $args]
758 + fconfigure $fd_rc -translation binary
759 + set buf [read $fd_rc]
760 + close $fd_rc
761 + }
762 + foreach line [split $buf "\0"] {
763 + if {[regexp {^([^\n]+)\n(.*)$} $line line name value]} {
764 + if {[is_many_config $name]} {
765 + lappend arr($name) $value
766 + } else {
767 + set arr($name) $value
768 + }
769 + }
770 + }
771 + }
772 default {
773 upvar $arr_name arr
774 array unset arr