From 29d76d4b05bc537ac59fd1e6f849ab3386c01502 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 12 Apr 2005 14:17:28 -0700 Subject: [PATCH] Make "checkout-cache" silently skip up-to-date files. It used to always overwrite them if forced. Now it just realizes that they are already ok, and don't need to be touched. --- checkout-cache.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/checkout-cache.c b/checkout-cache.c index 73a1a8d66..6ed8b69ec 100644 --- a/checkout-cache.c +++ b/checkout-cache.c @@ -96,12 +96,14 @@ static int write_entry(struct cache_entry *ce) static int checkout_entry(struct cache_entry *ce) { - if (!force) { - struct stat st; + struct stat st; - if (!stat(ce->name, &st)) { - unsigned changed = cache_match_stat(ce, &st); - if (changed && !quiet) + if (!stat(ce->name, &st)) { + unsigned changed = cache_match_stat(ce, &st); + if (!changed) + return 0; + if (!force) { + if (!quiet) fprintf(stderr, "checkout-cache: %s already exists\n", ce->name); return 0; } -- 2.30.2