{"thread":{"id":"18395","subject":"[PATCH] difftool: move 'git-difftool' out of contrib","startedAt":"2009-03-19T08:25:25Z","lastAt":"2009-03-19T08:25:25Z","messageCount":1,"participants":["David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"108488","messageId":"1237451125-10611-1-git-send-email-davvid@gmail.com","threadId":"18395","inReplyTo":null,"subject":"[PATCH] difftool: move 'git-difftool' out of contrib","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2009-03-19T08:25:25Z","receivedAt":"2009-03-19T08:25:25Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"This prepares 'git-difftool' and its documentation for\nmainstream use.  The backup file feature was removed since\nmost users found it annoying.  The reasoning is that it's\nbetter to start out with less features from the get-go and\nonly add things as users ask for them.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\n\nMost of these documentation changes were done to make things\nmore consistent.\n\n .gitignore                                         |    2 +\n Documentation/config.txt                           |   17 +++++++++\n .../difftool => Documentation}/git-difftool.txt    |   35 +++++++------------\n Makefile                                           |    2 +\n .../git-difftool-helper => git-difftool-helper.sh  |   34 +------------------\n contrib/difftool/git-difftool => git-difftool.perl |    0\n 6 files changed, 35 insertions(+), 55 deletions(-)\n rename {contrib/difftool => Documentation}/git-difftool.txt (73%)\n rename contrib/difftool/git-difftool-helper => git-difftool-helper.sh (86%)\n rename contrib/difftool/git-difftool => git-difftool.perl (100%)\n\ndiff --git a/.gitignore b/.gitignore\nindex 1c57d4c..966c886 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -35,6 +35,8 @@ git-diff\n git-diff-files\n git-diff-index\n git-diff-tree\n+git-difftool\n+git-difftool-helper\n git-describe\n git-fast-export\n git-fast-import\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 12540b6..fda6c4c 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -663,6 +663,23 @@ diff.suppressBlankEmpty::\n \tA boolean to inhibit the standard behavior of printing a space\n \tbefore each empty output line. Defaults to false.\n \n+diff.tool::\n+\tControls which diff tool is used.  `diff.tool` overrides\n+\t`merge.tool` when used by linkgit:git-difftool[1] and has\n+\tthe same valid values as `merge.tool`.\n+\n+difftool.<tool>.path::\n+\tOverride the path for the given tool.  This is useful in case\n+\tyour tool is not in the PATH.\n+\n+difftool.<tool>.cmd::\n+\tSpecify the command to invoke the specified diff tool.\n+\tThe specified command is evaluated in shell with the following\n+\tvariables available:  'LOCAL' is set to the name of the temporary\n+\tfile containing the contents of the diff pre-image and 'REMOTE'\n+\tis set to the name of the temporary file containing the contents\n+\tof the diff post-image.\n+\n diff.wordRegex::\n \tA POSIX Extended Regular Expression used to determine what is a \"word\"\n \twhen performing word-by-word difference calculations.  Character\ndiff --git a/contrib/difftool/git-difftool.txt b/Documentation/git-difftool.txt\nsimilarity index 73%\nrename from contrib/difftool/git-difftool.txt\nrename to Documentation/git-difftool.txt\nindex 2b7bc03..5ae02f8 100644\n--- a/contrib/difftool/git-difftool.txt\n+++ b/Documentation/git-difftool.txt\n@@ -3,35 +3,31 @@ git-difftool(1)\n \n NAME\n ----\n-git-difftool - compare changes using common merge tools\n+git-difftool - Show changes using common diff tools\n \n SYNOPSIS\n --------\n-'git difftool' [--tool=<tool>] [--no-prompt] ['git diff' options]\n+'git difftool' [--tool=<tool>] [--no-prompt] [<'git diff' options>]\n \n DESCRIPTION\n -----------\n 'git-difftool' is a git command that allows you to compare and edit files\n-between revisions using common merge tools.  At its most basic level,\n-'git-difftool' does what 'git-mergetool' does but its use is for non-merge\n-situations such as when preparing commits or comparing changes against\n-the index.\n-\n-'git difftool' is a frontend to 'git diff' and accepts the same\n-arguments and options.\n-\n-See linkgit:git-diff[1] for the full list of supported options.\n+between revisions using common diff tools.  'git difftool' is a frontend\n+to 'git-diff' and accepts the same options and arguments.\n \n OPTIONS\n -------\n+--no-prompt::\n+\tDo not prompt before launching a diff tool.\n+\n -t <tool>::\n --tool=<tool>::\n-\tUse the merge resolution program specified by <tool>.\n+\tUse the diff tool specified by <tool>.\n \tValid merge tools are:\n \tkdiff3, kompare, tkdiff, meld, xxdiff, emerge,\n \tvimdiff, gvimdiff, ecmerge, and opendiff\n +\n-If a merge resolution program is not specified, 'git-difftool'\n+If a diff tool is not specified, 'git-difftool'\n will use the configuration variable `diff.tool`.  If the\n configuration variable `diff.tool` is not set, 'git-difftool'\n will pick a suitable default.\n@@ -42,7 +38,7 @@ can configure the absolute path to kdiff3 by setting\n `difftool.kdiff3.path`. Otherwise, 'git-difftool' assumes the\n tool is available in PATH.\n +\n-Instead of running one of the known merge tool programs,\n+Instead of running one of the known diff tools,\n 'git-difftool' can be customized to run an alternative program\n by specifying the command line to invoke in a configuration\n variable `difftool.<tool>.cmd`.\n@@ -56,8 +52,7 @@ is set to the name of the temporary file containing the contents\n of the diff post-image.  `$BASE` is provided for compatibility\n with custom merge tool commands and has the same value as `$LOCAL`.\n \n---no-prompt::\n-\tDo not prompt before launching a diff tool.\n+See linkgit:git-diff[1] for the full list of supported options.\n \n CONFIG VARIABLES\n ----------------\n@@ -65,21 +60,17 @@ CONFIG VARIABLES\n difftool equivalents have not been defined.\n \n diff.tool::\n-\tThe default merge tool to use.\n+\tThe default diff tool to use.\n \n difftool.<tool>.path::\n \tOverride the path for the given tool.  This is useful in case\n \tyour tool is not in the PATH.\n \n difftool.<tool>.cmd::\n-\tSpecify the command to invoke the specified merge tool.\n+\tSpecify the command to invoke the specified diff tool.\n +\n See the `--tool=<tool>` option above for more details.\n \n-merge.keepBackup::\n-\tThe original, unedited file content can be saved to a file with\n-\ta `.orig` extension.  Defaults to `true` (i.e. keep the backup files).\n-\n SEE ALSO\n --------\n linkgit:git-diff[1]::\ndiff --git a/Makefile b/Makefile\nindex b96c2b3..cb99c5d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -265,6 +265,7 @@ BASIC_LDFLAGS =\n \n SCRIPT_SH += git-am.sh\n SCRIPT_SH += git-bisect.sh\n+SCRIPT_SH += git-difftool-helper.sh\n SCRIPT_SH += git-filter-branch.sh\n SCRIPT_SH += git-lost-found.sh\n SCRIPT_SH += git-merge-octopus.sh\n@@ -284,6 +285,7 @@ SCRIPT_SH += git-submodule.sh\n SCRIPT_SH += git-web--browse.sh\n \n SCRIPT_PERL += git-add--interactive.perl\n+SCRIPT_PERL += git-difftool.perl\n SCRIPT_PERL += git-archimport.perl\n SCRIPT_PERL += git-cvsexportcommit.perl\n SCRIPT_PERL += git-cvsimport.perl\ndiff --git a/contrib/difftool/git-difftool-helper b/git-difftool-helper.sh\nsimilarity index 86%\nrename from contrib/difftool/git-difftool-helper\nrename to git-difftool-helper.sh\nindex 9c0a134..b91002b 100755\n--- a/contrib/difftool/git-difftool-helper\n+++ b/git-difftool-helper.sh\n@@ -9,31 +9,7 @@\n \n # Set GIT_DIFFTOOL_NO_PROMPT to bypass the per-file prompt.\n should_prompt () {\n-\t! test -n \"$GIT_DIFFTOOL_NO_PROMPT\"\n-}\n-\n-# Should we keep the backup .orig file?\n-keep_backup_mode=\"$(git config --bool merge.keepBackup || echo true)\"\n-keep_backup () {\n-\ttest \"$keep_backup_mode\" = \"true\"\n-}\n-\n-# This function manages the backup .orig file.\n-# A backup $MERGED.orig file is created if changes are detected.\n-cleanup_temp_files () {\n-\tif test -n \"$MERGED\"; then\n-\t\tif keep_backup && test \"$MERGED\" -nt \"$BACKUP\"; then\n-\t\t\ttest -f \"$BACKUP\" && mv -- \"$BACKUP\" \"$MERGED.orig\"\n-\t\telse\n-\t\t\trm -f -- \"$BACKUP\"\n-\t\tfi\n-\tfi\n-}\n-\n-# This is called when users Ctrl-C out of git-difftool-helper\n-sigint_handler () {\n-\tcleanup_temp_files\n-\texit 1\n+\ttest -z \"$GIT_DIFFTOOL_NO_PROMPT\"\n }\n \n # This function prepares temporary files and launches the appropriate\n@@ -47,12 +23,6 @@ launch_merge_tool () {\n \tLOCAL=\"$2\"\n \tREMOTE=\"$3\"\n \tBASE=\"$1\"\n-\text=\"$$$(expr \"$MERGED\" : '.*\\(\\.[^/]*\\)$')\"\n-\tBACKUP=\"$MERGED.BACKUP.$ext\"\n-\n-\t# Create and ensure that we clean up $BACKUP\n-\ttest -f \"$MERGED\" && cp -- \"$MERGED\" \"$BACKUP\"\n-\ttrap sigint_handler INT\n \n \t# $LOCAL and $REMOTE are temporary files so prompt\n \t# the user with the real $MERGED name before launching $merge_tool.\n@@ -124,8 +94,6 @@ launch_merge_tool () {\n \t\tfi\n \t\t;;\n \tesac\n-\n-\tcleanup_temp_files\n }\n \n # Verifies that (difftool|mergetool).<tool>.cmd exists\ndiff --git a/contrib/difftool/git-difftool b/git-difftool.perl\nsimilarity index 100%\nrename from contrib/difftool/git-difftool\nrename to git-difftool.perl\n-- \n1.6.2.77.g8cc3f\n"}]}