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

     1  #!/usr/bin/env bash
     2  
     3  . "$(dirname "$0")/testlib.sh"
     4  
     5  begin_test "ext"
     6  (
     7    set -e
     8  
     9    # no need to setup a remote repo, since this test does not need to push or pull
    10  
    11    mkdir ext
    12    cd ext
    13    git init
    14  
    15    git config lfs.extension.foo.clean "foo-clean %f"
    16    git config lfs.extension.foo.smudge "foo-smudge %f"
    17    git config lfs.extension.foo.priority 0
    18  
    19    git config lfs.extension.bar.clean "bar-clean %f"
    20    git config lfs.extension.bar.smudge "bar-smudge %f"
    21    git config lfs.extension.bar.priority 1
    22  
    23    git config lfs.extension.baz.clean "baz-clean %f"
    24    git config lfs.extension.baz.smudge "baz-smudge %f"
    25    git config lfs.extension.baz.priority 2
    26  
    27    fooExpected="Extension: foo
    28      clean = foo-clean %f
    29      smudge = foo-smudge %f
    30      priority = 0"
    31  
    32    barExpected="Extension: bar
    33      clean = bar-clean %f
    34      smudge = bar-smudge %f
    35      priority = 1"
    36  
    37    bazExpected="Extension: baz
    38      clean = baz-clean %f
    39      smudge = baz-smudge %f
    40      priority = 2"
    41  
    42    actual=$(git lfs ext list foo)
    43    [ "$actual" = "$fooExpected" ]
    44  
    45    actual=$(git lfs ext list bar)
    46    [ "$actual" = "$barExpected" ]
    47  
    48    actual=$(git lfs ext list baz)
    49    [ "$actual" = "$bazExpected" ]
    50  
    51    actual=$(git lfs ext list foo bar)
    52    expected=$(printf "%s\n%s" "$fooExpected" "$barExpected")
    53    [ "$actual" = "$expected" ]
    54  
    55    actual=$(git lfs ext list)
    56    expected=$(printf "%s\n%s\n%s" "$fooExpected" "$barExpected" "$bazExpected")
    57    [ "$actual" = "$expected" ]
    58  
    59    actual=$(git lfs ext)
    60    [ "$actual" = "$expected" ]
    61  )
    62  end_test