From: Eric Sunshine Date: Sat, 01 Aug 2015 09:03:56 GMT Subject: Re: [RFC/PATCH 07/11] branch: move 'current' check down to the presentation layer Message-ID: In-Reply-To: On Sat, Aug 1, 2015 at 2:48 AM, Karthik Nayak wrote: > On Thu, Jul 30, 2015 at 2:57 AM, Matthieu Moy > wrote: > Good point! I just was wondering if we need another atom just to print a star. > But your points certainly are valid. I'll implement this. Thanks :) > >>> This would remove the need of making the printing of the "*" to be >>> needed by ref-filter. As this is only needed in branch.c >>> >>> If going on what you're saying we could have a "%(starifcurrent)" atom or >>> something, but I don't see a general use for this. >> >> To have a really customizeable format, you would want to allow e.g. >> >> git branch --format '%(starifcurrent) %(objectname) %(refname)' >> >> if the user wants to get the sha1 before the refname, and still have the >> star in front. It's a bit frustrating to have a hardcoded format that >> the user can't reproduce with the --format option, since it means you >> can't easily make a small variation on it. > > Agreed. will have a "starifcurrent" atom :) Please don't. It's better to avoid these highly specialized solutions and instead seek general purpose ones. For instance, utilizing the %(if:) atom suggested elsewhere, you might add an %(iscurrentbranch) which would allow a format like this: %(if:iscurrentbranch)*%(endif) Even more generic would be an %(ifeq:x:y) conditional and a %(currentbranch) atom: %(ifeq:refname:currentbranch)*%(endif) Those are just a couple ideas. Other variations are possible and likely preferable to the specialized %(starifcurrent).