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

Re: Finding all commits which modify a file

From
NGNeal Groothuis <ngroot@lo-cal.org>
Date
Jan 25, 2012, 16:23 UTC
Message-ID
<30433.38.96.167.131.1327508582.squirrel@mail.lo-cal.org>
In-Reply-To
<CA+gHt1BjqJpUke8JKjUmFyg3Zj5FmASd77LR-7P+6RrNLddD1A@mail.gmail.com>
> [ Do not cut the CC]
My apologies.
Show 35 quoted lines
> On Tue, Jan 24, 2012 at 5:34 PM, Neal Groothuis <ngroot@lo-cal.org> wrote:
>>> On Mon, Jan 23, 2012 at 5:14 PM, Neal Groothuis <ngroot@lo-cal.org>
>>> wrote:
>>>>> On 1/20/2012 3:35 PM, Neal Groothuis wrote:
>>>>>> I'm trying to find /all/ commits that change a file in the
>>>>>> repository...and its proving to be trickier than I thought. :-)
>>>>
>>>> On 1/21/2012 6:16 PM, Neal Kreitzinger wrote:
>>>>> Does git-log --all help?
>>>>
>>>> I don't see how it would.  The commits are all reachable from HEAD,
>>>> which
>>>> would seem to be the problem that --all would correct.
>>>>
>>>> What I'm trying to do is find the commits in which a file differs from
>>>> that same file in any of its parents.
>>>
>>> If you add parent rewriting (--parent, --graph or see it in gitk, with
>>> --full-history) you'll get your B2 commit as it adds commits to have a
>>> meaningful history. But I don't think this is what you are asking for.
>>
>> Correct.  If I add parent rewriting, I get all merges, even those in
>> which
>> the file is not changed from either parent.
>>
>> Based on what's in the man page for git log about the history
>> simplification algorithm, it seems that B2 should be included in the
>> output when I do a git log --full-history --simplify-history foo.txt, as
>> per the steps I noted in the original post.  Is my understanding of the
>> algorithm faulty?
>>
>
> Following your steps in the first post, B2 is excluded in the
> --simplify-merge phase because it is (originally) TREESAME, even if it
> is not in the rewritten history...

Thanks, I see---labeling a commit as TREESAME happens before simplification, rather than after.

In my example, that results in a simplified history where a commit in which the contents of the specified paths change gets removed. That seems perverse; I would think the utility of a simplified history would be to track down the commits in which the contents of the specified paths change without having to consider ones in which they do not.

Is there a situation where checking for TREESAMEness before simplification is desirable and checking after would not be?

- Neal
Previous: Santi BéjarNext: Junio C Hamano
Message 12 of 14 in “Finding all commits which modify a file”
  1. Neal GroothuisJan 20, 2012
  2. Neal KreitzingerJan 21, 2012
  3. Neal GroothuisJan 23, 2012
  4. Santi BéjarJan 24, 2012
  5. Santi BéjarJan 24, 2012
  6. Linus TorvaldsJan 24, 2012
  7. Santi BéjarJan 24, 2012
  8. Santi BéjarJan 24, 2012
  9. Junio C HamanoJan 24, 2012
  10. Neal GroothuisJan 24, 2012
  11. Santi BéjarJan 24, 2012
  12. Neal GroothuisJan 25, 2012
  13. Junio C HamanoJan 26, 2012
  14. Tay Ray ChuanJan 22, 2012

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.