On Wed, May 10, 2006 at 05:11:17PM -0700, Linus Torvalds wrote: > I also think we could do with a few scripts to just do setup of a remote > repo: > > git remote clone <remoteaddress> > git remote branch <remoteaddress> [-D] > git remote fsck <remoteaddress> > git remote repack <remoteaddress> -a -d Here's a 'git remote' that handles the easy commands. It makes things like 'git remote origin repack -a -d' do what you expect. The biggest problems are: - it only works for ssh remotes - it assumes your remote path is a git dir (do we have a usual way of deciding between $path and $path/.git?) - ssh'ing will mangle your shell quoting in the command arguments - the url parsing is somewhat ad-hoc (do we have a usual way of parsing urls for shell scripts?) --- Add braindead git-remote script. This script is a convenience wrapper for performing remote commands on a repository using ssh. --- Makefile | 2 +- git-remote.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletions(-) create mode 100644 git-remote.sh 8810ae2524d3339b8a8341b34b2d3f14ddb9c899 diff --git a/Makefile b/Makefile index 37fbe78..58eddd8 100644 --- a/Makefile +++ b/Makefile @@ -125,7 +125,7 @@ SCRIPT_SH = \ git-applymbox.sh git-applypatch.sh git-am.sh \ git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ git-merge-resolve.sh git-merge-ours.sh git-grep.sh \ - git-lost-found.sh + git-lost-found.sh git-remote.sh SCRIPT_PERL = \ git-archimport.perl git-cvsimport.perl git-relink.perl \ diff --git a/git-remote.sh b/git-remote.sh new file mode 100644 index 0000000..04b1ce9 --- /dev/null +++ b/git-remote.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +USAGE='<remote> <command> [options]' +. git-sh-setup +. git-parse-remote + +case "$#" in + 0|1) usage ;; +esac + +remote=`get_remote_url "$1"` shift; +case "$remote" in + ssh://*|git+ssh://*|ssh+git://*) + host=`echo "$remote" | sed 's!^[^/]*://\([^/]*\).*!\1!'` + path=`echo "$remote" | sed 's!^[^/]*://[^/]*\(.*\)!\1!'` + exec ssh -n $host "GIT_DIR=$path git $@" + ;; + *) die "unhandled protocol: $remote" ;; +esac -- 1.3.1 - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html