From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>,
Neal Kreitzinger <neal@rsss.com>,
git@vger.kernel.org
Subject: Re: scan entire repo for changes to file
Date: Tue, 16 Nov 2010 12:20:43 -0600 [thread overview]
Message-ID: <20101116182043.GA14552@burratino> (raw)
In-Reply-To: <7vk4kdi2h4.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> Martin von Zweigbergk wrote:
>>> On Thu, Nov 11, 2010 at 8:28 PM, Neal Kreitzinger <neal@rsss.com> wrote:
>>>> Is there a way to scan my entire repo (many unmerged branches) for any
>>>> changes to a file?
>>>> e.g.
>>>> $ git log * -- somepath/myblob
>>>> would return all commits in the repo that changed myblob.
>>>
>>> Might replacing '*' by '--all' give you what are looking for?
>>
>> Probably with --full-history if you want to know what happened on
>> historic branches, too.
>
> You would need to clarify what you mean by "historic branches" here.
Yes, quite right. I meant failed experiments of a certain kind.
The "git log -- path" facility can be used to learn the nature and
origin of a collection of files.
$ git log --graph --oneline -- block-sha1/
* 078e9bc msvc: Select the "fast" definition of the {get,put}_be32() macros
[...]
* d7c208a Add new optimized C 'block-sha1' routines
The result is a list of commits that explains the current state of
that file, without commits irrelevant to that purpose.
What happens to merges? Consider a history like this (history flowing
left to right):
A --- B --- C --- D --- E --- F --- G ---- M --- H
\ /
I ... ... J
There is a main line and a side branch. On the mainline, the selected
files have been getting better and better. The side branch does not
touch those files. Then the side branch would irrelevant to the
history of those files.
To flesh out this idea, git history simplification. When walking
through history, if a merge is encountered (M) and one of the parents
already matches the resulting state (G), then git will follow that
parent and ignore the others. If no parent matches the resulting
state, git follows all parents. So we get a simpler history that
should still adequately explain the result.
Consider another scenario, though:
A --- B --- C --- D --- E --- F --- G ---- M' --- H'
\ /
I' ... ... J'
There is a mainline and a side branch. On the mainline, the selected
files have been getting better and better. On the side branch, there
was an abortive experiment; some changes were made to the selected
files there, but none of these changes survived as far as the merge M'.
The side branch is _still_ irrelevant to the purpose of explaining the
current state of those files. Git will notice that (G matches M') and
ignore the side branch. But if your goal is not to explain the
current state but to delve into the history of all thoughts this
project remembers on a subject, such history simplification would not
be appropriate and you should be using the --full-history option.
The History Simplification section of git-log(1) has details.
Caveat: the list of commits selected with --full-history --dense do
not convey a coherent history. M' is uninteresting but some of the
commits on the I' ... J' track are; how do we stitch the interesting
commits together? So history visualization tools cop out and show
all merges when --full-history is enabled. (Put another way,
--parents --full-history implies --no-dense.)
Hope that helps.
next prev parent reply other threads:[~2010-11-16 18:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 1:28 scan entire repo for changes to file Neal Kreitzinger
2010-11-12 1:35 ` Martin von Zweigbergk
2010-11-12 1:44 ` Jonathan Nieder
2010-11-16 17:48 ` Junio C Hamano
2010-11-16 18:20 ` Jonathan Nieder [this message]
2010-11-18 0:47 ` Neal Kreitzinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101116182043.GA14552@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=martin.von.zweigbergk@gmail.com \
--cc=neal@rsss.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).