Skip to content

Commit 39b2e05

Browse files
authored
Merge pull request #524 from github/lildude/update-verify-routes
Cater for more explicit gist paths used in routes file
2 parents cdd99a6 + 267dcac commit 39b2e05

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

share/github-backup-utils/ghe-backup-repositories

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,24 @@ bm_end "$(basename $0) - Special Data Directories Sync"
367367
if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then
368368
bm_start "$(basename $0) - Verifying Routes"
369369

370+
# The list of gists returned by the source changed in 2.16.23, 2.17.14, 2.18.8 & 2.19.3
371+
# so we need to account for this difference here.
372+
parse_paths() {
373+
while read -r line; do
374+
if [[ "$GHE_REMOTE_VERSION" =~ 2.16 && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.16.23)" ]] || \
375+
[[ "$GHE_REMOTE_VERSION" =~ 2.17 && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.17.14)" ]] || \
376+
[[ "$GHE_REMOTE_VERSION" =~ 2.18 && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.18.8)" ]] || \
377+
[[ "$GHE_REMOTE_VERSION" =~ 2.19 && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.19.3)" ]] && \
378+
(echo "$line" | grep -q "gist"); then
379+
echo "$line"
380+
else
381+
dirname "$line"
382+
fi
383+
done
384+
}
385+
370386
cat $tempdir/*.rsync | sort | uniq > $tempdir/source_routes
371-
(cd $backup_dir/ && find * -mindepth 5 -maxdepth 6 -type d -name \*.git -exec dirname {} \; | sort | uniq) > $tempdir/destination_routes
387+
(cd $backup_dir/ && find * -mindepth 5 -maxdepth 6 -type d -name \*.git | parse_paths | sort | uniq) > $tempdir/destination_routes
372388

373389
git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more repository networks and/or gists were not found on the source appliance. Please contact GitHub Enterprise Support for assistance."
374390

0 commit comments

Comments
 (0)