-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Multi-Lower-Layer Overlay Support through Merging (#122)
* feat: add -L flag to support one or more lower directories * docs: shell completion, manpage, and readme update * test: add test to test merging multiple lowerdirs, and also invoking -L multiple times Note that currently -L implies -n (will not commit changes), support for that is being tracked in #142 --------- Co-authored-by: gliargovas <[email protected]> Co-authored-by: Ezri Zhu <[email protected]> Reviewed-by: Michael Greenberg <[email protected]> Reviewed-by: Konstantinos Kallas <[email protected]>
- Loading branch information
1 parent
9216d32
commit 0647f69
Showing
5 changed files
with
156 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/sh | ||
|
||
TRY_TOP="${TRY_TOP:-$(git rev-parse --show-toplevel --show-superproject-working-tree)}" | ||
TRY="$TRY_TOP/try" | ||
|
||
cleanup() { | ||
cd / | ||
|
||
if [ -d "$try_workspace" ] | ||
then | ||
rm -rf "$try_workspace" >/dev/null 2>&1 | ||
fi | ||
|
||
if [ -f "$try_example_dir1" ] | ||
then | ||
rm "$try_example_dir1" | ||
fi | ||
|
||
if [ -f "$try_example_dir2" ] | ||
then | ||
rm "$try_example_dir2" | ||
fi | ||
|
||
if [ -f "$try_example_dir3" ] | ||
then | ||
rm "$try_example_dir3" | ||
fi | ||
|
||
if [ -f "$expected1" ] | ||
then | ||
rm "$expected1" | ||
fi | ||
|
||
if [ -f "$expected2" ] | ||
then | ||
rm "$expected2" | ||
fi | ||
if [ -f "$expected3" ] | ||
then | ||
rm "$expected3" | ||
fi | ||
} | ||
|
||
trap 'cleanup' EXIT | ||
|
||
try_workspace="$(mktemp -d -p .)" | ||
cp "$TRY_TOP/test/resources/file.txt.gz" "$try_workspace/" | ||
cd "$try_workspace" || return 1 | ||
|
||
try_example_dir1="$(mktemp -d)" | ||
try_example_dir2="$(mktemp -d)" | ||
try_example_dir3="$(mktemp -d)" | ||
|
||
expected1="$(mktemp)" | ||
expected2="$(mktemp)" | ||
expected3="$(mktemp)" | ||
|
||
touch "$expected1" | ||
echo "test2" > "$expected2" | ||
echo "test3" > "$expected3" | ||
|
||
"$TRY" -D "$try_example_dir1" "touch file_1.txt; echo test > file_2.txt; rm file.txt.gz" || return 2 | ||
"$TRY" -D "$try_example_dir2" "echo test2 > file_2.txt" || return 3 | ||
"$TRY" -D "$try_example_dir3" "echo test3 > file_3.txt" || return 4 | ||
"$TRY" -L "$try_example_dir3:$try_example_dir2:$try_example_dir1" -y "cat file_1.txt > out1; cat file_2.txt > out2; cat file_3.txt > out3"|| return 5 | ||
|
||
diff -q "$expected1" out1 || return 6 | ||
diff -q "$expected2" out2 || return 7 | ||
diff -q "$expected3" out3 || return 8 | ||
|
||
! [ -f out4 ] || return 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters