]> gitweb.ps.run Git - ps-cgit/commit
guess default branch from HEAD
authorJulius Plenz <plenz@cis.fu-berlin.de>
Thu, 7 Apr 2011 10:59:24 +0000 (12:59 +0200)
committerLars Hjemli <hjemli@gmail.com>
Mon, 20 Jun 2011 18:42:19 +0000 (20:42 +0200)
commitd711de55280c3c9c10cfda4e24c8f3b3015217b2
tree2e4a7d8dcaeefb4259756a16be04c40dee7ed49c
parentb0d72da02850abaf4be65ff220774a457c214651
guess default branch from HEAD

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@cis.fu-berlin.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
cgitrc.5.txt
scan-tree.c