{"thread":{"id":"29411","subject":"Finding all commits which modify a file","startedAt":"2012-01-20T21:35:31Z","lastAt":"2012-01-26T22:42:27Z","messageCount":14,"participants":["Neal Groothuis","Neal Kreitzinger","Tay Ray Chuan","Santi Béjar","Linus Torvalds","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"182879","messageId":"46043.208.70.151.129.1327095331.squirrel@mail.lo-cal.org","threadId":"29411","inReplyTo":null,"subject":"Finding all commits which modify a file","fromName":"Neal Groothuis","fromEmail":"ngroot@lo-cal.org","sentAt":"2012-01-20T21:35:31Z","receivedAt":"2012-01-20T21:35:31Z","isPatch":false,"sender":{"key":"ngroot@lo-cal.org","avatar":null},"body":"Hello,\n\nI'm trying to find /all/ commits that change a file in the\nrepository...and its proving to be trickier than I thought. :-)\n\nThe situation that we were dealing with is this:\n\n- Person A and person B both pull from the same central repository.\n\n- Person A makes a change to file foo.txt and bar.txt, commits, and pushes\nto the central repository.\n\n- Person B makes a similar change to bar.txt and commits it.\n\n- Person B does a fetch and merge.  Since both A and B made changes to\nbar.txt, this requires conflicts to be resolved manually.\n\n- B reverts A's changes to foo.txt. (If B is coming from a different\nrevision control system, this may happen due to confusion about how merges\nare handled.)\n\n- B commits the changes.\n\n- B makes more changes to bar.txt, commits them, and pushes to the central\nrepository.\n\nAt this point, A's changes to foo.txt have been undone.\n\nGraphically:\n\n    A1\n   /  ^\n  v    \\\n  C1   B2<-B3\n  ^    /\n   \\  v\n    B1\n\nB1, B2, and B3 have the same version of foo.txt as C1, A1 modifies it.\n\nPerson A discovers that his changes are missing and wants to know what\nhappened.\n\ngit log foo.txt doesn't help; it won't even show commit A1, due to history\nsimplification.\n\ngit log --full-history foo.txt will show commit A1.  It still won't show\ncommit B2, though, which we'd also like to show (because that's where the\nchange to foo.txt got removed).\n\nI would think that git log --simplify-merges foo.txt would have done what\nI'd wanted, but it still does not show commit B2.   Based on what I'm\nreading in the man page, I would expect the simplification to go like\nthis:\n\n    A1\n    | ^\n    |  \\\n    |  B2<-B3\n    |  /\n    v v\n    C1\n\n(since B1 is TREESAME as C1 if we're only considering foo.txt)\n\n    A1\n    | ^\n    |  \\\n    |  B2<-B3\n    |\n    v\n    C1\n\n(since C1 is an ancestor of A1)\n\nHowever, the actual output only includes A1, not B2.\n\n - Can someone explain this, and/or\n - can someone offer a command to display all commits (including merges)\nin which ANY parent is not TREESAME?\n\nThanks!\n\n- Neal\n"},{"id":"182915","messageId":"4F1B4764.3010501@gmail.com","threadId":"29411","inReplyTo":"46043.208.70.151.129.1327095331.squirrel@mail.lo-cal.org","subject":"Re: Finding all commits which modify a file","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2012-01-21T23:16:52Z","receivedAt":"2012-01-21T23:16:52Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 1/20/2012 3:35 PM, Neal Groothuis wrote:\n> Hello,\n>\n> I'm trying to find /all/ commits that change a file in the\n> repository...and its proving to be trickier than I thought. :-)\n>\n> The situation that we were dealing with is this:\n>\n> - Person A and person B both pull from the same central repository.\n>\n> - Person A makes a change to file foo.txt and bar.txt, commits, and pushes\n> to the central repository.\n>\n> - Person B makes a similar change to bar.txt and commits it.\n>\n> - Person B does a fetch and merge.  Since both A and B made changes to\n> bar.txt, this requires conflicts to be resolved manually.\n>\n> - B reverts A's changes to foo.txt. (If B is coming from a different\n> revision control system, this may happen due to confusion about how merges\n> are handled.)\n>\n> - B commits the changes.\n>\n> - B makes more changes to bar.txt, commits them, and pushes to the central\n> repository.\n>\n> At this point, A's changes to foo.txt have been undone.\n>\n> Graphically:\n>\n>      A1\n>     /  ^\n>    v    \\\n>    C1   B2<-B3\n>    ^    /\n>     \\  v\n>      B1\n>\n> B1, B2, and B3 have the same version of foo.txt as C1, A1 modifies it.\n>\n> Person A discovers that his changes are missing and wants to know what\n> happened.\n>\n> git log foo.txt doesn't help; it won't even show commit A1, due to history\n> simplification.\n>\n> git log --full-history foo.txt will show commit A1.  It still won't show\n> commit B2, though, which we'd also like to show (because that's where the\n> change to foo.txt got removed).\n>\n> I would think that git log --simplify-merges foo.txt would have done what\n> I'd wanted, but it still does not show commit B2.   Based on what I'm\n> reading in the man page, I would expect the simplification to go like\n> this:\n>\n>      A1\n>      | ^\n>      |  \\\n>      |  B2<-B3\n>      |  /\n>      v v\n>      C1\n>\n> (since B1 is TREESAME as C1 if we're only considering foo.txt)\n>\n>      A1\n>      | ^\n>      |  \\\n>      |  B2<-B3\n>      |\n>      v\n>      C1\n>\n> (since C1 is an ancestor of A1)\n>\n> However, the actual output only includes A1, not B2.\n>\n>   - Can someone explain this, and/or\n>   - can someone offer a command to display all commits (including merges)\n> in which ANY parent is not TREESAME?\n>\nDoes git-log --all help?\n\nv/r,\nneal\n"},{"id":"182918","messageId":"CALUzUxpy+XdfMYqX8TGnpQ72FfvpF_VYP-19fTDLrD-=9CN3uw@mail.gmail.com","threadId":"29411","inReplyTo":"46043.208.70.151.129.1327095331.squirrel@mail.lo-cal.org","subject":"Re: Finding all commits which modify a file","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2012-01-22T04:03:19Z","receivedAt":"2012-01-22T04:03:19Z","isPatch":false,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"On Sat, Jan 21, 2012 at 5:35 AM, Neal Groothuis <ngroot@lo-cal.org> wrote:\n> Hello,\n>\n> I'm trying to find /all/ commits that change a file in the\n> repository...and its proving to be trickier than I thought. :-)\n>\n> The situation that we were dealing with is this:\n>\n> - Person A and person B both pull from the same central repository.\n>\n> - Person A makes a change to file foo.txt and bar.txt, commits, and pushes\n> to the central repository.\n>\n> - Person B makes a similar change to bar.txt and commits it.\n>\n> - Person B does a fetch and merge.  Since both A and B made changes to\n> bar.txt, this requires conflicts to be resolved manually.\n>\n> - B reverts A's changes to foo.txt. (If B is coming from a different\n> revision control system, this may happen due to confusion about how merges\n> are handled.)\n\nHow is this \"revert\" done? Was it done at the conflict resolution\nlevel or with a git-revert invocation?\n\nNonetheless, either way, A's commit would be still be present in the\nlog history.\n\n>[snip]\n> Graphically:\n>\n>    A1\n>   /  ^\n>  v    \\\n>  C1   B2<-B3\n>  ^    /\n>   \\  v\n>    B1\n>\n> B1, B2, and B3 have the same version of foo.txt as C1, A1 modifies it.\n\nJust to clarify, is C1 the commit that both A and B both share when\nthey first pull in the first step? And B2 is the merge?\n\n-- \nCheers,\nRay Chuan\n"},{"id":"182970","messageId":"41090.38.96.167.131.1327335283.squirrel@mail.lo-cal.org","threadId":"29411","inReplyTo":"4F1B4764.3010501@gmail.com","subject":"Re: Finding all commits which modify a file","fromName":"Neal Groothuis","fromEmail":"ngroot@lo-cal.org","sentAt":"2012-01-23T16:14:43Z","receivedAt":"2012-01-23T16:14:43Z","isPatch":false,"sender":{"key":"ngroot@lo-cal.org","avatar":null},"body":"> On 1/20/2012 3:35 PM, Neal Groothuis wrote:\n>> I'm trying to find /all/ commits that change a file in the\n>> repository...and its proving to be trickier than I thought. :-)\n\nOn 1/21/2012 6:16 PM, Neal Kreitzinger wrote:\n> Does git-log --all help?\n\nI don't see how it would.  The commits are all reachable from HEAD, which\nwould seem to be the problem that --all would correct.\n\nWhat I'm trying to do is find the commits in which a file differs from\nthat same file in any of its parents.\n\nIf I'm missing something, could you provide an example of using git-log\n--all to accomplish this?\n"},{"id":"183001","messageId":"CA+gHt1DxY42W9g+gJQTFrXuXBN-Jny+Jg60gKssdftZ5wxu91A@mail.gmail.com","threadId":"29411","inReplyTo":"41090.38.96.167.131.1327335283.squirrel@mail.lo-cal.org","subject":"Re: Finding all commits which modify a file","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2012-01-24T00:58:36Z","receivedAt":"2012-01-24T00:58:36Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"[Note: CC main authors of the code surrounding the patch]\n\nOn Mon, Jan 23, 2012 at 5:14 PM, Neal Groothuis <ngroot@lo-cal.org> wrote:\n>> On 1/20/2012 3:35 PM, Neal Groothuis wrote:\n>>> I'm trying to find /all/ commits that change a file in the\n>>> repository...and its proving to be trickier than I thought. :-)\n>\n> On 1/21/2012 6:16 PM, Neal Kreitzinger wrote:\n>> Does git-log --all help?\n>\n> I don't see how it would.  The commits are all reachable from HEAD, which\n> would seem to be the problem that --all would correct.\n>\n> What I'm trying to do is find the commits in which a file differs from\n> that same file in any of its parents.\n\nIf you add parent rewriting (--parent, --graph or see it in gitk, with\n--full-history) you'll get your B2 commit as it adds commits to have a\nmeaningful history. But I don't think this is what you are asking for.\n\n  You could try the following patch (sorry for the whitespace damage,\nalso attatched):\n\nSubject: [PATCH/RFC] revision: merging branches with different content\nis interesting in --full-history\n\n---\n revision.c                                 |    2 +-\n t/t6016-rev-list-graph-simplify-history.sh |    1 +\n 2 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/revision.c b/revision.c\nindex 064e351..db97250 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -492,7 +492,7 @@ static void try_to_simplify_commit(struct rev_info\n*revs, struct commit *commit)\n                }\n                die(\"bad tree compare for commit %s\",\nsha1_to_hex(commit->object.sha1));\n        }\n-       if (tree_changed && !tree_same)\n+       if ((tree_changed && !tree_same) || (!revs->simplify_history\n&& tree_changed))\n                return;\n        commit->object.flags |= TREESAME;\n }\ndiff --git a/t/t6016-rev-list-graph-simplify-history.sh\nb/t/t6016-rev-list-graph-simplify-history.sh\nindex f7181d1..50ffcf4 100755\n--- a/t/t6016-rev-list-graph-simplify-history.sh\n+++ b/t/t6016-rev-list-graph-simplify-history.sh\n@@ -168,6 +168,7 @@ test_expect_success '--graph --full-history\n--simplify-merges -- bar.txt' '\n        echo \"|\\\\  \" >> expected &&\n        echo \"| * $C4\" >> expected &&\n        echo \"* | $A5\" >> expected &&\n+       echo \"* | $A4\" >> expected &&\n        echo \"* | $A3\" >> expected &&\n        echo \"|/  \" >> expected &&\n        echo \"* $A2\" >> expected &&\n\n(I could rewrite the condition but I think it is cleaner).\n\nThis patch changes the semantics of --full-history to consider all\ncommits with at least one modified parent as an interesting commit\n(even for merges). This is almost as enabling --parent:\n\ngit $ git rev-list --full-history HEAD Makefile | wc -l\n1769\n\n$ git rev-list --full-history --parents HEAD Makefile | wc -l\n6732\n\ngit $ ./git rev-list --full-history HEAD Makefile | wc -l\n6052\n\nI think that --full-history should list these extra merges as you are\nasking for the full history and a merge merging two branches with\ndifferent content is an interesting event in this case (full history).\nBut maybe we should just add an extra flag...\n\nHTH,\nSanti\n\n\nFrom 36a09f1a39212eb4b45268215cc9c336a7afebda Mon Sep 17 00:00:00 2001\nFrom: =?UTF-8?q?Santi=20B=C3=A9jar?= <santi@agolina.net>\nDate: Tue, 24 Jan 2012 00:46:23 +0100\nSubject: [PATCH] revision: merging branches with different content is interesting in --full-history\n\n---\n revision.c                                 |    2 +-\n t/t6016-rev-list-graph-simplify-history.sh |    1 +\n 2 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/revision.c b/revision.c\nindex 064e351..db97250 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -492,7 +492,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)\n \t\t}\n \t\tdie(\"bad tree compare for commit %s\", sha1_to_hex(commit->object.sha1));\n \t}\n-\tif (tree_changed && !tree_same)\n+\tif ((tree_changed && !tree_same) || (!revs->simplify_history && tree_changed))\n \t\treturn;\n \tcommit->object.flags |= TREESAME;\n }\ndiff --git a/t/t6016-rev-list-graph-simplify-history.sh b/t/t6016-rev-list-graph-simplify-history.sh\nindex f7181d1..50ffcf4 100755\n--- a/t/t6016-rev-list-graph-simplify-history.sh\n+++ b/t/t6016-rev-list-graph-simplify-history.sh\n@@ -168,6 +168,7 @@ test_expect_success '--graph --full-history --simplify-merges -- bar.txt' '\n \techo \"|\\\\  \" >> expected &&\n \techo \"| * $C4\" >> expected &&\n \techo \"* | $A5\" >> expected &&\n+\techo \"* | $A4\" >> expected &&\n \techo \"* | $A3\" >> expected &&\n \techo \"|/  \" >> expected &&\n \techo \"* $A2\" >> expected &&\n-- \n1.7.4.rc3.8.gd2d4\n\n"},{"id":"183003","messageId":"CA+gHt1Cfn3H2-d5PN-E6Q0XTNC7V7i+xkS4DRaTc=jYXLhDU9g@mail.gmail.com","threadId":"29411","inReplyTo":"CA+gHt1DxY42W9g+gJQTFrXuXBN-Jny+Jg60gKssdftZ5wxu91A@mail.gmail.com","subject":"Re: Finding all commits which modify a file","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2012-01-24T01:15:50Z","receivedAt":"2012-01-24T01:15:50Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Tue, Jan 24, 2012 at 1:58 AM, Santi Béjar <santi@agolina.net> wrote:\n> [Note: CC main authors of the code surrounding the patch]\n>\n> On Mon, Jan 23, 2012 at 5:14 PM, Neal Groothuis <ngroot@lo-cal.org> wrote:\n>>> On 1/20/2012 3:35 PM, Neal Groothuis wrote:\n>>>> I'm trying to find /all/ commits that change a file in the\n>>>> repository...and its proving to be trickier than I thought. :-)\n>>\n>> On 1/21/2012 6:16 PM, Neal Kreitzinger wrote:\n>>> Does git-log --all help?\n>>\n>> I don't see how it would.  The commits are all reachable from HEAD, which\n>> would seem to be the problem that --all would correct.\n>>\n>> What I'm trying to do is find the commits in which a file differs from\n>> that same file in any of its parents.\n>\n> If you add parent rewriting (--parent, --graph or see it in gitk, with\n> --full-history) you'll get your B2 commit as it adds commits to have a\n> meaningful history. But I don't think this is what you are asking for.\n\nNote that even if it get listed, you won't get a diff for foo.txt\nbecause it is an evil merge as the result is not the expected (using\nthe three way merge) one but is equal to one of the branches.\n\nHTH,\nSanti\n"},{"id":"183002","messageId":"CA+55aFynLN7kBYh7i-kh+Xd1Qn-wKBePcokmJRNfe8RYA0cCZA@mail.gmail.com","threadId":"29411","inReplyTo":"CA+gHt1DxY42W9g+gJQTFrXuXBN-Jny+Jg60gKssdftZ5wxu91A@mail.gmail.com","subject":"Re: Finding all commits which modify a file","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2012-01-24T01:15:51Z","receivedAt":"2012-01-24T01:15:51Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Mon, Jan 23, 2012 at 4:58 PM, Santi Béjar <santi@agolina.net> wrote:\n>\n> If you add parent rewriting (--parent, --graph or see it in gitk, with\n> --full-history) you'll get your B2 commit as it adds commits to have a\n> meaningful history. But I don't think this is what you are asking for.\n>\n>  You could try the following patch (sorry for the whitespace damage,\n> also attatched):\n>\n> Subject: [PATCH/RFC] revision: merging branches with different content\n> is interesting in --full-history\n\nThe concept seems sane.\n\nBut please check the interaction with \"--simplify-merges\" too, just in\ncase. The merge simplification looks at TREESAME too, so I suspect\nyour change may break merge simplification.\n\n                      Linus\n"},{"id":"183004","messageId":"CA+gHt1AYrCv_9MJwBntt_+-GRb4N81PxxO8HXP-XU0pCiFWAVw@mail.gmail.com","threadId":"29411","inReplyTo":"CA+55aFynLN7kBYh7i-kh+Xd1Qn-wKBePcokmJRNfe8RYA0cCZA@mail.gmail.com","subject":"Re: Finding all commits which modify a file","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2012-01-24T01:36:09Z","receivedAt":"2012-01-24T01:36:09Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Tue, Jan 24, 2012 at 2:15 AM, Linus Torvalds\n<torvalds@linux-foundation.org> wrote:\n> On Mon, Jan 23, 2012 at 4:58 PM, Santi Béjar <santi@agolina.net> wrote:\n>>\n>> If you add parent rewriting (--parent, --graph or see it in gitk, with\n>> --full-history) you'll get your B2 commit as it adds commits to have a\n>> meaningful history. But I don't think this is what you are asking for.\n>>\n>>  You could try the following patch (sorry for the whitespace damage,\n>> also attatched):\n>>\n>> Subject: [PATCH/RFC] revision: merging branches with different content\n>> is interesting in --full-history\n>\n> The concept seems sane.\n>\n> But please check the interaction with \"--simplify-merges\" too, just in\n> case. The merge simplification looks at TREESAME too, so I suspect\n> your change may break merge simplification.\n\nIndeed, there is a bad interaction with --simplify-merges. If you add\n--simplify-merges it not only increase the number of commit but\nchanges them :-(\n\n$ ./git rev-list --full-history --simplify-merges HEAD Makefile >\nrev-list.simp-merges\n$ ./git rev-list --full-history HEAD Makefile > rev-list.new\n$ diff rev-list.new rev-list.simp-merges -u | diffstat\n rev-list.simp-merges | 1841 ++++++++++++++++++++++++++-------------------------\n 1 file changed, 944 insertions(+), 897 deletions(-)\n\nSanti\n"},{"id":"183005","messageId":"7vipk16fp6.fsf@alter.siamese.dyndns.org","threadId":"29411","inReplyTo":"CA+gHt1DxY42W9g+gJQTFrXuXBN-Jny+Jg60gKssdftZ5wxu91A@mail.gmail.com","subject":"Re: Finding all commits which modify a file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-01-24T01:40:21Z","receivedAt":"2012-01-24T01:40:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <santi@agolina.net> writes:\n\n> diff --git a/revision.c b/revision.c\n> index 064e351..db97250 100644\n> --- a/revision.c\n> +++ b/revision.c\n> @@ -492,7 +492,7 @@ static void try_to_simplify_commit(struct rev_info\n> *revs, struct commit *commit)\n>                 }\n>                 die(\"bad tree compare for commit %s\",\n> sha1_to_hex(commit->object.sha1));\n>         }\n> -       if (tree_changed && !tree_same)\n> +       if ((tree_changed && !tree_same) || (!revs->simplify_history\n> && tree_changed))\n\nIs that the same as saying this?\n\n\tif (!(tree_same && revs->simplify_history) && tree_changed)\n\t\treturn;\n\nWhich reads: unless we find a parent that matches the result and we are\nsimplifying the history, a child different from at least one parent is\nworth showing.\n\nWhich makes sort of sense at the conceptual level, but I am not sure if it\nis practically useful (the same issue with --full-history that makes\ncomplex history almost unreadable).\n"},{"id":"183019","messageId":"52932.38.96.167.131.1327422884.squirrel@mail.lo-cal.org","threadId":"29411","inReplyTo":"CA+gHt1DxY42W9g+gJQTFrXuXBN-Jny+Jg60gKssdftZ5wxu91A@mail.gmail.com","subject":"Re: Finding all commits which modify a file","fromName":"Neal Groothuis","fromEmail":"ngroot@lo-cal.org","sentAt":"2012-01-24T16:34:44Z","receivedAt":"2012-01-24T16:34:44Z","isPatch":false,"sender":{"key":"ngroot@lo-cal.org","avatar":null},"body":"> On Mon, Jan 23, 2012 at 5:14 PM, Neal Groothuis <ngroot@lo-cal.org> wrote:\n>>> On 1/20/2012 3:35 PM, Neal Groothuis wrote:\n>>>> I'm trying to find /all/ commits that change a file in the\n>>>> repository...and its proving to be trickier than I thought. :-)\n>>\n>> On 1/21/2012 6:16 PM, Neal Kreitzinger wrote:\n>>> Does git-log --all help?\n>>\n>> I don't see how it would.  The commits are all reachable from HEAD,\n>> which\n>> would seem to be the problem that --all would correct.\n>>\n>> What I'm trying to do is find the commits in which a file differs from\n>> that same file in any of its parents.\n>\n> If you add parent rewriting (--parent, --graph or see it in gitk, with\n> --full-history) you'll get your B2 commit as it adds commits to have a\n> meaningful history. But I don't think this is what you are asking for.\n\nCorrect.  If I add parent rewriting, I get all merges, even those in which\nthe file is not changed from either parent.\n\nBased on what's in the man page for git log about the history\nsimplification algorithm, it seems that B2 should be included in the\noutput when I do a git log --full-history --simplify-history foo.txt, as\nper the steps I noted in the original post.  Is my understanding of the\nalgorithm faulty?\n"},{"id":"183021","messageId":"CA+gHt1BjqJpUke8JKjUmFyg3Zj5FmASd77LR-7P+6RrNLddD1A@mail.gmail.com","threadId":"29411","inReplyTo":"52932.38.96.167.131.1327422884.squirrel@mail.lo-cal.org","subject":"Re: Finding all commits which modify a file","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2012-01-24T18:10:59Z","receivedAt":"2012-01-24T18:10:59Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"[ Do not cut the CC]\n\nOn Tue, Jan 24, 2012 at 5:34 PM, Neal Groothuis <ngroot@lo-cal.org> wrote:\n>> On Mon, Jan 23, 2012 at 5:14 PM, Neal Groothuis <ngroot@lo-cal.org> wrote:\n>>>> On 1/20/2012 3:35 PM, Neal Groothuis wrote:\n>>>>> I'm trying to find /all/ commits that change a file in the\n>>>>> repository...and its proving to be trickier than I thought. :-)\n>>>\n>>> On 1/21/2012 6:16 PM, Neal Kreitzinger wrote:\n>>>> Does git-log --all help?\n>>>\n>>> I don't see how it would.  The commits are all reachable from HEAD,\n>>> which\n>>> would seem to be the problem that --all would correct.\n>>>\n>>> What I'm trying to do is find the commits in which a file differs from\n>>> that same file in any of its parents.\n>>\n>> If you add parent rewriting (--parent, --graph or see it in gitk, with\n>> --full-history) you'll get your B2 commit as it adds commits to have a\n>> meaningful history. But I don't think this is what you are asking for.\n>\n> Correct.  If I add parent rewriting, I get all merges, even those in which\n> the file is not changed from either parent.\n>\n> Based on what's in the man page for git log about the history\n> simplification algorithm, it seems that B2 should be included in the\n> output when I do a git log --full-history --simplify-history foo.txt, as\n> per the steps I noted in the original post.  Is my understanding of the\n> algorithm faulty?\n>\n\nFollowing your steps in the first post, B2 is excluded in the\n--simplify-merge phase because it is (originally) TREESAME, even if it\nis not in the rewritten history...\n\nHTH,\nSanti\n"},{"id":"183024","messageId":"CA+gHt1DyUPXOnkCp5hu+z7eH2AoOia48vqjHQ3TnWnoTn603PQ@mail.gmail.com","threadId":"29411","inReplyTo":"CA+gHt1AYrCv_9MJwBntt_+-GRb4N81PxxO8HXP-XU0pCiFWAVw@mail.gmail.com","subject":"Re: Finding all commits which modify a file","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2012-01-24T18:35:52Z","receivedAt":"2012-01-24T18:35:52Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Tue, Jan 24, 2012 at 2:36 AM, Santi Béjar <santi@agolina.net> wrote:\n> On Tue, Jan 24, 2012 at 2:15 AM, Linus Torvalds\n> <torvalds@linux-foundation.org> wrote:\n>> On Mon, Jan 23, 2012 at 4:58 PM, Santi Béjar <santi@agolina.net> wrote:\n>>>\n>>> If you add parent rewriting (--parent, --graph or see it in gitk, with\n>>> --full-history) you'll get your B2 commit as it adds commits to have a\n>>> meaningful history. But I don't think this is what you are asking for.\n>>>\n>>>  You could try the following patch (sorry for the whitespace damage,\n>>> also attatched):\n>>>\n>>> Subject: [PATCH/RFC] revision: merging branches with different content\n>>> is interesting in --full-history\n>>\n>> The concept seems sane.\n>>\n>> But please check the interaction with \"--simplify-merges\" too, just in\n>> case. The merge simplification looks at TREESAME too, so I suspect\n>> your change may break merge simplification.\n>\n> Indeed, there is a bad interaction with --simplify-merges. If you add\n> --simplify-merges it not only increase the number of commit but\n> changes them :-(\n>\n> $ ./git rev-list --full-history --simplify-merges HEAD Makefile >\n> rev-list.simp-merges\n> $ ./git rev-list --full-history HEAD Makefile > rev-list.new\n> $ diff rev-list.new rev-list.simp-merges -u | diffstat\n>  rev-list.simp-merges | 1841 ++++++++++++++++++++++++++-------------------------\n>  1 file changed, 944 insertions(+), 897 deletions(-)\n\nOps, it even happens without my patch...\n\nI think it is OK, it just redefines what is TREESAME, and use the new\nmeaning in:\n\n* If after this parent rewriting, `C'` is a root or merge commit (has\n  zero or >1 parents), a boundary commit, or !TREESAME, it remains.\n  Otherwise, it is replaced with its only parent.\n\nWe could keep the old meaning if --simplify-merges or we could have a\nflag to just change the meaning of TREESAME for merges\n(--with-all-interesting-merges? I'm not good at naming flags...)\n\nSanti\n"},{"id":"183080","messageId":"30433.38.96.167.131.1327508582.squirrel@mail.lo-cal.org","threadId":"29411","inReplyTo":"CA+gHt1BjqJpUke8JKjUmFyg3Zj5FmASd77LR-7P+6RrNLddD1A@mail.gmail.com","subject":"Re: Finding all commits which modify a file","fromName":"Neal Groothuis","fromEmail":"ngroot@lo-cal.org","sentAt":"2012-01-25T16:23:02Z","receivedAt":"2012-01-25T16:23:02Z","isPatch":false,"sender":{"key":"ngroot@lo-cal.org","avatar":null},"body":"> [ Do not cut the CC]\n\nMy apologies.\n\n> On Tue, Jan 24, 2012 at 5:34 PM, Neal Groothuis <ngroot@lo-cal.org> wrote:\n>>> On Mon, Jan 23, 2012 at 5:14 PM, Neal Groothuis <ngroot@lo-cal.org>\n>>> wrote:\n>>>>> On 1/20/2012 3:35 PM, Neal Groothuis wrote:\n>>>>>> I'm trying to find /all/ commits that change a file in the\n>>>>>> repository...and its proving to be trickier than I thought. :-)\n>>>>\n>>>> On 1/21/2012 6:16 PM, Neal Kreitzinger wrote:\n>>>>> Does git-log --all help?\n>>>>\n>>>> I don't see how it would.  The commits are all reachable from HEAD,\n>>>> which\n>>>> would seem to be the problem that --all would correct.\n>>>>\n>>>> What I'm trying to do is find the commits in which a file differs from\n>>>> that same file in any of its parents.\n>>>\n>>> If you add parent rewriting (--parent, --graph or see it in gitk, with\n>>> --full-history) you'll get your B2 commit as it adds commits to have a\n>>> meaningful history. But I don't think this is what you are asking for.\n>>\n>> Correct.  If I add parent rewriting, I get all merges, even those in\n>> which\n>> the file is not changed from either parent.\n>>\n>> Based on what's in the man page for git log about the history\n>> simplification algorithm, it seems that B2 should be included in the\n>> output when I do a git log --full-history --simplify-history foo.txt, as\n>> per the steps I noted in the original post.  Is my understanding of the\n>> algorithm faulty?\n>>\n>\n> Following your steps in the first post, B2 is excluded in the\n> --simplify-merge phase because it is (originally) TREESAME, even if it\n> is not in the rewritten history...\n\nThanks, I see---labeling a commit as TREESAME happens before\nsimplification, rather than after.\n\nIn my example, that results in a simplified history where a commit in\nwhich the contents of the specified paths change gets removed.  That seems\nperverse; I would think the utility of a simplified history would be to\ntrack down the commits in which the contents of the specified paths change\nwithout having to consider ones in which they do not.\n\nIs there a situation where checking for TREESAMEness before simplification\nis desirable and checking after would not be?\n\n- Neal\n"},{"id":"183137","messageId":"7vwr8e13xo.fsf@alter.siamese.dyndns.org","threadId":"29411","inReplyTo":"30433.38.96.167.131.1327508582.squirrel@mail.lo-cal.org","subject":"Re: Finding all commits which modify a file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-01-26T22:42:27Z","receivedAt":"2012-01-26T22:42:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Neal Groothuis\" <ngroot@lo-cal.org> writes:\n\n> Is there a situation where checking for TREESAMEness before simplification\n> is desirable and checking after would not be?\n\nWhen you do not want to see a side branch that does not contribute to the\nend result at all, obviously ;-). Outside that situation, before or after\nshould not make a difference, I would think.\n"}]}