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

Re: Design of multiple hash support

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Nov 6, 2018, 00:13 UTC
Message-ID
<20181106001340.GC890086@genre.crustytoothpaste.net>
In-Reply-To
<20181105220042.GA162375@google.com>
On Mon, Nov 05, 2018 at 02:00:42PM -0800, Jonathan Nieder wrote:
Show 25 quoted lines
> Hi,
> 
> Duy Nguyen wrote:
> > On Mon, Nov 5, 2018 at 2:02 AM brian m. carlson
> > <sandals@crustytoothpaste.net> wrote:
> 
> >> There are basically two approaches I can take.  The first is to provide
> >> each command that needs to learn about this with its own --hash
> >> argument.  So we'd have:
> >>
> >>   git init --hash=sha256
> >>   git show-index --hash=sha256 <some-file
> >>
> >> The other alternative is that we provide a global option to git, which
> >> is parsed by all programs, like so:
> >>
> >>   git --hash=sha256 init
> >>   git --hash=sha256 show-index <some-file
> [...]
> > I'm leaning towards "git foo --hash=".
> 
> Can you say a little more about the semantics of the option?  For
> commands like "git init", I tend to agree with Duy here, since it
> allows each command's manual to describe what the option means in the
> context of that command.

Sure. The semantics for git init are "produce a repository with this hash algorithm". The semantics for git index-pack are "the pack I want you to index uses this hash algorithm". Essentially, more generically, the semantics are "the repository or data object uses this hash algorithm".

> For "git show-index", ideally Git should use the object format named
> in the idx file.

I agree that will be the eventual goal. It will also be what I ship in the final series, in all likelihood. I have most of pack v3 implemented, but it's not complete yet.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Jonathan Nieder
Message 7 of 7 in “Design of multiple hash support”
  1. brian m. carlsonNov 5, 2018
  2. Junio C HamanoNov 5, 2018
  3. Stefan BellerNov 5, 2018
  4. brian m. carlsonNov 5, 2018
  5. Duy NguyenNov 5, 2018
  6. Jonathan NiederNov 5, 2018
  7. brian m. carlsonNov 6, 2018

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.