File: t-ext.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 (62 lines) | stat: -rwxr-xr-x 1,481 bytes parent folder | download | duplicates (4)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash

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

begin_test "ext"
(
  set -e

  # no need to setup a remote repo, since this test does not need to push or pull

  mkdir ext
  cd ext
  git init

  git config lfs.extension.foo.clean "foo-clean %f"
  git config lfs.extension.foo.smudge "foo-smudge %f"
  git config lfs.extension.foo.priority 0

  git config lfs.extension.bar.clean "bar-clean %f"
  git config lfs.extension.bar.smudge "bar-smudge %f"
  git config lfs.extension.bar.priority 1

  git config lfs.extension.baz.clean "baz-clean %f"
  git config lfs.extension.baz.smudge "baz-smudge %f"
  git config lfs.extension.baz.priority 2

  fooExpected="Extension: foo
    clean = foo-clean %f
    smudge = foo-smudge %f
    priority = 0"

  barExpected="Extension: bar
    clean = bar-clean %f
    smudge = bar-smudge %f
    priority = 1"

  bazExpected="Extension: baz
    clean = baz-clean %f
    smudge = baz-smudge %f
    priority = 2"

  actual=$(git lfs ext list foo)
  [ "$actual" = "$fooExpected" ]

  actual=$(git lfs ext list bar)
  [ "$actual" = "$barExpected" ]

  actual=$(git lfs ext list baz)
  [ "$actual" = "$bazExpected" ]

  actual=$(git lfs ext list foo bar)
  expected=$(printf "%s\n%s" "$fooExpected" "$barExpected")
  [ "$actual" = "$expected" ]

  actual=$(git lfs ext list)
  expected=$(printf "%s\n%s\n%s" "$fooExpected" "$barExpected" "$bazExpected")
  [ "$actual" = "$expected" ]

  actual=$(git lfs ext)
  [ "$actual" = "$expected" ]
)
end_test