]> source.dussan.org Git - jgit.git/commitdiff
reftable: increment pointer *after* reading uint16 81/147281/10
authorHan-Wen Nienhuys <hanwen@google.com>
Wed, 7 Aug 2019 21:28:32 +0000 (23:28 +0200)
committerHan-Wen Nienhuys <hanwen@google.com>
Mon, 19 Aug 2019 09:40:28 +0000 (11:40 +0200)
This fixes timezone reads out of the reflog.

Change-Id: I126d8742e5e904a074c544514180720466164f7c
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockReader.java

index b67ec563fde64661d801763d90b7fcf0d5d6665b..0e33fa6e76bbb54518b4c669da833b1d5ed223c8 100644 (file)
@@ -624,6 +624,8 @@ public class ReftableTest {
                        assertEquals(ObjectId.zeroId(), lc.getReflogEntry().getOldId());
                        assertEquals(id(1), lc.getReflogEntry().getNewId());
                        assertEquals(who, lc.getReflogEntry().getWho());
+                       // compare string too, to catch tz differences.
+                       assertEquals(who.toExternalString(), lc.getReflogEntry().getWho().toExternalString());
                        assertEquals(msg, lc.getReflogEntry().getComment());
 
                        assertTrue(lc.next());
index f9e184c99e854cb10127db4a97179d2f9075f941..b66751b94c82613ddad8c027508903585b22d0cf 100644 (file)
@@ -557,7 +557,9 @@ class BlockReader {
        }
 
        private short readInt16() {
-               return (short) NB.decodeUInt16(buf, ptr += 2);
+               short result =(short) NB.decodeUInt16(buf, ptr);
+               ptr += 2;
+               return result;
        }
 
        private int readVarint32() {