{"thread":{"id":"64312","subject":"git whatchanged --i-still-use-this","startedAt":"2025-10-13T18:55:13Z","lastAt":"2025-10-13T19:51:37Z","messageCount":2,"participants":["Roy Lomicka","Kristoffer Haugsbakk"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"528659","messageId":"SJ2PR03MB7043AA590AD8D80DB4EC7B73CFEAA@SJ2PR03MB7043.namprd03.prod.outlook.com","threadId":"64312","inReplyTo":"SJ2PR03MB704376284D14F92B54139BFBCFEAA@SJ2PR03MB7043.namprd03.prod.outlook.com","subject":"git whatchanged --i-still-use-this","fromName":"Roy Lomicka","fromEmail":"rlomicka@concord.net","sentAt":"2025-10-13T18:55:10Z","receivedAt":"2025-10-13T18:55:13Z","isPatch":false,"sender":{"key":"rlomicka@concord.net","avatar":null},"body":"This is one way I deal with the fact that git has no option to respect mtime.\n\npowershell use-commit-times.ps1\n\n'git whatchanged' is nominated for removal.\nIf you still use this command, please add an extra\noption, '--i-still-use-this', on the command line\nand let us know you still use it by sending an e-mail\nto <mailto:git@vger.kernel.org>.  Thanks.\nfatal: refusing to run without --i-still-use-this\n\nuse-commit-times.ps1:\n\n#use-commit-times\n[string[]]$changes = &git whatchanged --reverse --pretty=%at\n$mtime = [DateTime]::Now;\n[string]$change = $null;\nforeach($change in $changes)\n{\n    if($change.Length -eq 0) { continue; }\n    if($change[0] -eq \":\")\n    {\n        $parts = $change.Split(\"`t\");\n        $file = $parts[$parts.Length - 1];\n        if([System.IO.File]::Exists($file))\n        {\n            [System.IO.File]::SetLastWriteTimeUtc($file, $mtime);\n        }\n    }\n    else\n    {\n        $mtime = [DateTimeOffset]::FromUnixTimeSeconds([Int64]::Parse($change)).DateTime;\n    }\n}\n\nRoy Lomicka\nSoftware Developer\np: (978) 367-3518\ne: mailto:rlomicka@concord.net \nw: http://www.concord.net/\n\nConcord Technologies and Biscom have come together to better serve you, https://concord.net/concord-technologies-acquires-biscom/.\n\n"},{"id":"528662","messageId":"4f213721-4fd5-4073-8be3-99de1ffa4a8a@app.fastmail.com","threadId":"64312","inReplyTo":"SJ2PR03MB7043AA590AD8D80DB4EC7B73CFEAA@SJ2PR03MB7043.namprd03.prod.outlook.com","subject":"Re: git whatchanged --i-still-use-this","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2025-10-13T19:51:15Z","receivedAt":"2025-10-13T19:51:37Z","isPatch":false,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Mon, Oct 13, 2025, at 20:55, Roy Lomicka wrote:\n> This is one way I deal with the fact that git has no option to respect mtime.\n\nThe general recommendation is to replace it with `git log` like so:\n\n• Given: `git whatchanged <opts>`\n• Replace with: `git log <opts> --no-merges --raw`\n\nAnd I think that should be okay in your case since it seems that commits\nwithout changes will not affect the result. See longer explanation\nbelow.\n\n-----\n\nLonger explanation:\n\nSee:\n\nhttps://lore.kernel.org/git/83241BDE-1E0D-489A-9181-C608E9FCC17B@gmail.com/\n\n   I run an important python script that uses this to set file times to\n   the dates of the actual git commits, so as I browse the files I can\n   see their last modified date, and not the date that the file was last\n   synced.\n\nThe recommendation above will give identical output as long as there are\nno empty commits in the Git history.  Where an empty commit is:\n\n• A single-parent commit (git-whatchanged(1) does not care about merges\n  by default, and not in your invocation)\n• There are no changes compared to the parent (same tree)\n\nSee the explanation for why they give different output in this case:\n\nhttps://lore.kernel.org/git/20250825085428.GA367101@coredump.intra.peff.net/\n\nNormally I wouldn’t note all of that since it seems unlikely to be\nrelevant.  (Certainly shouldn’t be relevant for interactive use.)\nHowever here the case seems so *scripted* that not being\noutput-equivalent might end up mattering.\n\n>\n> powershell use-commit-times.ps1\n>\n> 'git whatchanged' is nominated for removal.\n> If you still use this command, please add an extra\n> option, '--i-still-use-this', on the command line\n> and let us know you still use it by sending an e-mail\n> to <mailto:git@vger.kernel.org>.  Thanks.\n> fatal: refusing to run without --i-still-use-this\n>\n> use-commit-times.ps1:\n>\n>[snip]\n"}]}