Fix support for dyff
as external diff program
#30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
dyff has some special integration in place that makes it compatible with
kubectl diff
, see homeport/dyff#149.This is because, with
KUBECTL_EXTERNAL_DIFF="dyff between"
,kubectl
callsdyff <from> <to> between
, butdyff
expectsdyff between <from> <to>
.kubectl diff
uses different directories for from and to, which is automatically handled bydyff
: https://github.com/homeport/dyff/blame/c382d5132c86d2280335f4cb71754ab20776a85a/internal/cmd/root.go#L85-L98While
kubectl revisions diff
uses the same implementation for calling an external diff program likekubectl diff
, the difference is thatkubectl revisions diff
doesn't use dedicated directories for from and to.This PR changes the plugin to use dedicated directories as well, so that
dyff
works as an external diff program.This might seem a bit hacky. Instead, one could also write a custom implementation that doesn't append but prepend args like
between
. However, I'm reluctant to stop reusing kubectl's implementation because it might reveal further discrepancies in the future.The PR also adds a dedicated e2e test that ensures
kubectl revisions diff
works with the recommended setup for usingdyff
with kubectl, i.e., that it works with the sameKUBECTL_EXTERNAL_DIFF
setting.