3 . "$(dirname "$0")/testlib.sh"
5 begin_test "multiple revs with same OID get pushed once"
9 reponame="mutliple-revs-one-oid"
10 setup_remote_repo "$reponame"
11 clone_repo "$reponame" "$reponame"
14 git add .gitattributes
15 git commit -m "initial commit"
18 contents_oid="$(calc_oid "$contents")"
20 # Stash the contents of the file that we want to commit in .git/lfs/objects.
21 object_dir="$(echo $contents_oid \
22 | awk '{ print substr($0, 0, 2) "/" substr($0, 3, 2) }')"
23 mkdir -p ".git/lfs/objects/$object_dir"
24 printf "$contents" > ".git/lfs/objects/$object_dir/$contents_oid"
26 # Create a pointer with the old "http://git-media.io" spec
27 legacy_pointer="$(pointer $contents_oid 8 http://git-media.io/v/2)"
28 # Create a pointer with the latest spec to create a modification, but leave
30 latest_pointer="$(pointer $contents_oid 8)"
32 # Commit the legacy pointer
33 printf "$legacy_pointer" > a.dat
35 git commit -m "commit legacy"
37 # Commit the new pointer, causing a diff on a.dat, but leaving the OID
39 printf "$latest_pointer" > a.dat
41 git commit -m "commit latest"
43 # Delay the push until here, so the server doesn't have a copy of the OID that
44 # we're trying to push.
45 git push origin master 2>&1 | tee push.log
46 grep "Uploading LFS objects: 100% (1/1), 8 B" push.log
48 assert_server_object "$reponame" "$contents_oid"