Skip to content

Commit

Permalink
fix diff
Browse files Browse the repository at this point in the history
  • Loading branch information
usatiuk committed Dec 24, 2023
1 parent 1f72814 commit 404f6ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/repo/srcs/FileRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

FileRepository::FileRepository(Config config)
: Repository(std::move(config)), root(std::filesystem::path(this->config.getStr("repo"))),
writeCacheMax(config.getInt("repo-target") * 1024 * 1024) {}
writeCacheMax(this->config.getInt("repo-target") * 1024 * 1024) {}

bool FileRepository::exists() { return std::filesystem::is_directory(root) && std::filesystem::exists(root / "info"); }

Expand Down
24 changes: 12 additions & 12 deletions tests/clitests/scripts/diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ echo "testtestasdf9uuu" > "$TESTDATADIR"/testdata/4/filexd

echo "Data created"

if ! $CMD init --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
if ! $CMD init --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
echo "Error creating repo!"
exit 1
fi
echo "Repo created"

OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress simple --verbose 1)
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress simple --verbose 1)
echo "$OUT"
if ! ( ( echo "$OUT" | grep -q 'Copied: notempty/testfile' )\
&& ( echo "$OUT" | grep -q 'Copied: notempty' )\
Expand All @@ -87,7 +87,7 @@ if ! ( ( echo "$OUT" | grep -q 'Copied: notempty/testfile' )\
fi
echo "Backup 1 ok"

OUT=$($CMD run --from "$TESTDATADIR"/testdata/2 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress simple --verbose 1)
OUT=$($CMD run --from "$TESTDATADIR"/testdata/2 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress simple --verbose 1)
echo "$OUT"
if ! ( ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4 ' )\
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5 ' )\
Expand All @@ -100,7 +100,7 @@ if ! ( ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4 ' )\
fi
echo "Backup 2 ok"

OUT=$($CMD run --from "$TESTDATADIR"/testdata/3 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress simple --verbose 1)
OUT=$($CMD run --from "$TESTDATADIR"/testdata/3 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress simple --verbose 1)
echo "$OUT"
if ! ( ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4 ' )\
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5 ' )\
Expand All @@ -116,23 +116,23 @@ echo "Backup 3 ok"

i=$((0))
AIDS=()
OUT=$($CMD list --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff)
OUT=$($CMD list --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff)
echo "$OUT"
while IFS= read -r l; do
((i++))
aid=$(echo $l | grep -Eo '[0-9]+' | tail -1)
AIDS+=("$aid")
done <<< "$OUT"

OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[0]} --aid2 ${AIDS[1]})
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[0]} --aid2 ${AIDS[1]})
echo "$OUT"
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
echo "Error comparing archive 1 and 2!"
exit 1
fi
echo "OK comparing archive 1 and 2"
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
echo "$OUT"
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
Expand All @@ -141,7 +141,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && (
fi
echo "OK comparing archive 2 and 3"

OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]})
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]})
echo "$OUT"
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
Expand All @@ -150,7 +150,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && (
fi
echo "OK comparing archive 3 and current"

OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 )
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress none --verbose 1 )
echo "$OUT"
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
Expand All @@ -159,7 +159,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && (
fi
echo "OK comparing archive last (3) and current"

OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]} --prefix notempty2/notemptyi2 )
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]} --prefix notempty2/notemptyi2 )
echo "$OUT"
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ! ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
Expand All @@ -168,7 +168,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && !
fi
echo "OK comparing archive 3 and current with prefix "

OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --prefix notempty2/notemptyi2 )
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdataDIR/testdir/to1 --password asdff --progress none --verbose 1 --prefix notempty2/notemptyi2 )
echo "$OUT"
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ! ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
Expand All @@ -178,6 +178,6 @@ fi
echo "OK comparing archive last (3) and current with prefix "


rm -rf "$"$TESTDATADIR"/testdataDIR"
rm -rf "$TESTDATADIR"/testdataDIR

exit 0

0 comments on commit 404f6ad

Please sign in to comment.