git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/5] git-merge: add support for branch.<name>.mergeoptions

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 23, 2007, 19:20 UTC
Message-ID
<7vr6kpchny.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<8c5c35580709230331h459bd07ay8b17146b5feec212@mail.gmail.com>
"Lars Hjemli" <hjemli@gmail.com> writes:
Show 11 quoted lines
> On 9/23/07, Junio C Hamano <gitster@pobox.com> wrote:
>> Lars Hjemli <hjemli@gmail.com> writes:
>> > +branch=$(git-symbolic-ref HEAD | sed -e 's|^refs/heads/||')
>> > +mergeopts=$(git config "branch.$branch.mergeoptions")
>> > +parse_config $mergeopts
>>
>> What should happen when your head is detached?
>>
>
> My plan was 'nothing', but I should have tested it (it does work, but
> also prints an ugly "fatal: ref HEAD is not a symbolic ref").

That, and also running "git config branch..mergeoptions" and expect it does not change behaviour to issue more strict warning, are both not so good. Perhaps the code needs to be more defensive like:

    if branch=$(git symbolic-ref -q HEAD)
    then
        mergeopts=$(git config "branch.${branch#refs/heads/}.mergeoptions")
	if test -n "$mergeopts"
        then
	    parse_config $mergeopts
	fi
    fi
 
Previous: Lars HjemliNext: Lars Hjemli
Message 11 of 14 in “per branch options for git-merge incl. --no-ff”
  1. 0/5 per branch options for git-merge incl. --no-ffLars Hjemli, Sep 22, 2007
  2. 1/5 Add test-script for git-merge porcelainLars Hjemli, Sep 22, 2007
  3. 2/5 git-merge: refactor option parsingLars Hjemli, Sep 22, 2007
  4. 3/5 git-merge: add support for branch.<name>.mergeoptionsLars Hjemli, Sep 22, 2007
  5. 4/5 git-merge: add support for --commitLars Hjemli, Sep 22, 2007
  6. 5/5 git-merge: add --ff and --no-ff optionsLars Hjemli, Sep 22, 2007
  7. Junio C HamanoSep 23, 2007
  8. Lars HjemliSep 23, 2007
  9. Junio C HamanoSep 23, 2007
  10. Lars HjemliSep 23, 2007
  11. Junio C HamanoSep 23, 2007
  12. Lars HjemliSep 23, 2007
  13. Junio C HamanoSep 23, 2007
  14. Lars HjemliSep 23, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.