Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df5a495

Browse files
committed
test removal of remote references
1 parent 54f01b5 commit df5a495

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

tests/remove-refs.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
set -e
3+
4+
testsdir=$(dirname "$(readlink -f $0)")
5+
6+
. $testsdir/functions.sh
7+
8+
9+
initialise_git_repo
10+
11+
git -C $PRIMARY tag -a 'tag-a' -m 'add tag a'
12+
git -C $PRIMARY tag -a 'tag-b' -m 'add tag b'
13+
14+
15+
message "Pushing to remote ..."
16+
GIT_ALLOW_UNSIGNED=y git -C $PRIMARY push origin master --tags
17+
orig_master=$(git -C $PRIMARY rev-parse master)
18+
test -f $REMOTE/$orig_master || {
19+
fatal "missing commit in the remote!"
20+
}
21+
22+
GIT_ALLOW_UNSIGNED=y git -C $PRIMARY push --delete origin tag-a
23+
GIT_ALLOW_UNSIGNED=y git -C $PRIMARY push origin :tag-b
24+
25+
26+
message "Fetching from remote ..."
27+
git clone example://$REMOTE $SECONDARY
28+
test "$(git -C $SECONDARY tag)" = 'v1.0'

tests/test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ run_test() {
1010
echo >&2
1111
}
1212

13+
# Uncomment to get more information about synchronisation
14+
# export GIT_EXAMPLE_VERBOSE=1
15+
16+
1317
# Clone and fetch ‘master’
1418
run_test clone.sh
1519

@@ -21,3 +25,6 @@ run_test hard-push.sh
2125

2226
# Merged branches
2327
run_test merge.sh
28+
29+
# Removal of remote references
30+
run_test remove-refs.sh

0 commit comments

Comments
 (0)