* 'js/diff-ni' (early part):
diff --no-index: also imitate the exit status of diff(1)
Fix typo: do not show name1 when name2 fails
Teach git-diff-files the new option `--no-index`
run_diff_{files,index}(): update calling convention.
update-index: do not die too early in a read-only repository.
git-status: do not be totally useless in a read-only repository.
@ -8,7 +8,7 @@ git-diff-files - Compares files in the working tree and the index
@@ -8,7 +8,7 @@ git-diff-files - Compares files in the working tree and the index
@ -36,6 +36,9 @@ omit diff output for unmerged entries and just show "Unmerged".
@@ -36,6 +36,9 @@ omit diff output for unmerged entries and just show "Unmerged".
diff, similar to the way 'diff-tree' shows a merge
@ -23,6 +23,10 @@ tree and the index file, or the index file and the working tree.
@@ -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
int run_diff_files_cmd(struct rev_info *revs, int argc, const char **argv)
{
int silent_on_removed;
if (handle_diff_files_args(revs, argc, argv, &silent_on_removed))
return -1;
if (revs->max_count == -2) {
if (revs->diffopt.nr_paths != 2)
return error("need two files/directories with --no-index");
if (queue_diff(&revs->diffopt, revs->diffopt.paths[0],
revs->diffopt.paths[1]))
return -1;
diffcore_std(&revs->diffopt);
diff_flush(&revs->diffopt);
/*
* The return code for --no-index imitates diff(1):
* 0 = no changes, 1 = changes, else error
*/
return revs->diffopt.found_changes;
}
if (read_cache() < 0) {
perror("read_cache");
return -1;
}
return run_diff_files(revs, silent_on_removed);
}
int run_diff_files(struct rev_info *revs, int silent_on_removed)
{
int entries, i;
@ -20,11 +236,7 @@ int run_diff_files(struct rev_info *revs, int silent_on_removed)
@@ -20,11 +236,7 @@ int run_diff_files(struct rev_info *revs, int silent_on_removed)
if (diff_unmerged_stage < 0)
diff_unmerged_stage = 2;
entries = read_cache();
if (entries < 0) {
perror("read_cache");
return -1;
}
entries = active_nr;
for (i = 0; i < entries; i++) {
struct stat st;
unsigned int oldmode, newmode;
@ -362,10 +574,6 @@ int run_diff_index(struct rev_info *revs, int cached)
@@ -362,10 +574,6 @@ int run_diff_index(struct rev_info *revs, int cached)