From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-1.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB, SPF_HELO_PASS,SPF_PASS,WIKI_IMG shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 44FF31F9FC for ; Sun, 21 Mar 2021 13:06:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229897AbhCUNGQ (ORCPT ); Sun, 21 Mar 2021 09:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbhCUNFn (ORCPT ); Sun, 21 Mar 2021 09:05:43 -0400 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 47519C061574 for ; Sun, 21 Mar 2021 06:05:43 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id cl21-20020a17090af695b02900c61ac0f0e9so9968468pjb.1 for ; Sun, 21 Mar 2021 06:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=0on8O/8xkOC1YfpHv1MdK+C1s+mTuFklE36K7GHTSO0=; b=tf3VueRDcuj4eYeyFJwRh8V+Fr3QQ0z3PNQyt088MHTu9e7tmFsJwBHkqUJKQs46dV tup1Mhz+u7O2RFQDOeyYmgxKn1v6TIR4YFgZqT7Te+EHS3JP7hi0thLaOpafF7Jf3ZYu SER7Qki4mBxj+B4qu4yysty1vbq+ZxeBuyYchWZEeXj6h41PsEVQO0vPAT+27A48YdQ7 zdEghk/9DiXS7v6eAxS+M2Szfk7li85evnP39upCHsSRHNLkMyLESzdu+HbzIyzycVA/ fpPd/DbigBswlRVG/7wyhLYt4OlLywK8Y3Mox4jYafl5AVN2zq0gAiCYzlpLIO8nzaPT r40A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=0on8O/8xkOC1YfpHv1MdK+C1s+mTuFklE36K7GHTSO0=; b=APajBSse6v0+oo3ApRAEaccMM0aWVHtbnpt0WoS1CGrBJuxMYZStpkVBqGC+s4l6Im CkG1O6zOadie3SQlRuiFg/PwdI9HlT7F1j/Slsb8xPR+jfbdlYFse2LKFC2UsSxs6Lfa ZabIJWo7jwAGS/MfQ7p5zpzzKYplw6gwAu38Ar71oeH1ITqrPLGGk/fHp47t546Lb1RT FzpDM5ZR+n69CtOJlPXmA1N4tY1WDI5oWXD4/mJGCX24/kzDbU8nf3dAt3GlZ+E1rpR3 FiXNZ+fx7s+yzC+vzZt434uaZE76Dt/Yb9h6V/OZYhsizN1Bt5kVWqeQ7Umn0/I2mRSH 5XmQ== X-Gm-Message-State: AOAM533SEXD6R3ibkcrOnoT5jh3MOGG1RHoNWl1z3iKW1r8zl6e1ICPG FDy+MkQKm484KU+J5TKQKPR9M1PDoWnrVOx+ X-Google-Smtp-Source: ABdhPJxToJc1V6M+1ETEiPY7Cjq2l/NyziNqI/+SpVCGqx49TpCa8tDrwSzdp0je0tYVjI/uj2Gp6w== X-Received: by 2002:a17:90a:2a46:: with SMTP id d6mr8229343pjg.197.1616331942473; Sun, 21 Mar 2021 06:05:42 -0700 (PDT) Received: from [192.168.43.80] (subs32-116-206-28-38.three.co.id. [116.206.28.38]) by smtp.gmail.com with ESMTPSA id c2sm11049286pfb.121.2021.03.21.06.05.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Mar 2021 06:05:42 -0700 (PDT) To: git@vger.kernel.org From: Bagas Sanjaya Subject: Blob hash of binary files in patches generated by git format patch show in full form instead of short form Message-ID: <499c9922-eb42-c2a8-b4b4-8e5197ea0fc6@gmail.com> Date: Sun, 21 Mar 2021 20:05:39 +0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) I'm trying to do format-patch with binary files (images) in commits. In each commit, it adds an image and its alt description text in separated file. Full steps: First, initialize empty repo and populate it with commits: - cd /tmp - mkdir bin-patch && cd bin-patch - git init - echo "test format-patch binary files" > README - git add * && git commit -m "init README" - git checkout -b test - wget -c [1] -O stackoverflow.png && echo "Stack Overflow" > stackoverflow.alt - git add * && git commit -m "Add Stack Overflow logo" - wget -c [2] -O idntm.jpg && echo "Indonesia's Next Top Model cast" > idntm.alt - git add * && git commit -m "Add IdNTM cast poster" Now prepare patches as usual (with cover letter ignored for this purpose): - git format-patch --cover-letter -M master (image link): [1]: https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Stack_Overflow_logo.svg/1280px-Stack_Overflow_logo.svg.png [2]: https://upload.wikimedia.org/wikipedia/en/9/9f/IndonesiaNTM1Cast.jpg What did you expect to happen? (Expected behavior) Blob hash in the `index` header of generated patches for binary file (image) use short form (7 characters), just like for text file (alt description). What happened instead? (Actual behavior) Blob hash in the `index` stanza of generated patches for image use full (long) form. For first patch (Stack Overflow commit), diff header for the image read: ``` diff --git a/stackoverflow.png b/stackoverflow.png new file mode 100644 index 0000000000000000000000000000000000000000..969908ad3161a66af31f2441cfea4ae002a5ec67 ``` while diff header for alt description read: ``` diff --git a/stackoverflow.alt b/stackoverflow.alt new file mode 100644 index 0000000..9368417 ``` Similarly, for the second patch (INTM poster), diff header for the image read: ``` diff --git a/idntm.jpg b/idntm.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8921ab9540e0a36a53f8c6632482fb04d5d0cc6c ``` while diff header for alt description read: ``` diff --git a/idntm.alt b/idntm.alt new file mode 100644 index 0000000..719feb9 ``` What's different between what you expected and what actually happened? Blob hash for binary files are shown in full form, as opposed to blob hash for text files. Anything else you want to add: (none) Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.31.0.29.g98164e9585 cpu: x86_64 built from commit: 98164e9585e02e31dcf1377a553efe076c15f8c6 sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.11.6-kernelorg-upstream-generic #1 SMP Fri Mar 12 06:35:27 WIB 2021 x86_64 compiler info: gnuc: 9.3 libc info: glibc: 2.31 $SHELL (typically, interactive shell): /bin/bash [Enabled Hooks] (none) -- An old man doll... just what I always wanted! - Clara