summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdgit9
-rw-r--r--dgit.14
-rwxr-xr-xinfra/dgit-ssh-dispatch8
-rwxr-xr-xtests/tests/dsd-clone-drs17
4 files changed, 38 insertions, 0 deletions
diff --git a/dgit b/dgit
index 863104b..f314bda 100755
--- a/dgit
+++ b/dgit
@@ -2636,6 +2636,15 @@ sub cmd_archive_api_query {
exec @cmd or fail "exec curl: $!\n";
}
+sub cmd_clone_dgit_repos_server {
+ badusage "need destination argument" unless @ARGV==1;
+ my ($destdir) = @ARGV;
+ $package = '_dgit-repos-server';
+ my @cmd = (@git, qw(clone), access_giturl(), $destdir);
+ debugcmd ">",@cmd;
+ exec @cmd or fail "exec git clone: $!\n";
+}
+
#---------- argument parsing and main program ----------
sub cmd_version {
diff --git a/dgit.1 b/dgit.1
index ed4c6b1..72b16a0 100644
--- a/dgit.1
+++ b/dgit.1
@@ -202,6 +202,10 @@ ask it to generate a single squashed patch instead.
.TP
.B dgit version
Prints version information and exits.
+.TP
+.BI "dgit clone-dgit-repos-server" " destdir"
+Tries to fetch a copy of the source code for the dgit-repos-server,
+as actually being used on the dgit git server, as a git tree.
.SH OPTIONS
.TP
.BR --dry-run | -n
diff --git a/infra/dgit-ssh-dispatch b/infra/dgit-ssh-dispatch
index e1fc241..377f8b8 100755
--- a/infra/dgit-ssh-dispatch
+++ b/infra/dgit-ssh-dispatch
@@ -139,6 +139,14 @@ sub dispatch () {
} else {
die "unsupported git operation $cmd ($_)";
}
+ } elsif (
+ m#^${qre}git-upload-pack ${qre}/dgit/($lre)/(?:repos/)?_dgit-repos-server\.git${qre}$#
+ ) {
+ my $distro= $1;
+ serve_up("$dispatchdir/distro=$1/dgit-live/.git");
+ } elsif (m#^${qre}git-upload-pack\s#) {
+ die "unknown repo to serve ($_). use dgit, or for server source ".
+ "git clone here:/dgit/DISTRO/repos/_dgit-repos-server.git";
} else {
die "unsupported operation ($_)";
}
diff --git a/tests/tests/dsd-clone-drs b/tests/tests/dsd-clone-drs
new file mode 100755
index 0000000..3474160
--- /dev/null
+++ b/tests/tests/dsd-clone-drs
@@ -0,0 +1,17 @@
+#!/bin/bash
+set -e
+. tests/lib
+if ! test -d $root/.git; then
+ echo >&2 'not running out of git clone, cannot test self-clone'
+ exit 0
+fi
+
+t-dsd
+
+cd $tmp
+t-dgit clone-dgit-repos-server drs-cloned
+
+cd drs-cloned
+ls -al infra/dgit-repos-server
+
+echo ok.