{"thread":{"id":"63936","subject":"'seen' branch fails to build","startedAt":"2025-08-09T13:37:39Z","lastAt":"2025-08-10T00:16:11Z","messageCount":2,"participants":["Ramsay Jones","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"523869","messageId":"92c8c9eb-91de-48c6-88ac-7d5583cc766a@ramsayjones.plus.com","threadId":"63936","inReplyTo":null,"subject":"'seen' branch fails to build","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2025-08-09T13:34:29Z","receivedAt":"2025-08-09T13:37:39Z","isPatch":false,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Hi Junio,\n\nYou have probably already fixed this but, just in case you are unaware, the\ncurrent 'seen' branch @9faf989da6 (\"Merge branch 'gh/git-jump-pathname-with-sp'\ninto seen\", 2025-08-08) fails to build for me with DEVELOPER=1:\n\n      CC builtin/diff.o\n  builtin/diff.c: In function ‘cmd_diff’:\n  builtin/diff.c:500:17: error: ignoring return value of ‘chdir’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]\n    500 |                 chdir(prefix);\n        |                 ^~~~~~~~~~~~~\n  cc1: all warnings being treated as errors\n  make: *** [Makefile:2818: builtin/diff.o] Error 1\n\nSee commit 456a265746 (\"diff: --no-index should ignore the worktree\",\n2025-08-07) in the 'jc/diff-no-index-in-subdir' branch.\n\nIn order to get it to build, I just did:\n\n  $ git diff\n  diff --git a/builtin/diff.c b/builtin/diff.c\n  index 3eb4cbb057..ff16d7be99 100644\n  --- a/builtin/diff.c\n  +++ b/builtin/diff.c\n  @@ -497,7 +497,8 @@ int cmd_diff(int argc,\n           * prefix.\n           */\n          if (no_index && prefix) {\n  -               chdir(prefix);\n  +               if (chdir(prefix) < 0)\n  +                       die_errno(_(\"cannot chdir to %s\"), prefix);\n                  prefix = NULL;\n          }\n   \n  $ \n\n[I don't know if that is the best solution; it was just the quickest! :) ]\n\nATB,\nRamsay Jones\n\n \n"},{"id":"523879","messageId":"xmqq5xew58vq.fsf@gitster.g","threadId":"63936","inReplyTo":"92c8c9eb-91de-48c6-88ac-7d5583cc766a@ramsayjones.plus.com","subject":"Re: 'seen' branch fails to build","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-08-10T00:16:09Z","receivedAt":"2025-08-10T00:16:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsayjones.plus.com> writes:\n\n> See commit 456a265746 (\"diff: --no-index should ignore the worktree\",\n> 2025-08-07) in the 'jc/diff-no-index-in-subdir' branch.\n>\n> In order to get it to build, I just did:\n> ...\n\nThanks for noticing and reporting.  I'd save the translators by\nreusing the message used already elsewhere.\n\n\n builtin/diff.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git c/builtin/diff.c w/builtin/diff.c\nindex 3eb4cbb057..0b23c41456 100644\n--- c/builtin/diff.c\n+++ w/builtin/diff.c\n@@ -497,7 +497,8 @@ int cmd_diff(int argc,\n \t * prefix.\n \t */\n \tif (no_index && prefix) {\n-\t\tchdir(prefix);\n+\t\tif (chdir(prefix))\n+\t\t\tdie(_(\"cannot come back to cwd\"));\n \t\tprefix = NULL;\n \t}\n \n"}]}