Ticket #29093: portfetch.tcl.2.diff

File portfetch.tcl.2.diff, 1.8 KB (added by ci42, 13 years ago)

use command_exec for git.fetch

  • portfetch.tcl

    old new  
    9797
    9898default git.cmd {[findBinary git $portutil::autoconf::git_path]}
    9999default git.dir {${workpath}}
    100 default git.branch {}
     100default git.branch {"HEAD"}
     101default git.pre_args ""
     102default git.args ""
     103default git.post_args {"${git.url} ${distname}"}
    101104
    102105default hg.cmd {[findBinary hg $portutil::autoconf::hg_path]}
    103106default hg.dir {${workpath}}
     
    369372
    370373# Perform a git fetch
    371374proc portfetch::gitfetch {args} {
    372     global worksrcpath
    373     global git.url git.branch git.sha1 git.cmd
     375    global distname
     376    global git.dir git.args git.post_args git.branch
    374377
    375     set options "-q"
    376     if {[string length ${git.branch}] == 0} {
    377         # if we're just using HEAD, we can make a shallow repo
    378         set options "$options --depth=1"
    379     }
    380     set cmdstring "${git.cmd} clone $options ${git.url} ${worksrcpath} 2>&1"
    381     ui_debug "Executing: $cmdstring"
    382     if {[catch {system $cmdstring} result]} {
     378    set git.args "clone -q -n"
     379    if {[catch {command_exec git "" "2>&1"} result]} {
    383380        return -code error [msgcat::mc "Git clone failed"]
    384381    }
    385382
    386     if {[string length ${git.branch}] > 0} {
    387         set env "GIT_DIR=${worksrcpath}/.git GIT_WORK_TREE=${worksrcpath}"
    388         set cmdstring "$env ${git.cmd} checkout -q ${git.branch} 2>&1"
    389         ui_debug "Executing $cmdstring"
    390         if {[catch {system $cmdstring} result]} {
    391             return -code error [msgcat::mc "Git checkout failed"]
    392         }
     383    set git.dir ${git.dir}/${distname}
     384    set git.args "checkout -q -b ${git.branch}"
     385    set git.post_args ""
     386    if {[catch {command_exec git "" "2>&1"} result]} {
     387        return -code error [msgcat::mc "Git checkout failed"]
    393388    }
    394389
    395390    if {[info exists patchfiles]} {