only checkout the target branch when topgit is used

This commit is contained in:
Tino Breddin 2014-07-31 21:42:13 +02:00 committed by Eelco Dolstra
parent 55aaf807eb
commit 5ebc2e5419

View file

@ -39,14 +39,14 @@ sub _cloneRepo {
# to determine if this is a top-git branch. # to determine if this is a top-git branch.
if (defined $deepClone) { if (defined $deepClone) {
# Checkout the branch to look at its content. # Is the target branch a topgit branch?
$res = run(cmd => ["git", "checkout", "--force", "$branch"], dir => $clonePath); $res = run(cmd => ["git", "ls-tree", "-r", "$branch", ".topgit"], dir => $clonePath);
die "error checking out Git branch '$branch' at `$uri':\n$res->{stderr}" if $res->{status};
# Clean to remove potentially present artifacts after forcing branch switch if ($res->{stdout} != "") {
$res = run(cmd => ["git", "clean", "-d", "-x", "--force", "--force"], dir => $clonePath); # Checkout the branch to look at its content.
print STDERR "warning: `git clean -d -x --force --force' failed::\n$res->{stderr}" if $res->{status}; $res = run(cmd => ["git", "checkout", "--force", "$branch"], dir => $clonePath);
die "error checking out Git branch '$branch' at `$uri':\n$res->{stderr}" if $res->{status};
if (-f ".topdeps") {
# This is a TopGit branch. Fetch all the topic branches so # This is a TopGit branch. Fetch all the topic branches so
# that builders can run "tg patch" and similar. # that builders can run "tg patch" and similar.
$res = run(cmd => ["tg", "remote", "--populate", "origin"], dir => $clonePath, timeout => 600); $res = run(cmd => ["tg", "remote", "--populate", "origin"], dir => $clonePath, timeout => 600);