Skip to content

Commit

Permalink
Merge branch 'maint' of git://repo.or.cz/git-gui into maint
Browse files Browse the repository at this point in the history
* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Don't display CR within console windows
  git-gui: Handle progress bars from newer gits
  git-gui: Correctly report failures from git-write-tree
  git-gui: accept versions containing text annotations, like 1.5.3.mingw.1
  git-gui: Don't crash when starting gitk from a browser session
  git-gui: Allow gitk to be started on Cygwin with native Tcl/Tk
  git-gui: Ensure .git/info/exclude is honored in Cygwin workdirs
  git-gui: Handle starting on mapped shares under Cygwin
  git-gui: Display message box when we cannot find git in $PATH
  git-gui: Avoid using bold text in entire gui for some fonts
  • Loading branch information
Shawn O. Pearce committed Oct 21, 2007
2 parents 0b8293f + bbbadf6 commit 7468c29
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 11 deletions.
75 changes: 67 additions & 8 deletions git-gui/git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ proc _which {what} {
global env _search_exe _search_path

if {$_search_path eq {}} {
if {[is_Cygwin]} {
if {[is_Cygwin] && [regexp {^(/|\.:)} $env(PATH)]} {
set _search_path [split [exec cygpath \
--windows \
--path \
Expand Down Expand Up @@ -498,7 +498,11 @@ proc rmsel_tag {text} {
set _git [_which git]
if {$_git eq {}} {
catch {wm withdraw .}
error_popup "Cannot find git in PATH."
tk_messageBox \
-icon error \
-type ok \
-title [mc "git-gui: fatal error"] \
-message [mc "Cannot find git in PATH."]
exit 1
}

Expand Down Expand Up @@ -534,6 +538,7 @@ regsub -- {-dirty$} $_git_version {} _git_version
regsub {\.[0-9]+\.g[0-9a-f]+$} $_git_version {} _git_version
regsub {\.rc[0-9]+$} $_git_version {} _git_version
regsub {\.GIT$} $_git_version {} _git_version
regsub {\.[a-zA-Z]+\.[0-9]+$} $_git_version {} _git_version

if {![regexp {^[1-9]+(\.[0-9]+)+$} $_git_version]} {
catch {wm withdraw .}
Expand Down Expand Up @@ -903,6 +908,35 @@ proc rescan {after {honor_trustmtime 1}} {
}
}

if {[is_Cygwin]} {
set is_git_info_link {}
set is_git_info_exclude {}
proc have_info_exclude {} {
global is_git_info_link is_git_info_exclude

if {$is_git_info_link eq {}} {
set is_git_info_link [file isfile [gitdir info.lnk]]
}

if {$is_git_info_link} {
if {$is_git_info_exclude eq {}} {
if {[catch {exec test -f [gitdir info exclude]}]} {
set is_git_info_exclude 0
} else {
set is_git_info_exclude 1
}
}
return $is_git_info_exclude
} else {
return [file readable [gitdir info exclude]]
}
}
} else {
proc have_info_exclude {} {
return [file readable [gitdir info exclude]]
}
}

proc rescan_stage2 {fd after} {
global rescan_active buf_rdi buf_rdf buf_rlo

Expand All @@ -913,9 +947,8 @@ proc rescan_stage2 {fd after} {
}

set ls_others [list --exclude-per-directory=.gitignore]
set info_exclude [gitdir info exclude]
if {[file readable $info_exclude]} {
lappend ls_others "--exclude-from=$info_exclude"
if {[have_info_exclude]} {
lappend ls_others "--exclude-from=[gitdir info exclude]"
}
set user_exclude [get_config core.excludesfile]
if {$user_exclude ne {} && [file readable $user_exclude]} {
Expand Down Expand Up @@ -1093,11 +1126,17 @@ proc mapdesc {state path} {
}

proc ui_status {msg} {
$::main_status show $msg
global main_status
if {[info exists main_status]} {
$main_status show $msg
}
}

proc ui_ready {{test {}}} {
$::main_status show {Ready.} $test
global main_status
if {[info exists main_status]} {
$main_status show [mc "Ready."] $test
}
}

proc escape_path {path} {
Expand Down Expand Up @@ -1436,7 +1475,27 @@ proc do_gitk {revs} {
if {! [file exists $exe]} {
error_popup "Unable to start gitk:\n\n$exe does not exist"
} else {
global env

if {[info exists env(GIT_DIR)]} {
set old_GIT_DIR $env(GIT_DIR)
} else {
set old_GIT_DIR {}
}

set pwd [pwd]
cd [file dirname [gitdir]]
set env(GIT_DIR) [file tail [gitdir]]

eval exec $cmd $revs &

if {$old_GIT_DIR eq {}} {
unset env(GIT_DIR)
} else {
set env(GIT_DIR) $old_GIT_DIR
}
cd $pwd

ui_status $::starting_gitk_msg
after 10000 {
ui_ready $starting_gitk_msg
Expand Down Expand Up @@ -1648,7 +1707,7 @@ proc apply_config {} {
set font [lindex $option 1]
if {[catch {
foreach {cn cv} $repo_config(gui.$name) {
font configure $font $cn $cv
font configure $font $cn $cv -weight normal
}
} err]} {
error_popup "Invalid font specified in gui.$name:\n\n$err"
Expand Down
2 changes: 1 addition & 1 deletion git-gui/lib/commit.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ proc commit_committree {fd_wt curHEAD msg} {
global repo_config

gets $fd_wt tree_id
if {$tree_id eq {} || [catch {close $fd_wt} err]} {
if {[catch {close $fd_wt} err]} {
error_popup "write-tree failed:\n\n$err"
ui_status {Commit failed.}
unlock_index
Expand Down
2 changes: 1 addition & 1 deletion git-gui/lib/console.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ method _read {fd after} {
} else {
$w.m.t delete $console_cr end
$w.m.t insert end "\n"
$w.m.t insert end [string range $buf $c $cr]
$w.m.t insert end [string range $buf $c [expr {$cr - 1}]]
set c $cr
incr c
}
Expand Down
5 changes: 4 additions & 1 deletion git-gui/lib/status_bar.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ method update_meter {buf} {

set prior [string range $meter 0 $r]
set meter [string range $meter [expr {$r + 1}] end]
if {[regexp "\\((\\d+)/(\\d+)\\)\\s+done\r\$" $prior _j a b]} {
set p "\\((\\d+)/(\\d+)\\)"
if {[regexp ":\\s*\\d+% $p\(?:, done.\\s*\n|\\s*\r)\$" $prior _j a b]} {
update $this $a $b
} elseif {[regexp "$p\\s+done\r\$" $prior _j a b]} {
update $this $a $b
}
}
Expand Down

0 comments on commit 7468c29

Please sign in to comment.