{"thread":{"id":"57808","subject":"Issues with git config blame. ignorerevsfile when file not found","startedAt":"2022-04-27T20:04:01Z","lastAt":"2022-04-27T20:04:01Z","messageCount":1,"participants":["Maxime Fontaine Bombardier"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"454539","messageId":"CAHh029azN65vyscsCmwCG5sFPO_sGPVJ6twBXwMdNXxfYT0X4w@mail.gmail.com","threadId":"57808","inReplyTo":null,"subject":"Issues with git config blame. ignorerevsfile when file not found","fromName":"Maxime Fontaine Bombardier","fromEmail":"mbombardier@eptix.co","sentAt":"2022-04-27T20:03:43Z","receivedAt":"2022-04-27T20:04:01Z","isPatch":false,"sender":{"key":"mbombardier@eptix.co","avatar":null},"body":"Hi,\nI was looking to reformat full source code and ignore blame on this\ncommit. I was following this article :\nhttps://michaelheap.com/git-ignore-rev/\nUsing this config command :\n`git config --global blame.ignoreRevsFile .git-blame-ignore-revs`\nI'm able to see git blame without seeing the formatting commit.\nBUT when the file is not found on the repo, git blame is broken with\nthis error message:\ncould not open object name list: .git-blame-ignore-revs\n\nOn one hand, you don't want to manually write the ignore file every\ntime you want to use `git blame --ignore-rev <sha1>`, but on the other\nhand, git blame is broken on every other repo that does not include\nthis file... I also use git lens pair with vscode to see blames and\nthe extension is broken if the file does not exist too.\n\nHere are 2 ideas on how I would fix this issue:\n- New config \"blame.ignoreNotFound\" boolean.\n  - False by default.\n    - Will still see the error when the file is not found.\n  - True\n    - Will ignore errors about the file not found and remove the\n--ignore-rev feature in the current git blame command.\n    - I would put this setting to true as default, because I don't\ncare about error messages. All I care is that git blame shows me the\nreal author and not the one who launched the formatter, BUT to not\nbreak default behavior, this should be an optional setting.\n- New file standard! (which I think is a better option)\n  - Beside .gitignore, you can find the file .gitignorerevs (or any\nbetter name). If the file is found in the repo, doing git blame will\nuse the file by default.\n  - That way :\n    - It's not a global config that does not apply to specific repo or\nbreak the command when it's not found.\n    - It's not a manual argument you need to add each time the command is used.\n    - Nor a local config that everyone contributing to this repo needs\nto set up to use git blame correctly.\n  - And :\n    - Any git hosting website like Github/Gitlab/etc. could also use\nthe file to help dev search for specific changes on the website.\n  - IMO: I don't think having a file that ignores some commits will\nhurt people's workflow as this is a deliberate change. You know that\nthis commit is bad for the code history, so you want to ignore those\nchanges to clean up the history.\n\nWell I hope I gave enough description to make this change happen :)\nBtw, I'm writing today because I definitely think this is a MUST\nfeature to make git blame truly shine and because I searched online\nand I couldn't find any proper solution, just that you can't do that\nyet.\nhttps://stackoverflow.com/questions/70435937/git-blame-with-optional-ignorerevsfile\n"}]}