git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration
@ 2023-11-17 13:15 Johannes Schindelin via GitGitGadget
  2023-11-19 23:15 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2023-11-17 13:15 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    packfile.h: fix a typo
    
    I stumbled over this typo yesterday. Nothing about this patch is urgent,
    of course, it can easily wait until v2.43.0 is released.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1614%2Fdscho%2Fpackfile.h-typo-fix-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1614/dscho/packfile.h-typo-fix-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1614

 packfile.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packfile.h b/packfile.h
index c3692308b8d..28c8fd3e39a 100644
--- a/packfile.h
+++ b/packfile.h
@@ -54,7 +54,7 @@ const char *pack_basename(struct packed_git *p);
 struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);
 
 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);
 void for_each_file_in_pack_dir(const char *objdir,
 			       each_file_in_pack_dir_fn fn,
 			       void *data);

base-commit: cfb8a6e9a93adbe81efca66e6110c9b4d2e57169
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2023-11-19 23:15 UTC (permalink / raw)
  To: Johannes Schindelin via GitGitGadget; +Cc: git, Johannes Schindelin

"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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-19 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).