{"thread":{"id":"59152","subject":"git log --follow wrongly includes delete commit","startedAt":"2023-01-26T13:43:46Z","lastAt":"2023-01-26T17:18:43Z","messageCount":3,"participants":["Steinar H. Gunderson","Derrick Stolee"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"471066","messageId":"20230126130509.ovii7ji7hi5wm7qx@sesse.net","threadId":"59152","inReplyTo":null,"subject":"git log --follow wrongly includes delete commit","fromName":"Steinar H. Gunderson","fromEmail":"steinar+git@gunderson.no","sentAt":"2023-01-26T13:05:09Z","receivedAt":"2023-01-26T13:43:46Z","isPatch":false,"sender":{"key":"steinar+git@gunderson.no","avatar":null},"body":"Hi,\n\nI'm in the Chromium repository; it can be checked out at\nhttps://chromium.googlesource.com/chromium/src.git (you don't need the\nsub-repostiories). HEAD is pointing to 4e0db738b37c. git 2.39.1.\n\nWhen I run\n\n  git log --raw --follow base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h\n\nthis is the first commit that it lists (snipped):\n\ncommit 5d4451ebf298d9d71f716cc0135f465cec41fcd0\n[...]\n:100644 000000 9e81e1b53029f 0000000000000 D base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h\n\nThis indicates that the last thing that happened to the file is a delete.\nHowever, the file isn't deleted; it's alive and well. git log without\n--follow does not list this commit at all.\n\nSo either git log --follow is listing a delete commit that doesn't make\nsense, or it's missing whatever commit put it back into place afterwards.\n\n/* Steinar */\n-- \nHomepage: http://www.sesse.net/\n"},{"id":"471072","messageId":"fcc08ee2-dc58-09da-dc60-c438cfbf6602@github.com","threadId":"59152","inReplyTo":"20230126130509.ovii7ji7hi5wm7qx@sesse.net","subject":"Re: git log --follow wrongly includes delete commit","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2023-01-26T16:38:42Z","receivedAt":"2023-01-26T16:38:57Z","isPatch":false,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 1/26/2023 8:05 AM, Steinar H. Gunderson wrote:\n> I'm in the Chromium repository; it can be checked out at\n> https://chromium.googlesource.com/chromium/src.git (you don't need the\n> sub-repostiories). HEAD is pointing to 4e0db738b37c. git 2.39.1.\n> \n> When I run\n> \n>   git log --raw --follow base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h\n> \n> this is the first commit that it lists (snipped):\n> \n> commit 5d4451ebf298d9d71f716cc0135f465cec41fcd0\n> [...]\n> :100644 000000 9e81e1b53029f 0000000000000 D base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h\n> \n> This indicates that the last thing that happened to the file is a delete.\n> However, the file isn't deleted; it's alive and well. git log without\n> --follow does not list this commit at all.\n> \n> So either git log --follow is listing a delete commit that doesn't make\n> sense, or it's missing whatever commit put it back into place afterwards.\n\nIt's actually a third option: it was deleted but also renamed in an\nindependent point in history, but the delete is more recent \"in time\"\nthat it shows up first, and the merge that resolves the issue doesn't\nshow up at all.\n\nYou can see this when using --full-history --simplify-merges --graph,\nsince it will explore enough of the graph to recognize that deletion\nwhile also showing how things got merged strangely:\n\n$ git log --summary --full-history --simplify-merges --graph -- base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h\n*   commit 1e78967ed2f1937b3809c19d91e7dd62d756d307\n|\\  Merge: 5d4451ebf298 9e9b6e8ee772\n| | Author: grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>\n| | Date:   Tue Jul 19 16:14:55 2011 +0000\n| | \n| |     FileManagerDialogTest.SelectFileAndCancel flaky.\n| |     \n| |     BUG=89733\n| |     TBR=robertshield@chromium.org\n| |     TEST=browser_tests\n| |     Review URL: http://codereview.chromium.org/7447001\n| |     \n| |     git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93027 0039d316-1c4b-4281-b951-d872f2087c98\n| | \n* | commit 5d4451ebf298d9d71f716cc0135f465cec41fcd0\n|/  Author: jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>\n|   Date:   Tue Jul 19 15:45:49 2011 +0000\n|   \n|       Roll ANGLE r704:r705\n|       \n|       BUG=\n|       TEST=try\n|       \n|       Review URL: http://codereview.chromium.org/7375016\n|       \n|       git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93026 0039d316-1c4b-4281-b951-d872f2087c98\n|   \n|    delete mode 100644 base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h\n| \n* commit 9e9b6e8ee77229781fa8581b7f46413024404a5f\n  Author: thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>\n  Date:   Wed Dec 2 08:45:01 2009 +0000\n  \n      Move some XDG code from chrome to base, make DIR_USER_CACHE generic rather than Chromium specific, and clean up a few headers.\n      \n      BUG=none\n      TEST=none\n      Review URL: http://codereview.chromium.org/449048\n      \n      git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33565 0039d316-1c4b-4281-b951-d872f2087c98\n  \n   create mode 100644 base/third_party/xdg_user_dirs/xdg_user_dir_lookup.h\n\n(Note: I didn't include --follow here as it filtered the --graph\noutput in a strange way, including dropping the merge commitswhich was\nconfusing to me.)\n\nIn conclusion: while I agree that this output is confusing, it is due\nto the interesting shape of the commit history, and not actually a bug\nin --follow.\n\nThanks,\n-Stolee\n"},{"id":"471075","messageId":"20230126171830.6qb46wa2ed5h2z3b@sesse.net","threadId":"59152","inReplyTo":"fcc08ee2-dc58-09da-dc60-c438cfbf6602@github.com","subject":"Re: git log --follow wrongly includes delete commit","fromName":"Steinar H. Gunderson","fromEmail":"steinar+git@gunderson.no","sentAt":"2023-01-26T17:18:30Z","receivedAt":"2023-01-26T17:18:43Z","isPatch":false,"sender":{"key":"steinar+git@gunderson.no","avatar":null},"body":"On Thu, Jan 26, 2023 at 11:38:42AM -0500, Derrick Stolee wrote:\n> It's actually a third option: it was deleted but also renamed in an\n> independent point in history, but the delete is more recent \"in time\"\n> that it shows up first, and the merge that resolves the issue doesn't\n> show up at all.\n\nI see! So basically my parser needs to also start tracking merges,\nexcept --follow seems to be sort of odd with those as well (though\nI think maybe it's changed in some fairly recent git version).\n\n> (Note: I didn't include --follow here as it filtered the --graph\n> output in a strange way, including dropping the merge commitswhich was\n> confusing to me.)\n\nI think you need to give -c or --cc or something similar to see merges in\n--follow, but the man pages are not entirely clear to me.\n\n/* Steinar */\n-- \nHomepage: https://www.sesse.net/\n"}]}