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

git log -Sfoo ignores indentation (whitespace?) changes...

From
PLPeter Valdemar Mørch (Lists) <4ux6as402@sneakemail.com>
Date
Mar 3, 2009, 14:28 UTC
Message-ID
<49AD3E78.1050706@sneakemail.com>

Commits where only the indentation of 'foo' is changed are not shown with "git log -Sfoo". Is there any way to force showing them along with other changes involving foo? (E.g. for python, indentation matters!)

Why doesn't the second commit show up in the following?
$ git init

# Create text containing 'line' without whitespace $ echo 'line' > text $ git add text $ git commit -m "first" text

# Here, I add one space of indentation in front of 'line' $ echo ' line' > text $ git commit -m "second" text

# git log -Sline shows only the first commit, not the second,
# where the indentation changed.
$ git log -Sline
commit c4481e4b38bb521d91583e5c5a3b2b98f08b7ec0
Author: pvm <pvm@change_me.dk>
Date:   Tue Mar 3 14:45:38 2009 +0100
     first
# But clearly, the second commit *also* has changes
# containing 'line':
$ git log -p HEAD~..HEAD
commit 6cb883409aa9ccda00d7720ee9bf4fa59918c5fd
Author: pvm <pvm@change_me.dk>
Date:   Tue Mar 3 14:45:39 2009 +0100
     second
diff --git a/text b/text
index a999a0c..d650980 100644
--- a/text
+++ b/text
@@ -1 +1 @@
-line
+ line

I would like to see both "first" and "second" somehow - can I do that?
-- 
Peter Valdemar Mørch
http://www.morch.com
Next: Jeff King
Message 1 of 17 in “git log -Sfoo ignores indentation (whitespace?) changes...”
  1. Peter Valdemar Mørch (Lists)Mar 3, 2009
  2. Jeff KingMar 3, 2009
  3. doc: clarify how -S worksJeff King, Mar 3, 2009
  4. John TapsellMar 3, 2009
  5. Jeff KingMar 3, 2009
  6. John TapsellMar 3, 2009
  7. Junio C HamanoMar 3, 2009
  8. Jeff KingMar 3, 2009
  9. John TapsellMar 3, 2009
  10. Jeff KingMar 3, 2009
  11. Junio C HamanoMar 3, 2009
  12. Peter Valdemar Mørch (Lists)Mar 3, 2009
  13. Jeff KingMar 3, 2009
  14. Junio C HamanoMar 3, 2009
  15. Michael J GruberMar 3, 2009
  16. Jeff KingMar 3, 2009
  17. Junio C HamanoMar 3, 2009

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.