git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git log --follow wrongly includes delete commit
@ 2023-01-26 13:05 Steinar H. Gunderson
  2023-01-26 16:38 ` Derrick Stolee
  0 siblings, 1 reply; 3+ messages in thread
From: Steinar H. Gunderson @ 2023-01-26 13:05 UTC (permalink / raw)
  To: git

Hi,

I'm in the Chromium repository; it can be checked out at
https://chromium.googlesource.com/chromium/src.git (you don't need the
sub-repostiories). HEAD is pointing to 4e0db738b37c. git 2.39.1.

When I run

  git log --raw --follow base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h

this is the first commit that it lists (snipped):

commit 5d4451ebf298d9d71f716cc0135f465cec41fcd0
[...]
:100644 000000 9e81e1b53029f 0000000000000 D base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h

This indicates that the last thing that happened to the file is a delete.
However, the file isn't deleted; it's alive and well. git log without
--follow does not list this commit at all.

So either git log --follow is listing a delete commit that doesn't make
sense, or it's missing whatever commit put it back into place afterwards.

/* Steinar */
-- 
Homepage: http://www.sesse.net/

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

* Re: git log --follow wrongly includes delete commit
  2023-01-26 13:05 git log --follow wrongly includes delete commit Steinar H. Gunderson
@ 2023-01-26 16:38 ` Derrick Stolee
  2023-01-26 17:18   ` Steinar H. Gunderson
  0 siblings, 1 reply; 3+ messages in thread
From: Derrick Stolee @ 2023-01-26 16:38 UTC (permalink / raw)
  To: Steinar H. Gunderson, git

On 1/26/2023 8:05 AM, Steinar H. Gunderson wrote:
> I'm in the Chromium repository; it can be checked out at
> https://chromium.googlesource.com/chromium/src.git (you don't need the
> sub-repostiories). HEAD is pointing to 4e0db738b37c. git 2.39.1.
> 
> When I run
> 
>   git log --raw --follow base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h
> 
> this is the first commit that it lists (snipped):
> 
> commit 5d4451ebf298d9d71f716cc0135f465cec41fcd0
> [...]
> :100644 000000 9e81e1b53029f 0000000000000 D base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h
> 
> This indicates that the last thing that happened to the file is a delete.
> However, the file isn't deleted; it's alive and well. git log without
> --follow does not list this commit at all.
> 
> So either git log --follow is listing a delete commit that doesn't make
> sense, or it's missing whatever commit put it back into place afterwards.

It's actually a third option: it was deleted but also renamed in an
independent point in history, but the delete is more recent "in time"
that it shows up first, and the merge that resolves the issue doesn't
show up at all.

You can see this when using --full-history --simplify-merges --graph,
since it will explore enough of the graph to recognize that deletion
while also showing how things got merged strangely:

$ git log --summary --full-history --simplify-merges --graph -- base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h
*   commit 1e78967ed2f1937b3809c19d91e7dd62d756d307
|\  Merge: 5d4451ebf298 9e9b6e8ee772
| | Author: grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
| | Date:   Tue Jul 19 16:14:55 2011 +0000
| | 
| |     FileManagerDialogTest.SelectFileAndCancel flaky.
| |     
| |     BUG=89733
| |     TBR=robertshield@chromium.org
| |     TEST=browser_tests
| |     Review URL: http://codereview.chromium.org/7447001
| |     
| |     git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93027 0039d316-1c4b-4281-b951-d872f2087c98
| | 
* | commit 5d4451ebf298d9d71f716cc0135f465cec41fcd0
|/  Author: jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
|   Date:   Tue Jul 19 15:45:49 2011 +0000
|   
|       Roll ANGLE r704:r705
|       
|       BUG=
|       TEST=try
|       
|       Review URL: http://codereview.chromium.org/7375016
|       
|       git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93026 0039d316-1c4b-4281-b951-d872f2087c98
|   
|    delete mode 100644 base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h
| 
* commit 9e9b6e8ee77229781fa8581b7f46413024404a5f
  Author: thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
  Date:   Wed Dec 2 08:45:01 2009 +0000
  
      Move some XDG code from chrome to base, make DIR_USER_CACHE generic rather than Chromium specific, and clean up a few headers.
      
      BUG=none
      TEST=none
      Review URL: http://codereview.chromium.org/449048
      
      git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33565 0039d316-1c4b-4281-b951-d872f2087c98
  
   create mode 100644 base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h

(Note: I didn't include --follow here as it filtered the --graph
output in a strange way, including dropping the merge commitswhich was
confusing to me.)

In conclusion: while I agree that this output is confusing, it is due
to the interesting shape of the commit history, and not actually a bug
in --follow.

Thanks,
-Stolee

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

* Re: git log --follow wrongly includes delete commit
  2023-01-26 16:38 ` Derrick Stolee
@ 2023-01-26 17:18   ` Steinar H. Gunderson
  0 siblings, 0 replies; 3+ messages in thread
From: Steinar H. Gunderson @ 2023-01-26 17:18 UTC (permalink / raw)
  To: Derrick Stolee; +Cc: git

On Thu, Jan 26, 2023 at 11:38:42AM -0500, Derrick Stolee wrote:
> It's actually a third option: it was deleted but also renamed in an
> independent point in history, but the delete is more recent "in time"
> that it shows up first, and the merge that resolves the issue doesn't
> show up at all.

I see! So basically my parser needs to also start tracking merges,
except --follow seems to be sort of odd with those as well (though
I think maybe it's changed in some fairly recent git version).

> (Note: I didn't include --follow here as it filtered the --graph
> output in a strange way, including dropping the merge commitswhich was
> confusing to me.)

I think you need to give -c or --cc or something similar to see merges in
--follow, but the man pages are not entirely clear to me.

/* Steinar */
-- 
Homepage: https://www.sesse.net/

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

end of thread, other threads:[~2023-01-26 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 13:05 git log --follow wrongly includes delete commit Steinar H. Gunderson
2023-01-26 16:38 ` Derrick Stolee
2023-01-26 17:18   ` Steinar H. Gunderson

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