<commit_before>#!/usr/bin/env sh

if test -n "$(git status --porcelain)"; then
  echo 'Unclean working tree. Commit or stash changes first.' >&2;
  exit 128;
fi

if ! git fetch --quiet 2> /dev/null; then
  echo 'There was a problem fetching your branch.' >&2;
  exit 128;
fi

CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"

garbage() {
  git for-each-ref --format "${1:-}%(refname:short)" refs/heads/ --merged | egrep -v "$CURRENT_BRANCH"
}

BRANCHES=$(garbage "  ")
[[ -z  $BRANCHES  ]] && echo "\n  Nothing to garbage." && exit

echo && echo "$BRANCHES" && echo
read -rp "  Will be removed. Continue? (y/N) " -n 1

if [[ $REPLY =~ ^[Yy]$ ]]; then
  MESSAGE=$(garbage | xargs git branch -d)
  echo && echo && echo "$MESSAGE" | sed 's/Deleted/  Deleted/g'
fi
<commit_msg>Adjust style<commit_after>#!/usr/bin/env sh

if test -n "$(git status --porcelain)"; then
  echo 'Unclean working tree. Commit or stash changes first.' >&2;
  exit 128;
fi

if ! git fetch --quiet 2> /dev/null; then
  echo 'There was a problem fetching your branch.' >&2;
  exit 128;
fi

CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"

garbage() {
  git for-each-ref --format "${1:-}%(refname:short)" refs/heads/ --merged | egrep -v "$CURRENT_BRANCH"
}

BRANCHES=$(garbage "  ")

if [[ -z  $BRANCHES ]]; then
  printf "\n  Nothing to garbage."
  exit
fi

echo && echo "$BRANCHES" && echo
read -rp "  Will be removed. Continue? (y/N) " -n 1

if [[ $REPLY =~ ^[Yy]$ ]]; then
  MESSAGE=$(garbage | xargs git branch -d)
  echo && echo && echo "$MESSAGE" | sed 's/Deleted/  Deleted/g'
fi

{'fraction_non_alphanumeric': 0.18234165067178504, 'fraction_numerical': 0.014075495841330775, 'mean_word_length': 3.2615803814713895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4383277', 'n_tokens_mistral': 636, 'n_tokens_neox': 594, 'n_words': 192}