From 2b89f4385c09a6bc2949edd43f7af951166f8028 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 1 Mar 2015 20:01:59 -0800 Subject: [PATCH] genindex.sh: sort the project list In order for gitweb.cgi to properly pick up forks when using a project list file, the forks must come AFTER the forkee. Currently this would always be the case since the fork must be created after the forkee and therefore it would appear later in the group file. However, if we start reusing unused project numbers (because some project has been removed) and continue to maintain the group file in project number order, the fork could appear before the forkee. Guarantee this doesn't happen in the project list by sorting the output. Note that apparently glibc has a bug where sorting the list with a UTF-8 locale active causes '.' to sort after '/' which would break forks since we require foo.git to appear in the list before foo/fork.git. Fortunately explicitly setting LC_ALL=C works around this problem. We are careful to sort the list before applying the '+' -> '%2B' transformation. --- gitweb/genindex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitweb/genindex.sh b/gitweb/genindex.sh index 9d256d9..b819f21 100755 --- a/gitweb/genindex.sh +++ b/gitweb/genindex.sh @@ -18,7 +18,7 @@ fi # containing it to be omitted from the project list page. get_repo_list | while read proj; do echo "$proj.git $(cd "$cfg_reporoot/$proj.git" && config_get owner)" -done | sed -e 's/+/%2B/g' >/tmp/gitweb.list.$$ +done | LC_ALL=C sort -k 1,1 | sed -e 's/+/%2B/g' >/tmp/gitweb.list.$$ # Set the proper group, if configured, before the move if [ -n "$cfg_owning_group" ]; then -- 2.11.4.GIT