From: Junio C Hamano Date: Wed, 20 Jan 2010 22:37:25 +0000 (-0800) Subject: Merge branch 'jc/symbol-static' X-Git-Tag: v1.7.0-rc0~77 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/56eb8b43ebdb38683ff5ce395d7b5e080d402b5b?ds=inline;hp=-c Merge branch 'jc/symbol-static' * jc/symbol-static: date.c: mark file-local function static Replace parse_blob() with an explanatory comment symlinks.c: remove unused functions object.c: remove unused functions strbuf.c: remove unused function sha1_file.c: remove unused function mailmap.c: remove unused function utf8.c: mark file-local function static submodule.c: mark file-local function static quote.c: mark file-local function static remote-curl.c: mark file-local function static read-cache.c: mark file-local functions static parse-options.c: mark file-local function static entry.c: mark file-local function static http.c: mark file-local functions static pretty.c: mark file-local function static builtin-rev-list.c: mark file-local function static bisect.c: mark file-local function static --- 56eb8b43ebdb38683ff5ce395d7b5e080d402b5b diff --combined bisect.c index 3d04d2a0bb,5c03398841..6dc27ee7a6 --- a/bisect.c +++ b/bisect.c @@@ -593,7 -593,7 +593,7 @@@ struct commit_list *filter_skipped(stru * is increased by one between each call, but that should not matter * for this application. */ - int get_prn(int count) { + static int get_prn(int count) { count = count * 1103515245 + 12345; return ((unsigned)(count/65536) % PRN_MODULO); } @@@ -956,7 -956,7 +956,7 @@@ int bisect_next_all(const char *prefix { struct rev_info revs; struct commit_list *tried; - int reaches = 0, all = 0, nr; + int reaches = 0, all = 0, nr, steps; const unsigned char *bisect_rev; char bisect_rev_hex[41]; @@@ -998,10 -998,8 +998,10 @@@ } nr = all - reaches - 1; - printf("Bisecting: %d revisions left to test after this " - "(roughly %d steps)\n", nr, estimate_bisect_steps(all)); + steps = estimate_bisect_steps(all); + printf("Bisecting: %d revision%s left to test after this " + "(roughly %d step%s)\n", nr, (nr == 1 ? "" : "s"), + steps, (steps == 1 ? "" : "s")); return bisect_checkout(bisect_rev_hex); } diff --combined cache.h index cf36c8160e,b4b2ba70f6..caeafb2292 --- a/cache.h +++ b/cache.h @@@ -177,20 -177,15 +177,20 @@@ struct cache_entry #define CE_HASHED (0x100000) #define CE_UNHASHED (0x200000) +#define CE_CONFLICTED (0x800000) + +/* Only remove in work directory, not index */ +#define CE_WT_REMOVE (0x400000) /* * Extended on-disk flags */ #define CE_INTENT_TO_ADD 0x20000000 +#define CE_SKIP_WORKTREE 0x40000000 /* CE_EXTENDED2 is for future extension */ #define CE_EXTENDED2 0x80000000 -#define CE_EXTENDED_FLAGS (CE_INTENT_TO_ADD) +#define CE_EXTENDED_FLAGS (CE_INTENT_TO_ADD | CE_SKIP_WORKTREE) /* * Safeguard to avoid saving wrong flags: @@@ -239,7 -234,6 +239,7 @@@ static inline size_t ce_namelen(const s ondisk_cache_entry_size(ce_namelen(ce))) #define ce_stage(ce) ((CE_STAGEMASK & (ce)->ce_flags) >> CE_STAGESHIFT) #define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE) +#define ce_skip_worktree(ce) ((ce)->ce_flags & CE_SKIP_WORKTREE) #define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE) #define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644) @@@ -451,7 -445,6 +451,6 @@@ extern int index_name_pos(const struct #define ADD_CACHE_JUST_APPEND 8 /* Append only; tree.c::read_tree() */ #define ADD_CACHE_NEW_ONLY 16 /* Do not replace existing ones */ extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option); - extern struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really); extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name); extern int remove_index_entry_at(struct index_state *, int pos); extern void remove_marked_cache_entries(struct index_state *istate); @@@ -470,9 -463,7 +469,9 @@@ extern int index_name_is_other(const st /* do stat comparison even if CE_VALID is true */ #define CE_MATCH_IGNORE_VALID 01 /* do not check the contents but report dirty on racily-clean entries */ -#define CE_MATCH_RACY_IS_DIRTY 02 +#define CE_MATCH_RACY_IS_DIRTY 02 +/* do stat comparison even if CE_SKIP_WORKTREE is true */ +#define CE_MATCH_IGNORE_SKIP_WORKTREE 04 extern int ie_match_stat(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); extern int ie_modified(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); @@@ -481,9 -472,6 +480,6 @@@ extern int index_fd(unsigned char *sha1 extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object); extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st); - /* "careful lstat()" */ - extern int check_path(const char *path, int len, struct stat *st, int skiplen); - #define REFRESH_REALLY 0x0001 /* ignore_valid */ #define REFRESH_UNMERGED 0x0002 /* allow unmerged */ #define REFRESH_QUIET 0x0004 /* be quiet about it */ @@@ -537,7 -525,6 +533,7 @@@ extern int auto_crlf extern int read_replace_refs; extern int fsync_object_files; extern int core_preload_index; +extern int core_apply_sparse_checkout; enum safe_crlf { SAFE_CRLF_FALSE = 0, @@@ -627,7 -614,6 +623,6 @@@ static inline void hashclr(unsigned cha { memset(hash, 0, 20); } - extern int is_empty_blob_sha1(const unsigned char *sha1); #define EMPTY_TREE_SHA1_HEX \ "4b825dc642cb6eb9a060e54bf8d69288fbee4904" @@@ -697,7 -683,6 +692,6 @@@ extern int has_sha1_pack(const unsigne extern int has_sha1_file(const unsigned char *sha1); extern int has_loose_object_nonlocal(const unsigned char *sha1); - extern int has_pack_file(const unsigned char *sha1); extern int has_pack_index(const unsigned char *sha1); extern const signed char hexval_table[256]; @@@ -723,7 -708,6 +717,7 @@@ extern const char *resolve_ref(const ch extern int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref); extern int dwim_log(const char *str, int len, unsigned char *sha1, char **ref); extern int interpret_branch_name(const char *str, struct strbuf *); +extern int get_sha1_mb(const char *str, unsigned char *sha1); extern int refname_match(const char *abbrev_name, const char *full_name, const char **rules); extern const char *ref_rev_parse_rules[]; @@@ -798,8 -782,6 +792,6 @@@ extern int has_symlink_leading_path(con extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int); extern int has_symlink_or_noent_leading_path(const char *name, int len); extern int has_dirs_only_path(const char *name, int len, int prefix_len); - extern void invalidate_lstat_cache(const char *name, int len); - extern void clear_lstat_cache(void); extern void schedule_dir_for_removal(const char *name, int len); extern void remove_scheduled_dirs(void); diff --combined entry.c index 9d5b232781,55b988e22b..004182c99d --- a/entry.c +++ b/entry.c @@@ -179,7 -179,7 +179,7 @@@ static int write_entry(struct cache_ent * This is like 'lstat()', except it refuses to follow symlinks * in the path, after skipping "skiplen". */ - int check_path(const char *path, int len, struct stat *st, int skiplen) + static int check_path(const char *path, int len, struct stat *st, int skiplen) { const char *slash = path + len; @@@ -206,7 -206,7 +206,7 @@@ int checkout_entry(struct cache_entry * len += ce_namelen(ce); if (!check_path(path, len, &st, state->base_dir_len)) { - unsigned changed = ce_match_stat(ce, &st, CE_MATCH_IGNORE_VALID); + unsigned changed = ce_match_stat(ce, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE); if (!changed) return 0; if (!state->force) { diff --combined git-compat-util.h index a979e41c15,85dea123a4..60c8432f85 --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -96,7 -96,6 +96,7 @@@ #include #include #include +#include #ifndef NO_SYS_SELECT_H #include #endif @@@ -199,7 -198,6 +199,6 @@@ extern void warning(const char *err, .. extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params)); extern int prefixcmp(const char *str, const char *prefix); - extern time_t tm_to_time_t(const struct tm *tm); static inline const char *skip_prefix(const char *str, const char *prefix) { diff --combined parse-options.c index 10ec21fb89,7bbed5f3e2..d218122af5 --- a/parse-options.c +++ b/parse-options.c @@@ -3,6 -3,9 +3,9 @@@ #include "cache.h" #include "commit.h" + static int parse_options_usage(const char * const *usagestr, + const struct option *opts); + #define OPT_SHORT 1 #define OPT_UNSET 2 @@@ -560,8 -563,8 +563,8 @@@ void usage_msg_opt(const char *msg usage_with_options(usagestr, options); } - int parse_options_usage(const char * const *usagestr, - const struct option *opts) + static int parse_options_usage(const char * const *usagestr, + const struct option *opts) { return usage_with_options_internal(usagestr, opts, 0); } @@@ -633,10 -636,3 +636,10 @@@ int parse_opt_with_commit(const struct commit_list_insert(commit, opt->value); return 0; } + +int parse_opt_tertiary(const struct option *opt, const char *arg, int unset) +{ + int *target = opt->value; + *target = unset ? 2 : 1; + return 0; +} diff --combined parse-options.h index 91c1500661,72fa36011b..0c996916b6 --- a/parse-options.h +++ b/parse-options.h @@@ -123,8 -123,6 +123,8 @@@ struct option (h), PARSE_OPT_NOARG, NULL, (p) } #define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), "n", (h) } #define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) } +#define OPT_UYN(s, l, v, h) { OPTION_CALLBACK, (s), (l), (v), NULL, \ + (h), PARSE_OPT_NOARG, &parse_opt_tertiary } #define OPT_DATE(s, l, v, h) \ { OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \ parse_opt_approxidate_cb } @@@ -173,9 -171,6 +173,6 @@@ struct parse_opt_ctx_t const char *prefix; }; - extern int parse_options_usage(const char * const *usagestr, - const struct option *opts); - extern void parse_options_start(struct parse_opt_ctx_t *ctx, int argc, const char **argv, const char *prefix, int flags); @@@ -192,7 -187,6 +189,7 @@@ extern int parse_opt_abbrev_cb(const st extern int parse_opt_approxidate_cb(const struct option *, const char *, int); extern int parse_opt_verbosity_cb(const struct option *, const char *, int); extern int parse_opt_with_commit(const struct option *, const char *, int); +extern int parse_opt_tertiary(const struct option *, const char *, int); #define OPT__VERBOSE(var) OPT_BOOLEAN('v', "verbose", (var), "be verbose") #define OPT__QUIET(var) OPT_BOOLEAN('q', "quiet", (var), "be quiet") diff --combined read-cache.c index d214abab16,9f4f44cb62..f4512967b8 --- a/read-cache.c +++ b/read-cache.c @@@ -15,6 -15,8 +15,8 @@@ #include "revision.h" #include "blob.h" + static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really); + /* Index extensions. * * The first letter should be 'A'..'Z' for extensions that are not @@@ -156,7 -158,7 +158,7 @@@ static int ce_modified_check_fs(struct return 0; } - int is_empty_blob_sha1(const unsigned char *sha1) + static int is_empty_blob_sha1(const unsigned char *sha1) { static const unsigned char empty_blob_sha1[20] = { 0xe6,0x9d,0xe2,0x9b,0xb2,0xd1,0xd6,0x43,0x4b,0x8b, @@@ -259,17 -261,12 +261,17 @@@ int ie_match_stat(const struct index_st { unsigned int changed; int ignore_valid = options & CE_MATCH_IGNORE_VALID; + int ignore_skip_worktree = options & CE_MATCH_IGNORE_SKIP_WORKTREE; int assume_racy_is_modified = options & CE_MATCH_RACY_IS_DIRTY; /* * If it's marked as always valid in the index, it's * valid whatever the checked-out copy says. + * + * skip-worktree has the same effect with higher precedence */ + if (!ignore_skip_worktree && ce_skip_worktree(ce)) + return 0; if (!ignore_valid && (ce->ce_flags & CE_VALID)) return 0; @@@ -569,7 -566,7 +571,7 @@@ int add_to_index(struct index_state *is int size, namelen, was_same; mode_t st_mode = st->st_mode; struct cache_entry *ce, *alias; - unsigned ce_option = CE_MATCH_IGNORE_VALID|CE_MATCH_RACY_IS_DIRTY; + unsigned ce_option = CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE|CE_MATCH_RACY_IS_DIRTY; int verbose = flags & (ADD_CACHE_VERBOSE | ADD_CACHE_PRETEND); int pretend = flags & ADD_CACHE_PRETEND; int intent_only = flags & ADD_CACHE_INTENT; @@@ -1005,20 -1002,14 +1007,20 @@@ static struct cache_entry *refresh_cach struct cache_entry *updated; int changed, size; int ignore_valid = options & CE_MATCH_IGNORE_VALID; + int ignore_skip_worktree = options & CE_MATCH_IGNORE_SKIP_WORKTREE; if (ce_uptodate(ce)) return ce; /* - * CE_VALID means the user promised us that the change to - * the work tree does not matter and told us not to worry. + * CE_VALID or CE_SKIP_WORKTREE means the user promised us + * that the change to the work tree does not matter and told + * us not to worry. */ + if (!ignore_skip_worktree && ce_skip_worktree(ce)) { + ce_mark_uptodate(ce); + return ce; + } if (!ignore_valid && (ce->ce_flags & CE_VALID)) { ce_mark_uptodate(ce); return ce; @@@ -1152,7 -1143,7 +1154,7 @@@ int refresh_index(struct index_state *i return has_errors; } - struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really) + static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really) { return refresh_cache_ent(&the_index, ce, really, NULL); } @@@ -1617,8 -1608,9 +1619,8 @@@ int read_index_unmerged(struct index_st len = strlen(ce->name); size = cache_entry_size(len); new_ce = xcalloc(1, size); - hashcpy(new_ce->sha1, ce->sha1); memcpy(new_ce->name, ce->name, len); - new_ce->ce_flags = create_ce_flags(len, 0); + new_ce->ce_flags = create_ce_flags(len, 0) | CE_CONFLICTED; new_ce->ce_mode = ce->ce_mode; if (add_index_entry(istate, new_ce, 0)) return error("%s: cannot drop to stage #0", diff --combined remote-curl.c index 70fdceade5,b76dcb2e88..1361006959 --- a/remote-curl.c +++ b/remote-curl.c @@@ -317,7 -317,7 +317,7 @@@ static size_t rpc_out(void *ptr, size_ } #ifndef NO_CURL_IOCTL - curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp) + static curlioerr rpc_ioctl(CURL *handle, int cmd, void *clientp) { struct rpc_state *rpc = clientp; @@@ -510,7 -510,7 +510,7 @@@ static int rpc_service(struct rpc_stat strbuf_addf(&buf, "Content-Type: application/x-%s-request", svc); rpc->hdr_content_type = strbuf_detach(&buf, NULL); - strbuf_addf(&buf, "Accept: application/x-%s-response", svc); + strbuf_addf(&buf, "Accept: application/x-%s-result", svc); rpc->hdr_accept = strbuf_detach(&buf, NULL); while (!err) {