Skip to content

Commit 45255d3

Browse files
RajivTSfacebook-github-bot
authored andcommitted
Integration test demonstrating support for multiple tags with same name
Summary: The earlier versions of `gitimport` didn't used to peel tags when trying to upload the tag contents. With that version, it was possible to have the below scenario work for gitimport but fail for Mononoke Git server: - Create tag A point to commit C - Created another tag with the same name A and point it to the object id of the old tag A - gitimport the repo The earlier version of gitimport would only import the new tag A without uploading the git object corresponding to the old tag A. On Mononoke server when performing the clone, we would try to peel the tags and return everything referenced by it only to find the inner tag missing and would error out. This actually happened in production for `whatsapp/android` repo since it was imported early last year. In the current version of gitimport, this bug is fixed so this integration test serves as protection against regression and as a proof that we support this particular use-case Reviewed By: markbt Differential Revision: D75964395 fbshipit-source-id: 29835270ea9915b4cccf938fdc4881ade5fc607b
1 parent 6005cdc commit 45255d3

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This software may be used and distributed according to the terms of the
4+
# GNU General Public License found in the LICENSE file in the root
5+
# directory of this source tree.
6+
7+
$ . "${TEST_FIXTURES}/library.sh"
8+
$ REPOTYPE="blob_files"
9+
$ setup_common_config $REPOTYPE
10+
$ GIT_REPO_ORIGIN="${TESTTMP}/origin/repo-git"
11+
$ GIT_REPO="${TESTTMP}/repo-git"
12+
13+
# Setup git repository
14+
$ mkdir -p "$GIT_REPO_ORIGIN"
15+
$ cd "$GIT_REPO_ORIGIN"
16+
$ git init -q
17+
$ echo "this is file1" > file1
18+
$ git add file1
19+
$ git commit -qam "Add file1"
20+
$ git tag -a -m "new tag" first_tag
21+
$ git config advice.nestedTag false
22+
$ git tag -a -m "new tag" -f first_tag first_tag
23+
Updated tag 'first_tag' (was 8963e1f)
24+
$ echo "this is file2" > file2
25+
$ git add file2
26+
$ git commit -qam "Add file2"
27+
$ git tag -a empty_tag -m ""
28+
$ cd "$TESTTMP"
29+
$ git clone "$GIT_REPO_ORIGIN"
30+
Cloning into 'repo-git'...
31+
done.
32+
33+
# Capture all the known Git objects from the repo
34+
$ cd $GIT_REPO
35+
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/object_list
36+
37+
# Import it into Mononoke
38+
$ cd "$TESTTMP"
39+
$ quiet gitimport "$GIT_REPO" --derive-hg --generate-bookmarks full-repo
40+
41+
# Start up the Mononoke Git Service
42+
$ mononoke_git_service
43+
# Clone the Git repo from Mononoke
44+
$ git_client clone $MONONOKE_GIT_SERVICE_BASE_URL/$REPONAME.git
45+
Cloning into 'repo'...
46+
remote: Converting HAVE Git commits to Bonsais
47+
remote: Converting WANT Git commits to Bonsais
48+
remote: Collecting Bonsai commits to send to client
49+
remote: Counting number of objects to be sent in packfile
50+
remote: Generating trees and blobs stream
51+
remote: Generating commits stream
52+
remote: Generating tags stream
53+
remote: Sending packfile stream
54+
# Verify that we get the same Git repo back that we started with
55+
$ cd $REPONAME
56+
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/new_object_list
57+
$ diff -w $TESTTMP/new_object_list $TESTTMP/object_list

0 commit comments

Comments
 (0)