File: rebase.t

package info (click to toggle)
git-subrepo 0.4.9-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,552 kB
  • sloc: sh: 7,074; makefile: 273; perl: 226
file content (63 lines) | stat: -rw-r--r-- 1,222 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash

set -e

source test/setup

use Test::More

# Setup foo with 2 branches, one before the subrepo
# is added and one after so that we can rebase
# thus destroying the parent in two ways. The first
# destroys the second parent, but leave a reference to
# a merge point. The second such that no history of
# a merge point exists.

clone-foo-and-bar

(
    cd "$OWNER/foo"
    git switch -c branch1
    add-new-files foo1
    subrepo-clone-bar-into-foo
    git branch branch2
    add-new-files foo2
) &> /dev/null || die

(
    cd "$OWNER/bar"
    add-new-files bar2
    git push
) &> /dev/null || die

(
    cd "$OWNER/foo"
    # Rebasing onto this merge point will still
    # be able to find the merge point at branch1
    git subrepo pull bar
)

(
    cd "$OWNER/foo"
    git switch branch2
    add-new-files foo-branch2
    git switch branch1
    git rebase branch2
) &> /dev/null || die

# Force subrepo to search of the parent SHA,
# validate it found the prevous merge point
{
    output=$(
      cd "$OWNER/foo"
      git subrepo clean --force --all
      catch git subrepo branch bar
    )

    like "$output" "caused by a rebase" \
      "subrepo detected merge point"
}

done_testing 1

teardown