Skip to content

Commit 3d90c79

Browse files
committed
Merge branch 'il/remote-fd-ext'
* il/remote-fd-ext: remote-fd/ext: finishing touches after code review git-remote-ext git-remote-fd Add bidirectional_transfer_loop() Conflicts: compat/mingw.h
2 parents 23778ae + 7851b1e commit 3d90c79

11 files changed

Lines changed: 837 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
/git-remote-https
113113
/git-remote-ftp
114114
/git-remote-ftps
115+
/git-remote-fd
116+
/git-remote-ext
115117
/git-remote-testgit
116118
/git-repack
117119
/git-replace

Documentation/git-remote-ext.txt

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
git-remote-ext(1)
2+
=================
3+
4+
NAME
5+
----
6+
git-remote-ext - Bridge smart transport to external command.
7+
8+
SYNOPSIS
9+
--------
10+
git remote add nick "ext::<command>[ <arguments>...]"
11+
12+
DESCRIPTION
13+
-----------
14+
This remote helper uses the specified 'program' to connect
15+
to a remote git server.
16+
17+
Data written to stdin of this specified 'program' is assumed
18+
to be sent to git:// server, git-upload-pack, git-receive-pack
19+
or git-upload-archive (depending on situation), and data read
20+
from stdout of this program is assumed to be received from
21+
the same service.
22+
23+
Command and arguments are separated by unescaped space.
24+
25+
The following sequences have a special meaning:
26+
27+
'% '::
28+
Literal space in command or argument.
29+
30+
'%%'::
31+
Literal percent sign.
32+
33+
'%s'::
34+
Replaced with name (receive-pack, upload-pack, or
35+
upload-archive) of the service git wants to invoke.
36+
37+
'%S'::
38+
Replaced with long name (git-receive-pack,
39+
git-upload-pack, or git-upload-archive) of the service
40+
git wants to invoke.
41+
42+
'%G' (must be first characters in argument)::
43+
This argument will not be passed to 'program'. Instead, it
44+
will cause helper to start by sending git:// service request to
45+
remote side with service field set to approiate value and
46+
repository field set to rest of the argument. Default is not to send
47+
such request.
48+
+
49+
This is useful if remote side is git:// server accessed over
50+
some tunnel.
51+
52+
'%V' (must be first characters in argument)::
53+
This argument will not be passed to 'program'. Instead it sets
54+
the vhost field in git:// service request (to rest of the argument).
55+
Default is not to send vhost in such request (if sent).
56+
57+
ENVIRONMENT VARIABLES:
58+
----------------------
59+
60+
GIT_TRANSLOOP_DEBUG::
61+
If set, prints debugging information about various reads/writes.
62+
63+
ENVIRONMENT VARIABLES PASSED TO COMMAND:
64+
----------------------------------------
65+
66+
GIT_EXT_SERVICE::
67+
Set to long name (git-upload-pack, etc...) of service helper needs
68+
to invoke.
69+
70+
GIT_EXT_SERVICE_NOPREFIX::
71+
Set to long name (upload-pack, etc...) of service helper needs
72+
to invoke.
73+
74+
75+
EXAMPLES:
76+
---------
77+
This remote helper is transparently used by git when
78+
you use commands such as "git fetch <URL>", "git clone <URL>",
79+
, "git push <URL>" or "git remote add nick <URL>", where <URL>
80+
begins with `ext::`. Examples:
81+
82+
"ext::ssh -i /home/foo/.ssh/somekey user&#64;host.example %S 'foo/repo'"::
83+
Like host.example:foo/repo, but use /home/foo/.ssh/somekey as
84+
keypair and user as user on remote side. This avoids needing to
85+
edit .ssh/config.
86+
87+
"ext::socat -t3600 - ABSTRACT-CONNECT:/git-server %G/somerepo"::
88+
Represents repository with path /somerepo accessable over
89+
git protocol at abstract namespace address /git-server.
90+
91+
"ext::git-server-alias foo %G/repo"::
92+
Represents a repository with path /repo accessed using the
93+
helper program "git-server-alias foo". The path to the
94+
repository and type of request are not passed on the command
95+
line but as part of the protocol stream, as usual with git://
96+
protocol.
97+
98+
"ext::git-server-alias foo %G/repo %Vfoo"::
99+
Represents a repository with path /repo accessed using the
100+
helper program "git-server-alias foo". The hostname for the
101+
remote server passed in the protocol stream will be "foo"
102+
(this allows multiple virtual git servers to share a
103+
link-level address).
104+
105+
"ext::git-server-alias foo %G/repo% with% spaces %Vfoo"::
106+
Represents a repository with path '/repo with spaces' accessed
107+
using the helper program "git-server-alias foo". The hostname for
108+
the remote server passed in the protocol stream will be "foo"
109+
(this allows multiple virtual git servers to share a
110+
link-level address).
111+
112+
"ext::git-ssl foo.example /bar"::
113+
Represents a repository accessed using the helper program
114+
"git-ssl foo.example /bar". The type of request can be
115+
determined by the helper using environment variables (see
116+
above).
117+
118+
Documentation
119+
--------------
120+
Documentation by Ilari Liusvaara, Jonathan Nieder and the git list
121+
<git@vger.kernel.org>
122+
123+
GIT
124+
---
125+
Part of the linkgit:git[1] suite

Documentation/git-remote-fd.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
git-remote-fd(1)
2+
================
3+
4+
NAME
5+
----
6+
git-remote-fd - Reflect smart transport stream back to caller
7+
8+
SYNOPSIS
9+
--------
10+
"fd::<infd>[,<outfd>][/<anything>]" (as URL)
11+
12+
DESCRIPTION
13+
-----------
14+
This helper uses specified file descriptors to connect to remote git server.
15+
This is not meant for end users but for programs and scripts calling git
16+
fetch, push or archive.
17+
18+
If only <infd> is given, it is assumed to be bidirectional socket connected
19+
to remote git server (git-upload-pack, git-receive-pack or
20+
git-upload-achive). If both <infd> and <outfd> are given, they are assumed
21+
to be pipes connected to remote git server (<infd> being the inbound pipe
22+
and <outfd> being the outbound pipe.
23+
24+
It is assumed that any handshaking procedures have already been completed
25+
(such as sending service request for git://) before this helper is started.
26+
27+
<anything> can be any string. It is ignored. It is meant for provoding
28+
information to user in the URL in case that URL is displayed in some
29+
context.
30+
31+
ENVIRONMENT VARIABLES
32+
---------------------
33+
GIT_TRANSLOOP_DEBUG::
34+
If set, prints debugging information about various reads/writes.
35+
36+
EXAMPLES
37+
--------
38+
git fetch fd::17 master::
39+
Fetch master, using file descriptor #17 to communicate with
40+
git-upload-pack.
41+
42+
git fetch fd::17/foo master::
43+
Same as above.
44+
45+
git push fd::7,8 master (as URL)::
46+
Push master, using file descriptor #7 to read data from
47+
git-receive-pack and file descriptor #8 to write data to
48+
same service.
49+
50+
git push fd::7,8/bar master::
51+
Same as above.
52+
53+
Documentation
54+
--------------
55+
Documentation by Ilari Liusvaara and the git list <git@vger.kernel.org>
56+
57+
GIT
58+
---
59+
Part of the linkgit:git[1] suite

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,8 @@ BUILTIN_OBJS += builtin/read-tree.o
739739
BUILTIN_OBJS += builtin/receive-pack.o
740740
BUILTIN_OBJS += builtin/reflog.o
741741
BUILTIN_OBJS += builtin/remote.o
742+
BUILTIN_OBJS += builtin/remote-ext.o
743+
BUILTIN_OBJS += builtin/remote-fd.o
742744
BUILTIN_OBJS += builtin/replace.o
743745
BUILTIN_OBJS += builtin/rerere.o
744746
BUILTIN_OBJS += builtin/reset.o

builtin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ extern int cmd_read_tree(int argc, const char **argv, const char *prefix);
108108
extern int cmd_receive_pack(int argc, const char **argv, const char *prefix);
109109
extern int cmd_reflog(int argc, const char **argv, const char *prefix);
110110
extern int cmd_remote(int argc, const char **argv, const char *prefix);
111+
extern int cmd_remote_ext(int argc, const char **argv, const char *prefix);
112+
extern int cmd_remote_fd(int argc, const char **argv, const char *prefix);
111113
extern int cmd_config(int argc, const char **argv, const char *prefix);
112114
extern int cmd_rerere(int argc, const char **argv, const char *prefix);
113115
extern int cmd_reset(int argc, const char **argv, const char *prefix);

0 commit comments

Comments
 (0)