git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] commit.c:record_author_date() use skip_prefix() instead of starts_with()

From
Tanay Abhra <tanayabh@gmail.com>
Date
Mar 1, 2014, 19:48 UTC
Message-ID
<1393703299-7977-1-git-send-email-tanayabh@gmail.com>
Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
---
 commit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit.c b/commit.c
index 6bf4fe0..c954ecb 100644
--- a/commit.c
+++ b/commit.c
@@ -566,7 +566,7 @@ static void record_author_date(struct author_date_slab *author_date,
 	     buf;
 	     buf = line_end + 1) {
 		line_end = strchrnul(buf, '\n');
-		if (!starts_with(buf, "author ")) {
+		if (!skip_prefix(buf, "author ")) {
 			if (!line_end[0] || line_end[1] == '\n')
 				return; /* end of header */
 			continue;
-- 
1.7.9.5

Hello,

This is my patch for the GSoC microproject #10:

Rewrite commit.c:record_author_date() to use skip_prefix(). 
Are there other places in this file where skip_prefix() would be more 
readable than starts_with()?

Since skip_prefix() and starts_with() implement the same functionality with different
return values, they can be interchanged easily.

Other usage of starts_with() in the same file can be found with

$ grep -n starts_with commit.c

1116:		else if (starts_with(line, gpg_sig_header) &&
1196:		if (starts_with(buf, sigcheck_gpg_status[i].check + 1)) {

I have a query,should I tackle a bug from the mailing lists or research about the proposal 
and present a rough draft?

Cheers,
Tanay Abhra.
Next: Michael Haggerty
Message 1 of 4 in “commit.c:record_author_date() use skip_prefix() instead of starts_with()”
  1. commit.c:record_author_date() use skip_prefix() instead of starts_with()Tanay Abhra, Mar 1, 2014
  2. Michael HaggertyMar 3, 2014
  3. Junio C HamanoMar 3, 2014
  4. Eric SunshineMar 3, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.