aboutsummaryrefslogtreecommitdiffstats
path: root/tests/self_test.sh
blob: 52e1a28ab02728e2f021ad21a57e7bc486db7835 (plain) (blame)
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
#!/bin/bash

set -eo pipefail

# Collection of tests consisting in running `git-deps` on its own repository.
# The expected outputs of various commands are stored in the `expected_outputs` subdirectory.

# Because git-deps can only be run from the repository's root, this script should be run at
# the root of a clone of git-deps. The clone should not be shallow, so that all refs can be accessed.

echo "Running test suite"

echo "* Dependencies of 4f27a1e, a regular commit"
git-deps 4f27a1e^! | sort | diff tests/expected_outputs/deps_4f27a1e -

echo "* Same, but via pygit2's blame algorithm"
git-deps --pygit2-blame 4f27a1e^! | sort | diff tests/expected_outputs/deps_4f27a1e -

echo "* Dependencies of 1ba7ad5, a merge commit"
git-deps 1ba7ad5^! | sort | diff tests/expected_outputs/deps_1ba7ad5 -

echo "* Same, but via pygit2's blame algorithm"
git-deps --pygit2-blame 1ba7ad5^! | sort | diff tests/expected_outputs/deps_1ba7ad5 -

echo "* Dependencies of the root commit"
git-deps b196757^! | sort | diff tests/expected_outputs/deps_b196757 -

echo "* Same, but via pygit2's blame algorithm"
git-deps --pygit2-blame b196757^! | sort | diff tests/expected_outputs/deps_b196757 -

echo "* Recursive dependencies of a4f27a1e, a regular commit"
git-deps -r 4f27a1e^! | sort | diff tests/expected_outputs/recursive_deps_4f27a1e -

echo "All tests passed!"