remote-fd/ext: finishing touches after code review
When compiling with pthread support, transport-helper.c needs to include necessary header files. Also fix a few error messages in remote-ext and remote-fd programs, and a potential buffer underrun in remote-fd. In the documentation, clarify how %G and %V are used; the old description looked as if they take repository/vhost parameters, which was wrong. Also fix AsciiDoc markup for the page title of remote-fd/remote-ext manpages, and tweak the way how section headers are shown. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ilari Liusvaara committed
Nov 17, 2010 at 09:15 UTC
7851b1e60fabe350216d48e6de03a3ed21a49953
5 files changed
+21
-18
Documentation/git-remote-ext.txt
+5
-5
@@ -39,20 +39,20 @@ The following sequences have a special meaning:
39
git-upload-pack, or git-upload-archive) of the service
40
git wants to invoke.
41
42
-'%G<repository>' (as argument)::
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 <repository>. Default is not to send
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<host>' (as argument)::
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. Default is not to
55
- send vhost in such request (if sent).
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
----------------------
Documentation/git-remote-fd.txt
+5
-5
@@ -1,5 +1,5 @@
1
git-remote-fd(1)
2
-=================
2
+================
3
4
NAME
5
----
@@ -28,13 +28,13 @@ It is assumed that any handshaking procedures have already been completed
28
information to user in the URL in case that URL is displayed in some
29
context.
30
31
-ENVIRONMENT VARIABLES:
32
-----------------------
31
+ENVIRONMENT VARIABLES
32
+---------------------
33
GIT_TRANSLOOP_DEBUG::
34
If set, prints debugging information about various reads/writes.
35
36
-EXAMPLES:
37
----------
36
+EXAMPLES
37
+--------
38
git fetch fd::17 master::
39
Fetch master, using file descriptor #17 to communicate with
40
git-upload-pack.
builtin/remote-ext.c
+3
-5
@@ -142,7 +142,7 @@ static const char **parse_argv(const char *arg, const char *service)
142
for (i = 0; i < arguments; i++)
143
ret[i] = temparray[i];
144
ret[arguments] = NULL;
145
- return (const char **)ret;
145
+ return ret;
146
}
147
148
static void send_git_request(int stdin_fd, const char *serv, const char *repo,
@@ -239,10 +239,8 @@ static int command_loop(const char *child)
239
240
int cmd_remote_ext(int argc, const char **argv, const char *prefix)
241
{
242
- if (argc < 3) {
243
- fprintf(stderr, "Error: URL missing");
244
- exit(1);
245
- }
242
+ if (argc != 3)
243
+ die("Expected two arguments");
244
245
return command_loop(argv[2]);
246
}
builtin/remote-fd.c
+3
-3
@@ -31,7 +31,7 @@ static void command_loop(int input_fd, int output_fd)
31
}
32
/* Strip end of line characters. */
33
i = strlen(buffer);
34
- while (isspace(buffer[i - 1]))
34
+ while (i > 0 && isspace(buffer[i - 1]))
35
buffer[--i] = 0;
36
37
if (!strcmp(buffer, "capabilities")) {
@@ -56,8 +56,8 @@ int cmd_remote_fd(int argc, const char **argv, const char *prefix)
56
int output_fd = -1;
57
char *end;
58
59
- if (argc < 3)
60
- die("URL missing");
59
+ if (argc != 3)
60
+ die("Expected two arguments");
61
62
input_fd = (int)strtoul(argv[2], &end, 10);
63
transport-helper.c
+5
@@ -9,6 +9,11 @@
9
#include "remote.h"
10
#include "string-list.h"
11
12
+#ifndef NO_PTHREADS
13
+#include <pthread.h>
14
+#include "thread-utils.h"
15
+#endif
16
+
17
static int debug;
18
19
struct helper_data