summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7b802b8)
raw | patch | inline | side by side (parent: 7b802b8)
author | Junio C Hamano <junkio@cox.net> | |
Sat, 10 Feb 2007 02:51:40 +0000 (18:51 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 22 Feb 2007 10:02:15 +0000 (02:02 -0800) |
They used to open and read index themselves, but they now expect
their callers to do so.
Signed-off-by: Junio C Hamano <junkio@cox.net>
their callers to do so.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-diff-files.c | patch | blob | history | |
builtin-diff-index.c | patch | blob | history | |
builtin-diff.c | patch | blob | history | |
diff-lib.c | patch | blob | history | |
wt-status.c | patch | blob | history |
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index 5d4a5c5828d1202b6d6b2eadffc51fc131a37dc5..3ee26059fcf1fb23147fc41971438a823042b9c1 100644 (file)
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
if (rev.pending.nr ||
rev.min_age != -1 || rev.max_age != -1)
usage(diff_files_usage);
+ if (read_cache() < 0) {
+ perror("read_cache");
+ return -1;
+ }
return run_diff_files(&rev, silent);
}
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index 95a3db156bda2d1e8d2ad7bdf72a9f9a821c6f51..083599d5c4c174cfab7c148428630534e4cd8174 100644 (file)
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
if (rev.pending.nr != 1 ||
rev.max_count != -1 || rev.min_age != -1 || rev.max_age != -1)
usage(diff_cache_usage);
+ if (read_cache() < 0) {
+ perror("read_cache");
+ return -1;
+ }
return run_diff_index(&rev, cached);
}
diff --git a/builtin-diff.c b/builtin-diff.c
index a6590205e8f746304f3d06d3e328a05bf2bf954e..12d11f0c555d2ba80b2f14d4a43c13733574330e 100644 (file)
--- a/builtin-diff.c
+++ b/builtin-diff.c
if (revs->max_count < 0 &&
(revs->diffopt.output_format & DIFF_FORMAT_PATCH))
revs->combine_merges = revs->dense_combined_merges = 1;
+ if (read_cache() < 0) {
+ perror("read_cache");
+ return -1;
+ }
return run_diff_files(revs, silent);
}
revs->max_count != -1 || revs->min_age != -1 ||
revs->max_age != -1)
usage(builtin_diff_usage);
+ if (read_cache() < 0) {
+ perror("read_cache");
+ return -1;
+ }
return run_diff_index(revs, cached);
}
diff --git a/diff-lib.c b/diff-lib.c
index 91cd87742f9efd2c0fcf878c179bc6ed989cb50a..278ba79ee633b8109be2083597d43286c0ae08d8 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
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;
if (!revs->ignore_merges)
match_missing = 1;
- if (read_cache() < 0) {
- perror("read_cache");
- return -1;
- }
mark_merge_entries();
ent = revs->pending.objects[0].item;
diff --git a/wt-status.c b/wt-status.c
index 2879c3d5ecc5483dea779116381a036fd2dd0b45..e3465111530b1fb1ce7645cb810c00c2339f01a4 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
wt_status_print_trailer();
}
+static void wt_read_cache(struct wt_status *s)
+{
+ discard_cache();
+ read_cache();
+}
+
void wt_status_print_initial(struct wt_status *s)
{
int i;
char buf[PATH_MAX];
- read_cache();
+ wt_read_cache(s);
if (active_nr) {
s->commitable = 1;
wt_status_print_cached_header(NULL);
rev.diffopt.format_callback = wt_status_print_updated_cb;
rev.diffopt.format_callback_data = s;
rev.diffopt.detect_rename = 1;
+ wt_read_cache(s);
run_diff_index(&rev, 1);
}
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = wt_status_print_changed_cb;
rev.diffopt.format_callback_data = s;
+ wt_read_cache(s);
run_diff_files(&rev, 0);
}
setup_revisions(0, NULL, &rev, s->reference);
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
rev.diffopt.detect_rename = 1;
+ wt_read_cache(s);
run_diff_index(&rev, 1);
}
}
else {
wt_status_print_updated(s);
- discard_cache();
}
wt_status_print_changed(s);