File: t-filter-branch.sh

package info (click to toggle)
git-lfs 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,808 kB
  • sloc: sh: 21,256; makefile: 507; ruby: 417
file content (41 lines) | stat: -rwxr-xr-x 932 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash

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

begin_test "filter-branch (git-lfs/git-lfs#1773)"
(
  set -e

  reponame="filter-branch"
  setup_remote_repo "$reponame"
  clone_repo "$reponame" "$reponame"

  contents_a="contents (a)"
  printf "%s" "$contents_a" > a.dat
  git add a.dat
  git commit -m "add a.dat"

  contents_b="contents (b)"
  printf "%s" "$contents_b" > b.dat
  git add b.dat
  git commit -m "add b.dat"

  contents_c="contents (c)"
  printf "%s" "$contents_c" > c.dat
  git add c.dat
  git commit -m "add c.dat"

  git filter-branch -f --prune-empty \
    --tree-filter '
      echo >&2 "---"
      git rm --cached -r -q .
      git lfs track "*.dat"
      git add .
    ' --tag-name-filter cat -- --all


  assert_pointer "main" "a.dat" "$(calc_oid "$contents_a")" 12
  assert_pointer "main" "b.dat" "$(calc_oid "$contents_b")" 12
  assert_pointer "main" "c.dat" "$(calc_oid "$contents_c")" 12
)
end_test