git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] repack: Add --version parameter

From
Stefan Beller <stefanbeller@googlemail.com>
Date
Sep 28, 2013, 08:54 UTC
Message-ID
<5246994C.3020709@googlemail.com>
In-Reply-To
<CACsJy8BjTQhA6rDWk6FboxU-b6d93Jn+ZNvQ0DJYXehgrpSmwg@mail.gmail.com>
On 09/26/2013 01:42 PM, Duy Nguyen wrote:
Show 8 quoted lines
> On Thu, Sep 26, 2013 at 3:32 PM, Stefan Beller
> <stefanbeller@googlemail.com> wrote:
>> This is just a direct translation of
>> http://article.gmane.org/gmane.comp.version-control.git/235396
>> So I don't consider this is ready for inclusion.
>>
>> Some notes:
>> We need to have more error checking, repack shall be 0, 2 or 4 but
nothing
>> else. If 0 is given, no argument is passed to pack-objects, in case of
>> 2 or 4 --version=<n> is passed.
>
> It's not that bad. If you don't catch it, pack-objects will.
Ok, noted.
Show 14 quoted lines
>
>>
>> Do we really want to call it "--version"? This parameter sounds so much
>> like questioning for the program version, similar to
>>         git --version
>>         1.8.4
>> So I'd rather use "--repack-version".
>
> Hmm.. I think it's "git repack --pack-version"? Or if you meant "git
> pack-objects --version", I drop the "pack-" out because there's
> already "pack" in "pack-objects". But I'm OK renaming --version to
> --pack-version too. Maybe later.
>
>> @@ -22,6 +23,9 @@ static int repack_config(const char *var, const
char *value, void *cb)
Show 13 quoted lines
>>                 delta_base_offset = git_config_bool(var, value);
>>                 return 0;
>>         }
>> +       if (!strcmp(var, "core.preferredPackVersion")) {
>> +               pack_version = git_config_int(var, value);
>> +       }
>>         return git_default_config(var, value, cb);
>
> In np/pack-v4 series (not the one on 'pu' yet) git_default_config will
> do this and save the value in core_default_pack_format. So you don't
> need to set it here.
>
>> @@ -220,6 +226,8 @@ int cmd_repack(int argc, const char **argv, const
char *prefix)
Show 5 quoted lines
>>                 argv_array_push(&cmd_args,  "--quiet");
>>         if (delta_base_offset)
>>                 argv_array_push(&cmd_args,  "--delta-base-offset");
>> +       if (pack_version)
>> +               argv_array_pushf(&cmd_args, "--version=%u",
pack_version);
>
> but then you may need "if (!pack_version) pack_version =
> core_defaul_pack_format;" before this "if".

The reason I put the pack_version not here is for structural clarity. ("All config is done in either the parse_options section or in the repack_config function"). This may help having a the actual core logic easier and more understandable? If you feel otherwise, I'd change it to your proposal.

Thanks, Stefan

Previous: Duy NguyenNext: Nguyễn Thái Ngọc Duy
Message 16 of 20 in “pack v4 UI support”
  1. 00/10 pack v4 UI supportNguyễn Thái Ngọc Duy, Sep 26, 2013
  2. 01/10 test-dump: new test program to examine binary dataNguyễn Thái Ngọc Duy, Sep 26, 2013
  3. 02/10 config: add core.preferredPackVersionNguyễn Thái Ngọc Duy, Sep 26, 2013
  4. 03/10 upload-pack: new capability to send pack v4Nguyễn Thái Ngọc Duy, Sep 26, 2013
  5. 04/10 fetch: new option to set preferred pack version for transferNguyễn Thái Ngọc Duy, Sep 26, 2013
  6. 05/10 clone: new option to set preferred pack version for transferNguyễn Thái Ngọc Duy, Sep 26, 2013
  7. 06/10 fetch: pack v4 support on smart httpNguyễn Thái Ngọc Duy, Sep 26, 2013
  8. 07/10 receive-pack: request for packv4 if it's the preferred versionNguyễn Thái Ngọc Duy, Sep 26, 2013
  9. Junio C HamanoOct 17, 2013
  10. 08/10 send-pack: support pack v4Nguyễn Thái Ngọc Duy, Sep 26, 2013
  11. 09/10 repack: add --pack-version and fall back to core.preferredPackVersionNguyễn Thái Ngọc Duy, Sep 26, 2013
  12. repack: Add --version parameterStefan Beller, Sep 26, 2013
  13. Felipe ContrerasSep 26, 2013
  14. Stefan BellerSep 28, 2013
  15. Duy NguyenSep 26, 2013
  16. Stefan BellerSep 28, 2013
  17. 10/10 count-objects: report pack v4 usageNguyễn Thái Ngọc Duy, Sep 26, 2013
  18. Nicolas PitreSep 26, 2013
  19. Duy NguyenSep 26, 2013
  20. Nicolas PitreSep 27, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.