@@ -60,54 +60,6 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
60
60
}
61
61
}
62
62
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
-
111
63
# #####################################################################
112
64
# #
113
65
# # read only globals
@@ -532,7 +484,11 @@ if {$_git eq {}} {
532
484
533
485
if {[catch {set _git_version [git --version]} err]} {
534
486
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:
536
492
537
493
$err
538
494
@@ -541,7 +497,11 @@ $err
541
497
}
542
498
if {![regsub {^git version } $_git_version {} _git_version]} {
543
499
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 "
545
505
exit 1
546
506
}
547
507
@@ -619,14 +579,66 @@ proc git-version {args} {
619
579
620
580
if {[git-version < 1.5]} {
621
581
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.
623
587
624
588
You are using [ git-version] :
625
589
626
590
[ git --version] "
627
591
exit 1
628
592
}
629
593
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
+
630
642
# #####################################################################
631
643
# #
632
644
# # feature option selection
@@ -691,7 +703,15 @@ if {![file isdirectory $_gitdir]} {
691
703
error_popup " Git directory not found:\n\n $_gitdir "
692
704
exit 1
693
705
}
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]} {
695
715
if {[lindex [file split $_gitdir ] end] ne {.git}} {
696
716
catch {wm withdraw .}
697
717
error_popup " Cannot use funny .git directory:\n\n $_gitdir "
@@ -726,6 +746,7 @@ set empty_tree {}
726
746
set current_branch {}
727
747
set is_detached 0
728
748
set current_diff_path {}
749
+ set is_3way_diff 0
729
750
set selected_commit_type new
730
751
731
752
# #####################################################################
@@ -1936,6 +1957,12 @@ if {$browser ne {}} {
1936
1957
}
1937
1958
unset browser doc_path doc_url
1938
1959
1960
+ set root_exists 0
1961
+ bind . <Visibility> {
1962
+ bind . <Visibility> {}
1963
+ set root_exists 1
1964
+ }
1965
+
1939
1966
# -- Standard bindings
1940
1967
#
1941
1968
wm protocol . WM_DELETE_WINDOW do_quit
@@ -2410,23 +2437,26 @@ $ctxm add separator
2410
2437
$ctxm add command -label {Options...} \
2411
2438
-command do_options
2412
2439
proc popup_diff_menu {ctxm x y X Y} {
2413
- global current_diff_path
2440
+ global current_diff_path file_states
2414
2441
set ::cursorX $x
2415
2442
set ::cursorY $y
2416
2443
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"
2425
2446
} 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
2429
2458
}
2459
+ $ctxm entryconf $::ui_diff_applyhunk -state $s -label $l
2430
2460
tk_popup $ctxm $X $Y
2431
2461
}
2432
2462
bind_button3 $ui_diff [list popup_diff_menu $ctxm %x %y %X %Y]
0 commit comments