Skip to content

Conversation

@williamjoy
Copy link

Code mostly copied from dyff between , trying to resolve #189

  • accepts all arguments passed from git
  • generate similar diff context like built-in git diff
  • omit dyff header when running as external git diff tool
  • set GIT_CONFIG_PARAMETERS="'color.ui=always'" to enable color output

Tested with GIT_CONFIG_PARAMETERS="'color.ui=always'" git log --ext-diff -p '**/*.yml' in current repo:

Example output (and limitations)

commit c45a66f9da22f6676b31767dca2a9e68dd62a8a3
Author: Matthias Diester <mddiester@gmail.com>
Date:   Sun Mar 27 22:32:28 2022 +0200

    Fix timestamp parse issue in JSON command
    
    Fixes #217
    
    Bump `github.com/gonvenience/neat` to pick up timestamp parsing fix.
    
    Add test case based on user feedback.

dyff --git a/assets/issues/issue-217/datestring.yml b/assets/issues/issue-217/datestring.yml
new file mode 100644
index 0000000..71d2450
--- /dev/null
+++ b/assets/issues/issue-217/datestring.yml

(root level)
+ ten map entries added:
  Datestring: 2033-12-20
  ThirteenthMonth: 2033-13-20
  FortyDays: 2033-13-40
  TheYear9999: 9999-11-20
  OneShortDatestring: 999-99-99
  ExtDatestring: 2021-01-01-04-05
  DatestringFake: 9999-99-99
  DatestringNonHyphenated: 99999999
  DatestringOneHyphen: 9999-9999
  DatestringSlashes: 2022/01/01


commit 9f044ad62aaa0354937be279cb7e815011c673b8
Author: Matthias Diester <mddiester@gmail.com>
Date:   Mon Dec 6 20:45:04 2021 +0100

    Add Kubernetes specific document compare
    
    Introduce function to compare Kubernetes resources by their name.

dyff --git a/assets/issues/issue-184/from.yml b/assets/issues/issue-184/from.yml
new file mode 100644
index 0000000..cfaa8a4
--- /dev/null
+++ b/assets/issues/issue-184/from.yml
╭ Error: failed to compare input files
│ comparing YAMLs with a different number of documents is
│ currently not supported
╵
fatal: external diff died, stopping at assets/issues/issue-184/from.yml

William Wei added 3 commits April 28, 2022 14:23
- accepts all arguments passed from git
- generate similar diff context like built-in git diff
- omit dyff header when running as external git diff tool
- set GIT_CONFIG_PARAMETERS="'color.ui=always'" to enable colors
checking with KUBECTL_EXTERNAL_DIFF env variable this will be running in
all cases even not running kubectl diff command
move arg[1], arg[2] to the end of argument list
@HeavyWombat
Copy link
Member

I am sorry, but I was very busy lately, but I am working through my backlog now. This PR will come next.

@HeavyWombat
Copy link
Member

I had a look already. For PRs like these, I tend to play around with the problem a bit to get a better feeling.

@jon-walton
Copy link

Hi @HeavyWombat

Do you have any thoughts on whether or not this PR would be accepted & merged? I would like to use dyff with git but the lack of file names in the output makes it difficult when there are multiple changed files

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.

Add git diff support

3 participants