From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.7 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 04ED7201B0 for ; Tue, 28 Feb 2017 18:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751720AbdB1SPL (ORCPT ); Tue, 28 Feb 2017 13:15:11 -0500 Received: from mout.web.de ([212.227.15.14]:64817 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbdB1SOa (ORCPT ); Tue, 28 Feb 2017 13:14:30 -0500 Received: from macce.local ([195.198.252.176]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lp9kK-1c3v6g1E9s-00ereB; Tue, 28 Feb 2017 19:06:54 +0100 Subject: Re: git diff --quiet exits with 1 on clean tree with CRLF conversions To: Junio C Hamano References: <20170217212633.GA24937@mcrowe.com> <20170217221958.GA12163@mcrowe.com> <20170220153322.GA8352@mcrowe.com> <20170225153230.GA30565@mcrowe.com> Cc: git@vger.kernel.org, Mike Crowe From: =?UTF-8?Q?Torsten_B=c3=b6gershausen?= Message-ID: Date: Tue, 28 Feb 2017 19:06:44 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:BeA6mv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2G8lr VvC+sZ6 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On 2017-02-27 21:17, Junio C Hamano wrote: > Torsten, you've been quite active in fixing various glitches around > the EOL conversion in the latter half of last year. Have any > thoughts to share on this topic? > > Thanks. Sorry for the delay, being too busy with other things. I followed the discussion, but didn't have good things to contribute. I am not an expert in diff.c, but there seems to be a bug, thanks everybody for digging. Back to business: My understanding is that git diff --quiet should be quiet, when git add will not do anything (but the file is "touched". The touched means that Git will detect e.g a new mtime or inode or file size when doing lstat(). mtime is tricky, inodes are problematic under Windows. What is easy to change is the file length. I don't thing that we need a test file with LF, nor do we need the sleep, touch or anything. Would the the following work ? (This is copy-paste, so the TABs may be corrupted) #!/bin/sh # # Copyright (c) 2017 Mike Crowe # # These tests ensure that files changing line endings in the presence # of .gitattributes to indicate that line endings should be ignored # don't cause 'git diff' or 'git diff --quiet' to think that they have # been changed. test_description='git diff with files that require CRLF conversion' . ./test-lib.sh test_expect_success setup ' echo "* text=auto" > .gitattributes && printf "Hello\r\nWorld\r\n" >crlf.txt && git add .gitattributes crlf.txt lf.txt && git commit -m "initial" ' test_expect_success 'quiet diff works on file with line-ending change that has no effect on repository' ' printf "Hello\r\nWorld\n" >crlf.txt && git status && git diff --quiet ' test_done