From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id F10781F451 for ; Thu, 18 Jan 2024 00:56:41 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=sasl header.b=UcV19W0m; dkim-atps=neutral Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 68A201F244F1 for ; Thu, 18 Jan 2024 00:56:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED56C1C06; Thu, 18 Jan 2024 00:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b="UcV19W0m" Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) (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 D1AE317C3 for ; Thu, 18 Jan 2024 00:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.108.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705539390; cv=none; b=ZRua7ER+12wKIc+MkFnAvQD/GEuQ9llJ7NVtmyJsiKEVgvTouDOJ4vAC8UFE0RcJS6qjvTHVF/G5PzxvIAfq8u5bUhJ+oUOtO6J7J2BQKYLxf+WFIPvv8CONjtiNZ0Kg61SVfWUIm5JZvsHT/q2/yNs2vgAoWaJ6mXLJoQw5GE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705539390; c=relaxed/simple; bh=yxvGt/H9fLB+h6Jv67R/RM2074BmilIn4zEygZ9ZtYA=; h=Received:DKIM-Signature:Received:Received:From:To:Cc:Subject: In-Reply-To:References:Date:Message-ID:User-Agent:MIME-Version: Content-Type:X-Pobox-Relay-ID; b=fOqfUb3UhhPOVZmcA1tyrTsVmuX/t7lwOJEO7+7WNoGghPYZ3tQH0caGbQUYXXARP6jdb4bQKJAHZXlfVI0xA1AvAqI0CDZ/RLLz4+mrzDyHrtcHx8GKx5mzPIbkiWt1n78DLfmQV2yuS/9vfCyeGdXNU90UAdlO2L5wgmW5tBs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b=UcV19W0m; arc=none smtp.client-ip=64.147.108.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 079011C3A00; Wed, 17 Jan 2024 19:56:27 -0500 (EST) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=yxvGt/H9fLB+h6Jv67R/RM2074BmilIn4zEygZ 9ZtYA=; b=UcV19W0m6+aeZAJUBajkdG7gM8WoZ/QCt/JdPwreGz8aa1/dQYtB9A rwN8THYw+JEe6St1DavC+VSLwbx8Phj+kk/l+jm/1RZI3ixYcknvAsRoFa4a5D0t zjq2YXnE9RLHkfHADPFlw5gkBIbmT6zt82VxX5/ZIS1TP9D281fcw= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id F27CF1C39FE; Wed, 17 Jan 2024 19:56:26 -0500 (EST) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.125.200.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 5A7DB1C39FC; Wed, 17 Jan 2024 19:56:26 -0500 (EST) (envelope-from junio@pobox.com) From: Junio C Hamano To: "John Cai via GitGitGadget" Cc: git@vger.kernel.org, John Cai Subject: Re: [PATCH 03/12] t1414: convert test to use Git commands instead of writing refs manually In-Reply-To: <19233aa0d4496b66d67fbee82fb8d9b6b35a03cb.1705521155.git.gitgitgadget@gmail.com> (John Cai via GitGitGadget's message of "Wed, 17 Jan 2024 19:52:26 +0000") References: <19233aa0d4496b66d67fbee82fb8d9b6b35a03cb.1705521155.git.gitgitgadget@gmail.com> Date: Wed, 17 Jan 2024 16:56:25 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 6843A6C0-B59C-11EE-AD86-78DCEB2EC81B-77302942!pb-smtp1.pobox.com "John Cai via GitGitGadget" writes: > # Create a situation where the reflog and ref database disagree about the latest > # state of HEAD. > -test_expect_success REFFILES 'walk prefers reflog to ref tip' ' > +test_expect_success 'walk prefers reflog to ref tip' ' > + test_commit A && > + test_commit B && > + git reflog delete HEAD@{0} && > head=$(git rev-parse HEAD) && > + A=$(git rev-parse A) && > > + echo $A >expect && You do not need an intermediate variable A, i.e. git rev-parse A >expect && would suffice. Also it seems that $head is no longer used because you do not manufacture a reflog entry yourself, so the two assignments to $A and $head can be removed. > git log -g --format=%H -1 >actual && > test_cmp expect actual > ' The resulting code makes the intent of the test much clearer. Nicely done.