Re: Implementing branch attributes in git config

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>
Date: Thursday, May 11, 2006 - 5:51 am

On Wed, May 10, 2006 at 05:11:17PM -0700, Linus Torvalds wrote:


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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Implementing branch attributes in git config, Junio C Hamano, (Tue May 9, 2:03 pm)
Re: Implementing branch attributes in git config, Linus Torvalds, (Tue May 9, 3:24 pm)
Re: Implementing branch attributes in git config, Junio C Hamano, (Thu May 11, 1:22 pm)
Re: Implementing branch attributes in git config, Linus Torvalds, (Tue May 9, 8:17 pm)
Re: Implementing branch attributes in git config, Linus Torvalds, (Tue May 9, 10:08 pm)
Re: Implementing branch attributes in git config, Martin Langhoff, (Wed May 10, 3:19 am)
Re: Implementing branch attributes in git config, Linus Torvalds, (Wed May 10, 11:37 am)
Re: Implementing branch attributes in git config, Martin Langhoff, (Wed May 10, 7:17 pm)
Re: Implementing branch attributes in git config, Linus Torvalds, (Wed May 10, 7:55 pm)
Re: Implementing branch attributes in git config, Nicolas Pitre, (Wed May 10, 9:53 pm)
Re: Implementing branch attributes in git config, Martin Langhoff, (Wed May 10, 8:13 pm)
Re: Implementing branch attributes in git config, Johannes Schindelin, (Thu May 11, 6:30 am)
Re: Implementing branch attributes in git config, Linus Torvalds, (Wed May 10, 8:11 pm)
Re: Implementing branch attributes in git config, Jeff King, (Thu May 11, 5:51 am)
Re: Implementing branch attributes in git config, Jeff King, (Thu May 11, 7:39 am)
Re: Implementing branch attributes in git config, Johannes Schindelin, (Wed May 10, 7:07 am)
Re: Implementing branch attributes in git config, Junio C Hamano, (Tue May 9, 6:42 pm)