{"thread":{"id":"62726","subject":"git log date filter bug","startedAt":"2025-01-02T15:16:03Z","lastAt":"2025-01-03T20:13:22Z","messageCount":2,"participants":["Sarah Gastner","René Scharfe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"509800","messageId":"gEmXX5Orp18U4lUPlWeCKoepi91ih8VkreogEnepOIzTOihbf_iNuXqvdhFcgnIpRabnUscWIKf_GH04iI5NeVpdWjbHnPIPa6ZAtkfITk0=@protonmail.com","threadId":"62726","inReplyTo":null,"subject":"git log date filter bug","fromName":"Sarah Gastner","fromEmail":"gastner2001@protonmail.com","sentAt":"2025-01-02T15:15:50Z","receivedAt":"2025-01-02T15:16:03Z","isPatch":false,"sender":{"key":"gastner2001@protonmail.com","avatar":null},"body":"Good day,\n\nI encountered some weird behaviour that I think is a bug. I'll paste the bug report below and also attach it to this email.\n\nBest regards\n\nSarah Gastner\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\nI used the command \"git log --after=2023-03-10 before=2024-01-24\" in the kubernetes repository (https://github.com/kubernetes/kubernetes), checked out branch master (commit cb93d6ee69b8d4ca8701336e4f7cb278751f34e4).\n\nWhat did you expect to happen? (Expected behavior)\nThe following commit (amongst others) to appear in the output:\ncommit 501976cc34ed3bfea6e1c994d41cb9bc464d6c3b\nAuthor: Jiahui Feng <jhf@google.com>\nDate:   Mon Mar 13 14:40:47 2023 -0700\n\n    fix broken tests after dependency injection.\n\nWhat happened instead? (Actual behavior)\nThe commit did not appear.\n\nWhat's different between what you expected and what actually happened?\nBoth the author date and the commit date are 2023-03-13. \nThe interval 2023-03-10 to 2024-01-24 should include this date and therefore this commit.\n\nAnything else you want to add:\nI was able to figure out the minimal date interval needed for this commit to appear: 2023-03-07 to 2023-03-14.\nThe following command will only display the commit specified above: git log --after=2023-03-07 --before=2023-03-14 --grep=\"fix broken tests after dependency injection.\"\nIf you change the --after date to one day later (2023-03-08), there will be no output.\n\nThis issue appears in other repositories too.\n\nI observed this behaviour on Windows and WSL (Ubuntu).\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.47.1.windows.1\ncpu: x86_64\nbuilt from commit: 2cd22437f64229935dc564db969cbcbfed5e9045\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: D:/git-sdk-64-build-installers/usr/bin/sh\nfeature: fsmonitor--daemon\nlibcurl: 8.11.0\nOpenSSL: OpenSSL 3.2.3 3 Sep 2024\nzlib: 1.3.1\nuname: Windows 10.0 19045 \ncompiler info: gnuc: 14.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\n\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\nI used the command \"git log --after=2023-03-10 before=2024-01-24\" in the kubernetes repository (https://github.com/kubernetes/kubernetes), checked out branch master (commit cb93d6ee69b8d4ca8701336e4f7cb278751f34e4).\n\nWhat did you expect to happen? (Expected behavior)\nThe following commit (amongst others) to appear in the output:\ncommit 501976cc34ed3bfea6e1c994d41cb9bc464d6c3b\nAuthor: Jiahui Feng <jhf@google.com>\nDate:   Mon Mar 13 14:40:47 2023 -0700\n\n    fix broken tests after dependency injection.\n\nWhat happened instead? (Actual behavior)\nThe commit did not appear.\n\nWhat's different between what you expected and what actually happened?\nBoth the author date and the commit date are 2023-03-13. \nThe interval 2023-03-10 to 2024-01-24 should include this date and therefore this commit.\n\nAnything else you want to add:\nI was able to figure out the minimal date interval needed for this commit to appear: 2023-03-07 to 2023-03-14.\nThe following command will only display the commit specified above: git log --after=2023-03-07 --before=2023-03-14 --grep=\"fix broken tests after dependency injection.\"\nIf you change the --after date to one day later (2023-03-08), there will be no output.\n\nThis issue appears in other repositories too.\n\nI observed this behaviour on Windows and WSL (Ubuntu).\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.45.1.windows.1\ncpu: x86_64\nbuilt from commit: 965b16798dab6962ada5b0d8cf0dca68f385c448\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 19045 \ncompiler info: gnuc: 13.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\n\n\nThank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\nI used the command \"git log --after=2023-03-10 before=2024-01-24\" in the kubernetes repository (https://github.com/kubernetes/kubernetes), checked out branch master (commit cb93d6ee69b8d4ca8701336e4f7cb278751f34e4).\n\nWhat did you expect to happen? (Expected behavior)\nThe following commit (amongst others) to appear in the output:\ncommit 501976cc34ed3bfea6e1c994d41cb9bc464d6c3b\nAuthor: Jiahui Feng <jhf@google.com>\nDate:   Mon Mar 13 14:40:47 2023 -0700\n\n    fix broken tests after dependency injection.\n\nWhat happened instead? (Actual behavior)\nThe commit did not appear.\n\nWhat's different between what you expected and what actually happened?\nBoth the author date and the commit date are 2023-03-13. \nThe interval 2023-03-10 to 2024-01-24 should include this date and therefore this commit.\n\nAnything else you want to add:\nI was able to figure out the minimal date interval needed for this commit to appear: 2023-03-07 to 2023-03-14.\nThe following command will only display the commit specified above: git log --after=2023-03-07 --before=2023-03-14 --grep=\"fix broken tests after dependency injection.\"\nIf you change the --after date to one day later (2023-03-08), there will be no output.\n\nThis issue appears in other repositories too.\n\nI observed this behaviour on Windows and WSL (Ubuntu).\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.47.1.windows.1\ncpu: x86_64\nbuilt from commit: 2cd22437f64229935dc564db969cbcbfed5e9045\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: D:/git-sdk-64-build-installers/usr/bin/sh\nfeature: fsmonitor--daemon\nlibcurl: 8.11.0\nOpenSSL: OpenSSL 3.2.3 3 Sep 2024\nzlib: 1.3.1\nuname: Windows 10.0 19045 \ncompiler info: gnuc: 14.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\n"},{"id":"509889","messageId":"5796785f-134b-487b-90e4-e7aaf78cb912@web.de","threadId":"62726","inReplyTo":"gEmXX5Orp18U4lUPlWeCKoepi91ih8VkreogEnepOIzTOihbf_iNuXqvdhFcgnIpRabnUscWIKf_GH04iI5NeVpdWjbHnPIPa6ZAtkfITk0=@protonmail.com","subject":"Re: git log date filter bug","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2025-01-03T20:13:18Z","receivedAt":"2025-01-03T20:13:22Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 02.01.25 um 16:15 schrieb Sarah Gastner:\n> I encountered some weird behaviour that I think is a bug. I'll paste\n> the bug report below and also attach it to this email.\nThe following command shows the offending commit along with its parent,\nchild and grandchild; the format shows commit time, author time, commit\nhash and parent commit hash:\n\n$ git log --format=\"%ci %ai %h %p\" --max-count=4 82eb24156a1\n2023-03-08 15:01:06 -0800 2023-03-08 15:01:06 -0800 82eb24156a1 4346c5e5e29\n2023-03-07 15:51:09 -0800 2023-03-07 15:51:09 -0800 4346c5e5e29 501976cc34e\n2023-03-13 14:40:47 -0700 2023-03-13 14:40:47 -0700 501976cc34e feb18b3f5f9\n2023-03-07 15:49:19 -0800 2023-03-07 15:49:19 -0800 feb18b3f5f9 54283a1d383\n\nSo 501976cc34e was ostensibly committed six days after its child commit\n4346c5e5e29, which would require time travel capabilities.  Or, more\nlikely, someone edited the commit history, but did not update the\ncommit times, possibly with git rebase --committer-date-is-author-date.\n\ngit log assumes that commit dates are chronological and stops\ntraversing the history if it encounters a commit with a timestamp\nolder than the time given with --after.  That is a reasonable\nassumption usually.\n\nNot sure what git log could do better here.  It could add some slack to\nthe specified time and look deeper than actually asked for to try and\ncatch such time travel artifacts, but how much exactly?  History can be\narbitrarily deep and history editing can move commits arbitrarily far.\n\nShould it go all the way down to the root commits to be safe?  That's\nexpensive.  Should out-of-order commits be put on some kind of special\nlist for special treatment?  Sounds complicated.  The current deal of:\n\"You want to mess up commit dates, then tell your collaborators to add\nsome slack to commit date options\" is not ideal, but fair in a  way.\n\nPerhaps someone has a better idea?\n\nRené\n\n"}]}