4 * Check that a set of files are up-to-date in the filesystem or
5 * do not exist. Used to verify a patch target before doing a patch.
7 * Copyright (C) 2005 Linus Torvalds
11 static void check_file(const char *path)
13 int fd = open(path, O_RDONLY);
14 struct cache_entry *ce;
18 /* Nonexistent is fine */
21 die("%s: %s", path, strerror(errno));
25 /* Exists but is not in the cache is not fine */
26 pos = cache_name_pos(path, strlen(path));
28 die("preparing to update existing file '%s' not in cache", path);
29 ce = active_cache[pos];
31 if (fstat(fd, &st) < 0)
32 die("fstat(%s): %s", path, strerror(errno));
34 changed = cache_match_stat(ce, &st);
36 die("preparing to update file '%s' not uptodate in cache", path);
39 int main(int argc, char **argv)
44 for (i = 1; i < argc ; i++)