diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-02-19 14:26:02 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-02-19 14:27:24 +0300 |
commit | 3d4838d3706de2ba0045dc9f99a3dc96398def64 (patch) | |
tree | ece29423c4ece1139169a8b952914471593fe577 /tests/publish | |
parent | d3ef22615ba7d37be18c31b2fdd1bdb6be164939 (diff) |
Parse repositories and packages files for git repositories
Diffstat (limited to 'tests/publish')
-rwxr-xr-x | tests/publish | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/publish b/tests/publish index 253c703..5d1e928 100755 --- a/tests/publish +++ b/tests/publish @@ -56,22 +56,28 @@ for r in $(find test -type d -regex '.*/git/.*/[^/]+\.git'); do d=$(echo $br | sed -n -e 's%.*/git-bare/\(.*\)%\1%p') for u in "${urls[@]}"; do + url="$u/$d" - # Point the bare repository origin to the remote repository. + # Push local branches and tags to the remote repository, if it exists. # - git -C $br config remote.origin.url "$u/$d" + if git ls-remote "$url" 2>/dev/null >&2; then + # Point the bare repository origin to the remote repository. + # + git -C $br config remote.origin.url "$url" - # Delete all remote branches and tags. - # - while read commit ref; do - $echo_git git -C $br push origin ":$ref" - done < <(git -C $br ls-remote --refs origin) + # Delete all remote branches and tags. + # + while read commit ref; do + $echo_git git -C $br push origin ":$ref" + done < <(git -C $br ls-remote --refs origin) - # Push local branches. - # - while read branch; do - $echo_git git -C $br push --tags origin "$branch:$branch" - done < <(git -C $br for-each-ref --format='%(refname:short)' 'refs/heads/') + # Push local branches. + # + while read branch; do + $echo_git git -C $br push --tags origin "$branch:$branch" + done < <(git -C $br for-each-ref --format='%(refname:short)' \ + 'refs/heads/') + fi done # Prepare the bare repository for serving via the HTTPS dumb protocol. |