Skip to content

Commit 912d475

Browse files
pks-tgitster
authored andcommitted
t/helper: remove dependency on the_repository in "proc-receive"
The "proc-receive" test helper implicitly relies on `the_repository` via `parse_oid_hex()`. This isn't necessary though, and in fact the whole command does not depend on `the_repository` at all. Stop setting up `the_repository` and use `parse_oid_hex_any()` to parse object IDs. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8e9a1d0 commit 912d475

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

t/helper/test-proc-receive.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include "hex.h"
44
#include "parse-options.h"
55
#include "pkt-line.h"
6-
#include "setup.h"
76
#include "sigchain.h"
7+
#include "string-list.h"
88

99
static const char *proc_receive_usage[] = {
1010
"test-tool proc-receive [<options>]",
@@ -92,9 +92,9 @@ static void proc_receive_read_commands(struct packet_reader *reader,
9292
if (die_read_commands)
9393
die("die with the --die-read-commands option");
9494

95-
if (parse_oid_hex(reader->line, &old_oid, &p) ||
95+
if (parse_oid_hex_any(reader->line, &old_oid, &p) == GIT_HASH_UNKNOWN ||
9696
*p++ != ' ' ||
97-
parse_oid_hex(p, &new_oid, &p) ||
97+
parse_oid_hex_any(p, &new_oid, &p) == GIT_HASH_UNKNOWN ||
9898
*p++ != ' ')
9999
die("protocol error: expected 'old new ref', got '%s'",
100100
reader->line);
@@ -128,7 +128,6 @@ static void proc_receive_read_push_options(struct packet_reader *reader,
128128

129129
int cmd__proc_receive(int argc, const char **argv)
130130
{
131-
int nongit_ok = 0;
132131
struct packet_reader reader;
133132
struct command *commands = NULL;
134133
struct string_list push_options = STRING_LIST_INIT_DUP;
@@ -154,8 +153,6 @@ int cmd__proc_receive(int argc, const char **argv)
154153
OPT_END()
155154
};
156155

157-
setup_git_directory_gently(&nongit_ok);
158-
159156
argc = parse_options(argc, argv, "test-tools", options, proc_receive_usage, 0);
160157
if (argc > 0)
161158
usage_msg_opt("Too many arguments.", proc_receive_usage, options);

0 commit comments

Comments
 (0)