Skip to content

Commit 559d499

Browse files
committed
auto cleanup sources
1 parent 2351a30 commit 559d499

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/gt-pull.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ function gt_pull_internal_without_arg_checks() {
360360
# now that it was established
361361
trap "gt_pull_cleanupRepo '$repo'" EXIT
362362

363-
gitFetchTagFromRemote "$remote" "$repo" "$tagToPull" || return $?
363+
gitFetchTagFromRemote "$remote" "$repo" "$tagToPull" || return $?
364364

365365
git -C "$repo" checkout "tags/$tagToPull" -- "$path" || returnDying "was not able to checkout tags/%s and path %s" "$tagToPull" "$path" || return $?
366366

src/utils.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,22 @@ function gitDiffChars() {
105105
grep -A 1 @@ | tail -n +2
106106
}
107107

108-
function gitFetchTagFromRemote(){
109-
local remote repo tagToFetch
110-
# shellcheck disable=SC2034 # is passed by name to parseFnArgs
111-
local -ra params=(remote repo tagToFetch)
112-
parseFnArgs params "$@"
113-
114-
local tags
115-
tags=$(git -C "$repo" tag) || die "The following command failed (see above): git tag"
116-
if grep "$tagToFetch" <<<"$tags" >/dev/null; then
117-
logInfo "tag \033[0;36m%s\033[0m already exists locally, skipping fetching from remote \033[0;36m%s\033[0m" "$tagToFetch" "$remote"
118-
else
119-
local remoteTags
120-
remoteTags=$(cd "$repo" && remoteTagsSorted "$remote" -r) || (logInfo >&2 "check your internet connection" && return 1) || return $?
121-
grep "$tagToFetch" <<<"$remoteTags" >/dev/null || returnDying "remote \033[0;36m%s\033[0m does not have the tag \033[0;36m%s\033[0m\nFollowing the available tags:\n%s" "$remote" "$tagToFetch" "$remoteTags" || return $?
122-
git -C "$repo" fetch --depth 1 "$remote" "refs/tags/$tagToFetch:refs/tags/$tagToFetch" || returnDying "was not able to fetch tag %s from remote %s" "$tagToFetch" "$remote" || return $?
123-
fi
108+
function gitFetchTagFromRemote() {
109+
local remote repo tagToFetch
110+
# shellcheck disable=SC2034 # is passed by name to parseFnArgs
111+
local -ra params=(remote repo tagToFetch)
112+
parseFnArgs params "$@"
113+
114+
local tags
115+
tags=$(git -C "$repo" tag) || die "The following command failed (see above): git tag"
116+
if grep "$tagToFetch" <<<"$tags" >/dev/null; then
117+
logInfo "tag \033[0;36m%s\033[0m already exists locally, skipping fetching from remote \033[0;36m%s\033[0m" "$tagToFetch" "$remote"
118+
else
119+
local remoteTags
120+
remoteTags=$(cd "$repo" && remoteTagsSorted "$remote" -r) || (logInfo >&2 "check your internet connection" && return 1) || return $?
121+
grep "$tagToFetch" <<<"$remoteTags" >/dev/null || returnDying "remote \033[0;36m%s\033[0m does not have the tag \033[0;36m%s\033[0m\nFollowing the available tags:\n%s" "$remote" "$tagToFetch" "$remoteTags" || return $?
122+
git -C "$repo" fetch --depth 1 "$remote" "refs/tags/$tagToFetch:refs/tags/$tagToFetch" || returnDying "was not able to fetch tag %s from remote %s" "$tagToFetch" "$remote" || return $?
123+
fi
124124

125125
}
126126

0 commit comments

Comments
 (0)