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

. "$(dirname "$0")/testlib.sh"

begin_test "multiple revs with same OID get pushed once"
(
  set -e

  reponame="multiple-revs-one-oid"
  setup_remote_repo "$reponame"
  clone_repo "$reponame" "$reponame"

  git lfs track "*.dat"
  git add .gitattributes
  git commit -m "initial commit"

  contents="contents"
  contents_oid="$(calc_oid "$contents")"

  # Stash the contents of the file that we want to commit in .git/lfs/objects.
  object_dir="$(echo $contents_oid \
    | awk '{ print substr($0, 0, 2) "/" substr($0, 3, 2) }')"
  mkdir -p ".git/lfs/objects/$object_dir"
  printf "%s" "$contents" > ".git/lfs/objects/$object_dir/$contents_oid"

  # Create a pointer with the old "http://git-media.io" spec
  legacy_pointer="$(pointer $contents_oid 8 http://git-media.io/v/2)"
  # Create a pointer with the latest spec to create a modification, but leave
  # the OID untouched.<commit_msg>t-duplicate-oids: use correct awk indexing<commit_after>#!/usr/bin/env bash

. "$(dirname "$0")/testlib.sh"

begin_test "multiple revs with same OID get pushed once"
(
  set -e

  reponame="multiple-revs-one-oid"
  setup_remote_repo "$reponame"
  clone_repo "$reponame" "$reponame"

  git lfs track "*.dat"
  git add .gitattributes
  git commit -m "initial commit"

  contents="contents"
  contents_oid="$(calc_oid "$contents")"

  # Stash the contents of the file that we want to commit in .git/lfs/objects.
  object_dir="$(echo $contents_oid \
    | awk '{ print substr($0, 1, 2) "/" substr($0, 3, 2) }')"
  mkdir -p ".git/lfs/objects/$object_dir"
  printf "%s" "$contents" > ".git/lfs/objects/$object_dir/$contents_oid"

  # Create a pointer with the old "http://git-media.io" spec
  legacy_pointer="$(pointer $contents_oid 8 http://git-media.io/v/2)"
  # Create a pointer with the latest spec to create a modification, but leave
  # the OID untouched.
{'fraction_non_alphanumeric': 0.1493886230728336, 'fraction_numerical': 0.009569377990430622, 'mean_word_length': 3.863049095607235, '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': '4401790', 'n_tokens_mistral': 679, 'n_tokens_neox': 643, 'n_words': 191}