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

Re: --follow is ignored when used with --reverse

From
LFLukas Fleischer <git@cryptocrack.de>
Date
Jul 2, 2013, 09:38 UTC
Message-ID
<20130702093842.GA4353@blizzard>
In-Reply-To
<20130702091936.GA9161@serenity.lan>
On Tue, Jul 02, 2013 at 10:19:36AM +0100, John Keeping wrote:
Show 27 quoted lines
> On Fri, May 24, 2013 at 01:23:24AM +0200, Alois Mahdal wrote:
> > Hello!
> > 
> > This [has been reported][1] to this list about half a year ago
> > but with no response so I'm  not even sure if it's been
> > acknowledged as bug.
> > 
> >   [1]: http://marc.info/?l=git&m=135215709307126&q=raw
> > 
> > When I use `git log --follow file` all is OK, but once I add
> > `--reverse` to it, it no longer follows the file beyond renames.
> > 
> > This makes it hard to query for when the file was really added,
> > which I was trying to achieve with
> > 
> >     $ git -1 --reverse --follow several_times_renamed_file
> 
> In my testing it actually seems to be worse than that.  In git.git:
> 
>     $ git log --oneline builtin/clone.c | wc -l
>     99
>     $ git log --oneline --reverse builtin/clone.c | wc -l
>     99
>     $ git log --oneline --follow builtin/clone.c | wc -l
>     125
>     $ git log --oneline --follow --reverse builtin/clone.c | wc -l
>     3

I just wanted to point out that it works fine when specifying the *original* file name (which kind of makes sense given that everything is done in reverse order):

    $ git init >/dev/null
    $ echo foo >a && git add a && git commit -m first
    [master (root-commit) 3631134] first
     1 file changed, 1 insertion(+)
     create mode 100644 a
    $ echo bar >b && git add b && git commit -m second
    [master 7772184] second
     1 file changed, 1 insertion(+)
     create mode 100644 b
    $ git mv b c && git commit -m third
    [master 0275097] third
     1 file changed, 0 insertions(+), 0 deletions(-)
     rename b => c (100%)
    $ git log --oneline --follow --reverse -- c
    0275097 third
    $ git log --oneline --follow --reverse -- b
    7772184 second
    0275097 third
However, that also doesn't seem to work for builtin/clone.c:
    $ git log --oneline --follow --reverse -- builtin-clone.c | wc -l
    65
Show 7 quoted lines
> 
> So the combination of --reverse and --follow appears to have lost the
> majority of the commits!
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: John KeepingNext: Thomas Rast
Message 5 of 9 in “--follow is ignored when used with --reverse”
  1. Alois MahdalMay 23, 2013
  2. alois.mahdal.1-ndmail@zxcvb.czJul 2, 2013
  3. Ramkumar RamachandraJul 2, 2013
  4. John KeepingJul 2, 2013
  5. Lukas FleischerJul 2, 2013
  6. Thomas RastJul 2, 2013
  7. John KeepingJul 2, 2013
  8. Junio C HamanoJul 2, 2013
  9. Johannes SixtJul 2, 2013

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.