{"thread":{"id":"51454","subject":"Problem with git diff","startedAt":"2019-07-09T22:18:38Z","lastAt":"2019-07-09T23:36:29Z","messageCount":5,"participants":["McRoberts, John","Elijah Newren","Bryan Turner"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"378741","messageId":"1288734232ea45e0be655668ac60d98f@ASGEXCPWP07.ga.com","threadId":"51454","inReplyTo":null,"subject":"Problem with git diff","fromName":"McRoberts, John","fromEmail":"john.mcroberts@ga.com","sentAt":"2019-07-09T22:09:05Z","receivedAt":"2019-07-09T22:18:38Z","isPatch":false,"sender":{"key":"john.mcroberts@ga.com","avatar":null},"body":"I am responsible for generating a list of all files changed between two\nsuccessive releases of software. I was using 'git diff' but have run into a\nproblem.\n\nConsider the following situation: A development branch comes off of commit A\nand files are changed three times.  A tag (REL1) is placed on the third\ncommit.  Then the branch is merged back to master.  At this point, master's\nHEAD is at C (and it remains there).  Two development branches are created\noff of master, the first of which is not important here.  In the second one,\nthere are files changed and a tag (REL2) applied.\n\n \n---------------------[I]\n \n/      {dev branch}\n \n/\n \n/\n             {master branch}\n/\n [A] ---------------------------------[B]------------------------------->[C]\nmaster <HEAD>\n   \\                               filelist 6                           /  \\\n    \\                                                                  /\n\\\n     \\                                                                /\n\\\n      \\                                                              /\n\\\n       \\                {development branch}                        /\n\\\n        \\------->[D]----------------------->[E]-------------------[F]\n\\------[G]--------[H]\n                                                                 REL1\nREL2\n                fileset 1               fileset 2           fileset 3\nfileset 4    fileset 5\n\nAt this point, I run \n    'git diff  -m --first-parent --pretty=fuller --decorate=short\n--name-only REL2..REL2'\n\nI expect to see only filesets 4 and 5 listed.  I also see filesets 1, 2 and\n3 showing up.  This means that the git diff command is showing files that,in\nfact, did not change between the two tags.  By the way, I verified with a\nfile by file comparison that under REL2 and REL1, the files represented by\nfilesets 1, 2 and 3 had identical contents.\n\nIs there a way around this behavior?\n(Note: view the diagram in monospace case such as Courier)\n\nThanks, \n\nJack McRoberts\nConfiguration Management Software Specialist\nGeneral Atomics EMS Group\nWork Phone: 858-522-8342\n16969 Mesamint St, Room 86-1023G, \nSan Diego, CA  92127\n\n\n************************************************************************ \nCONFIDENTIALITY NOTICE: This communication is intended to be confidential to\nthe \nperson(s) to whom it is addressed. If you are not the intended recipient or\nthe agent of the \nintended recipient or if you are unable to deliver this communication to the\nintended\n recipient, you must not read, use or disseminate this information. If you\nhave received this \ncommunication in error, please advise the sender immediately by telephone\nand delete \nthis message and any attachments without retaining a copy. \n**************************************************************************\n\n\n"},{"id":"378747","messageId":"CABPp-BE1fQs99ipi9Y8gfQO3QHkxzQhn1uriEbj6YjdYH839eQ@mail.gmail.com","threadId":"51454","inReplyTo":"1288734232ea45e0be655668ac60d98f@ASGEXCPWP07.ga.com","subject":"Re: Problem with git diff","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-07-09T23:13:00Z","receivedAt":"2019-07-09T23:13:13Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi John,\n\nOn Tue, Jul 9, 2019 at 3:57 PM McRoberts, John <John.McRoberts@ga.com> wrote:\n>\n> I am responsible for generating a list of all files changed between two\n> successive releases of software. I was using 'git diff' but have run into a\n> problem.\n>\n> Consider the following situation: A development branch comes off of commit A\n> and files are changed three times.  A tag (REL1) is placed on the third\n> commit.  Then the branch is merged back to master.  At this point, master's\n> HEAD is at C (and it remains there).  Two development branches are created\n> off of master, the first of which is not important here.  In the second one,\n> there are files changed and a tag (REL2) applied.\n>\n>\n> ---------------------[I]\n>\n> /      {dev branch}\n>\n> /\n>\n> /\n>              {master branch}\n> /\n>  [A] ---------------------------------[B]------------------------------->[C]\n> master <HEAD>\n>    \\                               filelist 6                           /  \\\n>     \\                                                                  /\n> \\\n>      \\                                                                /\n> \\\n>       \\                                                              /\n> \\\n>        \\                {development branch}                        /\n> \\\n>         \\------->[D]----------------------->[E]-------------------[F]\n> \\------[G]--------[H]\n>                                                                  REL1\n> REL2\n>                 fileset 1               fileset 2           fileset 3\n> fileset 4    fileset 5\n>\n> At this point, I run\n>     'git diff  -m --first-parent --pretty=fuller --decorate=short\n> --name-only REL2..REL2'\n\nWow, we really, really need to throw errors and warnings when people\nuse crazy range operators with diff.[1][2]  What version of git are\nyou using that accepts --decorate=short as an argument to `git diff`?\nAnd why in the world does git diff accept --first-parent or\n--pretty=fuller?!?  That's insane for git-diff to swallow that.\n(#leftoverbits?)  Also, I think you meant `REL1` one of the two times\nyou wrote `REL2`, which makes me suspect you may have done some\ncopy-edit-paste and didn't try this actual command.\n\n> I expect to see only filesets 4 and 5 listed.  I also see filesets 1, 2 and\n> 3 showing up.  This means that the git diff command is showing files that,in\n> fact, did not change between the two tags.  By the way, I verified with a\n> file by file comparison that under REL2 and REL1, the files represented by\n> filesets 1, 2 and 3 had identical contents.\n\nFrom your description, I assume you actually ran something like\n  git diff --name-only REL1..REL2\n\nwhich compares REL2 to the merge base of REL1 and REL2 (yes, this is\ntotally counter-intuitive to a large percentage of the git userbase,\nbut it is well documented and hard to change).  Also from your\ndescription, what you seem to want is\n  git diff --name-only REL1 REL2\n\nsince you want to compare the two endpoints.  Does that help get what you want?\n\nHope that helps,\nElijah\n\n[1] https://public-inbox.org/git/CABPp-BECj___HneAYviE3SB=wU6OTcBi3S=+Un1sP6L4WJ7agA@mail.gmail.com/\n[2] https://public-inbox.org/git/CABPp-BGg_iSx3QMc-J4Fov97v9NnAtfxZGMrm3WfrGugOThjmA@mail.gmail.com/\n"},{"id":"378749","messageId":"CAGyf7-FeAJwWuhu-Zkccsfrcbbf3tuuOWwobsa4OOK1=hWackg@mail.gmail.com","threadId":"51454","inReplyTo":"CABPp-BE1fQs99ipi9Y8gfQO3QHkxzQhn1uriEbj6YjdYH839eQ@mail.gmail.com","subject":"Re: Problem with git diff","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2019-07-09T23:29:55Z","receivedAt":"2019-07-09T23:30:08Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Tue, Jul 9, 2019 at 4:13 PM Elijah Newren <newren@gmail.com> wrote:\n>\n> Hi John,\n>\n> On Tue, Jul 9, 2019 at 3:57 PM McRoberts, John <John.McRoberts@ga.com> wrote:\n> >\n> > I am responsible for generating a list of all files changed between two\n> > successive releases of software. I was using 'git diff' but have run into a\n> > problem.\n> >\n> > Consider the following situation: A development branch comes off of commit A\n> > and files are changed three times.  A tag (REL1) is placed on the third\n> > commit.  Then the branch is merged back to master.  At this point, master's\n> > HEAD is at C (and it remains there).  Two development branches are created\n> > off of master, the first of which is not important here.  In the second one,\n> > there are files changed and a tag (REL2) applied.\n> >\n> >\n> > ---------------------[I]\n> >\n> > /      {dev branch}\n> >\n> > /\n> >\n> > /\n> >              {master branch}\n> > /\n> >  [A] ---------------------------------[B]------------------------------->[C]\n> > master <HEAD>\n> >    \\                               filelist 6                           /  \\\n> >     \\                                                                  /\n> > \\\n> >      \\                                                                /\n> > \\\n> >       \\                                                              /\n> > \\\n> >        \\                {development branch}                        /\n> > \\\n> >         \\------->[D]----------------------->[E]-------------------[F]\n> > \\------[G]--------[H]\n> >                                                                  REL1\n> > REL2\n> >                 fileset 1               fileset 2           fileset 3\n> > fileset 4    fileset 5\n> >\n> > At this point, I run\n> >     'git diff  -m --first-parent --pretty=fuller --decorate=short\n> > --name-only REL2..REL2'\n>\n> Wow, we really, really need to throw errors and warnings when people\n> use crazy range operators with diff.[1][2]  What version of git are\n> you using that accepts --decorate=short as an argument to `git diff`?\n> And why in the world does git diff accept --first-parent or\n> --pretty=fuller?!?  That's insane for git-diff to swallow that.\n> (#leftoverbits?)  Also, I think you meant `REL1` one of the two times\n> you wrote `REL2`, which makes me suspect you may have done some\n> copy-edit-paste and didn't try this actual command.\n>\n> > I expect to see only filesets 4 and 5 listed.  I also see filesets 1, 2 and\n> > 3 showing up.  This means that the git diff command is showing files that,in\n> > fact, did not change between the two tags.  By the way, I verified with a\n> > file by file comparison that under REL2 and REL1, the files represented by\n> > filesets 1, 2 and 3 had identical contents.\n>\n> From your description, I assume you actually ran something like\n>   git diff --name-only REL1..REL2\n\nDid you mean REL1...REL2 (3 dots)? 2 dots (REL1..REL2) is identical to\nno dots (REL1 REL2), per the documentation for \"git diff\":\n\n       git diff [<options>] <commit> <commit> [--] [<path>...]\n\n           This is to view the changes between two arbitrary <commit>.\n\n       git diff [<options>] <commit>..<commit> [--] [<path>...]\n\n           This is synonymous to the previous form. If <commit> on one\nside is omitted, it will have the same effect\n           as using HEAD instead.\n\n(Forgive me if I'm mistaken here!)\n\n>\n> which compares REL2 to the merge base of REL1 and REL2 (yes, this is\n> totally counter-intuitive to a large percentage of the git userbase,\n> but it is well documented and hard to change).  Also from your\n> description, what you seem to want is\n>   git diff --name-only REL1 REL2\n>\n> since you want to compare the two endpoints.  Does that help get what you want?\n>\n> Hope that helps,\n> Elijah\n>\n> [1] https://public-inbox.org/git/CABPp-BECj___HneAYviE3SB=wU6OTcBi3S=+Un1sP6L4WJ7agA@mail.gmail.com/\n> [2] https://public-inbox.org/git/CABPp-BGg_iSx3QMc-J4Fov97v9NnAtfxZGMrm3WfrGugOThjmA@mail.gmail.com/\n"},{"id":"378750","messageId":"CABPp-BETbfzjUyYu9g83=u+HN9r3jwpK538EcOEiawBLG=uwDA@mail.gmail.com","threadId":"51454","inReplyTo":"CAGyf7-FeAJwWuhu-Zkccsfrcbbf3tuuOWwobsa4OOK1=hWackg@mail.gmail.com","subject":"Re: Problem with git diff","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2019-07-09T23:35:38Z","receivedAt":"2019-07-09T23:35:52Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Tue, Jul 9, 2019 at 4:30 PM Bryan Turner <bturner@atlassian.com> wrote:\n>\n> On Tue, Jul 9, 2019 at 4:13 PM Elijah Newren <newren@gmail.com> wrote:\n> >\n> > Hi John,\n> >\n> > On Tue, Jul 9, 2019 at 3:57 PM McRoberts, John <John.McRoberts@ga.com> wrote:\n> > >\n> > > I am responsible for generating a list of all files changed between two\n> > > successive releases of software. I was using 'git diff' but have run into a\n> > > problem.\n> > >\n> > > Consider the following situation: A development branch comes off of commit A\n> > > and files are changed three times.  A tag (REL1) is placed on the third\n> > > commit.  Then the branch is merged back to master.  At this point, master's\n> > > HEAD is at C (and it remains there).  Two development branches are created\n> > > off of master, the first of which is not important here.  In the second one,\n> > > there are files changed and a tag (REL2) applied.\n> > >\n> > >\n> > > ---------------------[I]\n> > >\n> > > /      {dev branch}\n> > >\n> > > /\n> > >\n> > > /\n> > >              {master branch}\n> > > /\n> > >  [A] ---------------------------------[B]------------------------------->[C]\n> > > master <HEAD>\n> > >    \\                               filelist 6                           /  \\\n> > >     \\                                                                  /\n> > > \\\n> > >      \\                                                                /\n> > > \\\n> > >       \\                                                              /\n> > > \\\n> > >        \\                {development branch}                        /\n> > > \\\n> > >         \\------->[D]----------------------->[E]-------------------[F]\n> > > \\------[G]--------[H]\n> > >                                                                  REL1\n> > > REL2\n> > >                 fileset 1               fileset 2           fileset 3\n> > > fileset 4    fileset 5\n> > >\n> > > At this point, I run\n> > >     'git diff  -m --first-parent --pretty=fuller --decorate=short\n> > > --name-only REL2..REL2'\n> >\n> > Wow, we really, really need to throw errors and warnings when people\n> > use crazy range operators with diff.[1][2]  What version of git are\n> > you using that accepts --decorate=short as an argument to `git diff`?\n> > And why in the world does git diff accept --first-parent or\n> > --pretty=fuller?!?  That's insane for git-diff to swallow that.\n> > (#leftoverbits?)  Also, I think you meant `REL1` one of the two times\n> > you wrote `REL2`, which makes me suspect you may have done some\n> > copy-edit-paste and didn't try this actual command.\n> >\n> > > I expect to see only filesets 4 and 5 listed.  I also see filesets 1, 2 and\n> > > 3 showing up.  This means that the git diff command is showing files that,in\n> > > fact, did not change between the two tags.  By the way, I verified with a\n> > > file by file comparison that under REL2 and REL1, the files represented by\n> > > filesets 1, 2 and 3 had identical contents.\n> >\n> > From your description, I assume you actually ran something like\n> >   git diff --name-only REL1..REL2\n>\n> Did you mean REL1...REL2 (3 dots)? 2 dots (REL1..REL2) is identical to\n> no dots (REL1 REL2), per the documentation for \"git diff\":\n>\n>        git diff [<options>] <commit> <commit> [--] [<path>...]\n>\n>            This is to view the changes between two arbitrary <commit>.\n>\n>        git diff [<options>] <commit>..<commit> [--] [<path>...]\n>\n>            This is synonymous to the previous form. If <commit> on one\n> side is omitted, it will have the same effect\n>            as using HEAD instead.\n>\n> (Forgive me if I'm mistaken here!)\n\nYes, thanks.  In trying to explain how two and three dots behave\ncontrary to expectation for git diff, I mess up two versus three dots.\nThat's kind of embarrassing...\n\n> > which compares REL2 to the merge base of REL1 and REL2 (yes, this is\n> > totally counter-intuitive to a large percentage of the git userbase,\n> > but it is well documented and hard to change).  Also from your\n> > description, what you seem to want is\n> >   git diff --name-only REL1 REL2\n\n...though at least I was smart enough to suggest something without\ndots, which is the only sane way to use git-diff.  ;-)\n"},{"id":"378751","messageId":"67b7d1d35bf14f56865b91410b6fc0ec@ASGEXCPWP07.ga.com","threadId":"51454","inReplyTo":"CABPp-BE1fQs99ipi9Y8gfQO3QHkxzQhn1uriEbj6YjdYH839eQ@mail.gmail.com","subject":"RE: -EXT-Re: Problem with git diff","fromName":"McRoberts, John","fromEmail":"john.mcroberts@ga.com","sentAt":"2019-07-09T23:26:57Z","receivedAt":"2019-07-09T23:36:29Z","isPatch":false,"sender":{"key":"john.mcroberts@ga.com","avatar":null},"body":"Actually, I was actually using git log (not git diff... sorry for the mistake) \nbecause I also mine other information I(dates, author, summary, etc)\n\n'git log  -m --first-parent --pretty=fuller --decorate=short  --name-only \nREL1..REL2'\n\nThat being said, I can work with the git diff output to filter out the \nirrelevant info.  I would still be curious about whether this is a valid use \nof git log.\n\nThanks,\n\nJack McRoberts\nConfiguration Management Software Specialist\nGeneral Atomics EMS Group\nWork Phone: 858-522-8342\n16969 Mesamint St, Room 86-1023G,\nSan Diego, CA  92127\n\n\n************************************************************************\nCONFIDENTIALITY NOTICE: This communication is intended to be confidential to \nthe\nperson(s) to whom it is addressed. If you are not the intended recipient or \nthe agent of the\nintended recipient or if you are unable to deliver this communication to the \nintended\n recipient, you must not read, use or disseminate this information. If you \nhave received this\ncommunication in error, please advise the sender immediately by telephone and \ndelete\nthis message and any attachments without retaining a copy.\n**************************************************************************\n\n\n-----Original Message-----\nFrom: Elijah Newren <newren@gmail.com>\nSent: Tuesday, July 9, 2019 4:13 PM\nTo: McRoberts, John <John.McRoberts@ga.com>\nCc: git@vger.kernel.org\nSubject: -EXT-Re: Problem with git diff\n\nWARNING:  This message is from an external source.  Evaluate the message \ncarefully BEFORE clicking on links or opening attachments.\n\nHi John,\n\nOn Tue, Jul 9, 2019 at 3:57 PM McRoberts, John <John.McRoberts@ga.com> wrote:\n>\n> I am responsible for generating a list of all files changed between\n> two successive releases of software. I was using 'git diff' but have\n> run into a problem.\n>\n> Consider the following situation: A development branch comes off of\n> commit A and files are changed three times.  A tag (REL1) is placed on\n> the third commit.  Then the branch is merged back to master.  At this\n> point, master's HEAD is at C (and it remains there).  Two development\n> branches are created off of master, the first of which is not\n> important here.  In the second one, there are files changed and a tag (REL2) \n> applied.\n>\n>\n> ---------------------[I]\n>\n> /      {dev branch}\n>\n> /\n>\n> /\n>              {master branch}\n> /\n>  [A]\n> ---------------------------------[B]------------------------------->[C\n> ]\n> master <HEAD>\n>    \\                               filelist 6                           /  \\\n>     \\                                                                  /\n> \\\n>      \\                                                                /\n> \\\n>       \\                                                              /\n> \\\n>        \\                {development branch}                        /\n> \\\n>         \\------->[D]----------------------->[E]-------------------[F]\n> \\------[G]--------[H]\n>                                                                  REL1\n> REL2\n>                 fileset 1               fileset 2           fileset 3\n> fileset 4    fileset 5\n>\n> At this point, I run\n>     'git diff  -m --first-parent --pretty=fuller --decorate=short\n> --name-only REL2..REL2'\n\nWow, we really, really need to throw errors and warnings when people use crazy \nrange operators with diff.[1][2]  What version of git are you using that \naccepts --decorate=short as an argument to `git diff`?\nAnd why in the world does git diff accept --first-parent or --pretty=fuller?!? \nThat's insane for git-diff to swallow that.\n(#leftoverbits?)  Also, I think you meant `REL1` one of the two times you \nwrote `REL2`, which makes me suspect you may have done some copy-edit-paste \nand didn't try this actual command.\n\n> I expect to see only filesets 4 and 5 listed.  I also see filesets 1,\n> 2 and\n> 3 showing up.  This means that the git diff command is showing files\n> that,in fact, did not change between the two tags.  By the way, I\n> verified with a file by file comparison that under REL2 and REL1, the\n> files represented by filesets 1, 2 and 3 had identical contents.\n\nFrom your description, I assume you actually ran something like\n  git diff --name-only REL1..REL2\n\nwhich compares REL2 to the merge base of REL1 and REL2 (yes, this is totally \ncounter-intuitive to a large percentage of the git userbase, but it is well \ndocumented and hard to change).  Also from your description, what you seem to \nwant is\n  git diff --name-only REL1 REL2\n\nsince you want to compare the two endpoints.  Does that help get what you \nwant?\n\nHope that helps,\nElijah\n\n[1] \nhttps://public-inbox.org/git/CABPp-BECj___HneAYviE3SB=wU6OTcBi3S=+Un1sP6L4WJ7agA@mail.gmail.com/\n[2] \nhttps://public-inbox.org/git/CABPp-BGg_iSx3QMc-J4Fov97v9NnAtfxZGMrm3WfrGugOThjmA@mail.gmail.com/\n"}]}