From patchwork Tue Jun 11 11:59:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13693593 Received: from wfout5-smtp.messagingengine.com (wfout5-smtp.messagingengine.com [64.147.123.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19D621791FC for ; Tue, 11 Jun 2024 11:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718107151; cv=none; b=d8vbjLxQc4rAIsStwZxt/qWQmpy2mdNohyTM35UJFoOJockqlLF0a+hZDLpcbVrcxH1Le2EUvejuwxTewwdUNsCv7UBhqhGHqyW07pE/lqZatE0PSlKdHyFtidKEfacOTCRi3j9MsKUziHmflYBaXRQ4PoAu1nlBQXA4lgNgZ3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718107151; c=relaxed/simple; bh=g8n9fbS9PoJSwboy0R0RG+xlTa1mJfdiieMXK5lVbmE=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pYkqlVOzl0Cu+vFBoM9CokW8jBLo5ycNS9viNY5QjVVAyIlzdpdqxptptJts06t3CjWGu3ft1nbgTp5of0sYtptDYgMeyRq582/dWEZ13dhHKV6+bJq4slE+RJoMjixmjSJoA/Ru0QSsk1H+xYOKF13cMDkxrhhSLnwO0fEUmCs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=eBFPS00m; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=fAtrkxE9; arc=none smtp.client-ip=64.147.123.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="eBFPS00m"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fAtrkxE9" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.west.internal (Postfix) with ESMTP id 548891C000F7 for ; Tue, 11 Jun 2024 07:59:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 11 Jun 2024 07:59:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1718107148; x=1718193548; bh=qxBxef0hWF enmkaaQaBMN+DPGKYiWvdVOb4qn0SMfAE=; b=eBFPS00m8BGFqxZ4Hvcy4UITuI 3kapXc09IwYJte/53Tjj22QNmAUyP05y6RE2aXPtyboig9p4F6OXywlYZZ0PVjRk AFCS1MeTpsvNs3uVV1YBvTL5y3XIHg1rd222FlMJGT8mNWjLQM/tmBtEor2fR3Xm Dlrlx5C+WsvfMwfiDoB6LU7bps7F+P0eROlCrT7e1XvZnUfh1rPGNmzeGnDNn/Qi r6RpXkDEauMWqbXyaFtBtes6RdbIpDkQLjOB2dox8YgZgj465bbxose10hcDI0HN PwYMcnhW3RCMU0g8z473pS5uWeCVe9QOThxWh2rGMSCsWU6BfRYkm8+pTJbg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1718107148; x=1718193548; bh=qxBxef0hWFenmkaaQaBMN+DPGKYi WvdVOb4qn0SMfAE=; b=fAtrkxE9Uw3eJM0rvlx3Trf/Td0jFAuOgwDHeRq4ecsn bbI06uMpMPBOa/nH81zjns7J/a9UU1EL1alv4fvmvQ0ek330aJjSDYi3Jk3PuYuE Nfi/IFKT50YkRl4xBLAnWev+EHSY4C0qL507/WNLP8NgXo9og4hjY6fVhojb9dyb EjsfZuTU2juTHg3XUx9CR9NOIkFV/mX7cDL63LMDEVTrSTYlmy4f2HREXKfq3c7m IW2BPwtUiDzQL2ZNwGtfRSmqTrcyd2BsiARgTXbRll9sjtRQo/xwCITr2hoOww/+ Mb6vQ7Mtw+fAd3nA3AYzqNdrt7MD0znKTYV4Nnzd2g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeduvddggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesghdtre ertddtvdenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehp khhsrdhimheqnecuggftrfgrthhtvghrnhepheeghfdtfeeuffehkefgffduleffjedthf dvjeektdfhhedvlefgtefgvdettdfhnecuvehluhhsthgvrhfuihiivgepudenucfrrghr rghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 11 Jun 2024 07:59:08 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id d55004ae (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Tue, 11 Jun 2024 11:58:59 +0000 (UTC) Date: Tue, 11 Jun 2024 13:59:05 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Subject: [PATCH 20/21] t/helper: remove dependency on `the_repository` in "proc-receive" Message-ID: <97fa3051fac18aa57b2930425271935762814462.1718106285.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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 --- 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 []", @@ -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);