"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
add messagelen "field" in notifications
To:
gameoftrees@openbsd.org
Date:
Wed, 27 Mar 2024 16:16:44 +0100

Download raw body.

Thread
It's needed un-ambiguosly parsing the standard input and so helps in my
wip got-notify-http.  ok?

diff /home/op/w/got
commit - c237d8914d9e7b85e50ad13b46083cdc61a78977
path + /home/op/w/got
blob - fc27cb994aba584eae60004e96e635c5e0f04af6
file + gotd/repo_write.c
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -1815,6 +1815,8 @@ print_commit(struct got_commit_object *commit, struct 
 	if (err)
 		goto done;
 
+	dprintf(fd, "messagelen: %zu\n", strlen(logmsg0));
+
 	logmsg = logmsg0;
 	do {
 		line = strsep(&logmsg, "\n");
@@ -2045,6 +2047,9 @@ print_tag(struct got_object_id *id, 
 		err = got_error_from_errno("strdup");
 		goto done;
 	}
+
+	dprintf(fd, "messagelen: %zu\n", strlen(tagmsg0));
+
 	tagmsg = tagmsg0;
 	do {
 		line = strsep(&tagmsg, "\n");
blob - 44052114a99b0f98370a006d3e3c691db559ceec
file + regress/gotd/email_notification.sh
--- regress/gotd/email_notification.sh
+++ regress/gotd/email_notification.sh
@@ -70,6 +70,7 @@ test_file_changed() {
 	printf "from: $GOT_AUTHOR\n" >> $testroot/stdout.expected
 	d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	printf "date: $d\n" >> $testroot/stdout.expected
+	printf "messagelen: 14\n" >> $testroot/stdout.expected
 	printf " \n" >> $testroot/stdout.expected
 	printf " make changes\n \n" >> $testroot/stdout.expected
 	printf " M  alpha  |  1+  1-\n\n"  >> $testroot/stdout.expected
@@ -152,6 +153,7 @@ test_many_commits_not_summarized() {
 		printf "commit $commit_id\n" >> $testroot/stdout.expected
 		printf "from: $GOT_AUTHOR\n" >> $testroot/stdout.expected
 		printf "date: $commit_time\n" >> $testroot/stdout.expected
+		printf "messagelen: 14\n" >> $testroot/stdout.expected
 		printf " \n" >> $testroot/stdout.expected
 		printf " make changes\n \n" >> $testroot/stdout.expected
 		printf " M  alpha  |  1+  1-\n\n"  \
@@ -308,6 +310,7 @@ test_branch_created() {
 	printf "from: $GOT_AUTHOR\n" >> $testroot/stdout.expected
 	d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	printf "date: $d\n" >> $testroot/stdout.expected
+	printf "messagelen: 11\n" >> $testroot/stdout.expected
 	printf " \n" >> $testroot/stdout.expected
 	printf " newbranch\n \n" >> $testroot/stdout.expected
 	printf " M  alpha  |  1+  1-\n\n"  >> $testroot/stdout.expected
@@ -430,6 +433,7 @@ test_tag_created() {
 	d=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"`
 	printf "date: $d\n" >> $testroot/stdout.expected
 	printf "object: commit $commit_id\n" >> $testroot/stdout.expected
+	printf "messagelen: 9\n" >> $testroot/stdout.expected
 	printf " \n" >> $testroot/stdout.expected
 	printf " new tag\n \n" >> $testroot/stdout.expected
 	printf "\r\n" >> $testroot/stdout.expected
@@ -504,6 +508,7 @@ test_tag_changed() {
 	printf "from: $GOT_AUTHOR\n" >> $testroot/stdout.expected
 	d=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"`
 	printf "date: $d\n" >> $testroot/stdout.expected
+	printf "messagelen: 8\n" >> $testroot/stdout.expected
 	printf "object: commit $commit_id\n" >> $testroot/stdout.expected
 	printf " \n" >> $testroot/stdout.expected
 	printf " new tag\n \n" >> $testroot/stdout.expected