Skip to content

Commit bf32975

Browse files
hubotpluehne
andauthored
Remove duplicate definitions in ghe-backup-config (#480) (#485)
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 Co-authored-by: Patrick Lühne <[email protected]>
1 parent 3db1527 commit bf32975

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,44 +146,12 @@ 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
185152
. "$GHE_BACKUP_ROOT/share/github-backup-utils/bm.sh"
186153
# shellcheck source=share/github-backup-utils/track-progress
187154
. "$GHE_BACKUP_ROOT/share/github-backup-utils/track-progress"
188-
# Save off GHE_HOSTNAME from the environment since we want it to override the
189-
# backup.config value when set.
190-
GHE_HOSTNAME_PRESERVE="$GHE_HOSTNAME"
191155

192156
# Source in the backup config file from the copy specified in the environment
193157
# first and then fall back to the backup-utils root, home directory and system.

0 commit comments

Comments
 (0)