From d516c2d11945cf13ed3d961fa63817c60b7a566b Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 22 Feb 2007 21:50:10 +0100 Subject: Teach git-diff-files the new option `--no-index` With this flag and given two paths, git-diff-files behaves as a GNU diff lookalike (plus the git goodies like --check, colour, etc.). This flag is also available in git-diff. It also works outside of a git repository. In addition, if git-diff{,-files} is called without revision or stage parameter, and with exactly two paths at least one of which is not tracked, the default is --no-index. So, you can now say git diff /etc/inittab /etc/fstab and it actually works! This also unifies the duplicated argument parsing between cmd_diff_files() and builtin_diff_files(). Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- Documentation/git-diff-files.txt | 5 ++++- Documentation/git-diff.txt | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt index 7248b35d95..b78c4c64f1 100644 --- a/Documentation/git-diff-files.txt +++ b/Documentation/git-diff-files.txt @@ -8,7 +8,7 @@ git-diff-files - Compares files in the working tree and the index SYNOPSIS -------- -'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc] [] [...] +'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc|-n|--no-index] [] [...] DESCRIPTION ----------- @@ -36,6 +36,9 @@ omit diff output for unmerged entries and just show "Unmerged". diff, similar to the way 'diff-tree' shows a merge commit with these flags. +\-n,\--no-index:: + Compare the two given files / directories. + -q:: Remain silent even on nonexistent files diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt index 6a098df26b..12a531d1e9 100644 --- a/Documentation/git-diff.txt +++ b/Documentation/git-diff.txt @@ -23,6 +23,10 @@ tree and the index file, or the index file and the working tree. further add to the index but you still haven't. You can stage these changes by using gitlink:git-add[1]. + If exactly two paths are given, and at least one is untracked, + compare the two files / directories. This behavior can be + forced by --no-index. + 'git-diff' [--options] --cached [] [--] [...]:: This form is to view the changes you staged for the next -- cgit v1.2.3