Merge branch 'jc/symbol-static'
authorJunio C Hamano <gitster@pobox.com>
Wed, 20 Jan 2010 22:37:25 +0000 (14:37 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Jan 2010 22:37:25 +0000 (14:37 -0800)
* 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

1  2 
bisect.c
cache.h
entry.c
git-compat-util.h
parse-options.c
parse-options.h
read-cache.c
remote-curl.c
diff --combined bisect.c
index 3d04d2a0bb1d3e2cc59d0747c838ba3f981a0b54,5c03398841e135a8f5941f89a43e0b02f7b02d57..6dc27ee7a6090e56d5b0f2072a72553d3b3e3b87
+++ 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];
  
        }
  
        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 cf36c8160e8027aa608da4baf59e2d9f04f0ccdd,b4b2ba70f6875c01e0262089359f3f9da0ed8c32..caeafb229245afe5be081684094ef81f6a6a8b6b
+++ 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 9d5b232781c6760930c354c1792ad6b924f8a72d,55b988e22b0381a0d4a43f2367248f4c60b0f51c..004182c99d27a6a5825d2429f9104fc7a8f1dc80
+++ 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 a979e41c15e90a07323cef04dbd05b82f1aa4b15,85dea123a451aabb465235eb5446af991d091ee1..60c8432f854f345b77b469d64dd1429cee74d30d
@@@ -96,7 -96,6 +96,7 @@@
  #include <sys/poll.h>
  #include <sys/socket.h>
  #include <sys/ioctl.h>
 +#include <termios.h>
  #ifndef NO_SYS_SELECT_H
  #include <sys/select.h>
  #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 10ec21fb89788e19e6d8d99b29da9801bb406dd3,7bbed5f3e2f54cdcaf42c93321cdc8089008eaf5..d218122af5c2c0cddd857fce0ae5064bf32f6387
@@@ -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 91c1500661be825fea7b751230e2ac3f8b95fab4,72fa36011bf9290075d52ec071bdd63a8b1a6455..0c996916b6044989f0e2945881c7c12f7292d5c1
@@@ -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 d214abab163e30c0328eac0bd9a65749c271d173,9f4f44cb62567375ca1169acbc0542d4463793d4..f4512967b8393e7934812e667d42a97f4d67ba8c
@@@ -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 70fdceade5b0d1f13be2f9f8bba3a310d0af8182,b76dcb2e887efd5fdc977a1afb2f57500e5a9c8a..136100695994049f2e9d6357cb25dd5a9d73ae28
@@@ -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) {