From patchwork Sun Nov 13 21:28:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Siddharth Asthana X-Patchwork-Id: 13041771 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 45124C4332F for ; Sun, 13 Nov 2022 21:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235416AbiKMV2z (ORCPT ); Sun, 13 Nov 2022 16:28:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235399AbiKMV2x (ORCPT ); Sun, 13 Nov 2022 16:28:53 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28D7913D7E for ; Sun, 13 Nov 2022 13:28:53 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id k5so8738603pjo.5 for ; Sun, 13 Nov 2022 13:28:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JNlTujIhSePUkZ7fXPGpdf5z9rmXsh6KK6wwHYrfSqQ=; b=dSPUQy/yw4UbgyVrJ2DSunSozMbBZutxkXFIYiCUtu5jS/JWuQ/zreBi7veF5ZtQEO JNmvKXvGykLhKGIyJc8B8LijNLIbj5lQpHMgZIclTCXVhUXy1IxtarrNmKwadfFZpylO fgSTK6W4cM/jrzxiWhUNcjisrIWWYZLwktray5ICZgcX9uZyJGTFVFMmY4QhhqarrJjJ qD40JWvMnW0XERWaTrdSJsuc8AgWv/0/tUpGMVXHlhfSWQoF9mmmn8MdJxa/V5OWxGUl sECcW/hUlvO3OPWgT2xwBLFcmEL6jPmATDHoQQTsKG+ay1NKMrxQ0LI8gjIYwBpmibrw 5c7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JNlTujIhSePUkZ7fXPGpdf5z9rmXsh6KK6wwHYrfSqQ=; b=xSxj1lEKj3qQ/ng+1h5/Pa64vRFBhblwu/OnwmaUN6FkW0ix9a2kCNeatTVBeM6ml4 vVseK/tr5lMqYn4vo0K3GuDBVV6oT21gSif8R59W1T0aXV+66Sgu3XKO2ZbUyxRNMipD PBO8m/TKkOmCFnAGO4JAjDNNmFEJGbG/kHeNO5GEjg9Q23ZkFQNrAxsWKLL3iJxCoI05 MVGvya8lgeCmbttJzFqDhcsTrt+z3XC4QuVcvW1cecSFK/2pChko7HRWrj9GlWuEtAVk B/EmVjHQsDw+S3o5Le8hUWlQNYjOvpPo7va+JJjrxjM6LFQ8zWUYGYpjdne3ItOtJJHf aA+Q== X-Gm-Message-State: ANoB5plRw6YuGNtxurCAJEXtWqfCTx52Y3aMOOcobuU8eETUVNBvI20d PDIX2Sr19XwnyCYNTolGcqmWXOI/CxZ+uac1 X-Google-Smtp-Source: AA0mqf7oIWpLV2Xi+jTy9e1xiSVJB/efu6KI1L9LrHW6siySjn8l7uSEE7VIuabmS4KkNzVR7Nc4qA== X-Received: by 2002:a17:90a:8cf:b0:213:8cf1:4d9d with SMTP id 15-20020a17090a08cf00b002138cf14d9dmr11287061pjn.5.1668374932070; Sun, 13 Nov 2022 13:28:52 -0800 (PST) Received: from HB2.. ([2409:4043:4c81:51c0:8e7b:5efe:71ba:3c2f]) by smtp.gmail.com with ESMTPSA id 79-20020a621552000000b0056c704abca7sm5116337pfv.220.2022.11.13.13.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Nov 2022 13:28:51 -0800 (PST) From: Siddharth Asthana To: git@vger.kernel.org Cc: christian.couder@gmail.com, gitster@pobox.com, johncai86@gmail.com, Johannes.Schindelin@gmx.de, avarab@gmail.com, me@ttaylorr.com, Siddharth Asthana Subject: [PATCH v4 1/3] cat-file: add mailmap support to -s option Date: Mon, 14 Nov 2022 02:58:28 +0530 Message-Id: <20221113212830.92609-2-siddharthasthana31@gmail.com> X-Mailer: git-send-email 2.38.1.423.g41b4650b24 In-Reply-To: <20221113212830.92609-1-siddharthasthana31@gmail.com> References: <20220916205946.178925-1-siddharthasthana31@gmail.com> <20221113212830.92609-1-siddharthasthana31@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Even though the cat-file command with `-s` option does not complain when `--use-mailmap` option is given, the latter option is ignored. Compute the size of the object after replacing the idents and report it instead. In order to make `-s` option honour the mailmap mechanism we have to read the contents of the commit/tag object. Make use of the call to `oid_object_info_extended()` to get the contents of the object and store in `buf`. `buf` is later freed in the function. Mentored-by: Christian Couder Mentored-by: John Cai Helped-by: Taylor Blau Helped-by: Ævar Arnfjörð Bjarmason Signed-off-by: Siddharth Asthana --- builtin/cat-file.c | 13 +++++++++++++ t/t4203-mailmap.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/builtin/cat-file.c b/builtin/cat-file.c index fa7bd89169..8a6e2343ec 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -132,8 +132,21 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name, case 's': oi.sizep = &size; + + if (use_mailmap) { + oi.typep = &type; + oi.contentp = (void**)&buf; + } + if (oid_object_info_extended(the_repository, &oid, &oi, flags) < 0) die("git cat-file: could not get object info"); + + if (use_mailmap && (type == OBJ_COMMIT || type == OBJ_TAG)) { + size_t s = size; + buf = replace_idents_using_mailmap(buf, &s); + size = cast_size_t_to_ulong(s); + } + printf("%"PRIuMAX"\n", (uintmax_t)size); ret = 0; goto cleanup; diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index cd1cab3e54..b500b31c92 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -1022,4 +1022,33 @@ test_expect_success '--mailmap enables mailmap in cat-file for annotated tag obj test_cmp expect actual ' +test_expect_success 'git cat-file -s returns correct size with --use-mailmap' ' + test_when_finished "rm .mailmap" && + cat >.mailmap <<-\EOF && + C O Mitter Orig + EOF + cat >expect <<-\EOF && + 209 + 220 + EOF + git cat-file -s HEAD >actual && + git cat-file --use-mailmap -s HEAD >>actual && + test_cmp expect actual +' + +test_expect_success 'git cat-file -s returns correct size with --use-mailmap for tag objects' ' + test_when_finished "rm .mailmap" && + cat >.mailmap <<-\EOF && + Orig C O Mitter + EOF + git tag -a -m "annotated tag" v3 && + cat >expect <<-\EOF && + 141 + 130 + EOF + git cat-file -s v3 >actual && + git cat-file --use-mailmap -s v3 >>actual && + test_cmp expect actual +' + test_done From patchwork Sun Nov 13 21:28:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Siddharth Asthana X-Patchwork-Id: 13041772 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 A8970C4332F for ; Sun, 13 Nov 2022 21:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235433AbiKMV3H (ORCPT ); Sun, 13 Nov 2022 16:29:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235415AbiKMV3D (ORCPT ); Sun, 13 Nov 2022 16:29:03 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9351F13F77 for ; Sun, 13 Nov 2022 13:28:59 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id b11so8758186pjp.2 for ; Sun, 13 Nov 2022 13:28:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PuR80NzvLposCHz1dATcq7xtH6HNWVtoEjbgjTnVlQI=; b=Zr952QPPbWGbVCI+40YXOpnQPqRq0hTb+ytOZgR979005hucm7v03dcKf2eC5BhVj8 YY/7LkwaP/4+zJVYr5zqD16f1AUDKlr/LAKwz0zv0MuzIxYygFbgifNRZQY4lRirRugr o0O5sZCHsPKFaHnXp/6JRy1TPuUyzT56gxAR48hXx2mjpPrHgbEsMTZ7X/eR1Yc+xpXP BpMsCcVT2AkwzEDJeH+Q/ewhaKawi+wyyYi046L0SQRPlElgL8fUaU2CMjXFX1L9iT2+ pqfBlJzKWEA95fRAfJ5jkLLKXEc0JozRaczFZgVupnof7epdpFrsr9xlnD6oHh6FvBTc m/Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PuR80NzvLposCHz1dATcq7xtH6HNWVtoEjbgjTnVlQI=; b=hcSCfAHAfhu5BYjJOyu4agPQi0QwQGaMoWKXFKJhgWpOKf3hLAy0JR7pT809s6ku8l uPpTWw0mMJF1EDZ/UCbRxWQgHWRxWhwzUpJdBcODp/NsIXydS91OL774vj7irKBGsPTs uHgRymuaecRgWo3Nt48J5XvmhTHHOTjNeeUIQbbBNqA7QyPhLbdLwb0II5qMyuUL5fki EAcF9jiqcbGJFCux7Gw6FcNO6k1h7juj6in6wxpypZp6p2Wnk6i+218+c8sfibjqlqyt 4p9JgnIxchlT1LFrh9A18FvF72TAPSYEM5GXTo3ihmdJB2ycpk2+6jJf6CMr0zq/5hE5 k05w== X-Gm-Message-State: ANoB5pkAOnria10p+jzs8H4oTJJQqKG9iBGnNgRTzPHsykRf+WLdswAw 19YkaX8rO78RXbJC6asCoLGbI/TiA0USXqTZ X-Google-Smtp-Source: AA0mqf7Jd/P2Y+4TfOuLnlM4kZbn44/8YnxjjpizALWUhRfflo9CpfDQZ/9rzhHKAxPNSfq2Qiq0uA== X-Received: by 2002:a17:903:3286:b0:187:a98:7eea with SMTP id jh6-20020a170903328600b001870a987eeamr11081047plb.109.1668374938528; Sun, 13 Nov 2022 13:28:58 -0800 (PST) Received: from HB2.. ([2409:4043:4c81:51c0:8e7b:5efe:71ba:3c2f]) by smtp.gmail.com with ESMTPSA id 79-20020a621552000000b0056c704abca7sm5116337pfv.220.2022.11.13.13.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Nov 2022 13:28:58 -0800 (PST) From: Siddharth Asthana To: git@vger.kernel.org Cc: christian.couder@gmail.com, gitster@pobox.com, johncai86@gmail.com, Johannes.Schindelin@gmx.de, avarab@gmail.com, me@ttaylorr.com, Siddharth Asthana Subject: [PATCH v4 2/3] cat-file: add mailmap support to --batch-check option Date: Mon, 14 Nov 2022 02:58:29 +0530 Message-Id: <20221113212830.92609-3-siddharthasthana31@gmail.com> X-Mailer: git-send-email 2.38.1.423.g41b4650b24 In-Reply-To: <20221113212830.92609-1-siddharthasthana31@gmail.com> References: <20220916205946.178925-1-siddharthasthana31@gmail.com> <20221113212830.92609-1-siddharthasthana31@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Even though the cat-file command with `--batch-check` option does not complain when `--use-mailmap` option is given, the latter option is ignored. Compute the size of the object after replacing the idents and report it instead. In order to make `--batch-check` option honour the mailmap mechanism we have to read the contents of the commit/tag object. There were two ways to do it: 1. Make two calls to `oid_object_info_extended()`. If `--use-mailmap` option is given, the first call will get us the type of the object and second call will only be made if the object type is either a commit or tag to get the contents of the object. 2. Make one call to `oid_object_info_extended()` to get the type of the object. Then, if the object type is either of commit or tag, make a call to `read_object_file()` to read the contents of the object. I benchmarked the following command with both the above approaches and compared against the current implementation where `--use-mailmap` option is ignored: `git cat-file --use-mailmap --batch-all-objects --batch-check --buffer --unordered` The results can be summarized as follows: Time (mean ± σ) default 827.7 ms ± 104.8 ms first approach 6.197 s ± 0.093 s second approach 1.975 s ± 0.217 s Since, the second approach is faster than the first one, I implemented it in this patch. Mentored-by: Christian Couder Mentored-by: John Cai Helped-by: Taylor Blau Helped-by: Ævar Arnfjörð Bjarmason Signed-off-by: Siddharth Asthana --- builtin/cat-file.c | 14 ++++++++++++++ t/t4203-mailmap.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 8a6e2343ec..39f2a2483f 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -444,6 +444,9 @@ static void batch_object_write(const char *obj_name, if (!data->skip_object_info) { int ret; + if (use_mailmap) + data->info.typep = &data->type; + if (pack) ret = packed_object_info(the_repository, pack, offset, &data->info); @@ -457,6 +460,17 @@ static void batch_object_write(const char *obj_name, fflush(stdout); return; } + + if (use_mailmap && (data->type == OBJ_COMMIT || data->type == OBJ_TAG)) { + size_t s = data->size; + char *buf = NULL; + + buf = read_object_file(&data->oid, &data->type, &data->size); + buf = replace_idents_using_mailmap(buf, &s); + data->size = cast_size_t_to_ulong(s); + + free(buf); + } } strbuf_reset(scratch); diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index b500b31c92..b4355c3e51 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -1051,4 +1051,34 @@ test_expect_success 'git cat-file -s returns correct size with --use-mailmap for test_cmp expect actual ' +test_expect_success 'git cat-file --batch-check returns correct size with --use-mailmap' ' + test_when_finished "rm .mailmap" && + cat >.mailmap <<-\EOF && + C O Mitter Orig + EOF + cat >expect <<-\EOF && + 92d99959b011b1cd69fe7be5315d6732fe302575 commit 209 + 92d99959b011b1cd69fe7be5315d6732fe302575 commit 220 + EOF + echo "HEAD" >in && + git cat-file --batch-check actual && + git cat-file --use-mailmap --batch-check >actual && + test_cmp expect actual +' + +test_expect_success 'git cat-file --batch-command returns correct size with --use-mailmap' ' + test_when_finished "rm .mailmap" && + cat >.mailmap <<-\EOF && + C O Mitter Orig + EOF + cat >expect <<-\EOF && + 92d99959b011b1cd69fe7be5315d6732fe302575 commit 209 + 92d99959b011b1cd69fe7be5315d6732fe302575 commit 220 + EOF + echo "info HEAD" >in && + git cat-file --batch-command actual && + git cat-file --use-mailmap --batch-command >actual && + test_cmp expect actual +' + test_done From patchwork Sun Nov 13 21:28:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Asthana X-Patchwork-Id: 13041773 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 BE1A2C4332F for ; Sun, 13 Nov 2022 21:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234149AbiKMV3T (ORCPT ); Sun, 13 Nov 2022 16:29:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235482AbiKMV3I (ORCPT ); Sun, 13 Nov 2022 16:29:08 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36E4EDEC6 for ; Sun, 13 Nov 2022 13:29:06 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id i3so9339429pfc.11 for ; Sun, 13 Nov 2022 13:29:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bUcvnsDHdg+ilZcYaBYTYakIkceiUTnGV3Kd9QPe5Hs=; b=dGlEFmJ0JwNVqgPOv5ZJIiuQUH8cuQyjdV/QgItVy+vaOWlKtTEfEDmjYDl+jXOj9N RSFhJSz4Q73VCiQ4qEIfNtAMVgRN77M7FLkpvagmaSW+2q5VVBy4+LEltsU0Ik47khX+ suRbZn6dXUSTqjzxIUADdJ1Y6kynH4PKtji1HnJ62bGj9Zc1d0eEYIRnDwYiTTkPDuEY xBufta4TRtA6jnf51/fXbzxJWPHeHEFdIiMPbzo6n9Q3Ts7Vnfv8hzhdWFXWYvMsqOlL qr0Is2SpDgt8zgysYVi6MaB22TU90ANLfHlxmBmcCrXoLc6zU3taY8rxLz81W7A1dHjY 7FKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bUcvnsDHdg+ilZcYaBYTYakIkceiUTnGV3Kd9QPe5Hs=; b=Zr7mucgDj6B+Zyw1YZk9f2JSVRWTUhM+BDolWQoVEF4Z/Z26qTW6i+dju65W29lOg/ vlSo01lrqfOA0UoToi8ugTf47xqbu1sAwoKXhgo+hcNkrdCa2C9VTncrk7T0ezEDWs3G dvBKFfSPMCfFqC8jOO8fvUm2QXxBGNPkhe67OOI/MDkSdhSHoaleApWNfQBO9cEByPtM 6NycJImxeOVxwhi3QjEHIqrCfP4m6Z/ooJkt7QZ6irtkBIgHVdkT5oKE+LFCR+8j8Tgf 190wnBLcWy9aiIpXc+fYMSUl45TfZV/WErZ5IAiFekophVzBzCBQb/mPFsdZ63hKSLnz TaDA== X-Gm-Message-State: ANoB5plu3fb+7P6a2WX8pdsPyAXjHByGeMnqwpY0arNr+70fk0xQ4fJ2 bKamOTmqePVQUBe4j0O6WB68m376xz4REfWR X-Google-Smtp-Source: AA0mqf5xDXbWUfmBIpvWzPr2qwpHxszXaZldj9q51Da1J996TyGO3yvpiK6p8vHCxgu0ge4iJNLTBw== X-Received: by 2002:a65:5a02:0:b0:449:8676:833f with SMTP id y2-20020a655a02000000b004498676833fmr9364204pgs.126.1668374944987; Sun, 13 Nov 2022 13:29:04 -0800 (PST) Received: from HB2.. ([2409:4043:4c81:51c0:8e7b:5efe:71ba:3c2f]) by smtp.gmail.com with ESMTPSA id 79-20020a621552000000b0056c704abca7sm5116337pfv.220.2022.11.13.13.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Nov 2022 13:29:04 -0800 (PST) From: Siddharth Asthana To: git@vger.kernel.org Cc: christian.couder@gmail.com, gitster@pobox.com, johncai86@gmail.com, Johannes.Schindelin@gmx.de, avarab@gmail.com, me@ttaylorr.com, Siddharth Asthana Subject: [PATCH v4 3/3] doc/cat-file: allow --use-mailmap for --batch options Date: Mon, 14 Nov 2022 02:58:30 +0530 Message-Id: <20221113212830.92609-4-siddharthasthana31@gmail.com> X-Mailer: git-send-email 2.38.1.423.g41b4650b24 In-Reply-To: <20221113212830.92609-1-siddharthasthana31@gmail.com> References: <20220916205946.178925-1-siddharthasthana31@gmail.com> <20221113212830.92609-1-siddharthasthana31@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The command git cat-file can now use the mailmap mechanism to replace idents with their canonical versions for commit and tag objects. There are several options like `-s`, `--batch`, `--batch-check` and `--batch-command` that can be combined with `--use-mailmap`. But the documentation for `-s`, `--batch`, `--batch-check` and `--batch-command` doesn't say so. This patch fixes that documentation. Mentored-by: Christian Couder Mentored-by: John Cai Helped-by: Taylor Blau Signed-off-by: Siddharth Asthana --- Documentation/git-cat-file.txt | 53 +++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt index ec30b5c574..81235c60a3 100644 --- a/Documentation/git-cat-file.txt +++ b/Documentation/git-cat-file.txt @@ -45,7 +45,9 @@ OPTIONS -s:: Instead of the content, show the object size identified by - ``. + ``. If used with `--use-mailmap` option, will show + the size of updated object after replacing idents using the + mailmap mechanism. -e:: Exit with zero status if `` exists and is a valid @@ -89,26 +91,49 @@ OPTIONS --batch:: --batch=:: Print object information and contents for each object provided - on stdin. May not be combined with any other options or arguments - except `--textconv` or `--filters`, in which case the input lines - also need to specify the path, separated by whitespace. See the - section `BATCH OUTPUT` below for details. + on stdin. May not be combined with any other options or arguments + except --textconv, --filters, or --use-mailmap. + + + * When used with `--textconv` or `--filters`, the input lines + must specify the path, separated by whitespace. See the section + `BATCH OUTPUT` below for details. + + + * When used with `--use-mailmap`, for commit and tag objects, the + contents part of the output shows the identities replaced using the + mailmap mechanism, while the information part of the output shows + the size of the object as if it actually recorded the replacement + identities. --batch-check:: --batch-check=:: - Print object information for each object provided on stdin. May - not be combined with any other options or arguments except - `--textconv` or `--filters`, in which case the input lines also - need to specify the path, separated by whitespace. See the - section `BATCH OUTPUT` below for details. + Print object information for each object provided on stdin. May not be + combined with any other options or arguments except --textconv, --filters + or --use-mailmap. + + + * When used with `--textconv` or `--filters`, the input lines must + specify the path, separated by whitespace. See the section + `BATCH OUTPUT` below for details. + + + * When used with `--use-mailmap`, for commit and tag objects, the + printed object information shows the size of the object as if the + identities recorded in it were replaced by the mailmap mechanism. --batch-command:: --batch-command=:: Enter a command mode that reads commands and arguments from stdin. May - only be combined with `--buffer`, `--textconv` or `--filters`. In the - case of `--textconv` or `--filters`, the input lines also need to specify - the path, separated by whitespace. See the section `BATCH OUTPUT` below - for details. + only be combined with `--buffer`, `--textconv`, `--use-mailmap` or + `--filters`. + + + * When used with `--textconv` or `--filters`, the input lines must + specify the path, separated by whitespace. See the section + `BATCH OUTPUT` below for details. + + + * When used with `--use-mailmap`, for commit and tag objects, the + `contents` command shows the identities replaced using the + mailmap mechanism, while the `info` command shows the size + of the object as if it actually recorded the replacement + identities. + + `--batch-command` recognizes the following commands: +