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

Re: First web interface and service API draft

From
Jon Seymour <jon.seymour@gmail.com>
Date
Apr 23, 2005, 06:39 UTC
Message-ID
<2cfc403205042223393a769e57@mail.gmail.com>
In-Reply-To
<1114203423.3207.24.camel@localhost>
On 4/23/05, Christian Meder <chris@absolutegiganten.org> wrote:
Show 21 quoted lines
> On Fri, 2005-04-22 at 10:23 -0400, Jan Harkes wrote:
> > On Fri, Apr 22, 2005 at 12:41:56PM +0200, Christian Meder wrote:
> > > -------
> > > /<project>/blob/<blob-sha1>
> > > /<project>/commit/<commit-sha1>
> >
> > It is trivial to find an object when given a sha, but to know the object
> > type you'd have to decompress it and check inside. Also the way git
> > stores these things you can't have both a blob and a commit with the
> > same sha anyways.
> >
> > So why not use,
> >     /<project/<hexadecimal sha1 representation>
> >       will give you the raw object.
> 
> Hmm. I'm not sure about throwing away the <objecttype> information in
> the url. I think I'd prefer to retain the blob, tree and commit
> namespaces because I think they help API users to explicitly state what
> kind of object they expect. I can't think of a scenario where I'd want a
> <sha1> of unknown type. Do you have a specific use case in mind ?
> 

I was initially inclined to agree with Jan, but on brief reflection I think Christian is correct to want to preserve the type info in the URI. There are numerous reasons why this is a good idea:

- both carbon and silicon users of the URI who don't have direct
access to the repository can infer what the URI refers to without
actually fetching it
- programmatically the web server can make request routing decisions
based on the URI alone and is not forced to perfom a relatively
expensive and unnecessary db hit to derive the type.

That said, I can see some value in providing a web-based type-resolution service.

So, given a URI of the form
     /<project>/object/<hexadecimal sha1 representation>

the server should resolve the type of the named object and issue an HTTP re-direct to the typed URI, e.g.

     /<project>/blob/<hexadecimal sha1 representation>

Because browsers tend not to remember redirection sources, external entities end up recording the typed URIs, but all the benefits of Jan's suggestion still accrue.

jon.
-- 
homepage: http://www.zeta.org.au/~jon/
blog: http://orwelliantremors.blogspot.com/
Previous: Christian MederNext: Petr Baudis
Message 13 of 16 in “First web interface and service API draft”
  1. Christian MederApr 22, 2005
  2. Jon SeymourApr 22, 2005
  3. Petr BaudisApr 22, 2005
  4. Jon SeymourApr 22, 2005
  5. Christian MederApr 22, 2005
  6. Christian MederApr 22, 2005
  7. Petr BaudisApr 22, 2005
  8. El DraperApr 22, 2005
  9. Christian MederApr 22, 2005
  10. Jon SeymourApr 22, 2005
  11. Jan HarkesApr 22, 2005
  12. Christian MederApr 22, 2005
  13. Jon SeymourApr 23, 2005
  14. Petr BaudisApr 22, 2005
  15. Petr BaudisApr 22, 2005
  16. Christian MederApr 24, 2005

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.