git/list[1] front-page[2] threads[3] people[4] search[5] about
 

How do I get git-format-patch to ignore changes that remove spaces from the end of the line?

From
TTTimur Tabi <timur@freescale.com>
Date
Feb 13, 2007, 21:59 UTC
Message-ID
<45D234C5.5090005@freescale.com>

I have configured my text editor to remove spaces at the end of each line whenever it saves a file. I do this so that I don't inadvertently add spaces to the end of any line.

Unfortunately, if the file *already* had spaces at the end of some lines before I start editing it, this spaces will also be removed.

After I commit my changes, I use git-format-patch to make a patch. I then get deltas like this:

   * Copyright (C) 1996-2005 Paul Mackerras.
- *
+ *
   *  Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
- *    {engebret|bergner}@us.ibm.com
+ *    {engebret|bergner}@us.ibm.com
   *

I don't want these deltas in my patch. However, if I specify an option like --ignore-all-space, git-format-patch omits deltas like this one:

-               memcpy(fs_enet_data.macaddr, mac_addr, 6);
+                       memcpy(fs_enet_data.macaddr, mac_addr, 6);

In this case, I *do* want the delta, because I'm indenting a line to fix a formatting error.

So how do I get the output that I want, and not the output that I don't want?
-- 
Timur Tabi
Linux Kernel Developer @ Freescale
Next: Junio C Hamano
Message 1 of 6 in “How do I get git-format-patch to ignore changes that remove spaces from the end of the line?”
  1. Timur TabiFeb 13, 2007
  2. Junio C HamanoFeb 13, 2007
  3. Timur TabiFeb 13, 2007
  4. teach diff machinery about --ignore-space-at-eolJohannes Schindelin, Feb 14, 2007
  5. Timur TabiFeb 14, 2007
  6. Timur TabiFeb 14, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.