• Show log

    Commit

  • Hash : 9d46f167
    Author : Patrick Steinhardt
    Date : 2019-07-19T10:50:51

    repository: do not initialize HEAD if it's provided by templates
    
    When using templates to initialize a git repository, then git-init(1)
    will copy over all contents of the template directory. These will be
    preferred over the default ones created by git-init(1). While we mostly
    do the same, there is the exception of "HEAD". While we do copy over the
    template's HEAD file, afterwards we'll immediately re-initialize its
    contents with either the default "ref: refs/origin/master" or the init
    option's `initial_head` field.
    
    Let's fix the inconsistency with upstream git-init(1) by not overwriting
    the template HEAD, but only if the user hasn't set `opts.initial_head`.
    If the `initial_head` field has been supplied, we should use that
    indifferent from whether the template contained a HEAD file or not. Add
    tests to verify we correctly use the template directory's HEAD file and
    that `initial_head` overrides the template.