Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not overwrite existing file if same as tar entry #3

Merged
merged 32 commits into from Feb 4, 2021
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
936305b
Upgrade Jena version to 3.16.0 (#196)
Dec 3, 2020
9e9f1cd
remove example-settings.xml
wwelling Jan 27, 2021
d18ea1a
Merge branch 'master' of github.com:vivo-project/Vitro into vivo-1443
wwelling Jan 27, 2021
c2e35c7
remove random system out from test
wwelling Jan 27, 2021
92519c7
update home directory untar non-destructive
wwelling Jan 27, 2021
5d44716
consistent file formatting
wwelling Jan 27, 2021
2d28cac
debug log if file to untar already exists
wwelling Jan 27, 2021
7a0e1b3
prefer monadic function by getting stream in untar
wwelling Jan 27, 2021
1c84d4b
order imports
wwelling Jan 27, 2021
0028740
checksum digest to retain modified files
wwelling Jan 27, 2021
ad18328
minor comment update
wwelling Jan 27, 2021
903bf2c
comments for additional methods
wwelling Jan 27, 2021
4d43116
some more comments
wwelling Jan 27, 2021
4996e45
correct/update comments
wwelling Jan 27, 2021
86eca2a
compare checksum from digest with existing file
wwelling Jan 28, 2021
c1122b7
oops, negate write condition
wwelling Jan 28, 2021
b9b1314
combine conditionals with comment
wwelling Jan 28, 2021
8e4f558
remove already exists logs
wwelling Jan 28, 2021
6ba1f7c
remove excessive logs
wwelling Jan 28, 2021
79ab2bc
minor styling updates
wwelling Jan 28, 2021
da011ef
minor cleanup and comment corrections
wwelling Jan 28, 2021
3fb8ff8
naive checksum validation
wwelling Jan 28, 2021
e206d05
overwrite files that have not changed
wwelling Jan 28, 2021
02a8394
minor cleanup
wwelling Jan 28, 2021
96be1bb
additional naive checksum validation
wwelling Jan 28, 2021
7097006
minor grammar correction
wwelling Jan 28, 2021
2b25af9
minor format improvement
wwelling Jan 28, 2021
62468a7
add command to manually generate checksum digest
wwelling Jan 28, 2021
3759f1b
update comment
wwelling Jan 28, 2021
6af95ee
simplify parsing checksum digest using pattern
wwelling Jan 28, 2021
3c6f8ad
Merge branch 'vivo-1443' of https://github.com/awoods/Vitro into vivo…
wwelling Feb 4, 2021
fcf8ec7
do not overwrite file if same as already exists
wwelling Feb 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,16 @@ private Map<String, String> untar(File destination) {

// reading bytes into memory to avoid having to unreliably reset stream
byte[] bytes = IOUtils.toByteArray(tarInput);
digest.put(outFilename, checksum(bytes));
String newFileChecksum = checksum(bytes);
digest.put(outFilename, newFileChecksum);

// if file already exists and stored digest contains the file,
// check to determine if it has changed
if (outFile.exists() && storedDigest.containsKey(outFilename)) {
// if file has not changed, overwrite
write = storedDigest.get(outFilename).equals(checksum(outFile));
String existingFileChecksum = checksum(outFile);
// if file has not changed and is not the same as new file, overwrite
write = storedDigest.get(outFilename).equals(existingFileChecksum)
&& !existingFileChecksum.equals(newFileChecksum);
}

if (write) {
Expand Down