From: Julius Plenz Date: Thu, 7 Apr 2011 10:59:24 +0000 (+0200) Subject: guess default branch from HEAD X-Git-Url: https://gitweb.ps.run/ps-cgit/commitdiff_plain/d711de55280c3c9c10cfda4e24c8f3b3015217b2?ds=sidebyside;hp=d711de55280c3c9c10cfda4e24c8f3b3015217b2 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 Signed-off-by: Lars Hjemli ---