]> git.scottworley.com Git - pinch/blame - tests/multi-update.sh
Update merges multiple files
[pinch] / tests / multi-update.sh
CommitLineData
01ba0eb2
SW
1#!/bin/sh
2
3repo_dir="`mktemp -d`"
4repo="$repo_dir/repo"
5git init "$repo"
6(
7 cd "$repo"
8 echo Contents > test-file
9 git add test-file
10 git commit -m 'Commit message'
11)
12
13conf1="`mktemp`"
14cat > "$conf1" <<EOF
15[foo]
16git_repo = file://$repo
17git_ref = master
18EOF
19
20conf2="`mktemp`"
21cat > "$conf2" <<EOF
22[bar]
23alias_of = foo
24EOF
25
26python3 ./pinch.py pin "$conf1"
27python3 ./pinch.py pin "$conf2"
28
29actual_env_command=`python3 ./pinch.py update --dry-run "$conf1" "$conf2"`
30
31rm -rf "$repo_dir" "$conf1" "$conf2"
32
33expected_env_command_RE='^nix-env --profile /nix/var/nix/profiles/per-user/[^/]+/channels --show-trace --file '\''<nix/unpack-channel.nix>'\'' --install --from-expression '\''f: f \{ name = "(repo-[0-9]{10}-[0-9a-f]{11})"; channelName = "bar"; src = builtins.storePath "/nix/store/.{32}-\1.tar.xz"; \}'\'' '\''f: f \{ name = "\1"; channelName = "foo"; src = builtins.storePath "/nix/store/.{32}-\1.tar.xz"; \}'\''$'
34
35if echo "$actual_env_command" | egrep "$expected_env_command_RE" > /dev/null;then
36 echo PASS
37else
38 echo "Output: $actual_env_command"
39 echo "does not match RE: $expected_env_command_RE"
40 exit 1
41fi