[PATCH 2/2] git-runstatus --refresh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This teaches git-runstatus a new option --refresh to refresh the
index in-core.

Signed-off-by: Junio C Hamano <junkio@xxxxxxx>
---
 * If a cache has 20k+ paths, this could be rather expensive
   because git-status already have refreshed the entries for us,
   so I am reluctant to make this the default, but obviously
   then qgit needs to know if it has runstatus that knows about
   this option.

 builtin-runstatus.c |    4 +++-
 wt-status.c         |    2 ++
 wt-status.h         |    1 +
 3 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/builtin-runstatus.c b/builtin-runstatus.c
index 4b489b1..df66742 100644
--- a/builtin-runstatus.c
+++ b/builtin-runstatus.c
@@ -4,7 +4,7 @@
 extern int wt_status_use_color;
 
 static const char runstatus_usage[] =
-"git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]";
+"git-runstatus [--color|--nocolor] [--refresh] [--amend] [--verbose] [--untracked]";
 
 int cmd_runstatus(int argc, const char **argv, const char *prefix)
 {
@@ -17,6 +17,8 @@ int cmd_runstatus(int argc, const char **argv, const char *prefix)
 	for (i = 1; i < argc; i++) {
 		if (!strcmp(argv[i], "--color"))
 			wt_status_use_color = 1;
+		else if (!strcmp(argv[i], "--refresh"))
+			s.refresh = 1;
 		else if (!strcmp(argv[i], "--nocolor"))
 			wt_status_use_color = 0;
 		else if (!strcmp(argv[i], "--amend")) {
diff --git a/wt-status.c b/wt-status.c
index e346511..27c228b 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -195,6 +195,8 @@ static void wt_read_cache(struct wt_status *s)
 {
 	discard_cache();
 	read_cache();
+	if (s->refresh)
+		refresh_cache(REFRESH_QUIET);
 }
 
 void wt_status_print_initial(struct wt_status *s)
diff --git a/wt-status.h b/wt-status.h
index cfea4ae..680a0ca 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -15,6 +15,7 @@ struct wt_status {
 	int verbose;
 	int amend;
 	int untracked;
+	int refresh;
 	/* These are computed during processing of the individual sections */
 	int commitable;
 	int workdir_dirty;
-- 
1.5.0.rc4.26.gcc46


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]