git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Finding all commits which modify a file
@ 2012-01-20 21:35 Neal Groothuis
  2012-01-21 23:16 ` Neal Kreitzinger
  2012-01-22  4:03 ` Tay Ray Chuan
  0 siblings, 2 replies; 16+ messages in thread
From: Neal Groothuis @ 2012-01-20 21:35 UTC (permalink / raw)
  To: git

Hello,

I'm trying to find /all/ commits that change a file in the
repository...and its proving to be trickier than I thought. :-)

The situation that we were dealing with is this:

- Person A and person B both pull from the same central repository.

- Person A makes a change to file foo.txt and bar.txt, commits, and pushes
to the central repository.

- Person B makes a similar change to bar.txt and commits it.

- Person B does a fetch and merge.  Since both A and B made changes to
bar.txt, this requires conflicts to be resolved manually.

- B reverts A's changes to foo.txt. (If B is coming from a different
revision control system, this may happen due to confusion about how merges
are handled.)

- B commits the changes.

- B makes more changes to bar.txt, commits them, and pushes to the central
repository.

At this point, A's changes to foo.txt have been undone.

Graphically:

    A1
   /  ^
  v    \
  C1   B2<-B3
  ^    /
   \  v
    B1

B1, B2, and B3 have the same version of foo.txt as C1, A1 modifies it.

Person A discovers that his changes are missing and wants to know what
happened.

git log foo.txt doesn't help; it won't even show commit A1, due to history
simplification.

git log --full-history foo.txt will show commit A1.  It still won't show
commit B2, though, which we'd also like to show (because that's where the
change to foo.txt got removed).

I would think that git log --simplify-merges foo.txt would have done what
I'd wanted, but it still does not show commit B2.   Based on what I'm
reading in the man page, I would expect the simplification to go like
this:

    A1
    | ^
    |  \
    |  B2<-B3
    |  /
    v v
    C1

(since B1 is TREESAME as C1 if we're only considering foo.txt)

    A1
    | ^
    |  \
    |  B2<-B3
    |
    v
    C1

(since C1 is an ancestor of A1)

However, the actual output only includes A1, not B2.

 - Can someone explain this, and/or
 - can someone offer a command to display all commits (including merges)
in which ANY parent is not TREESAME?

Thanks!

- Neal

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: Finding all commits which modify a file
@ 2012-02-02 14:55 Neal Groothuis
  2012-02-02 19:13 ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Neal Groothuis @ 2012-02-02 14:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

> "Neal Groothuis" <ngroot@lo-cal.org> writes:
>
>> Is there a situation where checking for TREESAMEness before
>> simplification
>> is desirable and checking after would not be?
>
> When you do not want to see a side branch that does not contribute to
the end result at all, obviously ;-). Outside that situation, before or
after should not make a difference, I would think.

In that case, you wouldn't be using the --full-history flag at all, yeah?

Right now, we can see where the file gets changed (A1), we just can't see
where it gets changed back (B2).  In fact, if I run git-log --full-history
--simplify-merges foo.txt, it looks like A1 was the last thing to make
changes to foo.txt, which seems misleading to me---history has been
simplified to the point of not being true.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-02-02 19:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20 21:35 Finding all commits which modify a file Neal Groothuis
2012-01-21 23:16 ` Neal Kreitzinger
2012-01-23 16:14   ` Neal Groothuis
2012-01-24  0:58     ` Santi Béjar
2012-01-24  1:15       ` Santi Béjar
2012-01-24  1:15       ` Linus Torvalds
2012-01-24  1:36         ` Santi Béjar
2012-01-24 18:35           ` Santi Béjar
2012-01-24  1:40       ` Junio C Hamano
2012-01-24 16:34       ` Neal Groothuis
2012-01-24 18:10         ` Santi Béjar
2012-01-25 16:23           ` Neal Groothuis
2012-01-26 22:42             ` Junio C Hamano
2012-01-22  4:03 ` Tay Ray Chuan
  -- strict thread matches above, loose matches on Subject: below --
2012-02-02 14:55 Neal Groothuis
2012-02-02 19:13 ` Junio C Hamano

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).