Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions scripts/fix-history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1122,17 +1122,19 @@ run_batch_cleanup() {
for _repo in "${repos[@]}"; do
pushd "$_repo" >/dev/null || continue
local lt lb rt rb
lt=$(get_tmp_backup_tags); lb=$(get_tmp_backup_branches)
rt=$(get_remote_tmp_backup_tags); rb=$(get_remote_tmp_backup_branches)
local n=$(( $(count_lines "$lt") + $(count_lines "$lb") + $(count_lines "$rt") + $(count_lines "$rb") ))
lt=$(get_tmp_backup_tags)
lb=$(get_tmp_backup_branches)
rt=$(get_remote_tmp_backup_tags)
rb=$(get_remote_tmp_backup_branches)
local n=$(($(count_lines "$lt") + $(count_lines "$lb") + $(count_lines "$rt") + $(count_lines "$rb")))
if [[ $n -gt 0 ]]; then
local key
key=$(printf '%s' "$_repo" | md5sum | cut -c1-16)
printf '%s' "$lt" > "$tmp_dir/${key}.lt"
printf '%s' "$lb" > "$tmp_dir/${key}.lb"
printf '%s' "$rt" > "$tmp_dir/${key}.rt"
printf '%s' "$rb" > "$tmp_dir/${key}.rb"
printf '%s' "$_repo" > "$tmp_dir/${key}.path"
printf '%s' "$lt" >"$tmp_dir/${key}.lt"
printf '%s' "$lb" >"$tmp_dir/${key}.lb"
printf '%s' "$rt" >"$tmp_dir/${key}.rt"
printf '%s' "$rb" >"$tmp_dir/${key}.rb"
printf '%s' "$_repo" >"$tmp_dir/${key}.path"
total_refs=$((total_refs + n))
print_info " $_repo (${n} ref(s))"
[[ -n "$lt" ]] && echo "$lt" | sed 's/^/ local tag: /'
Expand Down Expand Up @@ -1175,9 +1177,9 @@ run_batch_cleanup() {
local repo_path
repo_path=$(cat "$key_path")
pushd "$repo_path" >/dev/null || continue
delete_local_tags "$(cat "$tmp_dir/${base}.lt" 2>/dev/null || true)"
delete_local_tags "$(cat "$tmp_dir/${base}.lt" 2>/dev/null || true)"
delete_local_branches "$(cat "$tmp_dir/${base}.lb" 2>/dev/null || true)"
delete_remote_tags "$(cat "$tmp_dir/${base}.rt" 2>/dev/null || true)"
delete_remote_tags "$(cat "$tmp_dir/${base}.rt" 2>/dev/null || true)"
delete_remote_branches "$(cat "$tmp_dir/${base}.rb" 2>/dev/null || true)"
print_success " Cleaned: $repo_path"
((cleaned_repos++)) || true
Expand Down
15 changes: 9 additions & 6 deletions scripts/template-loading.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ ensure_repo_labels() {
local created=0
for def in "${label_defs[@]}"; do
local name color desc
IFS=':' read -r name color desc <<< "$def"
IFS=':' read -r name color desc <<<"$def"
if echo "$existing" | grep -qxF "$name"; then
continue
fi
Expand Down Expand Up @@ -1431,13 +1431,13 @@ run_batch_update() {
# If the user passed explicit paths that all lacked .git (likely a glob expansion like *),
# offer to fall back to the current directory before giving up.
local _had_explicit=false
[[ ${#POSITIONAL_ARGS[@]} -gt 1 || ( ${#POSITIONAL_ARGS[@]} -eq 1 && "${POSITIONAL_ARGS[0]}" != "." ) ]] \
[[ ${#POSITIONAL_ARGS[@]} -gt 1 || (${#POSITIONAL_ARGS[@]} -eq 1 && "${POSITIONAL_ARGS[0]}" != ".") ]] \
&& _had_explicit=true
if [[ "$_had_explicit" == "true" && "${ASSUME_YES:-false}" != "true" ]]; then
local _cwd_name
_cwd_name=$(basename "$PWD")
print_warning "None of the given paths contain a git repository."
read -rp "Did you mean to update the current folder '${_cwd_name}'? [Y/n]: " _fallback < /dev/tty
read -rp "Did you mean to update the current folder '${_cwd_name}'? [Y/n]: " _fallback </dev/tty
if [[ "${_fallback:-y}" =~ ^[Yy] ]]; then
dirs=(".")
git_dirs=(".")
Expand Down Expand Up @@ -1485,7 +1485,8 @@ run_batch_update() {

for d in "${git_dirs[@]}"; do
print_header
local _d_label; _d_label="$([[ "$d" == "." ]] && basename "$PWD" || echo "$d")"
local _d_label
_d_label="$([[ "$d" == "." ]] && basename "$PWD" || echo "$d")"
print_info "Updating: ${_d_label}"

pushd "$d" >/dev/null || {
Expand All @@ -1512,7 +1513,8 @@ run_batch_update() {
local is_member=false
IFS=',' read -ra _members <<<"$members_list"
for m in "${_members[@]}"; do
m="${m#"${m%%[! ]*}"}"; m="${m%"${m##*[! ]}"}"
m="${m#"${m%%[! ]*}"}"
m="${m%"${m##*[! ]}"}"
if [[ "$m" == "$remote_owner" ]]; then
is_member=true
break
Expand Down Expand Up @@ -1849,7 +1851,8 @@ run_batch_init() {
local is_member=false
IFS=',' read -ra _members <<<"$members_list"
for m in "${_members[@]}"; do
m="${m#"${m%%[! ]*}"}"; m="${m%"${m##*[! ]}"}"
m="${m#"${m%%[! ]*}"}"
m="${m%"${m##*[! ]}"}"
if [[ "$m" == "$remote_owner" ]]; then
is_member=true
break
Expand Down
Loading