Skip to content

Commit 2b93bfa

Browse files
author
Junio C Hamano
committed
Merge branch 'master' of git://repo.or.cz/git-gui
* 'master' of git://repo.or.cz/git-gui: git gui 0.7.0 git-gui: Paperbag fix blame in subdirectory git-gui: Format author/committer times in ISO format git-gui: Cleanup minor nits in blame code git-gui: Generate blame on uncommitted working tree file git-gui: Smarter command line parsing for browser, blame git-gui: Use prefix if blame is run in a subdirectory git-gui: Convert blame to the "class" way of doing things git-gui: Don't attempt to inline array reads in methods git-gui: Convert browser, console to "class" format git-gui: Define a simple class/method system git-gui: Allow shift-{k,j} to select a range of branches to merge git-gui: Call changes "Staged" and "Unstaged" in file list titles.
2 parents ffcc952 + d6da71a commit 2b93bfa

File tree

9 files changed

+513
-345
lines changed

9 files changed

+513
-345
lines changed

git-gui/GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=0.6.GITGUI
4+
DEF_VER=0.7.GITGUI
55

66
LF='
77
'

git-gui/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ $(GITGUI_BUILT_INS): git-gui
6464
$(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
6565

6666
lib/tclIndex: $(ALL_LIBFILES)
67-
$(QUIET_INDEX)echo auto_mkindex lib '*.tcl' | $(TCL_PATH)
67+
$(QUIET_INDEX)echo \
68+
source lib/class.tcl \; \
69+
auto_mkindex lib '*.tcl' \
70+
| $(TCL_PATH)
6871

6972
# These can record GITGUI_VERSION
7073
$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE GIT-GUI-VARS

git-gui/git-gui.sh

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,14 @@ unset -nocomplain v _junk act_maj act_min req_maj req_min
261261
##
262262
## repository setup
263263

264-
if { [catch {set _gitdir $env(GIT_DIR)}]
265-
&& [catch {set _gitdir [git rev-parse --git-dir]} err]} {
264+
if {[catch {
265+
set _gitdir $env(GIT_DIR)
266+
set _prefix {}
267+
}]
268+
&& [catch {
269+
set _gitdir [git rev-parse --git-dir]
270+
set _prefix [git rev-parse --show-prefix]
271+
} err]} {
266272
catch {wm withdraw .}
267273
error_popup "Cannot find the git directory:\n\n$err"
268274
exit 1
@@ -1288,7 +1294,7 @@ menu .mbar.repository
12881294

12891295
.mbar.repository add command \
12901296
-label {Browse Current Branch} \
1291-
-command {new_browser $current_branch}
1297+
-command {browser::new $current_branch}
12921298
trace add variable current_branch write ".mbar.repository entryconf [.mbar.repository index last] -label \"Browse \$current_branch\" ;#"
12931299
.mbar.repository add separator
12941300

@@ -1572,25 +1578,67 @@ bind all <$M1B-Key-Q> do_quit
15721578
bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}
15731579
bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
15741580

1581+
set subcommand_args {}
1582+
proc usage {} {
1583+
puts stderr "usage: $::argv0 $::subcommand $::subcommand_args"
1584+
exit 1
1585+
}
1586+
15751587
# -- Not a normal commit type invocation? Do that instead!
15761588
#
15771589
switch -- $subcommand {
15781590
browser {
1579-
if {[llength $argv] != 1} {
1580-
puts stderr "usage: $argv0 browser commit"
1581-
exit 1
1591+
set subcommand_args {rev?}
1592+
switch [llength $argv] {
1593+
0 {
1594+
set current_branch [git symbolic-ref HEAD]
1595+
regsub ^refs/((heads|tags|remotes)/)? \
1596+
$current_branch {} current_branch
1597+
}
1598+
1 {
1599+
set current_branch [lindex $argv 0]
15821600
}
1583-
set current_branch [lindex $argv 0]
1584-
new_browser $current_branch
1601+
default usage
1602+
}
1603+
browser::new $current_branch
15851604
return
15861605
}
15871606
blame {
1588-
if {[llength $argv] != 2} {
1589-
puts stderr "usage: $argv0 blame commit path"
1590-
exit 1
1607+
set subcommand_args {rev? path?}
1608+
set head {}
1609+
set path {}
1610+
set is_path 0
1611+
foreach a $argv {
1612+
if {$is_path || [file exists $_prefix$a]} {
1613+
if {$path ne {}} usage
1614+
set path $_prefix$a
1615+
break
1616+
} elseif {$a eq {--}} {
1617+
if {$path ne {}} {
1618+
if {$head ne {}} usage
1619+
set head $path
1620+
set path {}
1621+
}
1622+
set is_path 1
1623+
} elseif {$head eq {}} {
1624+
if {$head ne {}} usage
1625+
set head $a
1626+
} else {
1627+
usage
1628+
}
1629+
}
1630+
unset is_path
1631+
1632+
if {$head eq {}} {
1633+
set current_branch [git symbolic-ref HEAD]
1634+
regsub ^refs/((heads|tags|remotes)/)? \
1635+
$current_branch {} current_branch
1636+
} else {
1637+
set current_branch $head
15911638
}
1592-
set current_branch [lindex $argv 0]
1593-
show_blame $current_branch [lindex $argv 1]
1639+
1640+
if {$path eq {}} usage
1641+
blame::new $head $path
15941642
return
15951643
}
15961644
citool -
@@ -1638,7 +1686,7 @@ pack .vpane -anchor n -side top -fill both -expand 1
16381686
# -- Index File List
16391687
#
16401688
frame .vpane.files.index -height 100 -width 200
1641-
label .vpane.files.index.title -text {Changes To Be Committed} \
1689+
label .vpane.files.index.title -text {Staged Changes (Will Be Committed)} \
16421690
-background green
16431691
text $ui_index -background white -borderwidth 0 \
16441692
-width 20 -height 10 \
@@ -1658,7 +1706,7 @@ pack $ui_index -side left -fill both -expand 1
16581706
# -- Working Directory File List
16591707
#
16601708
frame .vpane.files.workdir -height 100 -width 200
1661-
label .vpane.files.workdir.title -text {Changed But Not Updated} \
1709+
label .vpane.files.workdir.title -text {Unstaged Changes (Will Not Be Committed)} \
16621710
-background red
16631711
text $ui_workdir -background white -borderwidth 0 \
16641712
-width 20 -height 10 \

0 commit comments

Comments
 (0)