]> source.dussan.org Git - jgit.git/commitdiff
Allow for optional tagger and message in Tag 33/1333/4
authorChris Aniszczyk <caniszczyk@gmail.com>
Thu, 19 Aug 2010 02:12:15 +0000 (21:12 -0500)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 19 Aug 2010 02:22:42 +0000 (19:22 -0700)
We should be more lenient when tagging without an
tagger or message. Currently, we will throw an NPE
which is incorrect behavior.

Change-Id: I04e30ce25a9432e4ca56c3f29658ecb24fb18d24
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java

index 3d700ac49ece142641c25d5d090269fc91913bad..a9522452b64cf19d0c90e87b7be27441bf3f6a3e 100644 (file)
@@ -378,12 +378,15 @@ public abstract class ObjectInserter {
                        w.write(tag.getTag());
                        w.write("\n");
 
-                       w.write("tagger ");
-                       w.write(tag.getTagger().toExternalString());
-                       w.write('\n');
+                       if (tag.getTagger() != null) {
+                               w.write("tagger ");
+                               w.write(tag.getTagger().toExternalString());
+                               w.write('\n');
+                       }
 
                        w.write('\n');
-                       w.write(tag.getMessage());
+                       if (tag.getMessage() != null)
+                               w.write(tag.getMessage());
                        w.close();
                } catch (IOException err) {
                        // This should never occur, the only way to get it above is