From unknown Sun Jun 22 00:51:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#29197: 27.0.50; pre-commit checks for new files against "head" Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Nov 2017 19:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29197 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 29197@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.151008235322017 (code B ref -1); Tue, 07 Nov 2017 19:20:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Nov 2017 19:19:13 +0000 Received: from localhost ([127.0.0.1]:57017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eC9Oy-0005j3-HM for submit@debbugs.gnu.org; Tue, 07 Nov 2017 14:19:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eC9Ow-0005ip-Oe for submit@debbugs.gnu.org; Tue, 07 Nov 2017 14:19:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eC9Oq-00058t-58 for submit@debbugs.gnu.org; Tue, 07 Nov 2017 14:19:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50895) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eC9Oq-00058p-1n for submit@debbugs.gnu.org; Tue, 07 Nov 2017 14:19:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eC9On-0005fn-Qj for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2017 14:19:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eC9Oi-000568-NF for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2017 14:19:01 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:50022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eC9Oi-00055p-HM for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2017 14:18:56 -0500 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id vA7JIpNM022332 for ; Tue, 7 Nov 2017 14:18:52 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id D07FBAE08A; Tue, 7 Nov 2017 14:18:50 -0500 (EST) From: Stefan Monnier Date: Tue, 07 Nov 2017 14:18:50 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.3 X-NAI-Spam-Rules: 5 Rules triggered BEC_TRC1=0.1, BEC_TRC1_W_GEN_SPAM_FEATRE=0.1, GEN_SPAM_FEATRE=0.1, EDT_SA_DN_PASS=0, RV6153=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6153> : inlines <6163> : streams <1769628> : uri <2529901> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Package: Emacs Version: 27.0.50 I finally figured out why recently, every time I merge changes from master into my local branch it complains: File name does not consist of -+./_ or ASCII letters or digits. It turns out it's because it's looking at the diff between master and my local (merged) branch (i.e. it looks at my local changes) whereas before it would look at the diff between the old version of my local branch and the merged version of my local branch (i.e. at the changes I'm pulling from master). And yes, indeed, my local branch has some files with "weird" chars in it. I think the warning should be improved: - I shouldn't get a warning in the above case, since this commit doesn't *add* those files (they weren't on origin/master admittedly but they were already on HEAD). - the warning should give me some hint about which file fails the test. Stefan In GNU Emacs 27.0.50 (build 1, x86_64-unknown-linux-gnu, GTK+ Version 3.22.24) of 2017-11-05 built on alfajor Repository revision: 7b20a85bf651debb66742d7ed8a55bdc883ded79 Windowing system distributor 'The X.Org Foundation', version 11.0.11905000 System Description: Debian GNU/Linux testing (buster) Recent messages: Undo! Saving file /home/monnier/src/emacs/trunk/build-aux/git-hooks/pre-commit... Wrote /home/monnier/src/emacs/trunk/build-aux/git-hooks/pre-commit funcall-interactively: Buffer is read-only: # Read-Only mode disabled in current buffer Saving file /home/monnier/src/emacs/work/.git/hooks/pre-commit... Wrote /home/monnier/src/emacs/work/.git/hooks/pre-commit Saving file /home/monnier/src/emacs/trunk/build-aux/git-hooks/pre-commit... Wrote /home/monnier/src/emacs/trunk/build-aux/git-hooks/pre-commit Mark set [2 times] Configured using: 'configure -C --enable-checking --with-modules --enable-check-lisp-object-type 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign' PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES LCMS2 Important settings: value of $LANG: fr_CH.UTF-8 locale-coding-system: utf-8-unix Major mode: InactiveMinibuffer Minor modes in effect: diff-auto-refine-mode: t electric-pair-mode: t global-reveal-mode: t reveal-mode: t auto-insert-mode: t savehist-mode: t minibuffer-electric-default-mode: t global-compact-docstrings-mode: t url-handler-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t global-prettify-symbols-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /home/monnier/src/emacs/elpa/packages/svg/svg hides /home/monnier/src/emacs/work/lisp/svg /home/monnier/src/emacs/elpa/packages/ada-mode/ada-mode hides /home/monnier/src/emacs/work/lisp/progmodes/ada-mode /home/monnier/src/emacs/elpa/packages/ada-mode/ada-stmt hides /home/monnier/src/emacs/work/lisp/progmodes/ada-stmt /home/monnier/src/emacs/elpa/packages/ada-mode/ada-prj hides /home/monnier/src/emacs/work/lisp/progmodes/ada-prj /home/monnier/src/emacs/elpa/packages/ada-mode/ada-xref hides /home/monnier/src/emacs/work/lisp/progmodes/ada-xref /home/monnier/src/emacs/elpa/packages/hyperbole/set hides /home/monnier/src/emacs/work/lisp/emacs-lisp/set /home/monnier/src/emacs/elpa/packages/landmark/landmark hides /home/monnier/src/emacs/work/lisp/obsolete/landmark /home/monnier/src/emacs/elpa/packages/crisp/crisp hides /home/monnier/src/emacs/work/lisp/obsolete/crisp Features: (sort mail-extr emacsbug message rmc puny dired dired-loaddefs format-spec rfc822 mml mml-sec epa derived epg gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils add-log log-view pcvs-util sh-script smie make-mode executable copyright whitespace vc vc-dispatcher smerge-mode lisp-mnt xscheme unsafep trace testcover shadow scheme re-builder profiler inf-lisp ielm gmm-utils ert pp find-func ewoc debug elp edebug cl-indent cus-edit cus-start cus-load wid-edit vc-git diff-mode filecache map cl-extra help-fns radix-tree server time-date flymake-proc flymake compile comint ansi-color ring warnings noutline outline easy-mmode flyspell ispell checkdoc thingatpt help-mode load-dir elec-pair reveal autoinsert proof-site proof-autoloads cl pg-vars savehist minibuf-eldef disp-table compact-docstrings cl-seq inline kotl-loaddefs advice info realgud-recursive-autoloads finder-inf url-auth package easymenu epg-config url-handlers url-parse auth-source eieio eieio-core cl-macs eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib bbdb-loaddefs mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 8 219296 26772) (symbols 24 29613 0) (miscs 20 4050 839) (strings 16 68318 5077) (string-bytes 1 2005085) (vectors 8 38803) (vector-slots 4 1642549 23736) (floats 8 120 353) (intervals 28 2761 113) (buffers 528 30)) From unknown Sun Jun 22 00:51:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#29197: 27.0.50; pre-commit checks for new files against "head" Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Nov 2017 21:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29197 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 29197@debbugs.gnu.org Received: via spool by 29197-submit@debbugs.gnu.org id=B29197.15100906052532 (code B ref 29197); Tue, 07 Nov 2017 21:37:01 +0000 Received: (at 29197) by debbugs.gnu.org; 7 Nov 2017 21:36:45 +0000 Received: from localhost ([127.0.0.1]:57163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCBY5-0000em-4T for submit@debbugs.gnu.org; Tue, 07 Nov 2017 16:36:45 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:52831) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCBY3-0000eY-Hm for 29197@debbugs.gnu.org; Tue, 07 Nov 2017 16:36:43 -0500 Received: by mail-wm0-f51.google.com with SMTP id t139so6889446wmt.1 for <29197@debbugs.gnu.org>; Tue, 07 Nov 2017 13:36:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OOhSdDZN7Wxbe5pFKSEiPx3kiqbBkAsg1Pz3l+gZS2w=; b=o7eoNGrbTCpTTEfWmzWc9gsJY8ecQdH682Udf3pHg4ALvdI6zRwPtcVIuvtYL5OB+M iIjFTz+9OnB0rVQ03Kcz4lAC8wFixqMR8DxpGpyFsSIP7XQtQejvZREkVXZrywPF0I71 0hl0kJ9QpjIqCeTgz6kZ9Ye+bjLz+4dJ32zr+tORSNVtUAXhKUQ2kGE4paouxqtaLbFv d5nqdwd+AckSOtxQscV1j4X1ChBL7/v+ZD/ipH2WixFG42uhOoXG8kYrYosGaZHVEuGz wwxlhq0Njx+mXjgQphYg0/zmzWHWYwmdx+4L5+gFPtadnLBcsRw2dFHYYBBGImNEMK12 F8kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OOhSdDZN7Wxbe5pFKSEiPx3kiqbBkAsg1Pz3l+gZS2w=; b=AqpG3iNKiSQYo2GckpMsDG8RoXEu/W6iFMrz6JGd6sxZY/HZpXp5U9B0IA6r7Bks7g AuqX4QQf86GQgVmZeilTnlN/6rUo232wrtou/ZYwj+Lf/VJ/TRreUZpA6befZu7rSkH2 uztdBKVO+fpW0ce9YEwF+OGwbexvg5r3+WcL8zC4N8y5pGWYNrXcc5/0vV++oNegW3ZE 7ePMhWoa2FODLk5gCG371TwmhNFh90w0tZuFwYFHK4zWlvIxLQ4miPfcZqcr5jnENAjQ gvANn3mB+wDRnFQyE9DVA1qgEMAb0pCOan0yG2BMBoLTW/I//F496hS5apW74Rweb54b GewA== X-Gm-Message-State: AJaThX5WLeeLXgybD5WIVTfJI2HfRHCzKkG80PQ99txbaEKi+d1uUCL/ 4hg9F8iL3wIdVqHRbOqcEs7vcYEjeLIPNtje6Vs= X-Google-Smtp-Source: ABhQp+Sppt3HCe3mnsJ3l5NspvPJMONm0hVIrvbYbDqmfIrlHx+MqsYkXYCFJQu6pGWwN3HynXtsypdv0VcHjoae+LA= X-Received: by 10.28.113.212 with SMTP id d81mr450682wmi.152.1510090597583; Tue, 07 Nov 2017 13:36:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.146.227 with HTTP; Tue, 7 Nov 2017 13:36:37 -0800 (PST) In-Reply-To: References: From: Noam Postavsky Date: Tue, 7 Nov 2017 16:36:37 -0500 X-Google-Sender-Auth: 6dYIHlVimmuJHnynejZt75jX49E Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On Tue, Nov 7, 2017 at 2:18 PM, Stefan Monnier wrote: > I finally figured out why recently, every time I merge changes from > master into my local branch it complains: > > File name does not consist of -+./_ or ASCII letters or digits. > > It turns out it's because it's looking at the diff between master and my > local (merged) branch (i.e. it looks at my local changes) whereas before > it would look at the diff between the old version of my local branch and > the merged version of my local branch (i.e. at the changes I'm pulling > from master). See [1] and followups. Getting warnings about other people's changes was causing some confusion and frustration. [1]: https://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00299.html > And yes, indeed, my local branch has some files with "weird" chars > in it. > > I think the warning should be improved: > - I shouldn't get a warning in the above case, since this commit doesn't > *add* those files (they weren't on origin/master admittedly but they were > already on HEAD). We could choose which side of the merge to check based on an environment var (that was considered in the thread I referenced above, but we didn't see much of a use case at the time). Or is it possible to check only changes from the merge itself (i.e., in case of conflict resolution)? > - the warning should give me some hint about which file fails the test. Yeah, that would make sense. From unknown Sun Jun 22 00:51:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#29197: 27.0.50; pre-commit checks for new files against "head" Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Feb 2018 01:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29197 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier , 29197@debbugs.gnu.org Received: via spool by 29197-submit@debbugs.gnu.org id=B29197.151865664228977 (code B ref 29197); Thu, 15 Feb 2018 01:05:02 +0000 Received: (at 29197) by debbugs.gnu.org; 15 Feb 2018 01:04:02 +0000 Received: from localhost ([127.0.0.1]:43473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1em7xx-0007XC-1n for submit@debbugs.gnu.org; Wed, 14 Feb 2018 20:04:01 -0500 Received: from mail-io0-f173.google.com ([209.85.223.173]:45474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1em7xu-0007Ww-Rf for 29197@debbugs.gnu.org; Wed, 14 Feb 2018 20:03:59 -0500 Received: by mail-io0-f173.google.com with SMTP id p188so27160098ioe.12 for <29197@debbugs.gnu.org>; Wed, 14 Feb 2018 17:03:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=1tqokSR67u6r4DWjRfsnHWQVCEus928lKUakDeTH1mw=; b=kW7Urrk6Eb6RR+zdCZx//d9LErHGiNpiBITInjnV3FBhaAgtsD/3Oug0YWhf6vJfj9 vKCHL0vaRJf7sayuF6tjWBmD4iQ6OQswGPHsA1D6aSparpODzJpC0Uhvt8drgZ8p0k8Z 0LdRjXMQk2G/HDxA5w6cyG1AE1l6fLRorMfacnlLE5b4romPsB2bo1XEHon/ZA/6NoJo 0HZY4gcwT1o411zyc065XOcl4mvFSP6EGmr6u1cH1JFhpQN7xCCdKKol438L1IKLbPxc J3qYgMDT8fVCMLhshPrHpmhfXQOIJ5Dm15XmnX2BuDGf04uiEhs6kwYxuAyB+HS547nr p0RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=1tqokSR67u6r4DWjRfsnHWQVCEus928lKUakDeTH1mw=; b=hnF/VqirC2sl7r6+erap55YMaQE5l02qTdGJHPKS28HsdE7OKZ80BgKOxiTwoAP1z6 a98ofOcFqQsA1gffnYN+FY9tAWbP8yAx0vF6Isjm3wql9jGItBNDpnUtj1PMmhF0Yknp UtRRjf1OfAzHYF/JblzTlEgzyMBLUPWL11QUBHIAh/fIzvLTKCtiQKC/xFbVF8iSfAzB 70Ly9pCm++wPpCmm/1ENHyfCoCkbtDnbDIF+3dlh7hnXt5ZLrOj6VgKVxqASMBzIduVA rj2W3Fu6bVAIeYRnQ+tWWySpa2mMCH0rkSgnr1v8KEFpdNTlM4gjTpZCGcBwO7qLZnyF UYIQ== X-Gm-Message-State: APf1xPBXssmQFrGtUlvPXTo2tdZFCX5lNPpVNKC2vxg0j4c2CLxY6txf onXGlLX9w2CVlaasSpYXqaWmbg== X-Google-Smtp-Source: AH8x226LW2K7BvnDet+nT+eUiR8QVdONGYSpl7Gsd1U3hPZPgoI/1ZZVUNxHnblYe0k4tD4uTcnB2g== X-Received: by 10.107.148.139 with SMTP id w133mr1453310iod.175.1518656633016; Wed, 14 Feb 2018 17:03:53 -0800 (PST) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id 91sm26952ioh.59.2018.02.14.17.03.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Feb 2018 17:03:51 -0800 (PST) From: Noam Postavsky References: Date: Wed, 14 Feb 2018 20:03:50 -0500 In-Reply-To: (Noam Postavsky's message of "Tue, 7 Nov 2017 16:36:37 -0500") Message-ID: <87lgfv83nt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain Noam Postavsky writes: >> I think the warning should be improved: >> - I shouldn't get a warning in the above case, since this commit doesn't >> *add* those files (they weren't on origin/master admittedly but they were >> already on HEAD). > > We could choose which side of the merge to check based on an > environment var (that was considered in the thread I referenced above, > but we didn't see much of a use case at the time). Or is it possible > to check only changes from the merge itself (i.e., in case of conflict > resolution)? > >> - the warning should give me some hint about which file fails the test. > > Yeah, that would make sense. This seems fairly difficult to do while keeping in standard bourne shell syntax. Not sure how to catch file names with whitespace. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Let-pre-commit-git-hook-check-merged-in-changes-B.patch Content-Description: patch >From fa94e7452be5ffb4d63ad2a40fc5b9fdeed3fed0 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 14 Feb 2018 19:58:07 -0500 Subject: [PATCH v1] ; Let pre-commit git hook check merged in changes (Bug#29197) * build-aux/git-hooks/pre-commit: If GIT_MERGE_CHECK_OTHER is 'true', check changes against the merge target, rather than the current branch. Include file name when giving error message about non-standard characters. --- build-aux/git-hooks/pre-commit | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/build-aux/git-hooks/pre-commit b/build-aux/git-hooks/pre-commit index 5e42dab233..33d8c91168 100755 --- a/build-aux/git-hooks/pre-commit +++ b/build-aux/git-hooks/pre-commit @@ -28,7 +28,7 @@ LC_ALL= # When doing a two-way merge, ignore problems that came from the other # side of the merge. head=HEAD -if test -r "$GIT_DIR"/MERGE_HEAD; then +if test -r "$GIT_DIR"/MERGE_HEAD && test "$GIT_MERGE_CHECK_OTHER" != true; then merge_heads=`cat "$GIT_DIR"/MERGE_HEAD` || exit for merge_head in $merge_heads; do case $head in @@ -42,13 +42,6 @@ head= fi git_diff='git diff --cached --name-only --diff-filter=A' -ok_chars='\0+[=-=]./0-9A-Z_a-z' -nbadchars=`$git_diff -z $head | tr -d "$ok_chars" | wc -c` - -if test "$nbadchars" -ne 0; then - echo "File name does not consist of -+./_ or ASCII letters or digits." - exit 1 -fi for new_name in `$git_diff $head`; do case $new_name in @@ -58,9 +51,20 @@ nbadchars= ChangeLog | */ChangeLog) echo "$new_name: Please use git commit messages, not ChangeLog files." exit 1;; + *[^-+./_0-9A-Z_a-z]*) + echo "$new_name: File name does not consist of -+./_ or ASCII letters or digits." + exit 1;; esac done +ok_chars='\0+[=-=]./0-9A-Z_a-z' +nbadchars=`$git_diff -z $head | tr -d "$ok_chars" | wc -c` + +if test "$nbadchars" -ne 0; then + echo "A file name has whitespace." + exit 1 +fi + # The '--check' option of git diff-index makes Git complain if changes # introduce whitespace errors. This can be a pain when editing test # files that deliberately contain lines with trailing whitespace. -- 2.11.0 --=-=-=-- From unknown Sun Jun 22 00:51:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#29197: 27.0.50; pre-commit checks for new files against "head" Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Aug 2018 12:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29197 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 29197@debbugs.gnu.org Received: via spool by 29197-submit@debbugs.gnu.org id=B29197.153545888132553 (code B ref 29197); Tue, 28 Aug 2018 12:22:02 +0000 Received: (at 29197) by debbugs.gnu.org; 28 Aug 2018 12:21:21 +0000 Received: from localhost ([127.0.0.1]:34989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuczp-0008St-12 for submit@debbugs.gnu.org; Tue, 28 Aug 2018 08:21:21 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:42010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuczm-0008Sb-Mc; Tue, 28 Aug 2018 08:21:19 -0400 Received: by mail-io0-f174.google.com with SMTP id n18-v6so1230940ioa.9; Tue, 28 Aug 2018 05:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=a0qkD6PJWaFYInFZFMrnq0OB5wGE1clk1fsRigSbPFc=; b=Do/s25HletwmTKGYg4jkcjUkOVcTMc3qK7I8tObBlQBisgWV31tlEzDTlhYU+TmR/K lXamQaGxw7eT1Q7aJsq+vF8Fv5AdTNS7DeLRTHRWg/s07P1O5Zh33ucQudHML+5gORba gdYg9bjhxKNLWHDE32oBCmcTXQvd7RXMgzAD6sCgM30HkBGablRWX/GgrVK2+FUikOv5 6tZ9c/LnaH07Zl2aSP3ARcs+4rPX0mvH9JxGR0M3GzpNvUXTlWCsYYUS6VFqCkxUL202 GxEs63IvaRStjCFr+nYAqLuj35O86ki5oabgo/zk2MLFWk8DpdSK6kATp/GiIR+HjJf9 XeVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=a0qkD6PJWaFYInFZFMrnq0OB5wGE1clk1fsRigSbPFc=; b=bi33xadtAkYBHgnW57RbgWP/OefGejyUaVoeL+5mEr1MSaFD2RqQsPJzvNRePscCnn 3aYm66m9nGLVUXCP+sgsMqVjlvaImqBrTuWcvW4CtobhxMaY6xN+uNfvxWu6rXBE/aDb FK9tyOncmH9Zw35HEl+47VyudLOi79qFBo6IuO0sxsYIs3wg+wAsuj5ieTnhItGB261f VOoHn+8Gp5Eikib4I/pyZxbQ8dYVSkBAUWglt+lMPhpN1VF7mGF1NcXLaO8pY25sUYhL CmZ+f8odvGXXPvC+nqdtTWxIglo4LC2HwRyi86fvql42eJVK9i3To6Uqly0B2iUefPdS zbgA== X-Gm-Message-State: APzg51BovKJFe/9GrTlQq7RbX3g9ir36RqPT/yGaSk/qoqSQcqdXN2mx nUhc8cqI1TB5YwdtoxpBAg0qYpHP X-Google-Smtp-Source: ANB0VdbvCDc5E1wl5q3/95134STRffvkUR9utNbRXZ9tfkLSaQrZVVPdLx2sGdy0iXVWB8MiQsug7Q== X-Received: by 2002:a6b:3fd4:: with SMTP id m203-v6mr1020827ioa.124.1535458872810; Tue, 28 Aug 2018 05:21:12 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id c141-v6sm656033itc.42.2018.08.28.05.21.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 05:21:12 -0700 (PDT) From: Noam Postavsky References: <87lgfv83nt.fsf@gmail.com> Date: Tue, 28 Aug 2018 08:21:11 -0400 In-Reply-To: <87lgfv83nt.fsf@gmail.com> (Noam Postavsky's message of "Wed, 14 Feb 2018 20:03:50 -0500") Message-ID: <87o9dmu1fs.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 29197 fixed close 29197 quit Noam Postavsky writes: > This seems fairly difficult to do while keeping in standard bourne shell > syntax. Not sure how to catch file names with whitespace. Acually, it turns out that 'git diff' does escaping, so it's pretty easy. Done in emacs-26. [1: fca935e4ab]: 2018-08-28 08:04:17 -0400 ; Let pre-commit git hook check merged in changes (Bug#29197) https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fca935e4abe817130abb2676ec2f37b73e4f45f4