[PATCH] guess default branch from HEAD

chris jugg at hotmail.com
Fri Jun 10 08:42:51 CEST 2011


Julius Plenz <plenz at ...> writes:
> 
> This is a saner alternative than hardcoding the default branch to be
> "master". The add_repo() function will now check for a symbolic ref in
> repo_path/HEAD. If there is a suitable one, overwrite repo->defbranch
> with it. Note that you'll need to strip the newline from the file (->
> len-17).
> 
> If HEAD is a symbolic link pointing directly to a branch below
> refs/heads/, do a readlink() instead to find the ref name.
> 
> Signed-off-by: Julius Plenz <plenz at ...>

I've successfully applied this patch against the current stable branch (commit: 
2a8f5531) and deployed the resulting binary without trouble.  The functionality 
appears to work as advertised.  So, along with setting the default 'readme'
value as:

readme=HEAD:README.md

each project is able to have a sensible default presentation based off of the 
project's default branch.  Very useful as we use gitolite to manage our 
repositories, this saves us further manual configuration outside of gitolite.

I hope this patch can be integrated into the official release.

chris






More information about the CGit mailing list