Merge branch 'jc/unused-symbols'
Mark file-local symbols as "static", and drop functions that nobody uses. * jc/unused-symbols: shallow.c: make check_shallow_file_for_update() static remote.c: make clear_cas_option() static urlmatch.c: make match_urls() static revision.c: make save_parents() and free_saved_parents() static line-log.c: make line_log_data_init() static pack-bitmap.c: make pack_bitmap_filename() static prompt.c: remove git_getpass() nobody uses http.c: make finish_active_slot() and handle_curl_result() static
This commit is contained in:
commit
c985aaf879
1
commit.h
1
commit.h
@ -254,7 +254,6 @@ extern int for_each_commit_graft(each_commit_graft_fn, void *);
|
|||||||
extern int is_repository_shallow(void);
|
extern int is_repository_shallow(void);
|
||||||
extern struct commit_list *get_shallow_commits(struct object_array *heads,
|
extern struct commit_list *get_shallow_commits(struct object_array *heads,
|
||||||
int depth, int shallow_flag, int not_shallow_flag);
|
int depth, int shallow_flag, int not_shallow_flag);
|
||||||
extern void check_shallow_file_for_update(void);
|
|
||||||
extern void set_alternate_shallow_file(const char *path, int override);
|
extern void set_alternate_shallow_file(const char *path, int override);
|
||||||
extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol,
|
extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol,
|
||||||
const struct sha1_array *extra);
|
const struct sha1_array *extra);
|
||||||
|
64
http.c
64
http.c
@ -117,6 +117,37 @@ size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf)
|
|||||||
return eltsize * nmemb;
|
return eltsize * nmemb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void closedown_active_slot(struct active_request_slot *slot)
|
||||||
|
{
|
||||||
|
active_requests--;
|
||||||
|
slot->in_use = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void finish_active_slot(struct active_request_slot *slot)
|
||||||
|
{
|
||||||
|
closedown_active_slot(slot);
|
||||||
|
curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE, &slot->http_code);
|
||||||
|
|
||||||
|
if (slot->finished != NULL)
|
||||||
|
(*slot->finished) = 1;
|
||||||
|
|
||||||
|
/* Store slot results so they can be read after the slot is reused */
|
||||||
|
if (slot->results != NULL) {
|
||||||
|
slot->results->curl_result = slot->curl_result;
|
||||||
|
slot->results->http_code = slot->http_code;
|
||||||
|
#if LIBCURL_VERSION_NUM >= 0x070a08
|
||||||
|
curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL,
|
||||||
|
&slot->results->auth_avail);
|
||||||
|
#else
|
||||||
|
slot->results->auth_avail = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Run callback if appropriate */
|
||||||
|
if (slot->callback_func != NULL)
|
||||||
|
slot->callback_func(slot->callback_data);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_CURL_MULTI
|
#ifdef USE_CURL_MULTI
|
||||||
static void process_curl_messages(void)
|
static void process_curl_messages(void)
|
||||||
{
|
{
|
||||||
@ -736,12 +767,6 @@ void run_active_slot(struct active_request_slot *slot)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void closedown_active_slot(struct active_request_slot *slot)
|
|
||||||
{
|
|
||||||
active_requests--;
|
|
||||||
slot->in_use = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void release_active_slot(struct active_request_slot *slot)
|
static void release_active_slot(struct active_request_slot *slot)
|
||||||
{
|
{
|
||||||
closedown_active_slot(slot);
|
closedown_active_slot(slot);
|
||||||
@ -758,31 +783,6 @@ static void release_active_slot(struct active_request_slot *slot)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish_active_slot(struct active_request_slot *slot)
|
|
||||||
{
|
|
||||||
closedown_active_slot(slot);
|
|
||||||
curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE, &slot->http_code);
|
|
||||||
|
|
||||||
if (slot->finished != NULL)
|
|
||||||
(*slot->finished) = 1;
|
|
||||||
|
|
||||||
/* Store slot results so they can be read after the slot is reused */
|
|
||||||
if (slot->results != NULL) {
|
|
||||||
slot->results->curl_result = slot->curl_result;
|
|
||||||
slot->results->http_code = slot->http_code;
|
|
||||||
#if LIBCURL_VERSION_NUM >= 0x070a08
|
|
||||||
curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL,
|
|
||||||
&slot->results->auth_avail);
|
|
||||||
#else
|
|
||||||
slot->results->auth_avail = 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Run callback if appropriate */
|
|
||||||
if (slot->callback_func != NULL)
|
|
||||||
slot->callback_func(slot->callback_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void finish_all_active_slots(void)
|
void finish_all_active_slots(void)
|
||||||
{
|
{
|
||||||
struct active_request_slot *slot = active_queue_head;
|
struct active_request_slot *slot = active_queue_head;
|
||||||
@ -845,7 +845,7 @@ char *get_remote_object_url(const char *url, const char *hex,
|
|||||||
return strbuf_detach(&buf, NULL);
|
return strbuf_detach(&buf, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int handle_curl_result(struct slot_results *results)
|
static int handle_curl_result(struct slot_results *results)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If we see a failing http code with CURLE_OK, we have turned off
|
* If we see a failing http code with CURLE_OK, we have turned off
|
||||||
|
2
http.h
2
http.h
@ -85,9 +85,7 @@ extern curlioerr ioctl_buffer(CURL *handle, int cmd, void *clientp);
|
|||||||
extern struct active_request_slot *get_active_slot(void);
|
extern struct active_request_slot *get_active_slot(void);
|
||||||
extern int start_active_slot(struct active_request_slot *slot);
|
extern int start_active_slot(struct active_request_slot *slot);
|
||||||
extern void run_active_slot(struct active_request_slot *slot);
|
extern void run_active_slot(struct active_request_slot *slot);
|
||||||
extern void finish_active_slot(struct active_request_slot *slot);
|
|
||||||
extern void finish_all_active_slots(void);
|
extern void finish_all_active_slots(void);
|
||||||
extern int handle_curl_result(struct slot_results *results);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This will run one slot to completion in a blocking manner, similar to how
|
* This will run one slot to completion in a blocking manner, similar to how
|
||||||
|
@ -237,7 +237,7 @@ static void diff_ranges_release(struct diff_ranges *diff)
|
|||||||
range_set_release(&diff->target);
|
range_set_release(&diff->target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void line_log_data_init(struct line_log_data *r)
|
static void line_log_data_init(struct line_log_data *r)
|
||||||
{
|
{
|
||||||
memset(r, 0, sizeof(struct line_log_data));
|
memset(r, 0, sizeof(struct line_log_data));
|
||||||
range_set_init(&r->ranges, 0);
|
range_set_init(&r->ranges, 0);
|
||||||
|
@ -54,8 +54,6 @@ struct line_log_data {
|
|||||||
struct diff_ranges diff;
|
struct diff_ranges diff;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void line_log_data_init(struct line_log_data *r);
|
|
||||||
|
|
||||||
extern void line_log_init(struct rev_info *rev, const char *prefix, struct string_list *args);
|
extern void line_log_init(struct rev_info *rev, const char *prefix, struct string_list *args);
|
||||||
|
|
||||||
extern int line_log_filter(struct rev_info *rev);
|
extern int line_log_filter(struct rev_info *rev);
|
||||||
|
@ -252,6 +252,20 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *pack_bitmap_filename(struct packed_git *p)
|
||||||
|
{
|
||||||
|
char *idx_name;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = strlen(p->pack_name) - strlen(".pack");
|
||||||
|
idx_name = xmalloc(len + strlen(".bitmap") + 1);
|
||||||
|
|
||||||
|
memcpy(idx_name, p->pack_name, len);
|
||||||
|
memcpy(idx_name + len, ".bitmap", strlen(".bitmap") + 1);
|
||||||
|
|
||||||
|
return idx_name;
|
||||||
|
}
|
||||||
|
|
||||||
static int open_pack_bitmap_1(struct packed_git *packfile)
|
static int open_pack_bitmap_1(struct packed_git *packfile)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@ -322,20 +336,6 @@ failed:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pack_bitmap_filename(struct packed_git *p)
|
|
||||||
{
|
|
||||||
char *idx_name;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = strlen(p->pack_name) - strlen(".pack");
|
|
||||||
idx_name = xmalloc(len + strlen(".bitmap") + 1);
|
|
||||||
|
|
||||||
memcpy(idx_name, p->pack_name, len);
|
|
||||||
memcpy(idx_name + len, ".bitmap", strlen(".bitmap") + 1);
|
|
||||||
|
|
||||||
return idx_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int open_pack_bitmap(void)
|
static int open_pack_bitmap(void)
|
||||||
{
|
{
|
||||||
struct packed_git *p;
|
struct packed_git *p;
|
||||||
|
@ -38,7 +38,6 @@ int prepare_bitmap_git(void);
|
|||||||
void count_bitmap_commit_list(uint32_t *commits, uint32_t *trees, uint32_t *blobs, uint32_t *tags);
|
void count_bitmap_commit_list(uint32_t *commits, uint32_t *trees, uint32_t *blobs, uint32_t *tags);
|
||||||
void traverse_bitmap_commit_list(show_reachable_fn show_reachable);
|
void traverse_bitmap_commit_list(show_reachable_fn show_reachable);
|
||||||
void test_bitmap_walk(struct rev_info *revs);
|
void test_bitmap_walk(struct rev_info *revs);
|
||||||
char *pack_bitmap_filename(struct packed_git *p);
|
|
||||||
int prepare_bitmap_walk(struct rev_info *revs);
|
int prepare_bitmap_walk(struct rev_info *revs);
|
||||||
int reuse_partial_packfile_from_bitmap(struct packed_git **packfile, uint32_t *entries, off_t *up_to);
|
int reuse_partial_packfile_from_bitmap(struct packed_git **packfile, uint32_t *entries, off_t *up_to);
|
||||||
int rebuild_existing_bitmaps(struct packing_data *mapping, khash_sha1 *reused_bitmaps, int show_progress);
|
int rebuild_existing_bitmaps(struct packing_data *mapping, khash_sha1 *reused_bitmaps, int show_progress);
|
||||||
|
5
prompt.c
5
prompt.c
@ -73,8 +73,3 @@ char *git_prompt(const char *prompt, int flags)
|
|||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *git_getpass(const char *prompt)
|
|
||||||
{
|
|
||||||
return git_prompt(prompt, PROMPT_ASKPASS);
|
|
||||||
}
|
|
||||||
|
1
prompt.h
1
prompt.h
@ -5,6 +5,5 @@
|
|||||||
#define PROMPT_ECHO (1<<1)
|
#define PROMPT_ECHO (1<<1)
|
||||||
|
|
||||||
char *git_prompt(const char *prompt, int flags);
|
char *git_prompt(const char *prompt, int flags);
|
||||||
char *git_getpass(const char *prompt);
|
|
||||||
|
|
||||||
#endif /* PROMPT_H */
|
#endif /* PROMPT_H */
|
||||||
|
2
remote.c
2
remote.c
@ -2156,7 +2156,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet
|
|||||||
/*
|
/*
|
||||||
* Compare-and-swap
|
* Compare-and-swap
|
||||||
*/
|
*/
|
||||||
void clear_cas_option(struct push_cas_option *cas)
|
static void clear_cas_option(struct push_cas_option *cas)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
1
remote.h
1
remote.h
@ -261,7 +261,6 @@ struct push_cas_option {
|
|||||||
|
|
||||||
extern int parseopt_push_cas_option(const struct option *, const char *arg, int unset);
|
extern int parseopt_push_cas_option(const struct option *, const char *arg, int unset);
|
||||||
extern int parse_push_cas_option(struct push_cas_option *, const char *arg, int unset);
|
extern int parse_push_cas_option(struct push_cas_option *, const char *arg, int unset);
|
||||||
extern void clear_cas_option(struct push_cas_option *);
|
|
||||||
|
|
||||||
extern int is_empty_cas(const struct push_cas_option *);
|
extern int is_empty_cas(const struct push_cas_option *);
|
||||||
void apply_push_cas(struct push_cas_option *, struct remote *, struct ref *);
|
void apply_push_cas(struct push_cas_option *, struct remote *, struct ref *);
|
||||||
|
106
revision.c
106
revision.c
@ -2970,6 +2970,61 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
|
|||||||
return commit_show;
|
return commit_show;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define_commit_slab(saved_parents, struct commit_list *);
|
||||||
|
|
||||||
|
#define EMPTY_PARENT_LIST ((struct commit_list *)-1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* You may only call save_parents() once per commit (this is checked
|
||||||
|
* for non-root commits).
|
||||||
|
*/
|
||||||
|
static void save_parents(struct rev_info *revs, struct commit *commit)
|
||||||
|
{
|
||||||
|
struct commit_list **pp;
|
||||||
|
|
||||||
|
if (!revs->saved_parents_slab) {
|
||||||
|
revs->saved_parents_slab = xmalloc(sizeof(struct saved_parents));
|
||||||
|
init_saved_parents(revs->saved_parents_slab);
|
||||||
|
}
|
||||||
|
|
||||||
|
pp = saved_parents_at(revs->saved_parents_slab, commit);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When walking with reflogs, we may visit the same commit
|
||||||
|
* several times: once for each appearance in the reflog.
|
||||||
|
*
|
||||||
|
* In this case, save_parents() will be called multiple times.
|
||||||
|
* We want to keep only the first set of parents. We need to
|
||||||
|
* store a sentinel value for an empty (i.e., NULL) parent
|
||||||
|
* list to distinguish it from a not-yet-saved list, however.
|
||||||
|
*/
|
||||||
|
if (*pp)
|
||||||
|
return;
|
||||||
|
if (commit->parents)
|
||||||
|
*pp = copy_commit_list(commit->parents);
|
||||||
|
else
|
||||||
|
*pp = EMPTY_PARENT_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free_saved_parents(struct rev_info *revs)
|
||||||
|
{
|
||||||
|
if (revs->saved_parents_slab)
|
||||||
|
clear_saved_parents(revs->saved_parents_slab);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit)
|
||||||
|
{
|
||||||
|
struct commit_list *parents;
|
||||||
|
|
||||||
|
if (!revs->saved_parents_slab)
|
||||||
|
return commit->parents;
|
||||||
|
|
||||||
|
parents = *saved_parents_at(revs->saved_parents_slab, commit);
|
||||||
|
if (parents == EMPTY_PARENT_LIST)
|
||||||
|
return NULL;
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
|
||||||
enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
|
enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit)
|
||||||
{
|
{
|
||||||
enum commit_action action = get_commit_action(revs, commit);
|
enum commit_action action = get_commit_action(revs, commit);
|
||||||
@ -3269,54 +3324,3 @@ void put_revision_mark(const struct rev_info *revs, const struct commit *commit)
|
|||||||
fputs(mark, stdout);
|
fputs(mark, stdout);
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
define_commit_slab(saved_parents, struct commit_list *);
|
|
||||||
|
|
||||||
#define EMPTY_PARENT_LIST ((struct commit_list *)-1)
|
|
||||||
|
|
||||||
void save_parents(struct rev_info *revs, struct commit *commit)
|
|
||||||
{
|
|
||||||
struct commit_list **pp;
|
|
||||||
|
|
||||||
if (!revs->saved_parents_slab) {
|
|
||||||
revs->saved_parents_slab = xmalloc(sizeof(struct saved_parents));
|
|
||||||
init_saved_parents(revs->saved_parents_slab);
|
|
||||||
}
|
|
||||||
|
|
||||||
pp = saved_parents_at(revs->saved_parents_slab, commit);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When walking with reflogs, we may visit the same commit
|
|
||||||
* several times: once for each appearance in the reflog.
|
|
||||||
*
|
|
||||||
* In this case, save_parents() will be called multiple times.
|
|
||||||
* We want to keep only the first set of parents. We need to
|
|
||||||
* store a sentinel value for an empty (i.e., NULL) parent
|
|
||||||
* list to distinguish it from a not-yet-saved list, however.
|
|
||||||
*/
|
|
||||||
if (*pp)
|
|
||||||
return;
|
|
||||||
if (commit->parents)
|
|
||||||
*pp = copy_commit_list(commit->parents);
|
|
||||||
else
|
|
||||||
*pp = EMPTY_PARENT_LIST;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit)
|
|
||||||
{
|
|
||||||
struct commit_list *parents;
|
|
||||||
|
|
||||||
if (!revs->saved_parents_slab)
|
|
||||||
return commit->parents;
|
|
||||||
|
|
||||||
parents = *saved_parents_at(revs->saved_parents_slab, commit);
|
|
||||||
if (parents == EMPTY_PARENT_LIST)
|
|
||||||
return NULL;
|
|
||||||
return parents;
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_saved_parents(struct rev_info *revs)
|
|
||||||
{
|
|
||||||
if (revs->saved_parents_slab)
|
|
||||||
clear_saved_parents(revs->saved_parents_slab);
|
|
||||||
}
|
|
||||||
|
12
revision.h
12
revision.h
@ -300,18 +300,14 @@ extern int rewrite_parents(struct rev_info *revs, struct commit *commit,
|
|||||||
rewrite_parent_fn_t rewrite_parent);
|
rewrite_parent_fn_t rewrite_parent);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save a copy of the parent list, and return the saved copy. This is
|
* The log machinery saves the original parent list so that
|
||||||
* used by the log machinery to retrieve the original parents when
|
* get_saved_parents() can later tell what the real parents of the
|
||||||
* commit->parents has been modified by history simpification.
|
* commits are, when commit->parents has been modified by history
|
||||||
*
|
* simpification.
|
||||||
* You may only call save_parents() once per commit (this is checked
|
|
||||||
* for non-root commits).
|
|
||||||
*
|
*
|
||||||
* get_saved_parents() will transparently return commit->parents if
|
* get_saved_parents() will transparently return commit->parents if
|
||||||
* history simplification is off.
|
* history simplification is off.
|
||||||
*/
|
*/
|
||||||
extern void save_parents(struct rev_info *revs, struct commit *commit);
|
|
||||||
extern struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
|
extern struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
|
||||||
extern void free_saved_parents(struct rev_info *revs);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -137,7 +137,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_shallow_file_for_update(void)
|
static void check_shallow_file_for_update(void)
|
||||||
{
|
{
|
||||||
if (is_shallow == -1)
|
if (is_shallow == -1)
|
||||||
die("BUG: shallow must be initialized by now");
|
die("BUG: shallow must be initialized by now");
|
||||||
|
@ -412,9 +412,9 @@ static size_t url_match_prefix(const char *url,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int match_urls(const struct url_info *url,
|
static int match_urls(const struct url_info *url,
|
||||||
const struct url_info *url_prefix,
|
const struct url_info *url_prefix,
|
||||||
int *exactusermatch)
|
int *exactusermatch)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* url_prefix matches url if the scheme, host and port of url_prefix
|
* url_prefix matches url if the scheme, host and port of url_prefix
|
||||||
|
@ -31,7 +31,6 @@ struct url_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern char *url_normalize(const char *, struct url_info *);
|
extern char *url_normalize(const char *, struct url_info *);
|
||||||
extern int match_urls(const struct url_info *url, const struct url_info *url_prefix, int *exactusermatch);
|
|
||||||
|
|
||||||
struct urlmatch_item {
|
struct urlmatch_item {
|
||||||
size_t matched_len;
|
size_t matched_len;
|
||||||
|
Loading…
Reference in New Issue
Block a user