Commit Diff


commit - add40c4fa581b1c31e3fa63c45dde97138b56583
commit + c08369d7b2d435a4c881c980f9a7192c5f7fc61a
blob - 485f7795b24965c4e263fc3a834a5eec78ed3dc8
blob + 4c9c3d505bea0901519b87431585b5a1faba5646
--- Makefile
+++ Makefile
@@ -4,8 +4,9 @@ SUBDIR = libexec got tog
 
 .if make(regress) || make(obj) || make(clean) || make(release)
 SUBDIR += regress
-# not part of original SUBDIR, since we don't build gotweb by default and
-# the port will be split into sub packages
+.endif
+
+.if make(clean)
 SUBDIR += gotweb
 .endif
 
blob - a8779fe566add57b9b508aec58b54d11dfb8b8eb
blob + 82b776f2c35989ae889a23211ad7fce4b90420c4
--- gotweb/Makefile
+++ gotweb/Makefile
@@ -32,9 +32,6 @@ realinstall:
 	fi
 	${INSTALL} -c -o ${WWWUSR} -g ${WWWGRP} -m 0755 \
 	    files/cgi-bin/gw_tmpl/* ${TMPL_DIR}
-	if [ ! -d ${ETC_DIR}/. ]; then \
-		${INSTALL} -d -o root -g daemon -m 755 ${ETC_DIR}; \
-	fi
 	if [ ! -d ${HTTPD_DIR}/. ]; then \
 		${INSTALL} -d -o root -g daemon -m 755 ${HTTPD_DIR}; \
 	fi
blob - af0950e4213a3507ef4d5d791c12dc953de5de14
blob + b91a7673b394570cea7dcb6eed8e2d9ede1197b5
--- gotweb/README
+++ gotweb/README
@@ -1,4 +1,4 @@
-Game of Trees Web (Gotweb) is a read-only web implementation of Got.
+Game of Trees Web (Gotweb) is a read-only web front-end for Got.
 
 Gotweb is still under development; it is being developed exclusively
 on OpenBSD and its target audience are OpenBSD developers. Gotweb is
blob - a55dfa209eaad11211cb2f51ad6f29220cb4ce97
blob + 969f659b425731a10dc96ef765903958e180d926
--- gotweb/TODO
+++ gotweb/TODO
@@ -1,7 +1,4 @@
-Complete templates.
-Complete stylesheets.
-Complete gw_funcs
-----
+TODO
 
 - Add Prev/Next to shortlogs/logs that have more entries than
   got_max_commits_display
@@ -14,3 +11,5 @@ Complete gw_funcs
 
 - Redo index header, so columns are removed when content is set to not display
   in gotweb.conf.
+
+- Move pledge to each function. Only diffing needs wpath and cpath.
blob - c7b010c01ae365f26edc8df50da0631a9dd8d790
blob + daa235b3c518c0e7524fc9f89e2d9c4b7942cf30
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
@@ -144,9 +144,6 @@ static const struct kvalid gw_keys[KEY__ZMAX] = {
 	{ kvalid_int,		"page" },
 	{ kvalid_stringne,	"path" },
 };
-
-int				 gw_get_repo_log_count(struct gw_trans *,
-				    char *);
 
 static struct gw_dir		*gw_init_gw_dir(char *);
 
@@ -262,146 +259,7 @@ gw_apply_unveil(const char *repo_path, const char *rep
 
 	return NULL;
 }
-
-int
-gw_get_repo_log_count(struct gw_trans *gw_trans, char *start_commit)
-{
-	const struct got_error *error;
-	struct got_repository *repo = NULL;
-	struct got_reflist_head refs;
-	struct got_commit_object *commit = NULL;
-	struct got_object_id *id = NULL;
-	struct got_commit_graph *graph = NULL;
-	char *in_repo_path = NULL, *path = NULL;
-	int log_count = 0;
 
-	error = got_repo_open(&repo, gw_trans->repo_path, NULL);
-	if (error)
-		return 0;
-
-	SIMPLEQ_INIT(&refs);
-
-	if (start_commit == NULL) {
-		struct got_reference *head_ref;
-		error = got_ref_open(&head_ref, repo, gw_trans->headref, 0);
-		if (error)
-			goto done;
-
-		error = got_ref_resolve(&id, repo, head_ref);
-		got_ref_close(head_ref);
-		if (error)
-			goto done;
-
-		error = got_object_open_as_commit(&commit, repo, id);
-	} else {
-		struct got_reference *ref;
-		error = got_ref_open(&ref, repo, start_commit, 0);
-		if (error == NULL) {
-			int obj_type;
-			error = got_ref_resolve(&id, repo, ref);
-			got_ref_close(ref);
-			if (error)
-				goto done;
-			error = got_object_get_type(&obj_type, repo, id);
-			if (error)
-				goto done;
-			if (obj_type == GOT_OBJ_TYPE_TAG) {
-				struct got_tag_object *tag;
-				error = got_object_open_as_tag(&tag, repo, id);
-				if (error)
-					goto done;
-				if (got_object_tag_get_object_type(tag) !=
-				    GOT_OBJ_TYPE_COMMIT) {
-					got_object_tag_close(tag);
-					error = got_error(GOT_ERR_OBJ_TYPE);
-					goto done;
-				}
-				free(id);
-				id = got_object_id_dup(
-				    got_object_tag_get_object_id(tag));
-				if (id == NULL)
-					error = got_error_from_errno(
-					    "got_object_id_dup");
-				got_object_tag_close(tag);
-				if (error)
-					goto done;
-			} else if (obj_type != GOT_OBJ_TYPE_COMMIT) {
-				error = got_error(GOT_ERR_OBJ_TYPE);
-				goto done;
-			}
-			error = got_object_open_as_commit(&commit, repo, id);
-			if (error)
-				goto done;
-		}
-		if (commit == NULL) {
-			error = got_repo_match_object_id_prefix(&id,
-			    start_commit, GOT_OBJ_TYPE_COMMIT, repo);
-			if (error)
-				goto done;
-		}
-		error = got_repo_match_object_id_prefix(&id,
-			    start_commit, GOT_OBJ_TYPE_COMMIT, repo);
-			if (error)
-				goto done;
-	}
-
-	error = got_object_open_as_commit(&commit, repo, id);
-	if (error)
-		goto done;
-
-	error = got_repo_map_path(&in_repo_path, repo, gw_trans->repo_path, 1);
-	if (error)
-		goto done;
-
-	if (in_repo_path) {
-		free(path);
-		path = in_repo_path;
-	}
-
-	error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name, NULL);
-	if (error)
-		goto done;
-
-	error = got_commit_graph_open(&graph, path, 0);
-	if (error)
-		goto done;
-
-	error = got_commit_graph_iter_start(graph, id, repo, NULL, NULL);
-	if (error)
-		goto done;
-
-	for (;;) {
-		error = got_commit_graph_iter_next(&id, graph, repo, NULL,
-		    NULL);
-		if (error) {
-			if (error->code == GOT_ERR_ITER_COMPLETED)
-				error = NULL;
-			break;
-		}
-		if (id == NULL)
-			break;
-
-		if (error)
-			break;
-		log_count++;
-	}
-done:
-	free(in_repo_path);
-	if (graph)
-		got_commit_graph_close(graph);
-	if (repo) {
-		error = got_repo_close(repo);
-		if (error)
-			return 0;
-	}
-	if (error) {
-		khttp_puts(gw_trans->gw_req, "Error: ");
-		khttp_puts(gw_trans->gw_req, error->msg);
-		return 0;
-	} else
-		return log_count;
-}
-
 static const struct got_error *
 gw_blame(struct gw_trans *gw_trans)
 {
@@ -1482,13 +1340,10 @@ gw_get_repo_log(struct gw_trans *gw_trans, const char 
 	     *log_blame_html = NULL;
 	char *commit_log0, *newline;
 	regex_t regex;
-	int have_match, log_count = 0, has_parent = 1;
+	int have_match, has_parent = 1;
 	size_t newsize;
 	struct buf *diffbuf = NULL;
 	time_t committer_time;
-
-	if (gw_trans->action == GW_LOG || gw_trans->action == GW_LOGBRIEFS)
-		log_count = gw_get_repo_log_count(gw_trans, start_commit);
 
 	error = buf_alloc(&diffbuf, 0);
 	if (error)
@@ -2768,7 +2623,7 @@ gw_html_escape(const char *html)
 }
 
 int
-main()
+main(int argc, char *argv[])
 {
 	const struct got_error *error = NULL;
 	struct gw_trans *gw_trans;