From: Lars Hjemli Date: Sun, 23 Sep 2007 19:33:15 GMT Subject: Re: [PATCH 3/5] git-merge: add support for branch..mergeoptions Message-ID: <8c5c35580709231233k1e24e36ayf294483d67096058@mail.gmail.com> In-Reply-To: <7vr6kpchny.fsf@gitster.siamese.dyndns.org> On 9/23/07, Junio C Hamano wrote: > "Lars Hjemli" writes: > > > On 9/23/07, Junio C Hamano wrote: > >> Lars Hjemli 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 Yes, this is much better (and the ${parameter#word} syntax was nice too). Thanks. -- larsh