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

_koopa_rsync_vm() {
    # """
    # rsync a desired prefix across virtual machines.
    # @note Updated 2020-02-18.
    #
    # Potentially useful flags:
    # * --omit-dir-times
    # """
    # We're enforcing use of '/usr/bin/rsync' here in case we're syncing
    # '/usr/local', which may have an updated copy of rsync installed.
    local rsync
    rsync="/usr/bin/rsync"
    _koopa_assert_is_installed "$rsync"

    local flags
    flags="$(_koopa_rsync_flags)"

    while (("$#"))
    do
        case "$1" in
            --flags=*)
                local flags="${1#*=}"
                shift 1
                ;;
            --prefix=*)
                local prefix="${1#*=}"
                shift 1
                ;;
            --source-ip=*)
                local source_ip="${1#*=}"
                shift 1
                ;;
            *)
                _koopa_invalid_arg "$1"
                ;;
        esac
    done

    _koopa_assert_is_set flags prefix source_ip

    local host_ip
    host_ip="$(_koopa_local_ip_address)"

    local user
    user="${USER:?}"

    # Check for accidental sync from source machine.
    if [ "$source_ip" == "$host_ip" ]
    then
        _koopa_note "On source machine: '${source_ip}'."
        return 1
    fi

    _koopa_h1 "Syncing '${prefix}' from '${source_ip}'."
    _koopa_dl "Flags" "$flags"

    _koopa_mkdir "$prefix"
    _koopa_remove_broken_symlinks "$prefix"
    _koopa_set_permissions --recursive --user "$prefix"

    # Note that this step won't work unless we leave 'flags' unquoted here.
    # shellcheck disable=SC2086
    rsync $flags \
        --rsync-path="sudo ${rsync}" \
        "${user}@${source_ip}:${prefix}/" \
        "${prefix}/"

    _koopa_remove_broken_symlinks "$prefix"
    _koopa_set_permissions --recursive "$prefix"
    return 0
}<commit_msg>Return success when on local machine<commit_after>#!/usr/bin/env bash

_koopa_rsync_vm() {
    # """
    # rsync a desired prefix across virtual machines.
    # @note Updated 2020-02-18.
    #
    # Potentially useful flags:
    # * --omit-dir-times
    # """
    # We're enforcing use of '/usr/bin/rsync' here in case we're syncing
    # '/usr/local', which may have an updated copy of rsync installed.
    local rsync
    rsync="/usr/bin/rsync"
    _koopa_assert_is_installed "$rsync"

    local flags
    flags="$(_koopa_rsync_flags)"

    while (("$#"))
    do
        case "$1" in
            --flags=*)
                local flags="${1#*=}"
                shift 1
                ;;
            --prefix=*)
                local prefix="${1#*=}"
                shift 1
                ;;
            --source-ip=*)
                local source_ip="${1#*=}"
                shift 1
                ;;
            *)
                _koopa_invalid_arg "$1"
                ;;
        esac
    done

    _koopa_assert_is_set flags prefix source_ip

    local host_ip
    host_ip="$(_koopa_local_ip_address)"

    local user
    user="${USER:?}"

    # Check for accidental sync from source machine.
    if [ "$source_ip" == "$host_ip" ]
    then
        _koopa_note "On source machine: '${source_ip}'."
        return 0
    fi

    _koopa_h1 "Syncing '${prefix}' from '${source_ip}'."
    _koopa_dl "Flags" "$flags"

    _koopa_mkdir "$prefix"
    _koopa_remove_broken_symlinks "$prefix"
    _koopa_set_permissions --recursive --user "$prefix"

    # Note that this step won't work unless we leave 'flags' unquoted here.
    # shellcheck disable=SC2086
    rsync $flags \
        --rsync-path="sudo ${rsync}" \
        "${user}@${source_ip}:${prefix}/" \
        "${prefix}/"

    _koopa_remove_broken_symlinks "$prefix"
    _koopa_set_permissions --recursive "$prefix"
    return 0
}
{'fraction_non_alphanumeric': 0.13155792276964048, 'fraction_numerical': 0.012250332889480693, 'mean_word_length': 1.8628048780487805, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5911921', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1170, 'n_words': 287}