{"thread":{"id":"60532","subject":"[PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration","startedAt":"2023-11-17T13:15:19Z","lastAt":"2023-11-19T23:15:30Z","messageCount":2,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"484991","messageId":"pull.1614.git.1700226915859.gitgitgadget@gmail.com","threadId":"60532","inReplyTo":null,"subject":"[PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-11-17T13:15:15Z","receivedAt":"2023-11-17T13:15:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nOne parameter is called `file_pach`. On the face of it, this looks as if\nit was supposed to talk about a `path` instead of a `pach`.\n\nHowever, looking at the way this callback is called, it gets fed the\n`d_name` from a directory entry, which provides just the file name, not\nthe full path. Therefore, let's fix this by calling the parameter\n`file_name` instead.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    packfile.h: fix a typo\n    \n    I stumbled over this typo yesterday. Nothing about this patch is urgent,\n    of course, it can easily wait until v2.43.0 is released.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1614%2Fdscho%2Fpackfile.h-typo-fix-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1614/dscho/packfile.h-typo-fix-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1614\n\n packfile.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/packfile.h b/packfile.h\nindex c3692308b8d..28c8fd3e39a 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -54,7 +54,7 @@ const char *pack_basename(struct packed_git *p);\n struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);\n \n typedef void each_file_in_pack_dir_fn(const char *full_path, size_t full_path_len,\n-\t\t\t\t      const char *file_pach, void *data);\n+\t\t\t\t      const char *file_name, void *data);\n void for_each_file_in_pack_dir(const char *objdir,\n \t\t\t       each_file_in_pack_dir_fn fn,\n \t\t\t       void *data);\n\nbase-commit: cfb8a6e9a93adbe81efca66e6110c9b4d2e57169\n-- \ngitgitgadget\n"},{"id":"485007","messageId":"xmqqfs11pc6r.fsf@gitster.g","threadId":"60532","inReplyTo":"pull.1614.git.1700226915859.gitgitgadget@gmail.com","subject":"Re: [PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-11-19T23:15:24Z","receivedAt":"2023-11-19T23:15:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> Subject: Re: [PATCH] Fix a typo in `each_file_in_pack_dir_fn()`'s declaration\n\nLet's have \"packfile.[ch]: \" before the title to tell what area the\nhelper function is about.\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> One parameter is called `file_pach`. On the face of it, this looks as if\n> it was supposed to talk about a `path` instead of a `pach`.\n>\n> However, looking at the way this callback is called, it gets fed the\n> `d_name` from a directory entry, which provides just the file name, not\n> the full path. Therefore, let's fix this by calling the parameter\n> `file_name` instead.\n>  ...\n>  typedef void each_file_in_pack_dir_fn(const char *full_path, size_t full_path_len,\n> -\t\t\t\t      const char *file_pach, void *data);\n> +\t\t\t\t      const char *file_name, void *data);\n\nVery good observation.  We form a pathname to a file in a\n\"objects/pack/\" subdirectory by concatenating this parameter after\nthe full_path/full_path_len parameter, which has the path to that\nsubdirectory, so \"file_name\" definitely is a much better name.\n\nThe \"full_path\" that does not say full path to what directory may\nhave room for improvement (\"leading_path\" or even \"packdir\"), but\nthat's OK.\n\nThanks for spotting.\n\n>  void for_each_file_in_pack_dir(const char *objdir,\n>  \t\t\t       each_file_in_pack_dir_fn fn,\n>  \t\t\t       void *data);\n>\n> base-commit: cfb8a6e9a93adbe81efca66e6110c9b4d2e57169\n"}]}