git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <derrickstolee@github.com>
To: Victoria Dye <vdye@github.com>,
	Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: gitster@pobox.com, me@ttaylorr.com
Subject: Re: [PATCH 2/2] multi-pack-index: use --object-dir real path
Date: Thu, 21 Apr 2022 15:55:39 -0400	[thread overview]
Message-ID: <be6aed1c-6237-3090-983f-42ef7e043d72@github.com> (raw)
In-Reply-To: <936e7f12-362d-3303-ddf4-5b40f17a0b9e@github.com>

On 4/21/2022 3:50 PM, Victoria Dye wrote:
> Derrick Stolee via GitGitGadget wrote:
>> +static void normalize_object_dir(void)
>> +{
>> +	if (!opts.object_dir)
>> +		opts.object_dir = get_object_directory();
>> +	else
>> +		opts.object_dir = real_pathdup(opts.object_dir, 1);
>> +}
>> +
> 
> Rather than copy the 'normalize_object_dir()' calls to every subcommand, you
> could "centralize" this by making the 'object_dir' option an 'OPT_CALLBACK'
> option, something like:
> 
> static struct option common_opts[] = {
> 	OPT_CALLBACK(0, "object-dir", &opts.object_dir, N_("file"),
> 		     N_("object directory containing set of packfile and pack-index pairs"),
> 		     normalize_object_dir),
> 	OPT_END(),
> };
> 
> It would require changing the function signature of 'normalize_object_dir'
> to match what's shown in 'Documentation/technical/api-parse-options.txt',
> and it potentially needs prefix handling similar to what's done in
> parse-options.c:get_value() (which internally calls 'fix_filename()' for
> filename opts), but I think it's probably worth reducing duplication here
> and avoiding the need to add 'normalize_object_dir()' to any new subcommand
> in the future.

Thanks! I agree that that would be a cleaner approach, especially if
a new subcommand is added in the future.

Thanks,
-Stolee

  reply	other threads:[~2022-04-21 19:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 14:57 [PATCH 0/2] multi-pack-index: use real paths for --object-dir Derrick Stolee via GitGitGadget
2022-04-21 14:57 ` [PATCH 1/2] midx: use real paths in lookup_multi_pack_index() Derrick Stolee via GitGitGadget
2022-04-21 14:57 ` [PATCH 2/2] multi-pack-index: use --object-dir real path Derrick Stolee via GitGitGadget
2022-04-21 19:50   ` Victoria Dye
2022-04-21 19:55     ` Derrick Stolee [this message]
2022-04-21 20:28     ` Junio C Hamano
2022-04-25 18:27 ` [PATCH v2 0/3] multi-pack-index: use real paths for --object-dir Derrick Stolee via GitGitGadget
2022-04-25 18:27   ` [PATCH v2 1/3] midx: use real paths in lookup_multi_pack_index() Derrick Stolee via GitGitGadget
2022-04-25 18:27   ` [PATCH v2 2/3] multi-pack-index: use --object-dir real path Derrick Stolee via GitGitGadget
2022-04-25 18:58     ` Junio C Hamano
2022-04-25 18:27   ` [PATCH v2 3/3] cache: use const char * for get_object_directory() Derrick Stolee via GitGitGadget

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be6aed1c-6237-3090-983f-42ef7e043d72@github.com \
    --to=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=vdye@github.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).