github.com/git-lfs/git-lfs@v2.5.2+incompatible/t/t-filter-branch.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  . "$(dirname "$0")/testlib.sh"
     4  
     5  begin_test "filter-branch (git-lfs/git-lfs#1773)"
     6  (
     7    set -e
     8  
     9    reponame="filter-branch"
    10    setup_remote_repo "$reponame"
    11    clone_repo "$reponame" "$reponame"
    12  
    13    contents_a="contents (a)"
    14    printf "$contents_a" > a.dat
    15    git add a.dat
    16    git commit -m "add a.dat"
    17  
    18    contents_b="contents (b)"
    19    printf "$contents_b" > b.dat
    20    git add b.dat
    21    git commit -m "add b.dat"
    22  
    23    contents_c="contents (c)"
    24    printf "$contents_c" > c.dat
    25    git add c.dat
    26    git commit -m "add c.dat"
    27  
    28    git filter-branch -f --prune-empty \
    29      --tree-filter '
    30        echo >&2 "---"
    31        git rm --cached -r -q .
    32        git lfs track "*.dat"
    33        git add .
    34      ' --tag-name-filter cat -- --all
    35  
    36  
    37    assert_pointer "master" "a.dat" "$(calc_oid "$contents_a")" 12
    38    assert_pointer "master" "b.dat" "$(calc_oid "$contents_b")" 12
    39    assert_pointer "master" "c.dat" "$(calc_oid "$contents_c")" 12
    40  )
    41  end_test