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

Re: [PATCH JGIT] Minor : Make ObjectId, RemoteConfig Serializable

From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Date
Feb 8, 2009, 19:45 UTC
Message-ID
<200902082045.22703.robin.rosenberg.lists@dewire.com>
In-Reply-To
<20090208191024.GA30557@spearce.org>
söndag 08 februari 2009 20:10:24 skrev Shawn O. Pearce:
Show 17 quoted lines
> Nigel Magnay <nigel.magnay@gmail.com> wrote:
> > > A problem (big problem) with serialization is that it often leads to
> > > fragile interfaces. One might want to have precise control over
> > > the serialization so a change in the implementation doesn't affect
> > > compatibility. Serializing AnyObjectId should not depend on the
> > > implementation de jour. Second, how do we handle subclasses?
> > >
> > > But maybe leaving it this way would be our way of saying that
> > > the interface may break at any time, promise.
> > 
> > Well, we can of course implement writeObject / readObject (or do so
> > if/when compatibility breaks, and it's cared about)
> > 
> > That's how I tend to view it anyway (may break at any time) - you
> > can't just update a jar library to a significantly new version and
> > expect it all to stay compatible. Also for half my use, it's not for
> > persistence, it's for transferring over the wire to a slave process.

Over-the wire has the same issue. Clients and servers often run with slightly different versions.

Show 7 quoted lines
> > Thinking a bit more clearly, I probably don't need AnyObjectId, just
> > ObjectId - but I've also missed RefSpec and URIish as they're used in
> > RemoteConfig..
> 
> Here's my two cents... we can do this, but only if we implement
> Externalizable and do the read and write ourselves so we have a
> stable format.
Show 6 quoted lines
> In the case of any of the types you are discussing there is an easy
> canonical form for them to be written on the wire, or to read back:
> 
>   ObjectId     - the 20 byte SHA-1
>   RefSpec      - the string form as it appears in the config file
>   URIish       - the string form as it appears in the config file
with our without the password?
>   RemoteConfig - a map of keys/values as it appears in the config

I lean toward the do it correctly side too. Don't forget a few test cases with pre-recorded serializations to verify compatibility over different versions of jgit.

-- robin
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 5 of 6 in “Minor : Make ObjectId, RemoteConfig Serializable”
  1. Minor : Make ObjectId, RemoteConfig SerializableNigel Magnay, Feb 6, 2009
  2. Robin RosenbergFeb 8, 2009
  3. Nigel MagnayFeb 8, 2009
  4. Shawn O. PearceFeb 8, 2009
  5. Robin RosenbergFeb 8, 2009
  6. Shawn O. PearceFeb 8, 2009

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.