diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-01-23 12:11:38 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-01-23 12:34:54 -0800 |
commit | 7c82df1114537fe221eeb2d8ac79b3eab9fa7225 (patch) | |
tree | 92b6f09e82eb88e56dc313941b0c58ac7838b007 /org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java | |
parent | 0238a21b624abf079ae21835a13067d2c8dedd81 (diff) | |
download | jgit-7c82df1114537fe221eeb2d8ac79b3eab9fa7225.tar.gz jgit-7c82df1114537fe221eeb2d8ac79b3eab9fa7225.zip |
Relax ObjectChecker to permit missing tagger lines
Annotated tags created with C Git versions before the introduction
of c818566 ([PATCH] Update tags to record who made them, 2005-07-14),
do not have a "tagger" line present in the object header. This line
did not appear in C Git until v0.99.1~9.
Ancient projects such as the Linux kernel contain such tags, for
example Linux 2.6.12 is older than when this feature first appeared
in C Git. Linux v2.6.13-rc4 in late July 2005 is the first kernel
version tag to actually contain a tagger line.
It is therefore acceptable for the header to be missing, and for
the RevTag.getTaggerIdent() method to return null.
Since the Javadoc for getTaggerIdent() already explained that the
identity may be null, we just need to test that this is true when
the header is missing, and allow the ObjectChecker to pass anyway.
Change-Id: I34ba82e0624a0d1a7edcf62ffba72260af6f7e5d
See: http://code.google.com/p/gerrit/issues/detail?id=399
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java index 82a8c38257..5906802d18 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, Google Inc. + * Copyright (C) 2008-2010, Google Inc. * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> * and other copyright owners as documented in the project's IP log. * @@ -217,10 +217,10 @@ public class ObjectChecker { throw new CorruptObjectException("no tag header"); ptr = nextLF(raw, ptr); - if ((ptr = match(raw, ptr, tagger)) < 0) - throw new CorruptObjectException("no tagger header"); - if ((ptr = personIdent(raw, ptr)) < 0 || raw[ptr++] != '\n') - throw new CorruptObjectException("invalid tagger"); + if ((ptr = match(raw, ptr, tagger)) > 0) { + if ((ptr = personIdent(raw, ptr)) < 0 || raw[ptr++] != '\n') + throw new CorruptObjectException("invalid tagger"); + } } private static int lastPathChar(final int mode) { |