mirror of
https://github.com/git/git.git
synced 2026-06-30 19:58:12 +00:00
Sync with 2.47.3
* maint-2.47: Git 2.47.3 Git 2.46.4 Git 2.45.4 Git 2.44.4 Git 2.43.7 wincred: avoid buffer overflow in wcsncat() bundle-uri: fix arbitrary file writes via parameter injection config: quote values containing CR character git-gui: sanitize 'exec' arguments: convert new 'cygpath' calls git-gui: do not mistake command arguments as redirection operators git-gui: introduce function git_redir for git calls with redirections git-gui: pass redirections as separate argument to git_read git-gui: pass redirections as separate argument to _open_stdout_stderr git-gui: convert git_read*, git_write to be non-variadic git-gui: override exec and open only on Windows gitk: sanitize 'open' arguments: revisit recently updated 'open' calls git-gui: use git_read in githook_read git-gui: sanitize $PATH on all platforms git-gui: break out a separate function git_read_nice git-gui: assure PATH has only absolute elements. git-gui: remove option --stderr from git_read git-gui: cleanup git-bash menu item git-gui: sanitize 'exec' arguments: background git-gui: avoid auto_execok in do_windows_shortcut git-gui: sanitize 'exec' arguments: simple cases git-gui: avoid auto_execok for git-bash menu item git-gui: treat file names beginning with "|" as relative paths git-gui: remove unused proc is_shellscript git-gui: remove git config --list handling for git < 1.5.3 git-gui: remove special treatment of Windows from open_cmd_pipe git-gui: remove HEAD detachment implementation for git < 1.5.3 git-gui: use only the configured shell git-gui: remove Tcl 8.4 workaround on 2>@1 redirection git-gui: make _shellpath usable on startup git-gui: use [is_Windows], not bad _shellpath git-gui: _which, only add .exe suffix if not present gitk: encode arguments correctly with "open" gitk: sanitize 'open' arguments: command pipeline gitk: collect construction of blameargs into a single conditional gitk: sanitize 'open' arguments: simple commands, readable and writable gitk: sanitize 'open' arguments: simple commands with redirections gitk: sanitize 'open' arguments: simple commands gitk: sanitize 'exec' arguments: redirect to process gitk: sanitize 'exec' arguments: redirections and background gitk: sanitize 'exec' arguments: redirections gitk: sanitize 'exec' arguments: 'eval exec' gitk: sanitize 'exec' arguments: simple cases gitk: have callers of diffcmd supply pipe symbol when necessary gitk: treat file names beginning with "|" as relative paths
This commit is contained in:
@@ -481,14 +481,14 @@ method _load {jump} {
|
||||
if {$do_textconv ne 0} {
|
||||
set fd [open_cmd_pipe $textconv $path]
|
||||
} else {
|
||||
set fd [open $path r]
|
||||
set fd [safe_open_file $path r]
|
||||
}
|
||||
fconfigure $fd -eofchar {}
|
||||
} else {
|
||||
if {$do_textconv ne 0} {
|
||||
set fd [git_read cat-file --textconv "$commit:$path"]
|
||||
set fd [git_read [list cat-file --textconv "$commit:$path"]]
|
||||
} else {
|
||||
set fd [git_read cat-file blob "$commit:$path"]
|
||||
set fd [git_read [list cat-file blob "$commit:$path"]]
|
||||
}
|
||||
}
|
||||
fconfigure $fd \
|
||||
@@ -617,7 +617,7 @@ method _exec_blame {cur_w cur_d options cur_s} {
|
||||
}
|
||||
|
||||
lappend options -- $path
|
||||
set fd [eval git_read --nice blame $options]
|
||||
set fd [git_read_nice [concat blame $options]]
|
||||
fconfigure $fd -blocking 0 -translation lf -encoding utf-8
|
||||
fileevent $fd readable [cb _read_blame $fd $cur_w $cur_d]
|
||||
set current_fd $fd
|
||||
@@ -986,7 +986,7 @@ method _showcommit {cur_w lno} {
|
||||
if {[catch {set msg $header($cmit,message)}]} {
|
||||
set msg {}
|
||||
catch {
|
||||
set fd [git_read cat-file commit $cmit]
|
||||
set fd [git_read [list cat-file commit $cmit]]
|
||||
fconfigure $fd -encoding binary -translation lf
|
||||
# By default commits are assumed to be in utf-8
|
||||
set enc utf-8
|
||||
@@ -1134,7 +1134,7 @@ method _blameparent {} {
|
||||
} else {
|
||||
set diffcmd [list diff-tree --unified=0 $cparent $cmit -- $new_path]
|
||||
}
|
||||
if {[catch {set fd [eval git_read $diffcmd]} err]} {
|
||||
if {[catch {set fd [git_read $diffcmd]} err]} {
|
||||
$status_operation stop [mc "Unable to display parent"]
|
||||
error_popup [strcat [mc "Error loading diff:"] "\n\n$err"]
|
||||
return
|
||||
|
||||
@@ -7,7 +7,7 @@ proc load_all_heads {} {
|
||||
set rh refs/heads
|
||||
set rh_len [expr {[string length $rh] + 1}]
|
||||
set all_heads [list]
|
||||
set fd [git_read for-each-ref --format=%(refname) $rh]
|
||||
set fd [git_read [list for-each-ref --format=%(refname) $rh]]
|
||||
fconfigure $fd -translation binary -encoding utf-8
|
||||
while {[gets $fd line] > 0} {
|
||||
if {!$some_heads_tracking || ![is_tracking_branch $line]} {
|
||||
@@ -21,10 +21,10 @@ proc load_all_heads {} {
|
||||
|
||||
proc load_all_tags {} {
|
||||
set all_tags [list]
|
||||
set fd [git_read for-each-ref \
|
||||
set fd [git_read [list for-each-ref \
|
||||
--sort=-taggerdate \
|
||||
--format=%(refname) \
|
||||
refs/tags]
|
||||
refs/tags]]
|
||||
fconfigure $fd -translation binary -encoding utf-8
|
||||
while {[gets $fd line] > 0} {
|
||||
if {![regsub ^refs/tags/ $line {} name]} continue
|
||||
|
||||
@@ -196,7 +196,7 @@ method _ls {tree_id {name {}}} {
|
||||
lappend browser_stack [list $tree_id $name]
|
||||
$w conf -state disabled
|
||||
|
||||
set fd [git_read ls-tree -z $tree_id]
|
||||
set fd [git_read [list ls-tree -z $tree_id]]
|
||||
fconfigure $fd -blocking 0 -translation binary -encoding utf-8
|
||||
fileevent $fd readable [cb _read $fd]
|
||||
}
|
||||
|
||||
@@ -304,12 +304,12 @@ The rescan will be automatically started now.
|
||||
_readtree $this
|
||||
} else {
|
||||
ui_status [mc "Refreshing file status..."]
|
||||
set fd [git_read update-index \
|
||||
set fd [git_read [list update-index \
|
||||
-q \
|
||||
--unmerged \
|
||||
--ignore-missing \
|
||||
--refresh \
|
||||
]
|
||||
]]
|
||||
fconfigure $fd -blocking 0 -translation binary
|
||||
fileevent $fd readable [cb _refresh_wait $fd]
|
||||
}
|
||||
@@ -345,14 +345,15 @@ method _readtree {} {
|
||||
[mc "Updating working directory to '%s'..." [_name $this]] \
|
||||
[mc "files checked out"]]
|
||||
|
||||
set fd [git_read --stderr read-tree \
|
||||
set fd [git_read [list read-tree \
|
||||
-m \
|
||||
-u \
|
||||
-v \
|
||||
--exclude-per-directory=.gitignore \
|
||||
$HEAD \
|
||||
$new_hash \
|
||||
]
|
||||
] \
|
||||
[list 2>@1]]
|
||||
fconfigure $fd -blocking 0 -translation binary
|
||||
fileevent $fd readable [cb _readtree_wait $fd $status_bar_operation]
|
||||
}
|
||||
@@ -510,18 +511,8 @@ method _update_repo_state {} {
|
||||
delete_this
|
||||
}
|
||||
|
||||
git-version proc _detach_HEAD {log new} {
|
||||
>= 1.5.3 {
|
||||
git update-ref --no-deref -m $log HEAD $new
|
||||
}
|
||||
default {
|
||||
set p [gitdir HEAD]
|
||||
file delete $p
|
||||
set fd [open $p w]
|
||||
fconfigure $fd -translation lf -encoding utf-8
|
||||
puts $fd $new
|
||||
close $fd
|
||||
}
|
||||
proc _detach_HEAD {log new} {
|
||||
git update-ref --no-deref -m $log HEAD $new
|
||||
}
|
||||
|
||||
method _confirm_reset {cur} {
|
||||
@@ -582,7 +573,7 @@ method _confirm_reset {cur} {
|
||||
pack $w.buttons.cancel -side right -padx 5
|
||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||
|
||||
set fd [git_read rev-list --pretty=oneline $cur ^$new_hash]
|
||||
set fd [git_read [list rev-list --pretty=oneline $cur ^$new_hash]]
|
||||
while {[gets $fd line] > 0} {
|
||||
set abbr [string range $line 0 7]
|
||||
set subj [string range $line 41 end]
|
||||
|
||||
@@ -641,8 +641,8 @@ method _do_clone2 {} {
|
||||
set pwd [pwd]
|
||||
if {[catch {
|
||||
file mkdir [gitdir objects info]
|
||||
set f_in [open [file join $objdir info alternates] r]
|
||||
set f_cp [open [gitdir objects info alternates] w]
|
||||
set f_in [safe_open_file [file join $objdir info alternates] r]
|
||||
set f_cp [safe_open_file [gitdir objects info alternates] w]
|
||||
fconfigure $f_in -translation binary -encoding binary
|
||||
fconfigure $f_cp -translation binary -encoding binary
|
||||
cd $objdir
|
||||
@@ -727,7 +727,7 @@ method _do_clone2 {} {
|
||||
[cb _do_clone_tags]
|
||||
}
|
||||
shared {
|
||||
set fd [open [gitdir objects info alternates] w]
|
||||
set fd [safe_open_file [gitdir objects info alternates] w]
|
||||
fconfigure $fd -translation binary
|
||||
puts $fd $objdir
|
||||
close $fd
|
||||
@@ -760,8 +760,8 @@ method _copy_files {objdir tocopy} {
|
||||
}
|
||||
foreach p $tocopy {
|
||||
if {[catch {
|
||||
set f_in [open [file join $objdir $p] r]
|
||||
set f_cp [open [file join .git objects $p] w]
|
||||
set f_in [safe_open_file [file join $objdir $p] r]
|
||||
set f_cp [safe_open_file [file join .git objects $p] w]
|
||||
fconfigure $f_in -translation binary -encoding binary
|
||||
fconfigure $f_cp -translation binary -encoding binary
|
||||
|
||||
@@ -818,12 +818,12 @@ method _clone_refs {} {
|
||||
error_popup [mc "Not a Git repository: %s" [file tail $origin_url]]
|
||||
return 0
|
||||
}
|
||||
set fd_in [git_read for-each-ref \
|
||||
set fd_in [git_read [list for-each-ref \
|
||||
--tcl \
|
||||
{--format=list %(refname) %(objectname) %(*objectname)}]
|
||||
{--format=list %(refname) %(objectname) %(*objectname)}]]
|
||||
cd $pwd
|
||||
|
||||
set fd [open [gitdir packed-refs] w]
|
||||
set fd [safe_open_file [gitdir packed-refs] w]
|
||||
fconfigure $fd -translation binary
|
||||
puts $fd "# pack-refs with: peeled"
|
||||
while {[gets $fd_in line] >= 0} {
|
||||
@@ -877,7 +877,7 @@ method _do_clone_full_end {ok} {
|
||||
|
||||
set HEAD {}
|
||||
if {[file exists [gitdir FETCH_HEAD]]} {
|
||||
set fd [open [gitdir FETCH_HEAD] r]
|
||||
set fd [safe_open_file [gitdir FETCH_HEAD] r]
|
||||
while {[gets $fd line] >= 0} {
|
||||
if {[regexp "^(.{40})\t\t" $line line HEAD]} {
|
||||
break
|
||||
@@ -953,13 +953,14 @@ method _do_clone_checkout {HEAD} {
|
||||
[mc "files"]]
|
||||
|
||||
set readtree_err {}
|
||||
set fd [git_read --stderr read-tree \
|
||||
set fd [git_read [list read-tree \
|
||||
-m \
|
||||
-u \
|
||||
-v \
|
||||
HEAD \
|
||||
HEAD \
|
||||
]
|
||||
] \
|
||||
[list 2>@1]]
|
||||
fconfigure $fd -blocking 0 -translation binary
|
||||
fileevent $fd readable [cb _readtree_wait $fd]
|
||||
}
|
||||
|
||||
@@ -146,14 +146,14 @@ constructor _new {path unmerged_only title} {
|
||||
append fmt { %(*subject)}
|
||||
append fmt {]}
|
||||
set all_refn [list]
|
||||
set fr_fd [git_read for-each-ref \
|
||||
set fr_fd [git_read [list for-each-ref \
|
||||
--tcl \
|
||||
--sort=-taggerdate \
|
||||
--format=$fmt \
|
||||
refs/heads \
|
||||
refs/remotes \
|
||||
refs/tags \
|
||||
]
|
||||
]]
|
||||
fconfigure $fr_fd -translation lf -encoding utf-8
|
||||
while {[gets $fr_fd line] > 0} {
|
||||
set line [eval $line]
|
||||
@@ -176,7 +176,7 @@ constructor _new {path unmerged_only title} {
|
||||
close $fr_fd
|
||||
|
||||
if {$unmerged_only} {
|
||||
set fr_fd [git_read rev-list --all ^$::HEAD]
|
||||
set fr_fd [git_read [list rev-list --all ^$::HEAD]]
|
||||
while {[gets $fr_fd sha1] > 0} {
|
||||
if {[catch {set rlst $cmt_refn($sha1)}]} continue
|
||||
foreach refn $rlst {
|
||||
@@ -579,7 +579,7 @@ method _reflog_last {name} {
|
||||
|
||||
set last {}
|
||||
if {[catch {set last [file mtime [gitdir $name]]}]
|
||||
&& ![catch {set g [open [gitdir logs $name] r]}]} {
|
||||
&& ![catch {set g [safe_open_file [gitdir logs $name] r]}]} {
|
||||
fconfigure $g -translation binary
|
||||
while {[gets $g line] >= 0} {
|
||||
if {[regexp {> ([1-9][0-9]*) } $line line when]} {
|
||||
|
||||
@@ -27,7 +27,7 @@ You are currently in the middle of a merge that has not been fully completed. Y
|
||||
if {[catch {
|
||||
set name ""
|
||||
set email ""
|
||||
set fd [git_read cat-file commit $curHEAD]
|
||||
set fd [git_read [list cat-file commit $curHEAD]]
|
||||
fconfigure $fd -encoding binary -translation lf
|
||||
# By default commits are assumed to be in utf-8
|
||||
set enc utf-8
|
||||
@@ -234,7 +234,7 @@ A good commit message has the following format:
|
||||
# -- Build the message file.
|
||||
#
|
||||
set msg_p [gitdir GITGUI_EDITMSG]
|
||||
set msg_wt [open $msg_p w]
|
||||
set msg_wt [safe_open_file $msg_p w]
|
||||
fconfigure $msg_wt -translation lf
|
||||
setup_commit_encoding $msg_wt
|
||||
puts $msg_wt $msg
|
||||
@@ -334,7 +334,7 @@ proc commit_commitmsg_wait {fd_ph curHEAD msg_p} {
|
||||
|
||||
proc commit_writetree {curHEAD msg_p} {
|
||||
ui_status [mc "Committing changes..."]
|
||||
set fd_wt [git_read write-tree]
|
||||
set fd_wt [git_read [list write-tree]]
|
||||
fileevent $fd_wt readable \
|
||||
[list commit_committree $fd_wt $curHEAD $msg_p]
|
||||
}
|
||||
@@ -359,7 +359,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
|
||||
# -- Verify this wasn't an empty change.
|
||||
#
|
||||
if {$commit_type eq {normal}} {
|
||||
set fd_ot [git_read cat-file commit $PARENT]
|
||||
set fd_ot [git_read [list cat-file commit $PARENT]]
|
||||
fconfigure $fd_ot -encoding binary -translation lf
|
||||
set old_tree [gets $fd_ot]
|
||||
close $fd_ot
|
||||
@@ -397,8 +397,8 @@ A rescan will be automatically started now.
|
||||
foreach p [concat $PARENT $MERGE_HEAD] {
|
||||
lappend cmd -p $p
|
||||
}
|
||||
lappend cmd <$msg_p
|
||||
if {[catch {set cmt_id [eval git $cmd]} err]} {
|
||||
set msgtxt [list <$msg_p]
|
||||
if {[catch {set cmt_id [git_redir $cmd $msgtxt]} err]} {
|
||||
catch {file delete $msg_p}
|
||||
error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
|
||||
ui_status [mc "Commit failed."]
|
||||
@@ -418,7 +418,7 @@ A rescan will be automatically started now.
|
||||
if {$commit_type ne {normal}} {
|
||||
append reflogm " ($commit_type)"
|
||||
}
|
||||
set msg_fd [open $msg_p r]
|
||||
set msg_fd [safe_open_file $msg_p r]
|
||||
setup_commit_encoding $msg_fd 1
|
||||
gets $msg_fd subject
|
||||
close $msg_fd
|
||||
|
||||
@@ -92,10 +92,9 @@ method _init {} {
|
||||
|
||||
method exec {cmd {after {}}} {
|
||||
if {[lindex $cmd 0] eq {git}} {
|
||||
set fd_f [eval git_read --stderr [lrange $cmd 1 end]]
|
||||
set fd_f [git_read [lrange $cmd 1 end] [list 2>@1]]
|
||||
} else {
|
||||
lappend cmd 2>@1
|
||||
set fd_f [_open_stdout_stderr $cmd]
|
||||
set fd_f [safe_open_command $cmd [list 2>@1]]
|
||||
}
|
||||
fconfigure $fd_f -blocking 0 -translation binary -encoding [encoding system]
|
||||
fileevent $fd_f readable [cb _read $fd_f $after]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
proc do_stats {} {
|
||||
global use_ttk NS
|
||||
set fd [git_read count-objects -v]
|
||||
set fd [git_read [list count-objects -v]]
|
||||
while {[gets $fd line] > 0} {
|
||||
if {[regexp {^([^:]+): (\d+)$} $line _ name value]} {
|
||||
set stats($name) $value
|
||||
|
||||
@@ -191,7 +191,7 @@ proc show_other_diff {path w m cont_info} {
|
||||
set sz [string length $content]
|
||||
}
|
||||
file {
|
||||
set fd [open $path r]
|
||||
set fd [safe_open_file $path r]
|
||||
fconfigure $fd \
|
||||
-eofchar {} \
|
||||
-encoding [get_path_encoding $path]
|
||||
@@ -215,7 +215,7 @@ proc show_other_diff {path w m cont_info} {
|
||||
$ui_diff insert end \
|
||||
"* [mc "Git Repository (subproject)"]\n" \
|
||||
d_info
|
||||
} elseif {![catch {set type [exec file $path]}]} {
|
||||
} elseif {![catch {set type [safe_exec [list file $path]]}]} {
|
||||
set n [string length $path]
|
||||
if {[string equal -length $n $path $type]} {
|
||||
set type [string range $type $n end]
|
||||
@@ -327,7 +327,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
|
||||
}
|
||||
}
|
||||
|
||||
if {[catch {set fd [eval git_read --nice $cmd]} err]} {
|
||||
if {[catch {set fd [git_read_nice $cmd]} err]} {
|
||||
set diff_active 0
|
||||
unlock_index
|
||||
ui_status [mc "Unable to display %s" [escape_path $path]]
|
||||
@@ -603,7 +603,7 @@ proc apply_or_revert_hunk {x y revert} {
|
||||
|
||||
if {[catch {
|
||||
set enc [get_path_encoding $current_diff_path]
|
||||
set p [eval git_write $apply_cmd]
|
||||
set p [git_write $apply_cmd]
|
||||
fconfigure $p -translation binary -encoding $enc
|
||||
puts -nonewline $p $wholepatch
|
||||
close $p} err]} {
|
||||
@@ -839,7 +839,7 @@ proc apply_or_revert_range_or_line {x y revert} {
|
||||
|
||||
if {[catch {
|
||||
set enc [get_path_encoding $current_diff_path]
|
||||
set p [eval git_write $apply_cmd]
|
||||
set p [git_write $apply_cmd]
|
||||
fconfigure $p -translation binary -encoding $enc
|
||||
puts -nonewline $p $current_diff_header
|
||||
puts -nonewline $p $wholepatch
|
||||
@@ -876,7 +876,7 @@ proc undo_last_revert {} {
|
||||
|
||||
if {[catch {
|
||||
set enc $last_revert_enc
|
||||
set p [eval git_write $apply_cmd]
|
||||
set p [git_write $apply_cmd]
|
||||
fconfigure $p -translation binary -encoding $enc
|
||||
puts -nonewline $p $last_revert
|
||||
close $p} err]} {
|
||||
|
||||
@@ -75,7 +75,7 @@ proc update_indexinfo {msg path_list after} {
|
||||
if {$batch > 25} {set batch 25}
|
||||
|
||||
set status_bar_operation [$::main_status start $msg [mc "files"]]
|
||||
set fd [git_write update-index -z --index-info]
|
||||
set fd [git_write [list update-index -z --index-info]]
|
||||
fconfigure $fd \
|
||||
-blocking 0 \
|
||||
-buffering full \
|
||||
@@ -144,7 +144,7 @@ proc update_index {msg path_list after} {
|
||||
if {$batch > 25} {set batch 25}
|
||||
|
||||
set status_bar_operation [$::main_status start $msg [mc "files"]]
|
||||
set fd [git_write update-index --add --remove -z --stdin]
|
||||
set fd [git_write [list update-index --add --remove -z --stdin]]
|
||||
fconfigure $fd \
|
||||
-blocking 0 \
|
||||
-buffering full \
|
||||
@@ -218,13 +218,13 @@ proc checkout_index {msg path_list after capture_error} {
|
||||
if {$batch > 25} {set batch 25}
|
||||
|
||||
set status_bar_operation [$::main_status start $msg [mc "files"]]
|
||||
set fd [git_write checkout-index \
|
||||
set fd [git_write [list checkout-index \
|
||||
--index \
|
||||
--quiet \
|
||||
--force \
|
||||
-z \
|
||||
--stdin \
|
||||
]
|
||||
]]
|
||||
fconfigure $fd \
|
||||
-blocking 0 \
|
||||
-buffering full \
|
||||
|
||||
@@ -93,7 +93,7 @@ method _start {} {
|
||||
set spec [$w_rev get_tracking_branch]
|
||||
set cmit [$w_rev get_commit]
|
||||
|
||||
set fh [open [gitdir FETCH_HEAD] w]
|
||||
set fh [safe_open_file [gitdir FETCH_HEAD] w]
|
||||
fconfigure $fh -translation lf
|
||||
if {$spec eq {}} {
|
||||
set remote .
|
||||
@@ -118,7 +118,7 @@ method _start {} {
|
||||
set cmd [list git]
|
||||
lappend cmd merge
|
||||
lappend cmd --strategy=recursive
|
||||
lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
|
||||
lappend cmd [git_redir [list fmt-merge-msg] [list <[gitdir FETCH_HEAD]]]
|
||||
lappend cmd HEAD
|
||||
lappend cmd $name
|
||||
}
|
||||
@@ -239,7 +239,7 @@ Continue with resetting the current changes?"]
|
||||
}
|
||||
|
||||
if {[ask_popup $op_question] eq {yes}} {
|
||||
set fd [git_read --stderr read-tree --reset -u -v HEAD]
|
||||
set fd [git_read [list read-tree --reset -u -v HEAD] [list 2>@1]]
|
||||
fconfigure $fd -blocking 0 -translation binary
|
||||
set status_bar_operation [$::main_status \
|
||||
start \
|
||||
|
||||
@@ -88,7 +88,7 @@ proc merge_load_stages {path cont} {
|
||||
set merge_stages(3) {}
|
||||
set merge_stages_buf {}
|
||||
|
||||
set merge_stages_fd [eval git_read ls-files -u -z -- {$path}]
|
||||
set merge_stages_fd [git_read [list ls-files -u -z -- $path]]
|
||||
|
||||
fconfigure $merge_stages_fd -blocking 0 -translation binary -encoding binary
|
||||
fileevent $merge_stages_fd readable [list read_merge_stages $merge_stages_fd $cont]
|
||||
@@ -310,7 +310,7 @@ proc merge_tool_get_stages {target stages} {
|
||||
foreach fname $stages {
|
||||
if {$merge_stages($i) eq {}} {
|
||||
file delete $fname
|
||||
catch { close [open $fname w] }
|
||||
catch { close [safe_open_file $fname w] }
|
||||
} else {
|
||||
# A hack to support autocrlf properly
|
||||
git checkout-index -f --stage=$i -- $target
|
||||
@@ -360,9 +360,9 @@ proc merge_tool_start {cmdline target backup stages} {
|
||||
|
||||
# Force redirection to avoid interpreting output on stderr
|
||||
# as an error, and launch the tool
|
||||
lappend cmdline {2>@1}
|
||||
set redir [list {2>@1}]
|
||||
|
||||
if {[catch { set mtool_fd [_open_stdout_stderr $cmdline] } err]} {
|
||||
if {[catch { set mtool_fd [safe_open_command $cmdline $redir] } err]} {
|
||||
delete_temp_files $mtool_tmpfiles
|
||||
error_popup [mc "Could not start the merge tool:\n\n%s" $err]
|
||||
return
|
||||
|
||||
@@ -32,7 +32,7 @@ proc all_tracking_branches {} {
|
||||
}
|
||||
|
||||
if {$pat ne {}} {
|
||||
set fd [eval git_read for-each-ref --format=%(refname) $cmd]
|
||||
set fd [git_read [concat for-each-ref --format=%(refname) $cmd]]
|
||||
while {[gets $fd n] > 0} {
|
||||
foreach spec $pat {
|
||||
set dst [string range [lindex $spec 0] 0 end-2]
|
||||
@@ -75,7 +75,7 @@ proc load_all_remotes {} {
|
||||
|
||||
foreach name $all_remotes {
|
||||
catch {
|
||||
set fd [open [file join $rm_dir $name] r]
|
||||
set fd [safe_open_file [file join $rm_dir $name] r]
|
||||
while {[gets $fd line] >= 0} {
|
||||
if {[regexp {^URL:[ ]*(.+)$} $line line url]} {
|
||||
set remote_url($name) $url
|
||||
@@ -145,7 +145,7 @@ proc add_fetch_entry {r} {
|
||||
}
|
||||
} else {
|
||||
catch {
|
||||
set fd [open [gitdir remotes $r] r]
|
||||
set fd [safe_open_file [gitdir remotes $r] r]
|
||||
while {[gets $fd n] >= 0} {
|
||||
if {[regexp {^Pull:[ \t]*([^:]+):} $n]} {
|
||||
set enable 1
|
||||
@@ -182,7 +182,7 @@ proc add_push_entry {r} {
|
||||
}
|
||||
} else {
|
||||
catch {
|
||||
set fd [open [gitdir remotes $r] r]
|
||||
set fd [safe_open_file [gitdir remotes $r] r]
|
||||
while {[gets $fd n] >= 0} {
|
||||
if {[regexp {^Push:[ \t]*([^:]+):} $n]} {
|
||||
set enable 1
|
||||
|
||||
@@ -308,7 +308,7 @@ method _load {cache uri} {
|
||||
set full_list [list]
|
||||
set head_cache($cache) [list]
|
||||
set full_cache($cache) [list]
|
||||
set active_ls [git_read ls-remote $uri]
|
||||
set active_ls [git_read [list ls-remote $uri]]
|
||||
fconfigure $active_ls \
|
||||
-blocking 0 \
|
||||
-translation lf \
|
||||
|
||||
@@ -12,7 +12,7 @@ proc do_windows_shortcut {} {
|
||||
set fn ${fn}.lnk
|
||||
}
|
||||
# Use git-gui.exe if available (ie: git-for-windows)
|
||||
set cmdLine [auto_execok git-gui.exe]
|
||||
set cmdLine [list [_which git-gui]]
|
||||
if {$cmdLine eq {}} {
|
||||
set cmdLine [list [info nameofexecutable] \
|
||||
[file normalize $::argv0]]
|
||||
@@ -30,8 +30,8 @@ proc do_cygwin_shortcut {} {
|
||||
global argv0 _gitworktree oguilib
|
||||
|
||||
if {[catch {
|
||||
set desktop [exec cygpath \
|
||||
--desktop]
|
||||
set desktop [safe_exec [list cygpath \
|
||||
--desktop]]
|
||||
}]} {
|
||||
set desktop .
|
||||
}
|
||||
@@ -50,14 +50,14 @@ proc do_cygwin_shortcut {} {
|
||||
"CHERE_INVOKING=1 \
|
||||
source /etc/profile; \
|
||||
git gui"}
|
||||
exec /bin/mkshortcut.exe \
|
||||
safe_exec [list /bin/mkshortcut.exe \
|
||||
--arguments $shargs \
|
||||
--desc "git-gui on $repodir" \
|
||||
--icon $oguilib/git-gui.ico \
|
||||
--name $fn \
|
||||
--show min \
|
||||
--workingdir $repodir \
|
||||
/bin/sh.exe
|
||||
/bin/sh.exe]
|
||||
} err]} {
|
||||
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
||||
}
|
||||
@@ -83,7 +83,7 @@ proc do_macosx_app {} {
|
||||
|
||||
file mkdir $MacOS
|
||||
|
||||
set fd [open [file join $Contents Info.plist] w]
|
||||
set fd [safe_open_file [file join $Contents Info.plist] w]
|
||||
puts $fd {<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
@@ -108,7 +108,7 @@ proc do_macosx_app {} {
|
||||
</plist>}
|
||||
close $fd
|
||||
|
||||
set fd [open $exe w]
|
||||
set fd [safe_open_file $exe w]
|
||||
puts $fd "#!/bin/sh"
|
||||
foreach name [lsort [array names env]] {
|
||||
set value $env($name)
|
||||
|
||||
@@ -7,7 +7,7 @@ proc find_ssh_key {} {
|
||||
~/.ssh/id_rsa.pub ~/.ssh/identity.pub
|
||||
} {
|
||||
if {[file exists $name]} {
|
||||
set fh [open $name r]
|
||||
set fh [safe_open_file $name r]
|
||||
set cont [read $fh]
|
||||
close $fh
|
||||
return [list $name $cont]
|
||||
@@ -83,9 +83,10 @@ proc make_ssh_key {w} {
|
||||
set sshkey_title [mc "Generating..."]
|
||||
$w.header.gen configure -state disabled
|
||||
|
||||
set cmdline [list sh -c {echo | ssh-keygen -q -t rsa -f ~/.ssh/id_rsa 2>&1}]
|
||||
set cmdline [list [shellpath] -c \
|
||||
{echo | ssh-keygen -q -t rsa -f ~/.ssh/id_rsa 2>&1}]
|
||||
|
||||
if {[catch { set sshkey_fd [_open_stdout_stderr $cmdline] } err]} {
|
||||
if {[catch { set sshkey_fd [safe_open_command $cmdline] } err]} {
|
||||
error_popup [mc "Could not start ssh-keygen:\n\n%s" $err]
|
||||
return
|
||||
}
|
||||
|
||||
@@ -110,14 +110,14 @@ proc tools_exec {fullname} {
|
||||
|
||||
set cmdline $repo_config(guitool.$fullname.cmd)
|
||||
if {[is_config_true "guitool.$fullname.noconsole"]} {
|
||||
tools_run_silent [list sh -c $cmdline] \
|
||||
tools_run_silent [list [shellpath] -c $cmdline] \
|
||||
[list tools_complete $fullname {}]
|
||||
} else {
|
||||
regsub {/} $fullname { / } title
|
||||
set w [console::new \
|
||||
[mc "Tool: %s" $title] \
|
||||
[mc "Running: %s" $cmdline]]
|
||||
console::exec $w [list sh -c $cmdline] \
|
||||
console::exec $w [list [shellpath] -c $cmdline] \
|
||||
[list tools_complete $fullname $w]
|
||||
}
|
||||
|
||||
@@ -130,8 +130,7 @@ proc tools_exec {fullname} {
|
||||
}
|
||||
|
||||
proc tools_run_silent {cmd after} {
|
||||
lappend cmd 2>@1
|
||||
set fd [_open_stdout_stderr $cmd]
|
||||
set fd [safe_open_command $cmd [list 2>@1]]
|
||||
|
||||
fconfigure $fd -blocking 0 -translation binary
|
||||
fileevent $fd readable [list tools_consume_input $fd $after]
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
# Copyright (C) 2007 Shawn Pearce
|
||||
|
||||
proc win32_read_lnk {lnk_path} {
|
||||
return [exec cscript.exe \
|
||||
return [safe_exec [list cscript.exe \
|
||||
/E:jscript \
|
||||
/nologo \
|
||||
[file join $::oguilib win32_shortcut.js] \
|
||||
$lnk_path]
|
||||
$lnk_path]]
|
||||
}
|
||||
|
||||
proc win32_create_lnk {lnk_path lnk_exec lnk_dir} {
|
||||
@@ -15,12 +15,13 @@ proc win32_create_lnk {lnk_path lnk_exec lnk_dir} {
|
||||
set lnk_args [lrange $lnk_exec 1 end]
|
||||
set lnk_exec [lindex $lnk_exec 0]
|
||||
|
||||
eval [list exec wscript.exe \
|
||||
set cmd [list wscript.exe \
|
||||
/E:jscript \
|
||||
/nologo \
|
||||
[file nativename [file join $oguilib win32_shortcut.js]] \
|
||||
$lnk_path \
|
||||
[file nativename [file join $oguilib git-gui.ico]] \
|
||||
$lnk_dir \
|
||||
$lnk_exec] $lnk_args
|
||||
$lnk_exec]
|
||||
safe_exec [concat $cmd $lnk_args]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user