]> source.dussan.org Git - jgit.git/commit
Fully implement SHA-1 abbreviations 89/1389/1
authorShawn O. Pearce <spearce@spearce.org>
Mon, 23 Aug 2010 22:53:11 +0000 (15:53 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 23 Aug 2010 22:53:11 +0000 (15:53 -0700)
commita5c18fcfc7929f91c6aa4a4314d28d0f924aad46
treebfc1fe50dd5e445b3d33d8d4a1cf4fc5136a3fac
parent32466c33bae19aff03b95a02e0b7e72d4e2f11b8
Fully implement SHA-1 abbreviations

ObjectReader implementations are now responsible for creating the
unique abbreviation of an ObjectId, or for resolving an abbreviation
back to its full form.  In this latter case the reader can offer up
multiple candidates to the caller, who may be able to disambiguate
them based on context.

Repository.resolve() doesn't take multiple candidates into account
right now, but it could in the future by looking for a remaining
^0 or ^{commit} suffix and take an expansion if there is only one
commit that matches the input abbreviation.  It could also use
the distance from an annotated tag to resolve "tag-NNN-gcommit"
style strings that are often output by `git describe`.

Change-Id: Icd3250adc8177ae05278b858933afdca0cbbdb56
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
20 files changed:
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/AbbreviatedObjectIdTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/AbbreviationTest.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/CachedObjectDirectory.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileObjectDatabase.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndex.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndexV1.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackIndexV2.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java