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

Re: file rename causes history to disappear

From
Linus Torvalds <torvalds@osdl.org>
Date
Sep 6, 2006, 16:37 UTC
Message-ID
<Pine.LNX.4.64.0609060922110.27779@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.64.0609060858050.27779@g5.osdl.org>
On Wed, 6 Sep 2006, Linus Torvalds wrote:
Show 6 quoted lines
> 
> 	git log -- drivers/scsi drivers/ata include/linux/ata.h
> 
>    So taking a filename-based approach is actually more _powerful_. You 
>    can emulate the "follow a single file" behaviour on top of it, but you 
>    can't sanely go the other way.

Side note: one thing that I wanted to do, but never got around to, is to allow wildcards in the tree-parsing code. It might be too expensive, but it's still occasionally something I'd like to do:

	git log -- 'mm/*.c'

to track every single C file in the VM (even if they don't exist right _now_).

Notice the difference between
	git log mm/*.c

and the above idea - the latter does actually work, but it only tracks the C files that exist right now under mm/. But it should be possible (and is potentially useful) to let the wildcard act over the history, rather than just a single point in time.

Because one additional advantage of thinking in terms of pathnames is exactly the fact that wildcards make sense in a way that they do _not_ make sense if you think of tracking "inodes". Exactly because "pathnames are forever", and a pathname has validity and exists regardless of whether a repository contains a _file_ with that name at any particular point in time.

So right now git does do the wildcard thing, but only for "git ls-files" (and through that, things like "git add", which used to be implemented in terms of ls-files). So you can do

	git add '*.c'
to add all C files (recursively - it's not the shell matcher).
			Linus
Previous: Linus TorvaldsNext: Junio C Hamano
Message 6 of 16 in “file rename causes history to disappear”
  1. Jeff GarzikSep 6, 2006
  2. Timo HirvonenSep 6, 2006
  3. Linus TorvaldsSep 6, 2006
  4. Jeff GarzikSep 6, 2006
  5. Linus TorvaldsSep 6, 2006
  6. Linus TorvaldsSep 6, 2006
  7. Junio C HamanoSep 6, 2006
  8. Randal L. SchwartzSep 6, 2006
  9. Junio C HamanoSep 7, 2006
  10. Alex RiesenSep 7, 2006
  11. Jakub NarebskiSep 6, 2006
  12. Linus TorvaldsSep 6, 2006
  13. Jakub NarebskiSep 6, 2006
  14. Linus TorvaldsSep 6, 2006
  15. Junio C HamanoSep 6, 2006
  16. Jakub NarebskiSep 6, 2006

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.