Skip to content

Conversation

@mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Jul 16, 2016

These are a few trivial cleanups collected while working on #33. Merges/includes #33, I will rebase as necessary.

Test-heavy to the point of ridiculousness, rationale is #39 (comment) .

@mtrmac mtrmac changed the title Cleanups WIP: Cleanups Jul 16, 2016
@runcom
Copy link
Member

runcom commented Jul 18, 2016

Test-heavy to the point of ridiculousness, rationale is #39 (comment) .

never enough about testing 😄

mtrmac added 9 commits July 18, 2016 21:19
$() is substituted by make; $$() by the shell.

Also fix policy_reference_match.go to comply.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This improves on the dirReference encapsulation, and makes the methods
clearly related to dirReference instead of arbitrary strings.

Does not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This improves the ociReference encapsulation, and makes the methods
clearly related to ociReference instead of arbitrary strings.

Does not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Instead of supplying literals to ensureParentDirectoryExists, first
compute the path of the file within the directory using the ociReference
methods, and then use that to compute the parent directory path.

Should not change behavior, except that filepath.Dir() implicitly calls
filepath.Clean(), apparently incompatible with UNIX path semantics.  But
then we always call filepath.Join() with the same d.ref.dir input, which
makes the same implicit call, and Go's handling of symlinks and .. seems
close-to-unfixably broken in general, and trying to fix that only here
is rather pointless:
golang/go#4382

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This improves the dockerReference encapsulation, and makes it more clear
that the reference.IsNameOnly case can not happen.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
In principle this may return incorrect results if the underlying file is
replaced between the two calls, in practice computing and looking up the
path twice is just unnecessary overhead.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
We should not allow invalid tags even by callers who “know OCI”.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Use a helper function for testing unmarshaling of obviously invalid
JSON.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@mtrmac mtrmac changed the title WIP: Cleanups Cleanups Jul 18, 2016
@mtrmac
Copy link
Collaborator Author

mtrmac commented Jul 18, 2016

Rebased, ready for review (but by no means urgent).

@runcom
Copy link
Member

runcom commented Jul 18, 2016

👍 feel free to merge

Approved with PullApprove

@mtrmac
Copy link
Collaborator Author

mtrmac commented Jul 19, 2016

👍

Approved with PullApprove

@mtrmac mtrmac merged commit 0c795ea into containers:master Jul 19, 2016
@mtrmac mtrmac deleted the cleanups branch July 19, 2016 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants