File: t-submodule-recurse.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 (64 lines) | stat: -rwxr-xr-x 1,477 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash

. "$(dirname "$0")/testlib.sh"
reponame="submodule-recurse-test-repo"
submodname="submodule-recurse-test-submodule"

begin_test "submodule with submodule.recurse = true"
(
  set -e

  setup_remote_repo "$reponame"
  setup_remote_repo "$submodname"

  clone_repo "$submodname" submodule

  git lfs track "*.dat" 2>&1 | tee track.log
  grep "Tracking \"\*.dat\"" track.log

  echo "foo" > file.dat
  git add .gitattributes file.dat
  git commit -a -m "add file"
  git push origin main
  subcommit1=$(git rev-parse HEAD)

  echo "bar" > file.dat
  git add file.dat
  git commit -a -m "update file"
  git push origin main
  subcommit2=$(git rev-parse HEAD)

  clone_repo "$reponame" repo
  git submodule add "$GITSERVER/$submodname" submodule
  git submodule update --init --recursive
  git -C submodule reset --hard "$subcommit1"
  git add .gitmodules submodule
  git commit -m "add submodule"
  git push origin main

  git checkout -b feature
  git -C submodule reset --hard "$subcommit2"
  git add .gitmodules submodule
  git commit -m "update submodule"
  git push origin feature

  clone_repo "$reponame" repo-no-recurse
  git submodule update --init --recursive
  git checkout feature

  if [[ -d "submodule/lfs/logs" ]]
  then
    exit 1
  fi

  clone_repo "$reponame" repo-recurse
  git config submodule.recurse true
  git submodule update --init --recursive
  git checkout feature

  if [[ -d "submodule/lfs/logs" ]]
  then
    exit 1
  fi
)
end_test