Skip to content

Commit 1b2782a

Browse files
committed
Merge branch 'maint' of git://repo.or.cz/git-gui into maint
* 'maint' of git://repo.or.cz/git-gui: git-gui: Work around bad interaction between Tcl and cmd.exe on ^{tree} git-gui: Don't linewrap within console windows git-gui: Correct ls-tree buffering problem in browser git-gui: Skip nicknames when selecting author initials git-gui: Ensure windows shortcuts always have .bat extension git-gui: Include a Push action on the left toolbar git-gui: Bind M1-P to push action git-gui: Don't bind F5/M1-R in all windows git-gui: Unlock the index when cancelling merge dialog git-gui: properly popup error if gitk should be started but is not installed
2 parents 512e44b + 20f1a10 commit 1b2782a

File tree

7 files changed

+60
-18
lines changed

7 files changed

+60
-18
lines changed

git-gui/git-gui.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,15 +1042,17 @@ proc do_gitk {revs} {
10421042
# lets us bypass using shell process on Windows systems.
10431043
#
10441044
set cmd [list [info nameofexecutable]]
1045-
lappend cmd [gitexec gitk]
1045+
set exe [gitexec gitk]
1046+
lappend cmd $exe
10461047
if {$revs ne {}} {
10471048
append cmd { }
10481049
append cmd $revs
10491050
}
10501051

1051-
if {[catch {eval exec $cmd &} err]} {
1052-
error_popup "Failed to start gitk:\n\n$err"
1052+
if {! [file exists $exe]} {
1053+
error_popup "Unable to start gitk:\n\n$exe does not exist"
10531054
} else {
1055+
eval exec $cmd &
10541056
set ui_status_value $starting_gitk_msg
10551057
after 10000 {
10561058
if {$ui_status_value eq $starting_gitk_msg} {
@@ -1523,7 +1525,8 @@ if {[is_enabled transport]} {
15231525

15241526
menu .mbar.push
15251527
.mbar.push add command -label {Push...} \
1526-
-command do_push_anywhere
1528+
-command do_push_anywhere \
1529+
-accelerator $M1T-P
15271530
}
15281531

15291532
if {[is_MacOSX]} {
@@ -1819,6 +1822,10 @@ pack .vpane.lower.commarea.buttons.commit -side top -fill x
18191822
lappend disable_on_lock \
18201823
{.vpane.lower.commarea.buttons.commit conf -state}
18211824

1825+
button .vpane.lower.commarea.buttons.push -text {Push} \
1826+
-command do_push_anywhere
1827+
pack .vpane.lower.commarea.buttons.push -side top -fill x
1828+
18221829
# -- Commit Message Buffer
18231830
#
18241831
frame .vpane.lower.commarea.buffer
@@ -2146,10 +2153,14 @@ if {[is_enabled branch]} {
21462153
bind . <$M1B-Key-n> do_create_branch
21472154
bind . <$M1B-Key-N> do_create_branch
21482155
}
2156+
if {[is_enabled transport]} {
2157+
bind . <$M1B-Key-p> do_push_anywhere
2158+
bind . <$M1B-Key-P> do_push_anywhere
2159+
}
21492160

2150-
bind all <Key-F5> do_rescan
2151-
bind all <$M1B-Key-r> do_rescan
2152-
bind all <$M1B-Key-R> do_rescan
2161+
bind . <Key-F5> do_rescan
2162+
bind . <$M1B-Key-r> do_rescan
2163+
bind . <$M1B-Key-R> do_rescan
21532164
bind . <$M1B-Key-s> do_signoff
21542165
bind . <$M1B-Key-S> do_signoff
21552166
bind . <$M1B-Key-i> do_add_all

git-gui/lib/blame.tcl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ method _read_blame {fd cur_w cur_d cur_s} {
547547
set a_name {}
548548
catch {set a_name $header($cmit,author)}
549549
while {$a_name ne {}} {
550+
if {$author_abbr ne {}
551+
&& [string index $a_name 0] eq {'}} {
552+
regsub {^'[^']+'\s+} $a_name {} a_name
553+
}
550554
if {![regexp {^([[:upper:]])} $a_name _a]} break
551555
append author_abbr $_a
552556
unset _a

git-gui/lib/browser.tcl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ field browser_status {Starting...}
1111
field browser_stack {}
1212
field browser_busy 1
1313

14+
field ls_buf {}; # Buffered record output from ls-tree
15+
1416
constructor new {commit} {
1517
global cursor_ptr M1B
1618
make_toplevel top w
@@ -160,7 +162,7 @@ method _click {was_double_click pos} {
160162
}
161163

162164
method _ls {tree_id {name {}}} {
163-
set browser_buffer {}
165+
set ls_buf {}
164166
set browser_files {}
165167
set browser_busy 1
166168

@@ -185,17 +187,19 @@ method _ls {tree_id {name {}}} {
185187
}
186188

187189
method _read {fd} {
188-
append browser_buffer [read $fd]
189-
set pck [split $browser_buffer "\0"]
190-
set browser_buffer [lindex $pck end]
190+
append ls_buf [read $fd]
191+
set pck [split $ls_buf "\0"]
192+
set ls_buf [lindex $pck end]
191193

192194
set n [llength $browser_files]
193195
$w conf -state normal
194196
foreach p [lrange $pck 0 end-1] {
195-
set info [split $p "\t"]
196-
set path [lindex $info 1]
197-
set info [split [lindex $info 0] { }]
198-
set type [lindex $info 1]
197+
set tab [string first "\t" $p]
198+
if {$tab == -1} continue
199+
200+
set info [split [string range $p 0 [expr {$tab - 1}]] { }]
201+
set path [string range $p [expr {$tab + 1}] end]
202+
set type [lindex $info 1]
199203
set object [lindex $info 2]
200204

201205
switch -- $type {
@@ -225,7 +229,7 @@ method _read {fd} {
225229
close $fd
226230
set browser_status Ready.
227231
set browser_busy 0
228-
unset browser_buffer
232+
set ls_buf {}
229233
if {$n > 0} {
230234
$w tag add in_sel 1.0 2.0
231235
focus -force $w

git-gui/lib/commit.tcl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,18 @@ proc commit_committree {fd_wt curHEAD msg} {
260260
# -- Verify this wasn't an empty change.
261261
#
262262
if {$commit_type eq {normal}} {
263-
set old_tree [git rev-parse "$PARENT^{tree}"]
263+
set fd_ot [open "| git cat-file commit $PARENT" r]
264+
fconfigure $fd_ot -encoding binary -translation lf
265+
set old_tree [gets $fd_ot]
266+
close $fd_ot
267+
268+
if {[string equal -length 5 {tree } $old_tree]
269+
&& [string length $old_tree] == 45} {
270+
set old_tree [string range $old_tree 5 end]
271+
} else {
272+
error "Commit $PARENT appears to be corrupt"
273+
}
274+
264275
if {$tree_id eq $old_tree} {
265276
info_popup {No changes to commit.
266277

git-gui/lib/console.tcl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,20 @@ method _init {} {
3131
-background white -borderwidth 1 \
3232
-relief sunken \
3333
-width 80 -height 10 \
34+
-wrap none \
3435
-font font_diff \
3536
-state disabled \
37+
-xscrollcommand [list $w.m.sbx set] \
3638
-yscrollcommand [list $w.m.sby set]
3739
label $w.m.s -text {Working... please wait...} \
3840
-anchor w \
3941
-justify left \
4042
-font font_uibold
43+
scrollbar $w.m.sbx -command [list $w.m.t xview] -orient h
4144
scrollbar $w.m.sby -command [list $w.m.t yview]
4245
pack $w.m.l1 -side top -fill x
4346
pack $w.m.s -side bottom -fill x
47+
pack $w.m.sbx -side bottom -fill x
4448
pack $w.m.sby -side right -fill y
4549
pack $w.m.t -side left -fill both -expand 1
4650
pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10

git-gui/lib/merge.tcl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ proc dialog {} {
213213
pack $w.buttons.visualize -side left
214214
button $w.buttons.create -text Merge -command $_start
215215
pack $w.buttons.create -side right
216-
button $w.buttons.cancel -text {Cancel} -command [list destroy $w]
216+
button $w.buttons.cancel \
217+
-text {Cancel} \
218+
-command "unlock_index;destroy $w"
217219
pack $w.buttons.cancel -side right -padx 5
218220
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
219221

git-gui/lib/shortcut.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ proc do_windows_shortcut {} {
99
-title "[appname] ([reponame]): Create Desktop Icon" \
1010
-initialfile "Git [reponame].bat"]
1111
if {$fn != {}} {
12+
if {[file extension $fn] ne {.bat}} {
13+
set fn ${fn}.bat
14+
}
1215
if {[catch {
1316
set fd [open $fn w]
1417
puts $fd "@ECHO Entering [reponame]"
@@ -42,6 +45,9 @@ proc do_cygwin_shortcut {} {
4245
-initialdir $desktop \
4346
-initialfile "Git [reponame].bat"]
4447
if {$fn != {}} {
48+
if {[file extension $fn] ne {.bat}} {
49+
set fn ${fn}.bat
50+
}
4551
if {[catch {
4652
set fd [open $fn w]
4753
set sh [exec cygpath \

0 commit comments

Comments
 (0)