The following commit has been merged in the master branch:
commit 13bac7cc32c9bb4567392359745aec34a46caf7b
Author: Bernhard R. Link <[email protected]>
Date: Sun Jan 8 13:52:27 2012 +0100
debcheckout: allow specifying branch in git repro identifiers
Add support for Vcs-Git to specify a branch to checkout using -b.
(git-clone -b was introduced in git v1.6.5-rc0,
so should available since squeeze).
Signed-off-by: Bernhard R. Link <[email protected]>
diff --git a/scripts/debcheckout.pl b/scripts/debcheckout.pl
index 3e23505..2e99061 100755
--- a/scripts/debcheckout.pl
+++ b/scripts/debcheckout.pl
@@ -511,7 +511,13 @@ sub checkout_repo($$$) {
@cmd = ("cvs", "-d", $root, "checkout", $module);
}
when ("darcs") { @cmd = ("darcs", "get", $repo_url); }
- when ("git") { @cmd = ("git", "clone", $repo_url); }
+ when ("git") {
+ if ($repo_url =~ m|(.*)\s+-b\s+(.*)|) {
+ @cmd = ("git", "clone", $1, "-b", $2);
+ } else {
+ @cmd = ("git", "clone", $repo_url);
+ }
+ }
when ("hg") { @cmd = ("hg", "clone", $repo_url); }
when ("svn") { @cmd = ("svn", "co", $repo_url); }
default { die "unsupported version control system '$repo_type'.\n"; }
@@ -877,6 +883,7 @@ sub print_repo($$) {
sub git_ls_remote($$) {
my ($url, $prefix) = @_;
+ $url =~ s|\s+-b\s+.*||;
my $cmd = "git ls-remote '$url'";
$cmd .= " '$prefix/*'" if length $prefix;
open GIT, "$cmd |" or die "can't execute $cmd\n";
@@ -995,7 +1002,7 @@ sub main() {
$pkg = $1;
} elsif ($repo_url =~ m!([a-z0-9.+-]+)/trunk/?!) { # svn with
$pkg/{trunk,tags,branches}
$pkg = $1;
- } elsif ($repo_url =~ /([a-z0-9.+-]+)\.git$/) { # git
+ } elsif ($repo_url =~ /([a-z0-9.+-]+)\.git(\s+-b\s+.*)?$/) { # git
$pkg = $1;
} elsif ($repo_url =~ /([a-z0-9.+-]+)$/) { # catch-all
$pkg = $1;
--
Git repository for devscripts
--
To unsubscribe, send mail to [email protected].