aboutsummaryrefslogtreecommitdiffstats
path: root/update-cache.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-20 21:18:54 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-20 21:18:54 -0700
commit0ed3715ffc97325a625e1e4ef44121d870b98679 (patch)
tree20c1c1a3614aac9522318fa38302f41279df5e38 /update-cache.c
parent218e441daf24b9c3be0f5ec423ace5185389ca61 (diff)
downloadgit-0ed3715ffc97325a625e1e4ef44121d870b98679.tar.gz
Add "-q" flag to git-update-cache
It suppresses the "needs update" message for subsequent "--refresh" cases (but not other errors). Will be useful for "git commit". Stay tuned.
Diffstat (limited to 'update-cache.c')
-rw-r--r--update-cache.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/update-cache.c b/update-cache.c
index d2f79fa453..7c2698df6e 100644
--- a/update-cache.c
+++ b/update-cache.c
@@ -12,7 +12,7 @@
* like "git-update-cache *" and suddenly having all the object
* files be revision controlled.
*/
-static int allow_add = 0, allow_remove = 0, allow_replace = 0, not_new = 0;
+static int allow_add = 0, allow_remove = 0, allow_replace = 0, not_new = 0, quiet = 0;
static int force_remove;
/* Three functions to allow overloaded pointer return; see linux/err.h */
@@ -222,10 +222,12 @@ static int refresh_cache(void)
new = refresh_entry(ce);
if (IS_ERR(new)) {
- if (!(not_new && PTR_ERR(new) == -ENOENT)) {
- printf("%s: needs update\n", ce->name);
- has_errors = 1;
- }
+ if (not_new && PTR_ERR(new) == -ENOENT)
+ continue;
+ if (quiet)
+ continue;
+ printf("%s: needs update\n", ce->name);
+ has_errors = 1;
continue;
}
active_cache_changed = 1;
@@ -352,6 +354,10 @@ int main(int argc, char **argv)
allow_options = 0;
continue;
}
+ if (!strcmp(path, "-q")) {
+ quiet = 1;
+ continue;
+ }
if (!strcmp(path, "--add")) {
allow_add = 1;
continue;