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

has_uncommitted_changes() {
  diff=$(git diff-index HEAD)
  if [ -n "$diff" ]; then
    return 0
  fi
  return 1
}

is_on_master() {
  branch=$(git symbolic-ref HEAD 2>/dev/null | cut -d'/' -f3)
  if [ "$branch" == "master" ]; then
    return 0
  else
    return 1
  fi
}

check_submodules_and_commit_on_update() {
  git submodule update --remote --init
  if has_uncommitted_changes "$1"; then
    git add -u
    git commit -m "updating submodules [autogenerated]"
  fi
}

update() {
  f() {
    echo "Synchronizing $1"
    cd "$1" || exit 1
    if is_on_master && ! has_uncommitted_changes "$1"; then
      git pull
      check_submodules_and_commit_on_update "$1"
      git push
    else
      echo "Skipping $1 -- not in a valid state to sync"
    fi
  }
  if [ -d "$1" ]; then
    f "$1"
  else
    echo "Skipping $1 - Not deployed on this machine."
  fi
}
<commit_msg>misc: make comment formatting consistent<commit_after>#!/usr/bin/env bash

has_uncommitted_changes() {
  diff=$(git diff-index HEAD)
  if [ -n "$diff" ]; then
    return 0
  fi
  return 1
}

is_on_master() {
  branch=$(git symbolic-ref HEAD 2>/dev/null | cut -d'/' -f3)
  if [ "$branch" == "master" ]; then
    return 0
  else
    return 1
  fi
}

check_submodules_and_commit_on_update() {
  git submodule update --remote --init
  if has_uncommitted_changes "$1"; then
    git add -u
    git commit -m "updating submodules [autogenerated]"
  fi
}

update() {
  f() {
    echo "Synchronizing $1"
    cd "$1" || exit 1
    if is_on_master && ! has_uncommitted_changes "$1"; then
      git pull
      check_submodules_and_commit_on_update "$1"
      git push
    else
      echo "Skipping $1 -- not in a valid state to sync"
    fi
  }
  if [ -d "$1" ]; then
    f "$1"
  else
    echo "Skipping $1 -- Not deployed on this machine."
  fi
}

{'fraction_non_alphanumeric': 0.1267605633802817, 'fraction_numerical': 0.01733477789815818, 'mean_word_length': 2.593385214007782, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1165097', 'n_tokens_mistral': 698, 'n_tokens_neox': 673, 'n_words': 206}