Skip to content

Commit 21ee952

Browse files
authored
Remove duplicate definitions in ghe-backup-config (#480)
While investigating an unrelated issue, I noticed that some definitions in ghe-backup-config are present twice. The reason for this appears to be a faulty merge conflict resolution [1], as both parent commits [2, 3] only have a single copy of these definitions but the merge commit has duplicates. It seems that an unwieldy conflict came up while merging the progress-indicator with the master branch, as a result of which both the old and new locations of these definitions were accidentally kept, causing the duplication. This removes one copy of each definition to avoid confusion and potential future bugs. [1] 1eaf809 [2] a8e7eca [3] 8aaccc3
1 parent 56e88a9 commit 21ee952

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

share/github-backup-utils/ghe-backup-config

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if [ -n "$GHE_SHOW_VERSION" ]; then
3535
fi
3636

3737
# Check for "--help|-h" in args or GHE_SHOW_HELP=true and show usage
38-
# shellcheck disable=SC2120 # the script name is always referenced
38+
# shellcheck disable=SC2120 # Our arguments are optional and not meant to be the owning script's
3939
print_usage() {
4040
grep '^#/' <"$0" | cut -c 4-
4141
exit "${1:-1}"
@@ -51,10 +51,6 @@ else
5151
done
5252
fi
5353

54-
# Add the bin and share/github-backup-utils dirs to PATH
55-
PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH"
56-
# shellcheck source=share/github-backup-utils/bm.sh
57-
. "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh"
5854
# Save off GHE_HOSTNAME from the environment since we want it to override the
5955
# backup.config value when set.
6056
GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME"
@@ -150,35 +146,6 @@ log_ssh(){
150146
log_level "ssh" "$1"
151147
}
152148

153-
# Assume this script lives in share/github-backup-utils/ when setting the root
154-
GHE_BACKUP_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
155-
156-
# Get the version from the version file.
157-
BACKUP_UTILS_VERSION="$(cat "$GHE_BACKUP_ROOT/share/github-backup-utils/version")"
158-
159-
# If a version check was requested, show the current version and exit
160-
if [ -n "$GHE_SHOW_VERSION" ]; then
161-
echo "GitHub backup-utils v$BACKUP_UTILS_VERSION"
162-
exit 0
163-
fi
164-
165-
# Check for "--help|-h" in args or GHE_SHOW_HELP=true and show usage
166-
# shellcheck disable=SC2120 # Our arguments are optional and not meant to be the owning script's
167-
print_usage() {
168-
grep '^#/' <"$0" | cut -c 4-
169-
exit "${1:-1}"
170-
}
171-
172-
if [ -n "$GHE_SHOW_HELP" ]; then
173-
print_usage
174-
else
175-
for a in "$@"; do
176-
if [ "$a" = "--help" ] || [ "$a" = "-h" ]; then
177-
print_usage
178-
fi
179-
done
180-
fi
181-
182149
# Add the bin and share/github-backup-utils dirs to PATH
183150
PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH"
184151
# shellcheck source=share/github-backup-utils/bm.sh
@@ -187,9 +154,6 @@ PATH="$GHE_BACKUP_ROOT/bin:$GHE_BACKUP_ROOT/share/github-backup-utils:$PATH"
187154
. "$GHE_BACKUP_ROOT/share/github-backup-utils/ghe-incremental-backup-restore"
188155
# shellcheck source=share/github-backup-utils/track-progress
189156
. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress"
190-
# Save off GHE_HOSTNAME from the environment since we want it to override the
191-
# backup.config value when set.
192-
GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME"
193157

194158

195159
ghe_restore_check() {

0 commit comments

Comments
 (0)