<pre style='margin:0'>
Clemens Lang (neverpanic) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/65d24fde2407c4fa6d48ea907c91a1ddf3c8b80a">https://github.com/macports/macports-base/commit/65d24fde2407c4fa6d48ea907c91a1ddf3c8b80a</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 65d24fd Fix version detection with Apple Git, adjust tests
</span>65d24fd is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 65d24fde2407c4fa6d48ea907c91a1ddf3c8b80a
</span>Author: Clemens Lang <cal@macports.org>
AuthorDate: Sun Nov 6 22:31:52 2016 +0100
<span style='display:block; white-space:pre;color:#404040;'> Fix version detection with Apple Git, adjust tests
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Apple's /usr/bin/git returns additional information at the end of the
</span><span style='display:block; white-space:pre;color:#404040;'> standard Git version string, so that splitting at whitespace and using
</span><span style='display:block; white-space:pre;color:#404040;'> the last component does not yield the expected version number.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Fix this by using a regex instead and adjust the tests to test both
</span><span style='display:block; white-space:pre;color:#404040;'> cases.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> For reference: The string returned by /usr/bin/git looks similar to
</span><span style='display:block; white-space:pre;color:#404040;'> | git version 2.9.3 (Apple Git-75)
</span>---
src/macports1.0/macports.tcl | 4 ++-
src/macports1.0/tests/macports.test | 51 +++++++++++++++++++------------------
2 files changed, 29 insertions(+), 26 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/macports.tcl b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 6c39fb5..14d628f 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2433,7 +2433,9 @@ proc macports::GetVCSUpdateCmd portDir {
</span> }
# regular git repository
set autostash ""
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![catch {exec $git --version} gitversion] && [vercmp [lindex [split $gitversion] end] 1.8.4] >= 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![catch {exec $git --version} git_version_string] && \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ [regexp -nocase "git version (\[^ ]+)" $git_version_string -> gitversion] && \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ [vercmp $gitversion 1.8.4] >= 0} {
</span> set autostash " --autostash"
}
return [list Git "$git pull --rebase${autostash}" $portDir]
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/tests/macports.test b/src/macports1.0/tests/macports.test
</span><span style='display:block; white-space:pre;color:#808080;'>index 2e8c040..62af19a 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/tests/macports.test
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/tests/macports.test
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -738,43 +738,44 @@ test GetVCSUpdateCmd-svn {
</span>
testConstraint hasGit [expr {![catch {macports::findBinary git} git]}]
<span style='display:block; white-space:pre;background:#ffe0e0;'>-testConstraint hasGitAutostash [expr {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ![catch {macports::findBinary git} git] &&
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ![catch {exec $git --version} gitversion] &&
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- [package vcompare [lindex [split $gitversion] end] 1.8.4] >= 0}]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-testConstraint hasNoGitAutostash [expr {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ![catch {macports::findBinary git} git] &&
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ![catch {exec $git --version} gitversion] &&
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- [package vcompare [lindex [split $gitversion] end] 1.8.4] < 0}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set git_vcsupdate_fixture {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set repo [makeDirectory macports-test-git-repo $tempdir]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exec $git init $repo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rename exec _save_exec
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ proc exec {cmd args} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global gitversion
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$cmd ne [macports::findBinary git] || [lindex $args 0] ne "--version"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [_save_exec $cmd {*}$args]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return "git version $gitversion (Apple Git-23)"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set git_vcsupdate_cleanup {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ removeDirectory macports-test-git-repo $tempdir
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rename exec ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rename _save_exec exec
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span>
test GetVCSUpdateCmd-git {
Tests GetVCSUpdateCmd on a valid Git repository with Git >= 1.8.4
} -constraints {
hasGit
<span style='display:block; white-space:pre;background:#ffe0e0;'>- hasGitAutostash
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -setup {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set repo [makeDirectory macports-test-git-repo $tempdir]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exec $git init $repo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -body {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} -setup $git_vcsupdate_fixture -body {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global gitversion
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set gitversion "1.8.6"
</span> string map [list $git GIT $repo REPO] [macports::GetVCSUpdateCmd $repo]
<span style='display:block; white-space:pre;background:#ffe0e0;'>-} -cleanup {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- removeDirectory macports-test-git-repo $tempdir
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -result {Git {GIT pull --rebase --autostash} REPO}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} -cleanup $git_vcsupdate_cleanup -result {Git {GIT pull --rebase --autostash} REPO}
</span>
test GetVCSUpdateCmd-git-noautostash {
Tests GetVCSUpdateCmd on a valid Git repository with Git < 1.8.4
} -constraints {
hasGit
<span style='display:block; white-space:pre;background:#ffe0e0;'>- hasNoGitAutostash
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -setup {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set repo [makeDirectory macports-test-git-repo $tempdir]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exec $git init $repo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -body {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} -setup $git_vcsupdate_fixture -body {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global giversion
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set gitversion "1.8.2"
</span> string map [list $git GIT $repo REPO] [macports::GetVCSUpdateCmd $repo]
<span style='display:block; white-space:pre;background:#ffe0e0;'>-} -cleanup {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- removeDirectory macports-test-git-repo $tempdir
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-} -result {Git {GIT pull --rebase} REPO}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} -cleanup $git_vcsupdate_cleanup -result {Git {GIT pull --rebase} REPO}
</span>
testConstraint hasGitSvn [expr {
![catch {macports::findBinary git} git] &&
</pre><pre style='margin:0'>
</pre>