* 'seen' branch fails to build
@ 2025-08-09 13:34 Ramsay Jones
2025-08-10 0:16 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2025-08-09 13:34 UTC (permalink / raw)
To: GIT Mailing-list; +Cc: Junio C Hamano
Hi Junio,
You have probably already fixed this but, just in case you are unaware, the
current 'seen' branch @9faf989da6 ("Merge branch 'gh/git-jump-pathname-with-sp'
into seen", 2025-08-08) fails to build for me with DEVELOPER=1:
CC builtin/diff.o
builtin/diff.c: In function ‘cmd_diff’:
builtin/diff.c:500:17: error: ignoring return value of ‘chdir’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
500 | chdir(prefix);
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:2818: builtin/diff.o] Error 1
See commit 456a265746 ("diff: --no-index should ignore the worktree",
2025-08-07) in the 'jc/diff-no-index-in-subdir' branch.
In order to get it to build, I just did:
$ git diff
diff --git a/builtin/diff.c b/builtin/diff.c
index 3eb4cbb057..ff16d7be99 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -497,7 +497,8 @@ int cmd_diff(int argc,
* prefix.
*/
if (no_index && prefix) {
- chdir(prefix);
+ if (chdir(prefix) < 0)
+ die_errno(_("cannot chdir to %s"), prefix);
prefix = NULL;
}
$
[I don't know if that is the best solution; it was just the quickest! :) ]
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: 'seen' branch fails to build
2025-08-09 13:34 'seen' branch fails to build Ramsay Jones
@ 2025-08-10 0:16 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2025-08-10 0:16 UTC (permalink / raw)
To: Ramsay Jones; +Cc: GIT Mailing-list
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> See commit 456a265746 ("diff: --no-index should ignore the worktree",
> 2025-08-07) in the 'jc/diff-no-index-in-subdir' branch.
>
> In order to get it to build, I just did:
> ...
Thanks for noticing and reporting. I'd save the translators by
reusing the message used already elsewhere.
builtin/diff.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git c/builtin/diff.c w/builtin/diff.c
index 3eb4cbb057..0b23c41456 100644
--- c/builtin/diff.c
+++ w/builtin/diff.c
@@ -497,7 +497,8 @@ int cmd_diff(int argc,
* prefix.
*/
if (no_index && prefix) {
- chdir(prefix);
+ if (chdir(prefix))
+ die(_("cannot come back to cwd"));
prefix = NULL;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-10 0:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-09 13:34 'seen' branch fails to build Ramsay Jones
2025-08-10 0:16 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).