Adds gdk diff-config command to preview config changes

Merged James EJ requested to merge jej/diff-config into master


Adds gdk diff-config command to preview a diff of changes which will be made to gitlab/config/gitlab.yml and other config files.


I want to be able to see what changes will be made to gitlab.yml before overwriting it. Especially when working on a feature which requires me to change things. Similarly I keep a line commented out in Procfile and don't want to unnecessarily reset that.


  1. Creates a temporary backup at file.unchanged
  2. Runs Make to update the config file
  3. Runs git diff --color --no-index file file.unchanged
  4. Restores file

After all files have been updated the Make output is printed to stderr, followed by the diff output to stdout. This allows gdk diff-config | less to show just the relevant output.

Works by creating a temporary blob with git hash-object -w for each file, making changes, comparing and finally restoring the original file.

The comparison step works by using git mktree to create a fake tree object for the config files, another after making changes, and using git diff old_tree new_tree to compare the two.


After the following gdk diff-config I can update a single file with make gitlab/config/database.yml instead of overwriting my changes to two other files at the same time with gdk reconfigure:

diff from 'gdk diff-config'

Edited by James EJ

Merge request reports