From patchwork Thu Mar 17 18:08:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12784427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9C81C433FE for ; Thu, 17 Mar 2022 18:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237182AbiCQSKP (ORCPT ); Thu, 17 Mar 2022 14:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237145AbiCQSKO (ORCPT ); Thu, 17 Mar 2022 14:10:14 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 609A61162B6 for ; Thu, 17 Mar 2022 11:08:57 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id a1so7099549wrh.10 for ; Thu, 17 Mar 2022 11:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rgu8zNsuzk0cMtndlG8lbYMfo7qxbFWDF94knNtZgOI=; b=Pl4hm2sxIO//8jsEzRcTB7bwWum4hRAl49EhNd50Wo2SrKSSbLaJD0rFpVe93iNSmE zfO8aT0SYa9bJYGgWqdvHhutY0TVlbI1ZCX01/kCEukceT9D5au3P1B4P5gTsKCkO6Pv eS26co5y980iEDoOOnigDcPdi72E035JMFVL/gJ5QFyR6eYtfMtlhMJ3/dzpj4r+U/5n /MFkyY8MEYWrlfzELVEy3B78jUC9UrO5gPp/1MeZkFfBXAKt3jceYoYHkO+XMHdcX63O 70a7Dv4DAEIcoVkspnPLPVVjRi8AbbNeEy50QhAGbDowNfycjmHZ99lvNReqLOKYaP3B praw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rgu8zNsuzk0cMtndlG8lbYMfo7qxbFWDF94knNtZgOI=; b=TyWc1bM9mmWzhM48MJtWqdkN+H7Uodu1ABdhLpo7g4hNMa+wlRgIZeEvdibyGCZ99d +J6qgMR7tO6lzhXg/j+mEMma6HpEFbOXzWro8RFI16tYU7RCQqOCdJeziDovKm4YgI6a 16fL2VvaQitDUrZ/U1JqfPKWoxbh1V97DA54a3pJ25hTAOzuSYTTBMROON8upnTTZlnX YvxDHrtyE4jDXQDEyHTiQ2P3hDdQbU4Rc4IfyhaSgJw94KgSZ2FeCdeiRncfQLRpUGkf nnfjwUE++LeCXesraYmEsTuTSsubh0d1np6tadMefJ/0PbmsOfO+qh54+gf3/tivX5um 3Q8g== X-Gm-Message-State: AOAM530h+oOZY/dkU1DvaYJaiOcNsH3NQ9nJlLLBBsVzjaiNlqoSdJHY B9K/E253jO7gjI5YE3YghO0atOY3PpmMgA== X-Google-Smtp-Source: ABdhPJy0Am/sHrWNv9udBRZ4X+ieg2IXYF5/tmJq1yPQrCwVjCFrONUD+5liYKg/khzEr0teLxU4nw== X-Received: by 2002:adf:f201:0:b0:1ed:c254:c1a2 with SMTP id p1-20020adff201000000b001edc254c1a2mr5110596wro.106.1647540535588; Thu, 17 Mar 2022 11:08:55 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id n8-20020a5d5988000000b00203d5f1f3e4sm4756253wri.105.2022.03.17.11.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 11:08:54 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , John Cai , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 1/8] reflog.c: indent argument lists Date: Thu, 17 Mar 2022 19:08:33 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1384.g7d2906948a1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When reflog.c was lib-ified in 7d3d226e700 (reflog: libify delete reflog function and helpers, 2022-03-02) these previously "static" functions were made non-"static", but the argument lists were not correspondingly indented according to our usual coding style. Let's do that. Signed-off-by: Ævar Arnfjörð Bjarmason --- reflog.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/reflog.c b/reflog.c index 333fd8708fe..82e5a935117 100644 --- a/reflog.c +++ b/reflog.c @@ -240,8 +240,8 @@ static int unreachable(struct expire_reflog_policy_cb *cb, struct commit *commit * Return true iff the specified reflog entry should be expired. */ int should_expire_reflog_ent(struct object_id *ooid, struct object_id *noid, - const char *email, timestamp_t timestamp, int tz, - const char *message, void *cb_data) + const char *email, timestamp_t timestamp, int tz, + const char *message, void *cb_data) { struct expire_reflog_policy_cb *cb = cb_data; struct commit *old_commit, *new_commit; @@ -273,10 +273,10 @@ int should_expire_reflog_ent(struct object_id *ooid, struct object_id *noid, } int should_expire_reflog_ent_verbose(struct object_id *ooid, - struct object_id *noid, - const char *email, - timestamp_t timestamp, int tz, - const char *message, void *cb_data) + struct object_id *noid, + const char *email, + timestamp_t timestamp, int tz, + const char *message, void *cb_data) { struct expire_reflog_policy_cb *cb = cb_data; int expire; @@ -323,8 +323,8 @@ static int is_head(const char *refname) } void reflog_expiry_prepare(const char *refname, - const struct object_id *oid, - void *cb_data) + const struct object_id *oid, + void *cb_data) { struct expire_reflog_policy_cb *cb = cb_data; struct commit_list *elem; @@ -377,8 +377,8 @@ void reflog_expiry_cleanup(void *cb_data) } int count_reflog_ent(struct object_id *ooid, struct object_id *noid, - const char *email, timestamp_t timestamp, int tz, - const char *message, void *cb_data) + const char *email, timestamp_t timestamp, int tz, + const char *message, void *cb_data) { struct cmd_reflog_expire_cb *cb = cb_data; if (!cb->expire_total || timestamp < cb->expire_total) From patchwork Thu Mar 17 18:08:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12784428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DCF7C433EF for ; Thu, 17 Mar 2022 18:09:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237185AbiCQSKQ (ORCPT ); Thu, 17 Mar 2022 14:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237180AbiCQSKP (ORCPT ); Thu, 17 Mar 2022 14:10:15 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14BF2114351 for ; Thu, 17 Mar 2022 11:08:58 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id h16so3033269wmd.0 for ; Thu, 17 Mar 2022 11:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h0ehVm2WXO0/ROC62XXLkfU/b6lpqMUbe8LHopB/tPc=; b=AE7ob5wwKTG+B/LDi9P7HCGIrzTBZOBU8TPj0o05pEiHrakni6dFBt959vIF/SXBMS EVu/goErqHonIBZjV+ktsJ4Q79s+sXabhKsnmET5A7ytFVfUaHQnvIGk+M1ecsZQ+6Of i/zXl0oaUhT/WOxJDyAuboJRAQhY+HC3tH+o+9js8ezvEoENmZBGQRCtc7j2CCbubzxx Qb7d6cVaEZpSVB+csBDZPmXuusZr9VqkMWC+p6srCMj7Pyq/2NdPJ2+ZU3XwoidMVO19 SNZXrTEdvL7FsN+bBA6LvnNyfg5fY4SzRq03wEcvGO4xilf7VybRd++yrKcFZmT9IHU6 15+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h0ehVm2WXO0/ROC62XXLkfU/b6lpqMUbe8LHopB/tPc=; b=T72BT0TRB17sgAeIMYlNd84aYFWdxzjqaGRbCosDrRRhXIQk3f9DTOC+8D5MFTAcdP H8/N4wGhju/jbpqcYCVL6ucAqD9jssEObplJDqCcAYLr9EUDiWZ6pmNnDK8za2Yi4E5/ /ZvPBk6+tdcKHaYamIUiO//O/uDP6+pFb+gHBcwnkqe/hiKMeP+kOKlH2f4/4YsAdo7+ SCezA7y7sC67EtAQKALILs+Fk5fAafRVo3KDEle8LWSJFU8zg3/QwqrzQmIMpt/Pyj5X t1+L46lh8vQzrOUrDl49dQvLKzhGxfvBFIOjGfNsRE1JLxbRBEpMaA0wsVi+awiIwNuL CdJA== X-Gm-Message-State: AOAM532r96frBR5mOmpTN+fOiZ2kPf8tmsP9omEyNvkIQ8Fi2G/FvFpW CFatvb/HtGxeuP00ibqdUCi17vBYY1foZw== X-Google-Smtp-Source: ABdhPJwc/BuKSgldtYParvkWYgt6/gRGCSB2dxaiUqRReOXGBpFUv71mrORLbNk++VRzNLjOE0pIvg== X-Received: by 2002:a05:600c:22cd:b0:389:c99a:45a4 with SMTP id 13-20020a05600c22cd00b00389c99a45a4mr5081510wmg.38.1647540536347; Thu, 17 Mar 2022 11:08:56 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id n8-20020a5d5988000000b00203d5f1f3e4sm4756253wri.105.2022.03.17.11.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 11:08:55 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , John Cai , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 2/8] reflog: refactor cmd_reflog() to "if" branches Date: Thu, 17 Mar 2022 19:08:34 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1384.g7d2906948a1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Refactor the "if" branches in cmd_reflog() to use "else if" instead, and remove the whitespace between them. As with 92f480909f7 (multi-pack-index: refactor "goto usage" pattern, 2021-08-23) this makes this code more consistent with how builtin/{bundle,stash,commit-graph,multi-pack-index}.c look and behave. Their top-level commands are all similar sub-command routing functions. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/reflog.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/builtin/reflog.c b/builtin/reflog.c index 9407f835cb6..c864f276308 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -384,14 +384,11 @@ int cmd_reflog(int argc, const char **argv, const char *prefix) if (!strcmp(argv[1], "show")) return cmd_log_reflog(argc - 1, argv + 1, prefix); - - if (!strcmp(argv[1], "expire")) + else if (!strcmp(argv[1], "expire")) return cmd_reflog_expire(argc - 1, argv + 1, prefix); - - if (!strcmp(argv[1], "delete")) + else if (!strcmp(argv[1], "delete")) return cmd_reflog_delete(argc - 1, argv + 1, prefix); - - if (!strcmp(argv[1], "exists")) + else if (!strcmp(argv[1], "exists")) return cmd_reflog_exists(argc - 1, argv + 1, prefix); return cmd_log_reflog(argc, argv, prefix); From patchwork Thu Mar 17 18:08:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12784429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D47FC433EF for ; Thu, 17 Mar 2022 18:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236377AbiCQSKV (ORCPT ); Thu, 17 Mar 2022 14:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237183AbiCQSKP (ORCPT ); Thu, 17 Mar 2022 14:10:15 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11E741162B6 for ; Thu, 17 Mar 2022 11:08:59 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id h23so7864908wrb.8 for ; Thu, 17 Mar 2022 11:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mPzeHTxtjNDX8hKe4aAPusU/5qxdMnJz7oOxDlBn3aw=; b=Js82yHjX/gVoQ+6iagT3FskrIT+ehTQrpGXMOiS9LnCIsTaqI58FyBqaUfkQTz2ytK jQnMaGEcnNw/oBKYfgFkxmdN/X4Ucx/5va6RnyA4OMOQu7dRSA6CWdswC7sbMKDOCqb2 b+94GAe3JxoWuEInEyEa84tE09SHHxHv0F+gpcz6qTTO43WIVS6mH1FqobskmO2CmLyB gIutapkKNlc7GCBF7V8pzvALgolZtAP6VJahZwgwSYIxyZanM3W+mJil9q9sGbfYMzeW f/Ih2QECW6jxeEVpqORkSdCOdffbUSsp2WfeR+BUHhOymJCZvcniZU6H8oz5Lh0QjFyh PF1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mPzeHTxtjNDX8hKe4aAPusU/5qxdMnJz7oOxDlBn3aw=; b=sbUqdRRI09Z70jNTLkm71D6FH8v5e0BmANUBN80sPCNOijp7X4hn8Lk+Oe8oSFkljP W4pcC51499V+qu45NpXGNGCADLzvhKhdY4sHL5ABDuDHU+5BVevC6Qs374wFy7soOvRW 7rhriQxuj/6LDPQxSIYJFZnsMDy+81bC94U93ECSx2IBuYLPz/jLdeoUmYKKAZLz3vki bDpZerz/n6XB1+40O7XSNerWS0ffvn9zG+fhhQT+NSGewyTPutZh54H9rsgNzHlTzOcX +GbLnfadmzxYRdUKwaxivpIecWRvEFiL/wGg4n1cZ76dsHhFna44VzG7M6AzrtD2WQ8T psbQ== X-Gm-Message-State: AOAM5332BcTDnfust2nrf1XN/c1BSASrFgpqLzbLiOIqnsnmF7xc37IS 7kLwk18TZPSo/76eIGDiCBm5Jzf1m/qoQA== X-Google-Smtp-Source: ABdhPJz4WiCev2S5atikv4tGohB1QyJNDzkqr02iYzD1DUhA069QqyOzYJDkpgq+Rl4kbExwlR63jQ== X-Received: by 2002:a5d:5849:0:b0:1ef:f98a:5406 with SMTP id i9-20020a5d5849000000b001eff98a5406mr5265468wrf.8.1647540537316; Thu, 17 Mar 2022 11:08:57 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id n8-20020a5d5988000000b00203d5f1f3e4sm4756253wri.105.2022.03.17.11.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 11:08:56 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , John Cai , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 3/8] reflog tests: add missing "git reflog exists" tests Date: Thu, 17 Mar 2022 19:08:35 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1384.g7d2906948a1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There were a few "git reflog exists" tests scattered over the test suite, but let's consolidate the testing of the main functionality into a new test file. This makes it easier to run just these tests during development. To do that amend and extend an existing test added in afcb2e7a3b8 (git-reflog: add exists command, 2015-07-21). Let's use "test_must_fail" instead of "!" (in case it segfaults), and test for basic usage, an unknown option etc. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t1411-reflog-show.sh | 5 ----- t/t1418-reflog-exists.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100755 t/t1418-reflog-exists.sh diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh index 0bb319b944a..975c4ea83a8 100755 --- a/t/t1411-reflog-show.sh +++ b/t/t1411-reflog-show.sh @@ -169,9 +169,4 @@ test_expect_success 'git log -g -p shows diffs vs. parents' ' test_cmp expect actual ' -test_expect_success 'reflog exists works' ' - git reflog exists refs/heads/main && - ! git reflog exists refs/heads/nonexistent -' - test_done diff --git a/t/t1418-reflog-exists.sh b/t/t1418-reflog-exists.sh new file mode 100755 index 00000000000..60c6411ce3c --- /dev/null +++ b/t/t1418-reflog-exists.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +test_description='Test reflog display routines' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + +. ./test-lib.sh + +test_expect_success 'setup' ' + test_commit A +' + +test_expect_success 'usage' ' + test_expect_code 129 git reflog exists && + test_expect_code 129 git reflog exists -h +' + +test_expect_success 'usage: unknown option' ' + test_expect_code 129 git reflog exists --unknown-option +' + +test_expect_success 'reflog exists works' ' + git reflog exists refs/heads/main && + test_must_fail git reflog exists refs/heads/nonexistent +' + +test_expect_success 'reflog exists works with a "--" delimiter' ' + git reflog exists -- refs/heads/main && + test_must_fail git reflog exists -- refs/heads/nonexistent +' + +test_done From patchwork Thu Mar 17 18:08:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12784430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91876C433EF for ; Thu, 17 Mar 2022 18:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237195AbiCQSKW (ORCPT ); Thu, 17 Mar 2022 14:10:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237186AbiCQSKR (ORCPT ); Thu, 17 Mar 2022 14:10:17 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD64412C6E2 for ; Thu, 17 Mar 2022 11:08:59 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id p9so8438821wra.12 for ; Thu, 17 Mar 2022 11:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V0k8nEPsjImGLJAhZ9MyoboZ86eZ8kNukohoS1X9Hlc=; b=FZbtB6hTJa5duZxtAcFpfjAcotClFowJwpQNBBeiPvzcSoUl3qL15KjUr2gePfVzRC ePMXa9/WhVr/Whz6Iudk48TBnj9nv70CsN3uPaZoJ6wfX1YHIgpW5wdsn9kf7d/awQ09 u0HIbaf19CVCk7s+rTldouI9F/jAUaaIzzBaJ3tlaYuzM2wz/mN/7zEqFzUhu6jaFw6i vCSKprJNmbj0xYSgTJ5+kCnX9P3Cf0U1hrZ7pcTzYuDx1ZK8P9YyX+o35wYZZhKH+qZY BJP6Yzjzas1dBpX62RnXAoWmYW8c3VToG+KBVJOP2fVu9Q0dE2rZFllbb7OzI8EpBd1i TfRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V0k8nEPsjImGLJAhZ9MyoboZ86eZ8kNukohoS1X9Hlc=; b=K8Bv7xAhHz4CIUItjmCOqnhsDNt5UagloykD1LbgwO6IJSZqeoCb0wxSwIMxQZYVj+ 3IhkNiOMIG8HwKq/BxP1l1y+yCzXBSAaDN5VUfiYLwH6Y3Tjfu6Ma5vU0QKZf1OuHUYj iLAx0VAWLaHMAqbcrG3os44AgvzfMHgWC8//a6j03W5kalymarY+jkQqWSEqnyPCaeP6 VIVbA4/+q8v6TS/s3MPNEGq+ZM0COwxj6q4IZxPtyXSX3ou6faig861TOSVv1g0j+A4A ZOacoRqnAzsUWmhOSy8KXbe38j0wiJ9t3dIFXXiLRgcY0yl4a1NrbK9PXNHpOoHMrIu4 LHkA== X-Gm-Message-State: AOAM530kLDBnB/gZVtKnIl01BXBUxXQj1+4dXB/dwVkc7Q+htjKz/z37 ooZAp/JfFQkVA6OsFVNoK4deWiJGS176gQ== X-Google-Smtp-Source: ABdhPJyfAKP5F5ZZ39rjMnQUqcPeYQ8t9/zqbRNsbDSfzw5pwvldExCH9ln2bzCgUz+lnwyAJgVLSQ== X-Received: by 2002:adf:fd44:0:b0:203:f45f:ce92 with SMTP id h4-20020adffd44000000b00203f45fce92mr666807wrs.45.1647540538190; Thu, 17 Mar 2022 11:08:58 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id n8-20020a5d5988000000b00203d5f1f3e4sm4756253wri.105.2022.03.17.11.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 11:08:57 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , John Cai , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 4/8] reflog: move "usage" variables and use macros Date: Thu, 17 Mar 2022 19:08:36 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1384.g7d2906948a1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Move the "usage" variables in builtin/reflog.c to the top of the file, in preparation for later commits defining a common "reflog_usage" in terms of some of these strings, as was done in 8757b35d443 (commit-graph: define common usage with a macro, 2021-08-23). While we're at it let's make them "const char *const", as is the convention with these "usage" variables. The use of macros here is a bit odd, but in subsequent commits we'll make these use the same pattern as builtin/commit-graph.c uses since 8757b35d443 (commit-graph: define common usage with a macro, 2021-08-23). Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/reflog.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/builtin/reflog.c b/builtin/reflog.c index c864f276308..25313d504a9 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -5,8 +5,31 @@ #include "worktree.h" #include "reflog.h" +#define BUILTIN_REFLOG_EXPIRE_USAGE \ + N_("git reflog expire [--expire=