[PATCH v2 19/20] t/helper: remove dependency on `the_repository` in "proc-receive"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ps@xxxxxx>
---
 t/helper/test-proc-receive.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c
index f30022d222..29361c7aab 100644
--- a/t/helper/test-proc-receive.c
+++ b/t/helper/test-proc-receive.c
@@ -3,8 +3,8 @@
 #include "hex.h"
 #include "parse-options.h"
 #include "pkt-line.h"
-#include "setup.h"
 #include "sigchain.h"
+#include "string-list.h"
 
 static const char *proc_receive_usage[] = {
 	"test-tool proc-receive [<options>]",
@@ -92,9 +92,9 @@ static void proc_receive_read_commands(struct packet_reader *reader,
 		if (die_read_commands)
 			die("die with the --die-read-commands option");
 
-		if (parse_oid_hex(reader->line, &old_oid, &p) ||
+		if (parse_oid_hex_any(reader->line, &old_oid, &p) == GIT_HASH_UNKNOWN ||
 		    *p++ != ' ' ||
-		    parse_oid_hex(p, &new_oid, &p) ||
+		    parse_oid_hex_any(p, &new_oid, &p) == GIT_HASH_UNKNOWN ||
 		    *p++ != ' ')
 			die("protocol error: expected 'old new ref', got '%s'",
 			    reader->line);
@@ -128,7 +128,6 @@ static void proc_receive_read_push_options(struct packet_reader *reader,
 
 int cmd__proc_receive(int argc, const char **argv)
 {
-	int nongit_ok = 0;
 	struct packet_reader reader;
 	struct command *commands = NULL;
 	struct string_list push_options = STRING_LIST_INIT_DUP;
@@ -154,8 +153,6 @@ int cmd__proc_receive(int argc, const char **argv)
 		OPT_END()
 	};
 
-	setup_git_directory_gently(&nongit_ok);
-
 	argc = parse_options(argc, argv, "test-tools", options, proc_receive_usage, 0);
 	if (argc > 0)
 		usage_msg_opt("Too many arguments.", proc_receive_usage, options);
-- 
2.45.2.457.g8d94cfb545.dirty

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux