<commit_before>#!/bin/sh

. "test/testlib.sh"

begin_test "untrack"
(
  set -e

  # no need to setup a remote repo, since this test doesn't need to push or pull

  reponame="untrack"
  git init $untrack
  cd $untrack

  # track *.jpg once
  git lfs track "*.jpg" | grep "Tracking \*.jpg"
  echo "* annex.backend=SHA512E" >> .gitattributes

  git lfs untrack "*.jpg"

  expected="* annex.backend=SHA512E"
  [ "$expected" = "$(cat .gitattributes)" ]
)
end_test

begin_test "untrack outside git repo"
(
  set -e

  git lfs untrack "*.foo" || {
    # this fails if it's run outside of a git repo using GIT_LFS_TEST_DIR

    # git itself returns an exit status of 128
    # $ git show
    # fatal: Not a git repository (or any of the parent directories): .git
    # $ echo "$?"
    # 128

    [ "$?" = "128" ]
    exit 0
  }

  if [ -n "$GIT_LFS_TEST_DIR" ]; then
    echo "GIT_LFS_TEST_DIR should be set outside of any Git repository"
    exit 1
  fi
)<commit_msg>アアー アアアア アー<commit_after>#!/bin/sh

. "test/testlib.sh"

begin_test "untrack"
(
  set -e

  # no need to setup a remote repo, since this test doesn't need to push or pull

  reponame="untrack"
  git init $reponame
  cd $reponame

  # track *.jpg once
  git lfs track "*.jpg" | grep "Tracking \*.jpg"
  echo "* annex.backend=SHA512E" >> .gitattributes

  git lfs untrack "*.jpg"

  expected="* annex.backend=SHA512E"
  [ "$expected" = "$(cat .gitattributes)" ]
)
end_test

begin_test "untrack outside git repo"
(
  set -e

  reponame="outside"
  mkdir $reponame
  cd $reponame

  git lfs untrack "*.foo" || {
    # this fails if it's run outside of a git repo using GIT_LFS_TEST_DIR

    # git itself returns an exit status of 128
    # $ git show
    # fatal: Not a git repository (or any of the parent directories): .git
    # $ echo "$?"
    # 128

    [ "$?" = "128" ]
    exit 0
  }

  if [ -n "$GIT_LFS_TEST_DIR" ]; then
    echo "GIT_LFS_TEST_DIR should be set outside of any Git repository"
    exit 1
  fi
)
{'fraction_non_alphanumeric': 0.1210126582278481, 'fraction_numerical': 0.017215189873417722, 'mean_word_length': 2.8220502901353965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3997446', 'n_tokens_mistral': 780, 'n_tokens_neox': 711, 'n_words': 243}