* [PATCH 00/10] mark private symbols static
@ 2015-01-14 23:40 Junio C Hamano
2015-01-14 23:40 ` [PATCH 01/10] http.c: make finish_active_slot() and handle_curl_result() static Junio C Hamano
` (11 more replies)
0 siblings, 12 replies; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
Here are a handful of patches to make symbols that are only used
within a .c file as static. This is not the kind of changes we
would want to do in the pre-release freeze period, and it is just
for reference. I may later come back to them after 2.3 final is
tagged.
Note that I did not blindly make everything that _could_ be made
static; the ones I deliberately left untouched are:
* config.c: this has a lot of git_configset_*() API functions that
were developed but not yet used (as part of 3/4-way done GSoc
project that did not fully convert users of the config subsystem
to these new style functions); making them static merely because
they are not yet used goes backwards.
* ewah/* and xdiff/*: I consider these borrowed code, which we
would want to avoid touching in the same series as our own code.
* graph.c: graph_next_line() and graph_set_column_colors() are not
called externally, but I suspect that they are API functions
waiting for a new caller to appear.
* line-log.c: range_set_append() is not called externally, but this
is only because a caller calls range_set_append_unsafe(), its
sibling, which may want to be cleaned up.
* refs.c: rollback_packed_refs() is not called externally, but the
codebase around refs API is in flux and I did not want to add to
the code churn.
* strbuf.c: xstrvfmt() is not called externally, but this is a
reasonable API function to keep; its friend xstrfmt() is used by
many places.
* string-list.c: print_string_list() may want to go, but it may
be useful for debugging, so I kept it in.
* wrapper.c: rmdir_or_warn() is not used externally, but this is a
reasonable API function as its friends like unlink_or_warn() that
are used.
The last patch in the series is very questionable. Instead of
hiding unused author_ident_sufficiently_given() function (and
possibly removing it), it adds external callers to justify its
existence ;-)
Junio C Hamano (10):
http.c: make finish_active_slot() and handle_curl_result() static
line-log.c: make line_log_data_init() static
prompt.c: remove git_getpass() nobody uses
revision.c: make save_parents() and free_saved_parents() static
urlmatch.c: make match_urls() static
remote.c: make clear_cas_option() static
shallow.c: make check_shallow_file_for_update() static
pack-bitmap.c: make pack_bitmap_filename() static
read-cache.c: make fill/match_stat_data() static
commit: show "Author:" hint when the ident is not given explicitly
builtin/commit.c | 6 ++--
cache.h | 14 --------
commit.h | 1 -
http.c | 64 ++++++++++++++++-----------------
http.h | 2 --
line-log.c | 2 +-
line-log.h | 2 --
pack-bitmap.c | 28 +++++++--------
pack-bitmap.h | 1 -
prompt.c | 5 ---
prompt.h | 1 -
read-cache.c | 14 ++++++--
remote.c | 2 +-
remote.h | 1 -
revision.c | 106 +++++++++++++++++++++++++++++--------------------------
revision.h | 12 +++----
shallow.c | 2 +-
urlmatch.c | 6 ++--
urlmatch.h | 1 -
19 files changed, 127 insertions(+), 143 deletions(-)
--
2.3.0-rc0-134-g109a908
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 01/10] http.c: make finish_active_slot() and handle_curl_result() static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-15 6:41 ` Jeff King
2015-01-14 23:40 ` [PATCH 02/10] line-log.c: make line_log_data_init() static Junio C Hamano
` (10 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
No external callers exist.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
http.c | 64 ++++++++++++++++++++++++++++++++--------------------------------
http.h | 2 --
2 files changed, 32 insertions(+), 34 deletions(-)
diff --git a/http.c b/http.c
index 040f362..16a6a2d 100644
--- a/http.c
+++ b/http.c
@@ -114,6 +114,37 @@ size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf)
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
static void process_curl_messages(void)
{
@@ -730,12 +761,6 @@ void run_active_slot(struct active_request_slot *slot)
#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)
{
closedown_active_slot(slot);
@@ -752,31 +777,6 @@ static void release_active_slot(struct active_request_slot *slot)
#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)
{
struct active_request_slot *slot = active_queue_head;
@@ -839,7 +839,7 @@ char *get_remote_object_url(const char *url, const char *hex,
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
diff --git a/http.h b/http.h
index 473179b..49afe39 100644
--- a/http.h
+++ b/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 int start_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 int handle_curl_result(struct slot_results *results);
/*
* This will run one slot to completion in a blocking manner, similar to how
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/10] line-log.c: make line_log_data_init() static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
2015-01-14 23:40 ` [PATCH 01/10] http.c: make finish_active_slot() and handle_curl_result() static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-14 23:40 ` [PATCH 03/10] prompt.c: remove git_getpass() nobody uses Junio C Hamano
` (9 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
No external callers exist.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
line-log.c | 2 +-
line-log.h | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/line-log.c b/line-log.c
index b7864ad..a490efe 100644
--- a/line-log.c
+++ b/line-log.c
@@ -237,7 +237,7 @@ static void diff_ranges_release(struct diff_ranges *diff)
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));
range_set_init(&r->ranges, 0);
diff --git a/line-log.h b/line-log.h
index a9212d8..7a5c24e 100644
--- a/line-log.h
+++ b/line-log.h
@@ -54,8 +54,6 @@ struct line_log_data {
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 int line_log_filter(struct rev_info *rev);
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/10] prompt.c: remove git_getpass() nobody uses
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
2015-01-14 23:40 ` [PATCH 01/10] http.c: make finish_active_slot() and handle_curl_result() static Junio C Hamano
2015-01-14 23:40 ` [PATCH 02/10] line-log.c: make line_log_data_init() static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-15 6:47 ` Jeff King
2015-01-14 23:40 ` [PATCH 04/10] revision.c: make save_parents() and free_saved_parents() static Junio C Hamano
` (8 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
prompt.c | 5 -----
prompt.h | 1 -
2 files changed, 6 deletions(-)
diff --git a/prompt.c b/prompt.c
index 8181eeb..7540639 100644
--- a/prompt.c
+++ b/prompt.c
@@ -73,8 +73,3 @@ char *git_prompt(const char *prompt, int flags)
}
return r;
}
-
-char *git_getpass(const char *prompt)
-{
- return git_prompt(prompt, PROMPT_ASKPASS);
-}
diff --git a/prompt.h b/prompt.h
index 04f321a..e04cced 100644
--- a/prompt.h
+++ b/prompt.h
@@ -5,6 +5,5 @@
#define PROMPT_ECHO (1<<1)
char *git_prompt(const char *prompt, int flags);
-char *git_getpass(const char *prompt);
#endif /* PROMPT_H */
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/10] revision.c: make save_parents() and free_saved_parents() static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (2 preceding siblings ...)
2015-01-14 23:40 ` [PATCH 03/10] prompt.c: remove git_getpass() nobody uses Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-14 23:40 ` [PATCH 05/10] urlmatch.c: make match_urls() static Junio C Hamano
` (7 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
No external callers exist.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
revision.c | 106 ++++++++++++++++++++++++++++++++-----------------------------
revision.h | 12 +++----
2 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/revision.c b/revision.c
index 86406a2..0f4619c 100644
--- a/revision.c
+++ b/revision.c
@@ -2968,6 +2968,61 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
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 action = get_commit_action(revs, commit);
@@ -3267,54 +3322,3 @@ void put_revision_mark(const struct rev_info *revs, const struct commit *commit)
fputs(mark, stdout);
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);
-}
diff --git a/revision.h b/revision.h
index 033a244..07807e5 100644
--- a/revision.h
+++ b/revision.h
@@ -298,18 +298,14 @@ extern int rewrite_parents(struct rev_info *revs, struct commit *commit,
rewrite_parent_fn_t rewrite_parent);
/*
- * Save a copy of the parent list, and return the saved copy. This is
- * used by the log machinery to retrieve the original parents 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).
+ * The log machinery saves the original parent list so that
+ * get_saved_parents() can later tell what the real parents of the
+ * commits are, when commit->parents has been modified by history
+ * simpification.
*
* get_saved_parents() will transparently return commit->parents if
* 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 void free_saved_parents(struct rev_info *revs);
#endif
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/10] urlmatch.c: make match_urls() static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (3 preceding siblings ...)
2015-01-14 23:40 ` [PATCH 04/10] revision.c: make save_parents() and free_saved_parents() static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-15 6:49 ` Jeff King
2015-01-14 23:40 ` [PATCH 06/10] remote.c: make clear_cas_option() static Junio C Hamano
` (6 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
No external callers exist.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
urlmatch.c | 6 +++---
urlmatch.h | 1 -
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/urlmatch.c b/urlmatch.c
index 618d216..132d342 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -412,9 +412,9 @@ static size_t url_match_prefix(const char *url,
return 0;
}
-int match_urls(const struct url_info *url,
- const struct url_info *url_prefix,
- int *exactusermatch)
+static int match_urls(const struct url_info *url,
+ const struct url_info *url_prefix,
+ int *exactusermatch)
{
/*
* url_prefix matches url if the scheme, host and port of url_prefix
diff --git a/urlmatch.h b/urlmatch.h
index b461dfd..528862a 100644
--- a/urlmatch.h
+++ b/urlmatch.h
@@ -31,7 +31,6 @@ 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 {
size_t matched_len;
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/10] remote.c: make clear_cas_option() static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (4 preceding siblings ...)
2015-01-14 23:40 ` [PATCH 05/10] urlmatch.c: make match_urls() static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-14 23:40 ` [PATCH 07/10] shallow.c: make check_shallow_file_for_update() static Junio C Hamano
` (5 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
No external callers exist.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
remote.c | 2 +-
remote.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/remote.c b/remote.c
index 5b9c693..0b3939c 100644
--- a/remote.c
+++ b/remote.c
@@ -2156,7 +2156,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet
/*
* Compare-and-swap
*/
-void clear_cas_option(struct push_cas_option *cas)
+static void clear_cas_option(struct push_cas_option *cas)
{
int i;
diff --git a/remote.h b/remote.h
index 8b62efd..31ccdcd 100644
--- a/remote.h
+++ b/remote.h
@@ -260,7 +260,6 @@ struct push_cas_option {
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 void clear_cas_option(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 *);
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/10] shallow.c: make check_shallow_file_for_update() static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (5 preceding siblings ...)
2015-01-14 23:40 ` [PATCH 06/10] remote.c: make clear_cas_option() static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-14 23:40 ` [PATCH 08/10] pack-bitmap.c: make pack_bitmap_filename() static Junio C Hamano
` (4 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
No external callers exist.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
commit.h | 1 -
shallow.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/commit.h b/commit.h
index 5cc1e7e..9f189cb 100644
--- a/commit.h
+++ b/commit.h
@@ -254,7 +254,6 @@ extern int for_each_commit_graft(each_commit_graft_fn, void *);
extern int is_repository_shallow(void);
extern struct commit_list *get_shallow_commits(struct object_array *heads,
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 int write_shallow_commits(struct strbuf *out, int use_pack_protocol,
const struct sha1_array *extra);
diff --git a/shallow.c b/shallow.c
index cdd0775..04ea816 100644
--- a/shallow.c
+++ b/shallow.c
@@ -137,7 +137,7 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
return result;
}
-void check_shallow_file_for_update(void)
+static void check_shallow_file_for_update(void)
{
if (is_shallow == -1)
die("BUG: shallow must be initialized by now");
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/10] pack-bitmap.c: make pack_bitmap_filename() static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (6 preceding siblings ...)
2015-01-14 23:40 ` [PATCH 07/10] shallow.c: make check_shallow_file_for_update() static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-15 6:51 ` Jeff King
2015-01-14 23:40 ` [PATCH 09/10] read-cache.c: make fill/match_stat_data() static Junio C Hamano
` (3 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
pack-bitmap.c | 28 ++++++++++++++--------------
pack-bitmap.h | 1 -
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 6a81841..0cd85f6 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -252,6 +252,20 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
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)
{
int fd;
@@ -322,20 +336,6 @@ failed:
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)
{
struct packed_git *p;
diff --git a/pack-bitmap.h b/pack-bitmap.h
index 487600b..0adcef7 100644
--- a/pack-bitmap.h
+++ b/pack-bitmap.h
@@ -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 traverse_bitmap_commit_list(show_reachable_fn show_reachable);
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 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);
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/10] read-cache.c: make fill/match_stat_data() static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (7 preceding siblings ...)
2015-01-14 23:40 ` [PATCH 08/10] pack-bitmap.c: make pack_bitmap_filename() static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-14 23:40 ` [PATCH 10/10] commit: show "Author:" hint when the ident is not given explicitly Junio C Hamano
` (2 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
cache.h | 14 --------------
read-cache.c | 14 ++++++++++++--
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/cache.h b/cache.h
index f704af5..98911c8 100644
--- a/cache.h
+++ b/cache.h
@@ -539,20 +539,6 @@ extern int ie_modified(const struct index_state *, const struct cache_entry *, s
extern int index_fd(unsigned char *sha1, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags);
extern int index_path(unsigned char *sha1, const char *path, struct stat *st, unsigned flags);
-/*
- * Record to sd the data from st that we use to check whether a file
- * might have changed.
- */
-extern void fill_stat_data(struct stat_data *sd, struct stat *st);
-
-/*
- * Return 0 if st is consistent with a file not having been changed
- * since sd was filled. If there are differences, return a
- * combination of MTIME_CHANGED, CTIME_CHANGED, OWNER_CHANGED,
- * INODE_CHANGED, and DATA_CHANGED.
- */
-extern int match_stat_data(const struct stat_data *sd, struct stat *st);
-
extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
#define REFRESH_REALLY 0x0001 /* ignore_valid */
diff --git a/read-cache.c b/read-cache.c
index 9cff715..5a71de1 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -83,7 +83,11 @@ void rename_index_entry_at(struct index_state *istate, int nr, const char *new_n
add_index_entry(istate, new, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
}
-void fill_stat_data(struct stat_data *sd, struct stat *st)
+/*
+ * Record to sd the data from st that we use to check whether a file
+ * might have changed.
+ */
+static void fill_stat_data(struct stat_data *sd, struct stat *st)
{
sd->sd_ctime.sec = (unsigned int)st->st_ctime;
sd->sd_mtime.sec = (unsigned int)st->st_mtime;
@@ -96,7 +100,13 @@ void fill_stat_data(struct stat_data *sd, struct stat *st)
sd->sd_size = st->st_size;
}
-int match_stat_data(const struct stat_data *sd, struct stat *st)
+/*
+ * Return 0 if st is consistent with a file not having been changed
+ * since sd was filled. If there are differences, return a
+ * combination of MTIME_CHANGED, CTIME_CHANGED, OWNER_CHANGED,
+ * INODE_CHANGED, and DATA_CHANGED.
+ */
+static int match_stat_data(const struct stat_data *sd, struct stat *st)
{
int changed = 0;
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/10] commit: show "Author:" hint when the ident is not given explicitly
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (8 preceding siblings ...)
2015-01-14 23:40 ` [PATCH 09/10] read-cache.c: make fill/match_stat_data() static Junio C Hamano
@ 2015-01-14 23:40 ` Junio C Hamano
2015-01-15 7:17 ` Jeff King
2015-01-15 0:07 ` [PATCH 00/10] mark private symbols static Stefan Beller
2015-01-15 7:18 ` Jeff King
11 siblings, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2015-01-14 23:40 UTC (permalink / raw
To: git
This is a knee-jerk response to two facts:
- the author_ident_sufficiently_given() function is public but
nobody uses it;
- a corresponding function committer_ident_sufficiently_given() is
used to determine when to add "Committer: " reminder in the log
message editor.
The existing logic decides to show "Author:" reminder when the
author is different from the committer, so there won't be practical
difference other than we would end up showing both reminders when a
committer with iffy name derived from the heuristic is committing
her own patch.
Which means this patch probably should be dropped.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin/commit.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 7d90c35..b512504 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -847,7 +847,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
assert_split_ident(&ai, author_ident);
assert_split_ident(&ci, &committer_ident);
- if (ident_cmp(&ai, &ci))
+ if (ident_cmp(&ai, &ci) ||
+ !author_ident_sufficiently_given())
status_printf_ln(s, GIT_COLOR_NORMAL,
_("%s"
"Author: %.*s <%.*s>"),
@@ -1440,7 +1441,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1,
format_commit_message(commit, "%an <%ae>", &author_ident, &pctx);
format_commit_message(commit, "%cn <%ce>", &committer_ident, &pctx);
- if (strbuf_cmp(&author_ident, &committer_ident)) {
+ if (strbuf_cmp(&author_ident, &committer_ident) ||
+ !author_ident_sufficiently_given()) {
strbuf_addstr(&format, "\n Author: ");
strbuf_addbuf_percentquote(&format, &author_ident);
}
--
2.3.0-rc0-134-g109a908
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 00/10] mark private symbols static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (9 preceding siblings ...)
2015-01-14 23:40 ` [PATCH 10/10] commit: show "Author:" hint when the ident is not given explicitly Junio C Hamano
@ 2015-01-15 0:07 ` Stefan Beller
2015-01-15 7:18 ` Jeff King
11 siblings, 0 replies; 19+ messages in thread
From: Stefan Beller @ 2015-01-15 0:07 UTC (permalink / raw
To: Junio C Hamano; +Cc: git@vger.kernel.org
Regarding patch 1 - 9:
Reviewed-by: Stefan Beller <sbeller@google.com>
for what it's worth.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 01/10] http.c: make finish_active_slot() and handle_curl_result() static
2015-01-14 23:40 ` [PATCH 01/10] http.c: make finish_active_slot() and handle_curl_result() static Junio C Hamano
@ 2015-01-15 6:41 ` Jeff King
0 siblings, 0 replies; 19+ messages in thread
From: Jeff King @ 2015-01-15 6:41 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
On Wed, Jan 14, 2015 at 03:40:46PM -0800, Junio C Hamano wrote:
> No external callers exist.
I think this is sensible. They used to be used directly by remote-curl.c
for the smart-http protocol. But they got wrapped by run_one_slot in
beed336 (http: never use curl_easy_perform, 2014-02-18). And I'd expect
any future users to follow that route.
-Peff
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 03/10] prompt.c: remove git_getpass() nobody uses
2015-01-14 23:40 ` [PATCH 03/10] prompt.c: remove git_getpass() nobody uses Junio C Hamano
@ 2015-01-15 6:47 ` Jeff King
0 siblings, 0 replies; 19+ messages in thread
From: Jeff King @ 2015-01-15 6:47 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
On Wed, Jan 14, 2015 at 03:40:48PM -0800, Junio C Hamano wrote:
> -char *git_getpass(const char *prompt)
> -{
> - return git_prompt(prompt, PROMPT_ASKPASS);
> -}
Yay. This was whittled down to a compatibility wrapper around the more
flexible git_prompt, waiting for the final callers to go away. That
happened in 791643a8, when imap-send learned to use the credential
interface.
-Peff
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 05/10] urlmatch.c: make match_urls() static
2015-01-14 23:40 ` [PATCH 05/10] urlmatch.c: make match_urls() static Junio C Hamano
@ 2015-01-15 6:49 ` Jeff King
0 siblings, 0 replies; 19+ messages in thread
From: Jeff King @ 2015-01-15 6:49 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
On Wed, Jan 14, 2015 at 03:40:50PM -0800, Junio C Hamano wrote:
> No external callers exist.
I think there was some notion that we might use this elsewhere (e.g., to
harmonize the credential.* and http.* config matching rules). But I do
not have any plans to work on that soon, and I am not even sure what
interface would be needed, so it's reasonable to make this static in the
interim.
-Peff
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 08/10] pack-bitmap.c: make pack_bitmap_filename() static
2015-01-14 23:40 ` [PATCH 08/10] pack-bitmap.c: make pack_bitmap_filename() static Junio C Hamano
@ 2015-01-15 6:51 ` Jeff King
0 siblings, 0 replies; 19+ messages in thread
From: Jeff King @ 2015-01-15 6:51 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
On Wed, Jan 14, 2015 at 03:40:53PM -0800, Junio C Hamano wrote:
> pack-bitmap.c | 28 ++++++++++++++--------------
> pack-bitmap.h | 1 -
> 2 files changed, 14 insertions(+), 15 deletions(-)
Looks good. I have some other not-yet-public bitmap stuff to send
pending cleanup and testing, but I checked and none of it cares about
this function.
-Peff
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 10/10] commit: show "Author:" hint when the ident is not given explicitly
2015-01-14 23:40 ` [PATCH 10/10] commit: show "Author:" hint when the ident is not given explicitly Junio C Hamano
@ 2015-01-15 7:17 ` Jeff King
0 siblings, 0 replies; 19+ messages in thread
From: Jeff King @ 2015-01-15 7:17 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
On Wed, Jan 14, 2015 at 03:40:55PM -0800, Junio C Hamano wrote:
> This is a knee-jerk response to two facts:
>
> - the author_ident_sufficiently_given() function is public but
> nobody uses it;
>
> - a corresponding function committer_ident_sufficiently_given() is
> used to determine when to add "Committer: " reminder in the log
> message editor.
>
> The existing logic decides to show "Author:" reminder when the
> author is different from the committer, so there won't be practical
> difference other than we would end up showing both reminders when a
> committer with iffy name derived from the heuristic is committing
> her own patch.
>
> Which means this patch probably should be dropped.
Yeah, I seem to recall going through this logic myself recently and
coming to the same conclusion (probably while working on fac9083). I
don't think it is really adding anything to the one case where it
triggers (and in fact looks a bit worse, as the author information is
redundant).
-Peff
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/10] mark private symbols static
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
` (10 preceding siblings ...)
2015-01-15 0:07 ` [PATCH 00/10] mark private symbols static Stefan Beller
@ 2015-01-15 7:18 ` Jeff King
2015-01-15 17:52 ` Junio C Hamano
11 siblings, 1 reply; 19+ messages in thread
From: Jeff King @ 2015-01-15 7:18 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
On Wed, Jan 14, 2015 at 03:40:45PM -0800, Junio C Hamano wrote:
> Here are a handful of patches to make symbols that are only used
> within a .c file as static. This is not the kind of changes we
> would want to do in the pre-release freeze period, and it is just
> for reference. I may later come back to them after 2.3 final is
> tagged.
I commented specifically on the ones that are in areas I touch a lot,
but all of them look fine to me.
-Peff
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/10] mark private symbols static
2015-01-15 7:18 ` Jeff King
@ 2015-01-15 17:52 ` Junio C Hamano
0 siblings, 0 replies; 19+ messages in thread
From: Junio C Hamano @ 2015-01-15 17:52 UTC (permalink / raw
To: Jeff King, Stefan Beller; +Cc: git
Jeff King <peff@peff.net> writes:
> On Wed, Jan 14, 2015 at 03:40:45PM -0800, Junio C Hamano wrote:
>
>> Here are a handful of patches to make symbols that are only used
>> within a .c file as static. This is not the kind of changes we
>> would want to do in the pre-release freeze period, and it is just
>> for reference. I may later come back to them after 2.3 final is
>> tagged.
>
> I commented specifically on the ones that are in areas I touch a lot,
> but all of them look fine to me.
Thanks for reviews.
The primary reason I sent out this series was to show the reasoning
in 00/10 to decide what *not* to touch, by the way, to send a signal
to those who may want to throw unnecessary churn at the codebase, by
the way ;-)
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2015-01-15 17:52 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-14 23:40 [PATCH 00/10] mark private symbols static Junio C Hamano
2015-01-14 23:40 ` [PATCH 01/10] http.c: make finish_active_slot() and handle_curl_result() static Junio C Hamano
2015-01-15 6:41 ` Jeff King
2015-01-14 23:40 ` [PATCH 02/10] line-log.c: make line_log_data_init() static Junio C Hamano
2015-01-14 23:40 ` [PATCH 03/10] prompt.c: remove git_getpass() nobody uses Junio C Hamano
2015-01-15 6:47 ` Jeff King
2015-01-14 23:40 ` [PATCH 04/10] revision.c: make save_parents() and free_saved_parents() static Junio C Hamano
2015-01-14 23:40 ` [PATCH 05/10] urlmatch.c: make match_urls() static Junio C Hamano
2015-01-15 6:49 ` Jeff King
2015-01-14 23:40 ` [PATCH 06/10] remote.c: make clear_cas_option() static Junio C Hamano
2015-01-14 23:40 ` [PATCH 07/10] shallow.c: make check_shallow_file_for_update() static Junio C Hamano
2015-01-14 23:40 ` [PATCH 08/10] pack-bitmap.c: make pack_bitmap_filename() static Junio C Hamano
2015-01-15 6:51 ` Jeff King
2015-01-14 23:40 ` [PATCH 09/10] read-cache.c: make fill/match_stat_data() static Junio C Hamano
2015-01-14 23:40 ` [PATCH 10/10] commit: show "Author:" hint when the ident is not given explicitly Junio C Hamano
2015-01-15 7:17 ` Jeff King
2015-01-15 0:07 ` [PATCH 00/10] mark private symbols static Stefan Beller
2015-01-15 7:18 ` Jeff King
2015-01-15 17:52 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).