Update integration tests to use valid git pull

Summary:
All the integration tests related to `git pull` used it as `git pull https://hostname/repos/git/ro/repo.git`. This doesn't function as a standard pull, i.e. just `git pull`. [This SO post](https://stackoverflow.com/questions/48749715/what-does-git-pull-link-to-remote-do) explains the detailed difference but fundamentally using pull with a remote URL ends up using a default ref spec that works only for branches (i.e. `+refs/heads/*:refs/remotes/origin/*`). This makes us miss out tags from the server.

This diff updates the integration tests to make use of just `git pull` so that we pull all refs (heads and tags).

Reviewed By: mitrandir77

Differential Revision: D56979746

fbshipit-source-id: a309ef656dfb1e179cf342041729a9e5920539e6
This commit is contained in:
Rajiv Sharma 2024-05-07 03:11:41 -07:00 committed by Facebook GitHub Bot
parent 6c1dbeeca4
commit cd3d2615b1
4 changed files with 11 additions and 5 deletions

View File

@ -90,6 +90,7 @@
$ cd "$GIT_REPO"
$ quiet git pull "$GIT_REPO_ORIGIN"
# Capture all the known Git objects from the repo
$ cd $GIT_REPO_ORIGIN
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/object_list
# Import the newly added commits to Mononoke
@ -99,7 +100,7 @@
$ cd $REPONAME
# Wait for the warm bookmark cache to catch up with the latest changes
$ wait_for_git_bookmark_move HEAD $current_head
$ quiet git_client pull $MONONOKE_GIT_SERVICE_BASE_URL/$REPONAME.git
$ quiet git_client pull
# Verify that we get the same Git repo back that we started with
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/new_object_list
$ diff -w $TESTTMP/new_object_list $TESTTMP/object_list

View File

@ -77,6 +77,7 @@
$ cd "$GIT_REPO"
$ quiet git pull "$GIT_REPO_ORIGIN"
# Capture all the known Git objects from the repo
$ cd $GIT_REPO_ORIGIN
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/object_list_after_pull
# Diff the list of objects before and after the pull to show that we got new objects
$ diff -w -q $TESTTMP/object_list $TESTTMP/object_list_after_pull
@ -90,7 +91,7 @@
$ cd $REPONAME
# Wait for the warm bookmark cache to catch up with the latest changes
$ wait_for_git_bookmark_move HEAD $current_head
$ quiet git_client pull $MONONOKE_GIT_SERVICE_BASE_URL/$REPONAME.git
$ quiet git_client pull
# Verify that we get the same Git repo back that we started with
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/new_object_list
$ diff -w $TESTTMP/new_object_list $TESTTMP/object_list_after_pull

View File

@ -63,11 +63,14 @@
$ echo "this is fileB.this is fileB.this is fileB.this is fileB.this is fileB.this is fileB.this is fileB.this is fileB" > fileB
$ git add fileB
$ git commit -qam "Reverted fileB.1 -> fileB"
$ git tag -a -m "last tag" last_tag
$ echo "this is fileB.2 this is fileB.2 this is fileB.2 this is fileB.2 this is fileB.2 this is fileB.2 this is fileB.2.this is fileB.2" > fileB
$ git add fileB
$ git commit -qam "Modified fileB -> fileB.2"
$ cd "$GIT_REPO"
$ quiet git pull "$GIT_REPO_ORIGIN"
# Capture all the known Git objects from the repo
$ cd $GIT_REPO_ORIGIN
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/object_list
# Import the newly added commits to Mononoke
@ -77,7 +80,7 @@
$ cd $REPONAME
# Wait for the warm bookmark cache to catch up with the latest changes
$ wait_for_git_bookmark_move HEAD $current_head
$ quiet git_client pull $MONONOKE_GIT_SERVICE_BASE_URL/$REPONAME.git
$ quiet git_client pull
# Verify that we get the same Git repo back that we started with
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/new_object_list
$ diff -w $TESTTMP/new_object_list $TESTTMP/object_list

View File

@ -66,6 +66,7 @@
$ cd "$GIT_REPO"
$ quiet git pull "$GIT_REPO_ORIGIN"
# Capture all the known Git objects from the repo
$ cd $GIT_REPO_ORIGIN
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/object_list
# Import the newly added commits to Mononoke
@ -76,7 +77,7 @@
$ cd $REPONAME
# Wait for the warm bookmark cache to catch up with the latest changes
$ wait_for_git_bookmark_move HEAD $current_head
$ quiet git_client pull $MONONOKE_GIT_SERVICE_BASE_URL/$REPONAME.git
$ quiet git_client pull
# Verify that we get the same Git repo back that we started with
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/new_object_list
$ diff -w $TESTTMP/new_object_list $TESTTMP/object_list