git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH 0/3] Introduce AbbreviatedObjectId
@ 2008-12-10 23:18 Shawn O. Pearce
  2008-12-10 23:18 ` [JGIT PATCH 1/3] Define an abstraction for handling abbreviated SHA-1 strings Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn O. Pearce @ 2008-12-10 23:18 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

I'm using this new type to handle the "index" line of a git patch
file, where object ids are generally shorter than 40 characters
and thus aren't parsable by ObjectId.

Reading the short id is important because we can validate that a
patch applies correctly by computing the SHA-1 of the result and
testing it against the abbreviated id read in the "index" line.
If the base object SHA-1 matches the abbreviated line then the
result of applying the patch must also match; if it doesn't the
patch application logic is broken.

Shawn O. Pearce (3):
  Define an abstraction for handling abbreviated SHA-1 strings
  Add ObjectId.startsWith(AbbreviatedObjectId)
  Change AnyObjectId.abbreviate() to return AbbreviatedObjectId

 .../ui/internal/components/RefContentProposal.java |    2 +-
 .../egit/ui/internal/fetch/FetchResultTable.java   |   12 +-
 .../egit/ui/internal/push/PushResultTable.java     |   21 +-
 .../src/org/spearce/jgit/pgm/Branch.java           |    2 +-
 .../src/org/spearce/jgit/pgm/Fetch.java            |    8 +-
 .../src/org/spearce/jgit/pgm/Push.java             |    5 +-
 .../spearce/jgit/lib/AbbreviatedObjectIdTest.java  |  285 ++++++++++++++++++++
 .../org/spearce/jgit/lib/AbbreviatedObjectId.java  |  262 ++++++++++++++++++
 .../src/org/spearce/jgit/lib/AnyObjectId.java      |   39 +++-
 9 files changed, 608 insertions(+), 28 deletions(-)
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/lib/AbbreviatedObjectIdTest.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/AbbreviatedObjectId.java

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-10 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 23:18 [JGIT PATCH 0/3] Introduce AbbreviatedObjectId Shawn O. Pearce
2008-12-10 23:18 ` [JGIT PATCH 1/3] Define an abstraction for handling abbreviated SHA-1 strings Shawn O. Pearce
2008-12-10 23:18   ` [JGIT PATCH 2/3] Add ObjectId.startsWith(AbbreviatedObjectId) Shawn O. Pearce
2008-12-10 23:18     ` [JGIT PATCH 3/3] Change AnyObjectId.abbreviate() to return AbbreviatedObjectId Shawn O. Pearce

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 NNTP newsgroup(s).