]> arthur.barton.de Git - bup.git/commitdiff
bup: add a test for index contents
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 22 Jul 2020 19:35:32 +0000 (21:35 +0200)
committerRob Browning <rlb@defaultvalue.org>
Sat, 15 May 2021 18:57:24 +0000 (13:57 -0500)
Add a test that checks that our index files are exactly
identical to the ones git would write. This is slightly
dangerous as git might introduce a new format, but that
seems unlikely now, it's been stable for a long time;
if it happens we can deal with it then.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
test/ext/test-misc

index 1b5833297b0810ac2437120e18dbc548552551f0..7a7e4ce4f32eb7b8ece0badc4b573f1afe928407 100755 (executable)
@@ -60,15 +60,19 @@ WVSTART "save/git-fsck"
 ) || exit $?
 
 
-WVSTART "pack name same as git"
+WVSTART "pack name and idx same as git"
 (
     # reuse packs from previous test
     WVPASS cd "$BUP_DIR"/objects/pack/
     WVPASS ls *.pack
     for pack in *.pack ; do
+       bup_idx_sha=$(sha1sum $(basename $pack .pack).idx) || exit $?
        gitname=$(git index-pack $pack) || exit $?
        # make sure we named it correctly (like git)
        WVPASSEQ pack-$gitname.pack $pack
+       # make sure we wrote the index correctly
+       git_idx_sha=$(sha1sum $(basename $pack .pack).idx) || exit $?
+       WVPASSEQ "$bup_idx_sha" "$git_idx_sha"
     done
 ) || exit $?