From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration
Date: Mon, 20 Nov 2023 08:15:24 +0900 [thread overview]
Message-ID: <xmqqfs11pc6r.fsf@gitster.g> (raw)
In-Reply-To: <pull.1614.git.1700226915859.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Fri, 17 Nov 2023 13:15:15 +0000")
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> Subject: Re: [PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration
Let's have "packfile.[ch]: " before the title to tell what area the
helper function is about.
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> One parameter is called `file_pach`. On the face of it, this looks as if
> it was supposed to talk about a `path` instead of a `pach`.
>
> However, looking at the way this callback is called, it gets fed the
> `d_name` from a directory entry, which provides just the file name, not
> the full path. Therefore, let's fix this by calling the parameter
> `file_name` instead.
> ...
> typedef void each_file_in_pack_dir_fn(const char *full_path, size_t full_path_len,
> - const char *file_pach, void *data);
> + const char *file_name, void *data);
Very good observation. We form a pathname to a file in a
"objects/pack/" subdirectory by concatenating this parameter after
the full_path/full_path_len parameter, which has the path to that
subdirectory, so "file_name" definitely is a much better name.
The "full_path" that does not say full path to what directory may
have room for improvement ("leading_path" or even "packdir"), but
that's OK.
Thanks for spotting.
> void for_each_file_in_pack_dir(const char *objdir,
> each_file_in_pack_dir_fn fn,
> void *data);
>
> base-commit: cfb8a6e9a93adbe81efca66e6110c9b4d2e57169
prev parent reply other threads:[~2023-11-19 23:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 13:15 [PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration Johannes Schindelin via GitGitGadget
2023-11-19 23:15 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfs11pc6r.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).