Skip to contentSkip to conversation

mark private symbols static

PATCH In review Junio C Hamano 3 participants 19 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover mark private symbols static

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(-)
Signature · 1 line
2.3.0-rc0-134-g109a908
#1 lore raw

PATCH 1/10 http.c: make finish_active_slot() and handle_curl_result() static

No external callers exist.

---
 http.c | 64 ++++++++++++++++++++++++++++++++--------------------------------
 http.h |  2 --
 2 files changed, 32 insertions(+), 34 deletions(-)
http.c +32 -32
index 040f362..16a6a2d 100644
@@ -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
http.h +0 -2
index 473179b..49afe39 100644
@@ -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
Signature · 1 line
2.3.0-rc0-134-g109a908
#2 lore raw

Re: [PATCH 01/10] http.c: make finish_active_slot() and handle_curl_result() static

Quoted 1 line · Junio C Hamano

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

#3 lore raw

PATCH 2/10 line-log.c: make line_log_data_init() static

In reply to Junio C Hamano

No external callers exist.

---
 line-log.c | 2 +-
 line-log.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
line-log.c +1 -1
index b7864ad..a490efe 100644
@@ -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);
line-log.h +0 -2
index a9212d8..7a5c24e 100644
@@ -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);
Signature · 1 line
2.3.0-rc0-134-g109a908
#4 lore raw

PATCH 3/10 prompt.c: remove git_getpass() nobody uses

In reply to Junio C Hamano
---
 prompt.c | 5 -----
 prompt.h | 1 -
 2 files changed, 6 deletions(-)
prompt.c +0 -5
index 8181eeb..7540639 100644
@@ -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);
-}
prompt.h +0 -1
index 04f321a..e04cced 100644
@@ -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 */
Signature · 1 line
2.3.0-rc0-134-g109a908
#5 lore raw

Re: [PATCH 03/10] prompt.c: remove git_getpass() nobody uses

prompt.c char *git_prompt(const char *prompt, int flags) · line 80

Quoted 4 lines · Junio C Hamano
prompt.c +0 -4
-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

#6 lore raw

PATCH 4/10 revision.c: make save_parents() and free_saved_parents() static

In reply to Junio C Hamano

No external callers exist.

---
 revision.c | 106 ++++++++++++++++++++++++++++++++-----------------------------
 revision.h |  12 +++----
 2 files changed, 59 insertions(+), 59 deletions(-)
revision.c +55 -51
index 86406a2..0f4619c 100644
@@ -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);
-}
revision.h +4 -8
index 033a244..07807e5 100644
@@ -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
Signature · 1 line
2.3.0-rc0-134-g109a908
#7 lore raw

PATCH 5/10 urlmatch.c: make match_urls() static

In reply to Junio C Hamano

No external callers exist.

---
 urlmatch.c | 6 +++---
 urlmatch.h | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)
urlmatch.c +3 -3
index 618d216..132d342 100644
@@ -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
urlmatch.h +0 -1
index b461dfd..528862a 100644
@@ -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;
Signature · 1 line
2.3.0-rc0-134-g109a908
#8 lore raw

Re: [PATCH 05/10] urlmatch.c: make match_urls() static

Quoted 1 line · Junio C Hamano

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

#9 lore raw

PATCH 6/10 remote.c: make clear_cas_option() static

In reply to Junio C Hamano

No external callers exist.

---
 remote.c | 2 +-
 remote.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
remote.c +1 -1
index 5b9c693..0b3939c 100644
@@ -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;
 
remote.h +0 -1
index 8b62efd..31ccdcd 100644
@@ -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 *);
Signature · 1 line
2.3.0-rc0-134-g109a908
#10 lore raw

PATCH 7/10 shallow.c: make check_shallow_file_for_update() static

In reply to Junio C Hamano

No external callers exist.

---
 commit.h  | 1 -
 shallow.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
commit.h +0 -1
index 5cc1e7e..9f189cb 100644
@@ -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);
shallow.c +1 -1
index cdd0775..04ea816 100644
@@ -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");
Signature · 1 line
2.3.0-rc0-134-g109a908
#11 lore raw

PATCH 8/10 pack-bitmap.c: make pack_bitmap_filename() static

In reply to Junio C Hamano
---
 pack-bitmap.c | 28 ++++++++++++++--------------
 pack-bitmap.h |  1 -
 2 files changed, 14 insertions(+), 15 deletions(-)
pack-bitmap.c +14 -14
index 6a81841..0cd85f6 100644
@@ -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;
pack-bitmap.h +0 -1
index 487600b..0adcef7 100644
@@ -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);
Signature · 1 line
2.3.0-rc0-134-g109a908
#12 lore raw

Re: [PATCH 08/10] pack-bitmap.c: make pack_bitmap_filename() static

Quoted 3 lines · Junio C Hamano
 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

#13 lore raw

PATCH 9/10 read-cache.c: make fill/match_stat_data() static

In reply to Junio C Hamano
---
 cache.h      | 14 --------------
 read-cache.c | 14 ++++++++++++--
 2 files changed, 12 insertions(+), 16 deletions(-)
cache.h +0 -14
index f704af5..98911c8 100644
@@ -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 */
read-cache.c +12 -2
index 9cff715..5a71de1 100644
@@ -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;
 
Signature · 1 line
2.3.0-rc0-134-g109a908
#14 lore raw

PATCH 10/10 commit: show "Author:" hint when the ident is not given explicitly

In reply to Junio C Hamano

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.

---
 builtin/commit.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
builtin/commit.c +4 -2
index 7d90c35..b512504 100644
@@ -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);
 	}
Signature · 1 line
2.3.0-rc0-134-g109a908
#15 lore raw

Re: [PATCH 10/10] commit: show "Author:" hint when the ident is not given explicitly

Quoted 9 lines · Junio C Hamano

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.

Quoted 7 lines

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

#16 lore raw
In reply to Junio C Hamano
Quoted 5 lines · Junio C Hamano

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

#17 lore raw
Quoted 10 lines · Jeff King
Quoted 5 lines · Junio C Hamano

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 ;-)