git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Problem with git diff
@ 2019-07-09 22:09 McRoberts, John
  2019-07-09 23:13 ` Elijah Newren
  0 siblings, 1 reply; 5+ messages in thread
From: McRoberts, John @ 2019-07-09 22:09 UTC (permalink / raw)
  To: git@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 2864 bytes --]

I am responsible for generating a list of all files changed between two
successive releases of software. I was using 'git diff' but have run into a
problem.

Consider the following situation: A development branch comes off of commit A
and files are changed three times.  A tag (REL1) is placed on the third
commit.  Then the branch is merged back to master.  At this point, master's
HEAD is at C (and it remains there).  Two development branches are created
off of master, the first of which is not important here.  In the second one,
there are files changed and a tag (REL2) applied.

 
---------------------[I]
 
/      {dev branch}
 
/
 
/
             {master branch}
/
 [A] ---------------------------------[B]------------------------------->[C]
master <HEAD>
   \                               filelist 6                           /  \
    \                                                                  /
\
     \                                                                /
\
      \                                                              /
\
       \                {development branch}                        /
\
        \------->[D]----------------------->[E]-------------------[F]
\------[G]--------[H]
                                                                 REL1
REL2
                fileset 1               fileset 2           fileset 3
fileset 4    fileset 5

At this point, I run 
    'git diff  -m --first-parent --pretty=fuller --decorate=short
--name-only REL2..REL2'

I expect to see only filesets 4 and 5 listed.  I also see filesets 1, 2 and
3 showing up.  This means that the git diff command is showing files that,in
fact, did not change between the two tags.  By the way, I verified with a
file by file comparison that under REL2 and REL1, the files represented by
filesets 1, 2 and 3 had identical contents.

Is there a way around this behavior?
(Note: view the diagram in monospace case such as Courier)

Thanks, 

Jack McRoberts
Configuration Management Software Specialist
General Atomics EMS Group
Work Phone: 858-522-8342
16969 Mesamint St, Room 86-1023G, 
San Diego, CA  92127


************************************************************************ 
CONFIDENTIALITY NOTICE: This communication is intended to be confidential to
the 
person(s) to whom it is addressed. If you are not the intended recipient or
the agent of the 
intended recipient or if you are unable to deliver this communication to the
intended
 recipient, you must not read, use or disseminate this information. If you
have received this 
communication in error, please advise the sender immediately by telephone
and delete 
this message and any attachments without retaining a copy. 
**************************************************************************



[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 7316 bytes --]

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

* Re: Problem with git diff
  2019-07-09 22:09 Problem with git diff McRoberts, John
@ 2019-07-09 23:13 ` Elijah Newren
  2019-07-09 23:26   ` -EXT-Re: " McRoberts, John
  2019-07-09 23:29   ` Bryan Turner
  0 siblings, 2 replies; 5+ messages in thread
From: Elijah Newren @ 2019-07-09 23:13 UTC (permalink / raw)
  To: McRoberts, John; +Cc: git@vger.kernel.org

Hi John,

On Tue, Jul 9, 2019 at 3:57 PM McRoberts, John <John.McRoberts@ga.com> wrote:
>
> I am responsible for generating a list of all files changed between two
> successive releases of software. I was using 'git diff' but have run into a
> problem.
>
> Consider the following situation: A development branch comes off of commit A
> and files are changed three times.  A tag (REL1) is placed on the third
> commit.  Then the branch is merged back to master.  At this point, master's
> HEAD is at C (and it remains there).  Two development branches are created
> off of master, the first of which is not important here.  In the second one,
> there are files changed and a tag (REL2) applied.
>
>
> ---------------------[I]
>
> /      {dev branch}
>
> /
>
> /
>              {master branch}
> /
>  [A] ---------------------------------[B]------------------------------->[C]
> master <HEAD>
>    \                               filelist 6                           /  \
>     \                                                                  /
> \
>      \                                                                /
> \
>       \                                                              /
> \
>        \                {development branch}                        /
> \
>         \------->[D]----------------------->[E]-------------------[F]
> \------[G]--------[H]
>                                                                  REL1
> REL2
>                 fileset 1               fileset 2           fileset 3
> fileset 4    fileset 5
>
> At this point, I run
>     'git diff  -m --first-parent --pretty=fuller --decorate=short
> --name-only REL2..REL2'

Wow, we really, really need to throw errors and warnings when people
use crazy range operators with diff.[1][2]  What version of git are
you using that accepts --decorate=short as an argument to `git diff`?
And why in the world does git diff accept --first-parent or
--pretty=fuller?!?  That's insane for git-diff to swallow that.
(#leftoverbits?)  Also, I think you meant `REL1` one of the two times
you wrote `REL2`, which makes me suspect you may have done some
copy-edit-paste and didn't try this actual command.

> I expect to see only filesets 4 and 5 listed.  I also see filesets 1, 2 and
> 3 showing up.  This means that the git diff command is showing files that,in
> fact, did not change between the two tags.  By the way, I verified with a
> file by file comparison that under REL2 and REL1, the files represented by
> filesets 1, 2 and 3 had identical contents.

From your description, I assume you actually ran something like
  git diff --name-only REL1..REL2

which compares REL2 to the merge base of REL1 and REL2 (yes, this is
totally counter-intuitive to a large percentage of the git userbase,
but it is well documented and hard to change).  Also from your
description, what you seem to want is
  git diff --name-only REL1 REL2

since you want to compare the two endpoints.  Does that help get what you want?

Hope that helps,
Elijah

[1] https://public-inbox.org/git/CABPp-BECj___HneAYviE3SB=wU6OTcBi3S=+Un1sP6L4WJ7agA@mail.gmail.com/
[2] https://public-inbox.org/git/CABPp-BGg_iSx3QMc-J4Fov97v9NnAtfxZGMrm3WfrGugOThjmA@mail.gmail.com/

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

* RE: -EXT-Re: Problem with git diff
  2019-07-09 23:13 ` Elijah Newren
@ 2019-07-09 23:26   ` McRoberts, John
  2019-07-09 23:29   ` Bryan Turner
  1 sibling, 0 replies; 5+ messages in thread
From: McRoberts, John @ 2019-07-09 23:26 UTC (permalink / raw)
  To: Elijah Newren; +Cc: git@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 4823 bytes --]

Actually, I was actually using git log (not git diff... sorry for the mistake) 
because I also mine other information I(dates, author, summary, etc)

'git log  -m --first-parent --pretty=fuller --decorate=short  --name-only 
REL1..REL2'

That being said, I can work with the git diff output to filter out the 
irrelevant info.  I would still be curious about whether this is a valid use 
of git log.

Thanks,

Jack McRoberts
Configuration Management Software Specialist
General Atomics EMS Group
Work Phone: 858-522-8342
16969 Mesamint St, Room 86-1023G,
San Diego, CA  92127


************************************************************************
CONFIDENTIALITY NOTICE: This communication is intended to be confidential to 
the
person(s) to whom it is addressed. If you are not the intended recipient or 
the agent of the
intended recipient or if you are unable to deliver this communication to the 
intended
 recipient, you must not read, use or disseminate this information. If you 
have received this
communication in error, please advise the sender immediately by telephone and 
delete
this message and any attachments without retaining a copy.
**************************************************************************


-----Original Message-----
From: Elijah Newren <newren@gmail.com>
Sent: Tuesday, July 9, 2019 4:13 PM
To: McRoberts, John <John.McRoberts@ga.com>
Cc: git@vger.kernel.org
Subject: -EXT-Re: Problem with git diff

WARNING:  This message is from an external source.  Evaluate the message 
carefully BEFORE clicking on links or opening attachments.

Hi John,

On Tue, Jul 9, 2019 at 3:57 PM McRoberts, John <John.McRoberts@ga.com> wrote:
>
> I am responsible for generating a list of all files changed between
> two successive releases of software. I was using 'git diff' but have
> run into a problem.
>
> Consider the following situation: A development branch comes off of
> commit A and files are changed three times.  A tag (REL1) is placed on
> the third commit.  Then the branch is merged back to master.  At this
> point, master's HEAD is at C (and it remains there).  Two development
> branches are created off of master, the first of which is not
> important here.  In the second one, there are files changed and a tag (REL2) 
> applied.
>
>
> ---------------------[I]
>
> /      {dev branch}
>
> /
>
> /
>              {master branch}
> /
>  [A]
> ---------------------------------[B]------------------------------->[C
> ]
> master <HEAD>
>    \                               filelist 6                           /  \
>     \                                                                  /
> \
>      \                                                                /
> \
>       \                                                              /
> \
>        \                {development branch}                        /
> \
>         \------->[D]----------------------->[E]-------------------[F]
> \------[G]--------[H]
>                                                                  REL1
> REL2
>                 fileset 1               fileset 2           fileset 3
> fileset 4    fileset 5
>
> At this point, I run
>     'git diff  -m --first-parent --pretty=fuller --decorate=short
> --name-only REL2..REL2'

Wow, we really, really need to throw errors and warnings when people use crazy 
range operators with diff.[1][2]  What version of git are you using that 
accepts --decorate=short as an argument to `git diff`?
And why in the world does git diff accept --first-parent or --pretty=fuller?!? 
That's insane for git-diff to swallow that.
(#leftoverbits?)  Also, I think you meant `REL1` one of the two times you 
wrote `REL2`, which makes me suspect you may have done some copy-edit-paste 
and didn't try this actual command.

> I expect to see only filesets 4 and 5 listed.  I also see filesets 1,
> 2 and
> 3 showing up.  This means that the git diff command is showing files
> that,in fact, did not change between the two tags.  By the way, I
> verified with a file by file comparison that under REL2 and REL1, the
> files represented by filesets 1, 2 and 3 had identical contents.

From your description, I assume you actually ran something like
  git diff --name-only REL1..REL2

which compares REL2 to the merge base of REL1 and REL2 (yes, this is totally 
counter-intuitive to a large percentage of the git userbase, but it is well 
documented and hard to change).  Also from your description, what you seem to 
want is
  git diff --name-only REL1 REL2

since you want to compare the two endpoints.  Does that help get what you 
want?

Hope that helps,
Elijah

[1] 
https://public-inbox.org/git/CABPp-BECj___HneAYviE3SB=wU6OTcBi3S=+Un1sP6L4WJ7agA@mail.gmail.com/
[2] 
https://public-inbox.org/git/CABPp-BGg_iSx3QMc-J4Fov97v9NnAtfxZGMrm3WfrGugOThjmA@mail.gmail.com/

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 7316 bytes --]

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

* Re: Problem with git diff
  2019-07-09 23:13 ` Elijah Newren
  2019-07-09 23:26   ` -EXT-Re: " McRoberts, John
@ 2019-07-09 23:29   ` Bryan Turner
  2019-07-09 23:35     ` Elijah Newren
  1 sibling, 1 reply; 5+ messages in thread
From: Bryan Turner @ 2019-07-09 23:29 UTC (permalink / raw)
  To: Elijah Newren; +Cc: McRoberts, John, git@vger.kernel.org

On Tue, Jul 9, 2019 at 4:13 PM Elijah Newren <newren@gmail.com> wrote:
>
> Hi John,
>
> On Tue, Jul 9, 2019 at 3:57 PM McRoberts, John <John.McRoberts@ga.com> wrote:
> >
> > I am responsible for generating a list of all files changed between two
> > successive releases of software. I was using 'git diff' but have run into a
> > problem.
> >
> > Consider the following situation: A development branch comes off of commit A
> > and files are changed three times.  A tag (REL1) is placed on the third
> > commit.  Then the branch is merged back to master.  At this point, master's
> > HEAD is at C (and it remains there).  Two development branches are created
> > off of master, the first of which is not important here.  In the second one,
> > there are files changed and a tag (REL2) applied.
> >
> >
> > ---------------------[I]
> >
> > /      {dev branch}
> >
> > /
> >
> > /
> >              {master branch}
> > /
> >  [A] ---------------------------------[B]------------------------------->[C]
> > master <HEAD>
> >    \                               filelist 6                           /  \
> >     \                                                                  /
> > \
> >      \                                                                /
> > \
> >       \                                                              /
> > \
> >        \                {development branch}                        /
> > \
> >         \------->[D]----------------------->[E]-------------------[F]
> > \------[G]--------[H]
> >                                                                  REL1
> > REL2
> >                 fileset 1               fileset 2           fileset 3
> > fileset 4    fileset 5
> >
> > At this point, I run
> >     'git diff  -m --first-parent --pretty=fuller --decorate=short
> > --name-only REL2..REL2'
>
> Wow, we really, really need to throw errors and warnings when people
> use crazy range operators with diff.[1][2]  What version of git are
> you using that accepts --decorate=short as an argument to `git diff`?
> And why in the world does git diff accept --first-parent or
> --pretty=fuller?!?  That's insane for git-diff to swallow that.
> (#leftoverbits?)  Also, I think you meant `REL1` one of the two times
> you wrote `REL2`, which makes me suspect you may have done some
> copy-edit-paste and didn't try this actual command.
>
> > I expect to see only filesets 4 and 5 listed.  I also see filesets 1, 2 and
> > 3 showing up.  This means that the git diff command is showing files that,in
> > fact, did not change between the two tags.  By the way, I verified with a
> > file by file comparison that under REL2 and REL1, the files represented by
> > filesets 1, 2 and 3 had identical contents.
>
> From your description, I assume you actually ran something like
>   git diff --name-only REL1..REL2

Did you mean REL1...REL2 (3 dots)? 2 dots (REL1..REL2) is identical to
no dots (REL1 REL2), per the documentation for "git diff":

       git diff [<options>] <commit> <commit> [--] [<path>...]

           This is to view the changes between two arbitrary <commit>.

       git diff [<options>] <commit>..<commit> [--] [<path>...]

           This is synonymous to the previous form. If <commit> on one
side is omitted, it will have the same effect
           as using HEAD instead.

(Forgive me if I'm mistaken here!)

>
> which compares REL2 to the merge base of REL1 and REL2 (yes, this is
> totally counter-intuitive to a large percentage of the git userbase,
> but it is well documented and hard to change).  Also from your
> description, what you seem to want is
>   git diff --name-only REL1 REL2
>
> since you want to compare the two endpoints.  Does that help get what you want?
>
> Hope that helps,
> Elijah
>
> [1] https://public-inbox.org/git/CABPp-BECj___HneAYviE3SB=wU6OTcBi3S=+Un1sP6L4WJ7agA@mail.gmail.com/
> [2] https://public-inbox.org/git/CABPp-BGg_iSx3QMc-J4Fov97v9NnAtfxZGMrm3WfrGugOThjmA@mail.gmail.com/

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

* Re: Problem with git diff
  2019-07-09 23:29   ` Bryan Turner
@ 2019-07-09 23:35     ` Elijah Newren
  0 siblings, 0 replies; 5+ messages in thread
From: Elijah Newren @ 2019-07-09 23:35 UTC (permalink / raw)
  To: Bryan Turner; +Cc: McRoberts, John, git@vger.kernel.org

On Tue, Jul 9, 2019 at 4:30 PM Bryan Turner <bturner@atlassian.com> wrote:
>
> On Tue, Jul 9, 2019 at 4:13 PM Elijah Newren <newren@gmail.com> wrote:
> >
> > Hi John,
> >
> > On Tue, Jul 9, 2019 at 3:57 PM McRoberts, John <John.McRoberts@ga.com> wrote:
> > >
> > > I am responsible for generating a list of all files changed between two
> > > successive releases of software. I was using 'git diff' but have run into a
> > > problem.
> > >
> > > Consider the following situation: A development branch comes off of commit A
> > > and files are changed three times.  A tag (REL1) is placed on the third
> > > commit.  Then the branch is merged back to master.  At this point, master's
> > > HEAD is at C (and it remains there).  Two development branches are created
> > > off of master, the first of which is not important here.  In the second one,
> > > there are files changed and a tag (REL2) applied.
> > >
> > >
> > > ---------------------[I]
> > >
> > > /      {dev branch}
> > >
> > > /
> > >
> > > /
> > >              {master branch}
> > > /
> > >  [A] ---------------------------------[B]------------------------------->[C]
> > > master <HEAD>
> > >    \                               filelist 6                           /  \
> > >     \                                                                  /
> > > \
> > >      \                                                                /
> > > \
> > >       \                                                              /
> > > \
> > >        \                {development branch}                        /
> > > \
> > >         \------->[D]----------------------->[E]-------------------[F]
> > > \------[G]--------[H]
> > >                                                                  REL1
> > > REL2
> > >                 fileset 1               fileset 2           fileset 3
> > > fileset 4    fileset 5
> > >
> > > At this point, I run
> > >     'git diff  -m --first-parent --pretty=fuller --decorate=short
> > > --name-only REL2..REL2'
> >
> > Wow, we really, really need to throw errors and warnings when people
> > use crazy range operators with diff.[1][2]  What version of git are
> > you using that accepts --decorate=short as an argument to `git diff`?
> > And why in the world does git diff accept --first-parent or
> > --pretty=fuller?!?  That's insane for git-diff to swallow that.
> > (#leftoverbits?)  Also, I think you meant `REL1` one of the two times
> > you wrote `REL2`, which makes me suspect you may have done some
> > copy-edit-paste and didn't try this actual command.
> >
> > > I expect to see only filesets 4 and 5 listed.  I also see filesets 1, 2 and
> > > 3 showing up.  This means that the git diff command is showing files that,in
> > > fact, did not change between the two tags.  By the way, I verified with a
> > > file by file comparison that under REL2 and REL1, the files represented by
> > > filesets 1, 2 and 3 had identical contents.
> >
> > From your description, I assume you actually ran something like
> >   git diff --name-only REL1..REL2
>
> Did you mean REL1...REL2 (3 dots)? 2 dots (REL1..REL2) is identical to
> no dots (REL1 REL2), per the documentation for "git diff":
>
>        git diff [<options>] <commit> <commit> [--] [<path>...]
>
>            This is to view the changes between two arbitrary <commit>.
>
>        git diff [<options>] <commit>..<commit> [--] [<path>...]
>
>            This is synonymous to the previous form. If <commit> on one
> side is omitted, it will have the same effect
>            as using HEAD instead.
>
> (Forgive me if I'm mistaken here!)

Yes, thanks.  In trying to explain how two and three dots behave
contrary to expectation for git diff, I mess up two versus three dots.
That's kind of embarrassing...

> > which compares REL2 to the merge base of REL1 and REL2 (yes, this is
> > totally counter-intuitive to a large percentage of the git userbase,
> > but it is well documented and hard to change).  Also from your
> > description, what you seem to want is
> >   git diff --name-only REL1 REL2

...though at least I was smart enough to suggest something without
dots, which is the only sane way to use git-diff.  ;-)

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

end of thread, other threads:[~2019-07-09 23:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09 22:09 Problem with git diff McRoberts, John
2019-07-09 23:13 ` Elijah Newren
2019-07-09 23:26   ` -EXT-Re: " McRoberts, John
2019-07-09 23:29   ` Bryan Turner
2019-07-09 23:35     ` Elijah Newren

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).