Skip to content

Commit 0a04ca0

Browse files
committed
Implement function to different gist path parsing
1 parent 4366717 commit 0a04ca0

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.22, 2.17.13, 2.18.7 & 2.19.1
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.22)" ]] || \
375+
[[ "$GHE_REMOTE_VERSION" =~ 2.17 && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.17.13)" ]] || \
376+
[[ "$GHE_REMOTE_VERSION" =~ 2.18 && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.18.7)" ]] || \
377+
[[ "$GHE_REMOTE_VERSION" =~ 2.19 && "$(version $GHE_REMOTE_VERSION)" -ge "$(version 2.19.1)" ]] && \
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 | while read -r line; do if [[ ! $line == */gist/* ]]; then dirname "$line"; else echo "$line"; fi; done | 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)