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

Re: Directory renames without breaking git log.

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 4, 2008, 20:41 UTC
Message-ID
<m3ljy7prtj.fsf@localhost.localdomain>
In-Reply-To
<200809042145.09573.kai@samba.org>
Kai Blin <kai@samba.org> writes:
Show 20 quoted lines
> On Thursday 04 September 2008 02:16:24 Tarmigan wrote:
> > On Wed, Sep 3, 2008 at 2:38 PM, Kai Blin <kai@samba.org> wrote:
> > > Unfortunately, the directories are big enough that git log stops to track
> > > the renamed files, so e.g. git log ./samba3 does not show the samba3
> > > history. The history is not lost, of course, but it's way less intuitive
> > > to get it.
> >
> > You can try setting diff.renamelimit to 0 in your ~/.gitconfig.  See
> > Linus's email here for a similar situation in the kernel:
> > http://lwn.net/Articles/292948/
> 
> That doesn't seem to fix "git log path/to/file" cases. The really
> interesting part is that if I try "git log --follow -M -C
> path/to/file", I don't get any history at all. (--follow is the
> culprit, if I remove that I at least get the merge commit)
> 
> git blame still works, and git log --sparse path/to/file works, of 
> course. --sparse makes giving a path a bit pointless, of course, but we 
> probably can live with that for time being. I'm still open for suggestions, 
> of course. :)

Unfortunately "git log --follow <filename>" works correctly only on relative simple histories. You are of course welcome to improve this part of git.

Simple workaround is to use "git log <file>" (optionally using --diff-filter) to get when file vanished, check using "git show" or "git whatchanged" on boundary commit, then use "git log -C -C -- <old name> <new name>"

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Junio C HamanoNext: Tarmigan
Message 7 of 8 in “Directory renames without breaking git log.”
  1. Kai BlinSep 3, 2008
  2. TarmiganSep 4, 2008
  3. Kai BlinSep 4, 2008
  4. Junio C HamanoSep 4, 2008
  5. Kai BlinSep 4, 2008
  6. Junio C HamanoSep 4, 2008
  7. Jakub NarebskiSep 4, 2008
  8. TarmiganSep 4, 2008

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.