aboutsummaryrefslogtreecommitdiff
path: root/src/tools/git-external-diff
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2018-05-24 23:45:31 +0930
committerAndrew Dunstan <andrew@dunslane.net>2018-05-24 23:45:31 +0930
commit4431c94c3606ab54594b15ad89c7e71e46b4fb6a (patch)
tree203bd94954867d2c5bf8bb0cf8d90287f060659e /src/tools/git-external-diff
parent0c7e6b791a316431fb206a9ae2184377c4296995 (diff)
downloadpostgresql-4431c94c3606ab54594b15ad89c7e71e46b4fb6a.tar.gz
postgresql-4431c94c3606ab54594b15ad89c7e71e46b4fb6a.zip
Preserve information on use of git-external-diff
Now that the Working with git wiki page no longer suggests producing context diffs, we should preserve the information on how to use git-external-diff for those people who want to view context format diffs. The most obvious place is in the script itself, so that's what's done here.
Diffstat (limited to 'src/tools/git-external-diff')
-rw-r--r--src/tools/git-external-diff35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/tools/git-external-diff b/src/tools/git-external-diff
index 59fa36624c7..39ddd01b3d3 100644
--- a/src/tools/git-external-diff
+++ b/src/tools/git-external-diff
@@ -7,6 +7,41 @@
# path old-file old-hash old-mode new-file new-hash new-mode
# 'path' is the git-tree-relative path of the file being diff'ed
+=comment
+
+This info is copied from the old wiki page on Working with git:
+
+Context diffs with Git
+
+Copy git-external-diff into libexec/git-core/ of your git installation
+and configure git to use that wrapper with:
+
+ git config [--global] diff.external git-external-diff
+
+--global makes the configuration global for your user - otherwise it is
+just configured for the current repository.
+
+For every command which displays diffs in some way you can use the
+parameter "--[no-]-ext-diff" to enable respectively disable using the
+external diff command.
+
+For the git diff command --ext-diff is enabled by default - for any
+other command like git log -p or git format-patch it is not!
+
+This method should work on all platforms supported by git.
+
+If you do not want to configure the external wrapper permanently or you
+want to overwrite it you can also invoke git like:
+
+ export GIT_EXTERNAL_DIFF=git-external-diff
+ git diff --[no-]ext-diff
+
+Alternatively, configure a git alias in ~/.gitconfig or .git/config:
+
+ [alias]
+ cdiff = !GIT_EXTERNAL_DIFF=git-context-diff git diff
+=cut
+
old_hash="$3"
new_hash=$(git hash-object "$5")