pijul_org / pijul

test: Add a case about forking from a patch

By lthms on May 1, 2018
This patch is not signed.
A91y9zQHKj7bjATjopKTKxyoVKKvQe3oAH5yLEgBCricrN7hcNT57EcwXihcXU56VaH2s5fRwDBcmKs53Hj5r3FF
This patch is in the following branches:
latest
master
testing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    patch_number=$(("$(pijul log --hash-only | wc -l)" - 1))
#!/usr/bin/env bats

load ../test_helper

@test "fork from a patch" {
    pijul init

    echo "change 1" > file.txt
    pijul add file.txt
    pijul record -A me -a -m "change 1"

    echo "change 2" > file.txt
    target="$(pijul record -A me -a -m "change 2" | sed -e 's/Recorded patch //')"

    echo "change 3" > file.txt
    pijul record -A me -a -m "change 3"

    pijul fork --patch "${target}" test

    patch_number=$(pijul log --hash-only | wc -l)

    [ ${patch_number} -eq 2 ]
}