{"thread":{"id":"63734","subject":"[RFC PATCH] blame: avoid failing if ignoreRevsFile does not exist","startedAt":"2025-07-03T08:18:58Z","lastAt":"2025-07-03T13:18:22Z","messageCount":3,"participants":["Francesco Nicoletta Puzzillo","Kristoffer Haugsbakk","Ben Knoble"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"521237","messageId":"20250703081838.190603-1-francesco.nicolettap@amarulasolutions.com","threadId":"63734","inReplyTo":null,"subject":"[RFC PATCH] blame: avoid failing if ignoreRevsFile does not exist","fromName":"Francesco Nicoletta Puzzillo","fromEmail":"francesco.nicolettap@amarulasolutions.com","sentAt":"2025-07-03T08:18:38Z","receivedAt":"2025-07-03T08:18:58Z","isPatch":true,"sender":{"key":"francesco.nicolettap@amarulasolutions.com","avatar":null},"body":"Setting ignoreRevsFile globally makes the blame command fail in\nrepositories that don't have the file present.\n\nCheck that the file exists before trying to parse it.\n\nSigned-off-by: Francesco Nicoletta Puzzillo <francesco.nicolettap@amarulasolutions.com>\n---\n builtin/blame.c  | 3 ++-\n t/t8002-blame.sh | 6 ++++++\n 2 files changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 944952e30e..e4236f0ebc 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -868,12 +868,13 @@ static void build_ignorelist(struct blame_scoreboard *sb,\n {\n \tstruct string_list_item *i;\n \tstruct object_id oid;\n+\tstruct stat st;\n \n \toidset_init(&sb->ignore_list, 0);\n \tfor_each_string_list_item(i, ignore_revs_file_list) {\n \t\tif (!strcmp(i->string, \"\"))\n \t\t\toidset_clear(&sb->ignore_list);\n-\t\telse\n+\t\telse if (!stat(i->string, &st))\n \t\t\toidset_parse_file_carefully(&sb->ignore_list, i->string,\n \t\t\t\t\t\t    the_repository->hash_algo,\n \t\t\t\t\t\t    peel_to_commit_oid, sb);\ndiff --git a/t/t8002-blame.sh b/t/t8002-blame.sh\nindex 7822947f02..24010f544c 100755\n--- a/t/t8002-blame.sh\n+++ b/t/t8002-blame.sh\n@@ -173,4 +173,10 @@ test_expect_success 'blame with uncommitted edits in partial clone does not cras\n \tgit -C client blame file.txt\n '\n \n+test_expect_success 'blame with ignoreRevsFile set but not present does not fail' '\n+\ttest_commit A file line1 &&\n+\tgit config --global blame.ignoreRevsFile .git-blame-ignore-revs &&\n+\tgit blame file\n+'\n+\n test_done\n\nbase-commit: 8b6f19ccfc3aefbd0f22f6b7d56ad6a3fc5e4f37\n-- \n2.43.0\n\n"},{"id":"521239","messageId":"099c2a59-ac60-474b-a535-ec7dcb1f44f8@app.fastmail.com","threadId":"63734","inReplyTo":"20250703081838.190603-1-francesco.nicolettap@amarulasolutions.com","subject":"Re: [RFC PATCH] blame: avoid failing if ignoreRevsFile does not exist","fromName":"Kristoffer Haugsbakk","fromEmail":"kristofferhaugsbakk@fastmail.com","sentAt":"2025-07-03T08:25:21Z","receivedAt":"2025-07-03T08:26:29Z","isPatch":true,"sender":{"key":"kristofferhaugsbakk@fastmail.com","avatar":null},"body":"On Thu, Jul 3, 2025, at 10:18, Francesco Nicoletta Puzzillo wrote:\n> Setting ignoreRevsFile globally makes the blame command fail in\n> repositories that don't have the file present.\n>\n> Check that the file exists before trying to parse it.\n>\n> Signed-off-by: Francesco Nicoletta Puzzillo <francesco.nicolettap@amarulasolutions.com>\n\nRelevant thread\n\nhttps://lore.kernel.org/git/20210807202752.1278672-1-noah.pendleton@gmail.com/\n"},{"id":"521274","messageId":"93842D18-3051-4169-B314-AD5A1407575D@gmail.com","threadId":"63734","inReplyTo":"099c2a59-ac60-474b-a535-ec7dcb1f44f8@app.fastmail.com","subject":"Re: [RFC PATCH] blame: avoid failing if ignoreRevsFile does not exist","fromName":"Ben Knoble","fromEmail":"ben.knoble@gmail.com","sentAt":"2025-07-03T13:18:09Z","receivedAt":"2025-07-03T13:18:22Z","isPatch":true,"sender":{"key":"ben.knoble@gmail.com","avatar":"https://avatars.githubusercontent.com/u/22802209?v=4"},"body":"\n> Le 3 juil. 2025 à 04:26, Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> a écrit :\n> \n> ﻿On Thu, Jul 3, 2025, at 10:18, Francesco Nicoletta Puzzillo wrote:\n>> Setting ignoreRevsFile globally makes the blame command fail in\n>> repositories that don't have the file present.\n>> \n>> Check that the file exists before trying to parse it.\n>> \n>> Signed-off-by: Francesco Nicoletta Puzzillo <francesco.nicolettap@amarulasolutions.com>\n> \n> Relevant thread\n> \n> https://lore.kernel.org/git/20210807202752.1278672-1-noah.pendleton@gmail.com/\n> \n\nIndeed. IIRC there was some polish to do on Junio’s patches, which I intend to get to unless someone beats me to it ;)"}]}