Re: [PATCH] chdir-notify.h: Removed unused param 'name'
From: Jeff King <hidden>
Date: 2026-08-14 20:31:02
On Fri, Aug 14, 2026 at 12:38:49PM -0700, Colin Hinton wrote:
the `name` parameter in `chdir_notify_entry` is only set to NULL. Dropped to simplify logic in `chdir_notify_unregister`
I think this makes sense. It is often helpful in cleanup patches to
summarize the history in the commit message. And then we can be sure
that the unused field is OK to be removed, and it is not simply a bug
that nobody is passing in the value.
It looks like these became NULL in the callers across several functions,
like 1f43ff2c7e (refs: unregister reference stores from "chdir_notify",
2026-06-25) and 0de2467e6c (odb/source-packed: start converting to a
proper `struct odb_source`, 2026-06-17). With hunks like this:
- chdir_notify_reparent("files-backend $GIT_DIR", &refs->base.gitdir);
- chdir_notify_reparent("files-backend $GIT_COMMONDIR",
- &refs->gitcommondir);
+ chdir_notify_register(NULL, files_ref_store_reparent, refs);
None of those indicate why they drop the descriptive names in favor of
NULL.
I think ultimately the reason is that the only user of the "name" field
was chdir_notify_reparent(), when it produced trace output. That went
away in 5bf546755c (chdir-notify: drop unused `chdir_notify_reparent()`,
2026-06-25).
So those other patches were preparing for that world, though I think the
ordering is somewhat confusing (and I won't be surprised if there was
some intermediate state where turning on tracing might have caused a
segfault).
So AFAICT the patch itself is good, but it might be nice to give some
explanation in the commit message.
-Peff