Skip to content

Commit e92ea62

Browse files
committed
Merge branch 'master' of git://repo.or.cz/git-gui
* 'master' of git://repo.or.cz/git-gui: git-gui: Correct 'git gui blame' in a subdirectory git-gui: Do not offer to stage three-way diff hunks into the index git-gui: Refactor diff pane popup support for future improvements git-gui: Fix "unoptimized loading" to not cause git-gui to crash git-gui: Paper bag fix "Stage Hunk For Commit" in diff context menu git-gui: Allow git-merge to use branch names in conflict markers git-gui: Fix window manager problems on ion3
2 parents 09b0d9d + c80d25d commit e92ea62

File tree

3 files changed

+97
-66
lines changed

3 files changed

+97
-66
lines changed

git-gui/git-gui.sh

Lines changed: 94 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -60,54 +60,6 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
6060
}
6161
}
6262

63-
######################################################################
64-
##
65-
## configure our library
66-
67-
set oguilib {@@GITGUI_LIBDIR@@}
68-
set oguirel {@@GITGUI_RELATIVE@@}
69-
if {$oguirel eq {1}} {
70-
set oguilib [file dirname [file dirname [file normalize $argv0]]]
71-
set oguilib [file join $oguilib share git-gui lib]
72-
} elseif {[string match @@* $oguirel]} {
73-
set oguilib [file join [file dirname [file normalize $argv0]] lib]
74-
}
75-
76-
set idx [file join $oguilib tclIndex]
77-
if {[catch {set fd [open $idx r]} err]} {
78-
catch {wm withdraw .}
79-
tk_messageBox \
80-
-icon error \
81-
-type ok \
82-
-title "git-gui: fatal error" \
83-
-message $err
84-
exit 1
85-
}
86-
if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} {
87-
set idx [list]
88-
while {[gets $fd n] >= 0} {
89-
if {$n ne {} && ![string match #* $n]} {
90-
lappend idx $n
91-
}
92-
}
93-
} else {
94-
set idx {}
95-
}
96-
close $fd
97-
98-
if {$idx ne {}} {
99-
set loaded [list]
100-
foreach p $idx {
101-
if {[lsearch -exact $loaded $p] >= 0} continue
102-
source [file join $oguilib $p]
103-
lappend loaded $p
104-
}
105-
unset loaded p
106-
} else {
107-
set auto_path [concat [list $oguilib] $auto_path]
108-
}
109-
unset -nocomplain oguirel idx fd
110-
11163
######################################################################
11264
##
11365
## read only globals
@@ -532,7 +484,11 @@ if {$_git eq {}} {
532484

533485
if {[catch {set _git_version [git --version]} err]} {
534486
catch {wm withdraw .}
535-
error_popup "Cannot determine Git version:
487+
tk_messageBox \
488+
-icon error \
489+
-type ok \
490+
-title "git-gui: fatal error" \
491+
-message "Cannot determine Git version:
536492
537493
$err
538494
@@ -541,7 +497,11 @@ $err
541497
}
542498
if {![regsub {^git version } $_git_version {} _git_version]} {
543499
catch {wm withdraw .}
544-
error_popup "Cannot parse Git version string:\n\n$_git_version"
500+
tk_messageBox \
501+
-icon error \
502+
-type ok \
503+
-title "git-gui: fatal error" \
504+
-message "Cannot parse Git version string:\n\n$_git_version"
545505
exit 1
546506
}
547507

@@ -619,14 +579,66 @@ proc git-version {args} {
619579

620580
if {[git-version < 1.5]} {
621581
catch {wm withdraw .}
622-
error_popup "[appname] requires Git 1.5.0 or later.
582+
tk_messageBox \
583+
-icon error \
584+
-type ok \
585+
-title "git-gui: fatal error" \
586+
-message "[appname] requires Git 1.5.0 or later.
623587
624588
You are using [git-version]:
625589
626590
[git --version]"
627591
exit 1
628592
}
629593

594+
######################################################################
595+
##
596+
## configure our library
597+
598+
set oguilib {@@GITGUI_LIBDIR@@}
599+
set oguirel {@@GITGUI_RELATIVE@@}
600+
if {$oguirel eq {1}} {
601+
set oguilib [file dirname [file dirname [file normalize $argv0]]]
602+
set oguilib [file join $oguilib share git-gui lib]
603+
} elseif {[string match @@* $oguirel]} {
604+
set oguilib [file join [file dirname [file normalize $argv0]] lib]
605+
}
606+
607+
set idx [file join $oguilib tclIndex]
608+
if {[catch {set fd [open $idx r]} err]} {
609+
catch {wm withdraw .}
610+
tk_messageBox \
611+
-icon error \
612+
-type ok \
613+
-title "git-gui: fatal error" \
614+
-message $err
615+
exit 1
616+
}
617+
if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} {
618+
set idx [list]
619+
while {[gets $fd n] >= 0} {
620+
if {$n ne {} && ![string match #* $n]} {
621+
lappend idx $n
622+
}
623+
}
624+
} else {
625+
set idx {}
626+
}
627+
close $fd
628+
629+
if {$idx ne {}} {
630+
set loaded [list]
631+
foreach p $idx {
632+
if {[lsearch -exact $loaded $p] >= 0} continue
633+
source [file join $oguilib $p]
634+
lappend loaded $p
635+
}
636+
unset loaded p
637+
} else {
638+
set auto_path [concat [list $oguilib] $auto_path]
639+
}
640+
unset -nocomplain oguirel idx fd
641+
630642
######################################################################
631643
##
632644
## feature option selection
@@ -691,7 +703,15 @@ if {![file isdirectory $_gitdir]} {
691703
error_popup "Git directory not found:\n\n$_gitdir"
692704
exit 1
693705
}
694-
if {![is_enabled bare]} {
706+
if {$_prefix ne {}} {
707+
regsub -all {[^/]+/} $_prefix ../ cdup
708+
if {[catch {cd $cdup} err]} {
709+
catch {wm withdraw .}
710+
error_popup "Cannot move to top of working directory:\n\n$err"
711+
exit 1
712+
}
713+
unset cdup
714+
} elseif {![is_enabled bare]} {
695715
if {[lindex [file split $_gitdir] end] ne {.git}} {
696716
catch {wm withdraw .}
697717
error_popup "Cannot use funny .git directory:\n\n$_gitdir"
@@ -726,6 +746,7 @@ set empty_tree {}
726746
set current_branch {}
727747
set is_detached 0
728748
set current_diff_path {}
749+
set is_3way_diff 0
729750
set selected_commit_type new
730751

731752
######################################################################
@@ -1936,6 +1957,12 @@ if {$browser ne {}} {
19361957
}
19371958
unset browser doc_path doc_url
19381959

1960+
set root_exists 0
1961+
bind . <Visibility> {
1962+
bind . <Visibility> {}
1963+
set root_exists 1
1964+
}
1965+
19391966
# -- Standard bindings
19401967
#
19411968
wm protocol . WM_DELETE_WINDOW do_quit
@@ -2410,23 +2437,26 @@ $ctxm add separator
24102437
$ctxm add command -label {Options...} \
24112438
-command do_options
24122439
proc popup_diff_menu {ctxm x y X Y} {
2413-
global current_diff_path
2440+
global current_diff_path file_states
24142441
set ::cursorX $x
24152442
set ::cursorY $y
24162443
if {$::ui_index eq $::current_diff_side} {
2417-
$ctxm entryconf $::ui_diff_applyhunk \
2418-
-state normal \
2419-
-label {Unstage Hunk From Commit}
2420-
} elseif {![info exists file_states($current_diff_path)]
2421-
|| {_O} eq [lindex $file_states($::current_diff_path) 0]} {
2422-
$ctxm entryconf $::ui_diff_applyhunk \
2423-
-state disabled \
2424-
-label {Stage Hunk For Commit}
2444+
set s normal
2445+
set l "Unstage Hunk From Commit"
24252446
} else {
2426-
$ctxm entryconf $::ui_diff_applyhunk \
2427-
-state normal \
2428-
-label {Stage Hunk For Commit}
2447+
if {$current_diff_path eq {}
2448+
|| ![info exists file_states($current_diff_path)]
2449+
|| {_O} eq [lindex $file_states($current_diff_path) 0]} {
2450+
set s disabled
2451+
} else {
2452+
set s normal
2453+
}
2454+
set l "Stage Hunk For Commit"
2455+
}
2456+
if {$::is_3way_diff} {
2457+
set s disabled
24292458
}
2459+
$ctxm entryconf $::ui_diff_applyhunk -state $s -label $l
24302460
tk_popup $ctxm $X $Y
24312461
}
24322462
bind_button3 $ui_diff [list popup_diff_menu $ctxm %x %y %X %Y]

git-gui/lib/class.tcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,12 @@ proc make_toplevel {t w args} {
148148
}
149149
}
150150

151-
if {[winfo ismapped .]} {
151+
if {$::root_exists || [winfo ismapped .]} {
152152
regsub -all {::} $this {__} w
153153
set top .$w
154154
set pfx $top
155155
toplevel $top
156+
set ::root_exists 1
156157
} else {
157158
set top .
158159
set pfx {}

git-gui/lib/merge.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ method _start {} {
114114
lappend cmd --strategy=recursive
115115
lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
116116
lappend cmd HEAD
117-
lappend cmd $cmit
117+
lappend cmd $name
118118

119119
set msg "Merging $current_branch and $stitle"
120120
ui_status "$msg..."

0 commit comments

Comments
 (0)