git-diff: Introduce --index and deprecate --cached.
'git diff --cached' still works, but its use is discouraged in the documentation. 'git diff --index' does the same thing and is consistent with how 'git apply --index' works. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Junio C Hamano <junkio@cox.net>maint
							parent
							
								
									ced7b828fa
								
							
						
					
					
						commit
						4c81c213a4
					
				|  | @ -22,8 +22,10 @@ the number of trees given to the command. | ||||||
|  |  | ||||||
| * When one <tree-ish> is given, the working tree and the named | * When one <tree-ish> is given, the working tree and the named | ||||||
|   tree are compared, using `git-diff-index`.  The option |   tree are compared, using `git-diff-index`.  The option | ||||||
|   `--cached` can be given to compare the index file and |   `--index` can be given to compare the index file and | ||||||
|   the named tree. |   the named tree. | ||||||
|  |   `--cached` is a deprecated alias for `--index`. It's use is | ||||||
|  |   discouraged. | ||||||
|  |  | ||||||
| * When two <tree-ish>s are given, these two trees are compared | * When two <tree-ish>s are given, these two trees are compared | ||||||
|   using `git-diff-tree`. |   using `git-diff-tree`. | ||||||
|  | @ -47,7 +49,7 @@ Various ways to check your working tree:: | ||||||
| + | + | ||||||
| ------------ | ------------ | ||||||
| $ git diff            <1> | $ git diff            <1> | ||||||
| $ git diff --cached   <2> | $ git diff --index    <2> | ||||||
| $ git diff HEAD       <3> | $ git diff HEAD       <3> | ||||||
| ------------ | ------------ | ||||||
| + | + | ||||||
|  |  | ||||||
|  | @ -137,7 +137,7 @@ static int builtin_diff_index(struct rev_info *revs, | ||||||
| 	int cached = 0; | 	int cached = 0; | ||||||
| 	while (1 < argc) { | 	while (1 < argc) { | ||||||
| 		const char *arg = argv[1]; | 		const char *arg = argv[1]; | ||||||
| 		if (!strcmp(arg, "--cached")) | 		if (!strcmp(arg, "--index") || !strcmp(arg, "--cached")) | ||||||
| 			cached = 1; | 			cached = 1; | ||||||
| 		else | 		else | ||||||
| 			usage(builtin_diff_usage); | 			usage(builtin_diff_usage); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Andreas Ericsson
						Andreas Ericsson