From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giuseppe Bilotta Subject: [PATCHv4] git apply: option to ignore whitespace differences Date: Fri, 31 Jul 2009 22:40:58 +0200 Message-ID: <1249072858-21894-1-git-send-email-giuseppe.bilotta@gmail.com> Cc: Junio C Hamano , Felipe Contreras , Nanako Shiraishi , Giuseppe Bilotta To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Fri Jul 31 22:41:22 2009 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1MWyum-00028d-LP for gcvg-git-2@gmane.org; Fri, 31 Jul 2009 22:41:21 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbZGaUlL (ORCPT ); Fri, 31 Jul 2009 16:41:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751889AbZGaUlL (ORCPT ); Fri, 31 Jul 2009 16:41:11 -0400 Received: from mail-fx0-f217.google.com ([209.85.220.217]:52999 "EHLO mail-fx0-f217.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751814AbZGaUlJ (ORCPT ); Fri, 31 Jul 2009 16:41:09 -0400 Received: by fxm17 with SMTP id 17so1583708fxm.37 for ; Fri, 31 Jul 2009 13:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=TUKWXKpYApOxYn5ugBihkHd3gZTooA9LfcfY4YBuiL0=; b=O1cnsHtKEqx5uQxl9gI2/FJ7b1VeAoJahuT+GzmVhytVWfFy2mVNUT4iq4xsOGqBQN ALLcJm4Tchf1F0i1LGdPS4WLutIJz3PqVChSPz0plvVT3dAVt/XO9gjqJ/bK1fuXXh4r YMTgZ7sLEfdr4CbYKHTfSeobIZb0NZZ+i/26M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=Dv93eivjmL3hqai/XRILMgrVs049NIZ5uzlG1bORVishQCrSkaygDOIxZQQ7mCC01r tmm6u+GAqmDPPMDILIHvDBbnJ/69gKxBjL0/7nnWExY7ewcd+daP4rF848mmP82vCgdh rXNU3E0+oPrl5XL28ep7O9CyFIbuyu2zrWpVc= Received: by 10.103.134.17 with SMTP id l17mr1740112mun.76.1249072868019; Fri, 31 Jul 2009 13:41:08 -0700 (PDT) Received: from localhost (host-78-15-19-142.cust-adsl.tiscali.it [78.15.19.142]) by mx.google.com with ESMTPS id j10sm11654462mue.15.2009.07.31.13.41.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 31 Jul 2009 13:41:07 -0700 (PDT) X-Mailer: git-send-email 1.6.4.216.g15680.dirty Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Introduce --ignore-whitespace / --ignore-space-change option and corresponding config apply.ignorewhitespace to ignore changes in whitespace of context lines while applying patches. The two names match the corresponding option resp. in 'patch' and 'git diff'. 'git am', 'git rebase' and the bash git completion are made aware of the option. Signed-off-by: Giuseppe Bilotta --- Changes wrt the previous version: * the option has a dual name * the option management has a cleaner structure, allowing an easier implementation of options such as --ignore-space-at-eol or --ignore-all-space * the documentation mentions that ignoring changes in whitespace prevents context lines from being whitespace-fixed Documentation/config.txt | 8 ++ Documentation/git-am.txt | 5 +- Documentation/git-apply.txt | 13 +++ Documentation/git-rebase.txt | 3 +- builtin-apply.c | 172 ++++++++++++++++++++++++++++++-- cache.h | 1 + contrib/completion/git-completion.bash | 3 + environment.c | 1 + git-am.sh | 4 +- git-rebase.sh | 3 + t/t4107-apply-ignore-whitespace.sh | 149 +++++++++++++++++++++++++++ 11 files changed, 352 insertions(+), 10 deletions(-) create mode 100755 t/t4107-apply-ignore-whitespace.sh diff --git a/Documentation/config.txt b/Documentation/config.txt index c6f09f8..0b53cab 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -461,6 +461,14 @@ it will be treated as a shell command. For example, defining executed from the top-level directory of a repository, which may not necessarily be the current directory. +apply.ignorewhitespace:: + When set to 'change', tells 'git-apply' to ignore changes in + whitespace, in the same way as the '--ignore-space-change' + option. + When set to one of: no, none, never, false tells 'git-apply' to + respect all whitespace differences. + See linkgit:git-apply[1]. + apply.whitespace:: Tells 'git-apply' how to handle whitespaces, in the same way as the '--whitespace' option. See linkgit:git-apply[1]. diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 32e689b..fcacc94 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'git am' [--signoff] [--keep] [--utf8 | --no-utf8] [--3way] [--interactive] [--committer-date-is-author-date] - [--ignore-date] + [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=