about summary refs log tree commit diff
path: root/parsing.c
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2014-05-29 17:35:46 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-06-28 15:14:56 +0200
commit79c985e13c10b498c3ea62f4607c2e2a460c3b10 (patch)
treed06ca41cfe2ebb5ff80ae747e38aeaad35734e35 /parsing.c
parentremove trailing whitespaces from source files (diff)
downloadcgit-pink-79c985e13c10b498c3ea62f4607c2e2a460c3b10.tar.gz
cgit-pink-79c985e13c10b498c3ea62f4607c2e2a460c3b10.zip
git: update for git 2.0
prefixcmp() and suffixcmp() have been remove, functionality is now
provided by starts_with() and ends_with(). Retrurn values have been
changed, so instead of just renaming we have to fix logic.
Everything else looks just fine.
Diffstat (limited to '')
-rw-r--r--parsing.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/parsing.c b/parsing.c
index 5b4b1f4..073f46f 100644
--- a/parsing.c
+++ b/parsing.c
@@ -147,25 +147,25 @@ struct commitinfo *cgit_parse_commit(struct commit *commit)
 	if (p == NULL)
 		return ret;
 
-	if (prefixcmp(p, "tree "))
+	if (!starts_with(p, "tree "))
 		die("Bad commit: %s", sha1_to_hex(commit->object.sha1));
 	else
 		p += 46; // "tree " + hex[40] + "\n"
 
-	while (!prefixcmp(p, "parent "))
+	while (starts_with(p, "parent "))
 		p += 48; // "parent " + hex[40] + "\n"
 
-	if (p && !prefixcmp(p, "author ")) {
+	if (p && starts_with(p, "author ")) {
 		p = parse_user(p + 7, &ret->author, &ret->author_email,
 			&ret->author_date);
 	}
 
-	if (p && !prefixcmp(p, "committer ")) {
+	if (p && starts_with(p, "committer ")) {
 		p = parse_user(p + 10, &ret->committer, &ret->committer_email,
 			&ret->committer_date);
 	}
 
-	if (p && !prefixcmp(p, "encoding ")) {
+	if (p && starts_with(p, "encoding ")) {
 		p += 9;
 		t = strchr(p, '\n');
 		if (t) {
@@ -244,7 +244,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag)
 		if (*p == '\n')
 			break;
 
-		if (!prefixcmp(p, "tagger ")) {
+		if (starts_with(p, "tagger ")) {
 			p = parse_user(p + 7, &ret->tagger, &ret->tagger_email,
 				&ret->tagger_date);
 		} else {