Re: [PATCH 2/2] [TopGit] Portability: Don't use alternation ("|") in sed regular expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Brian, hello Junio,

On Thu, Mar 12, 2009 at 11:00:00AM -0400, Brian Campbell wrote:
> On Mar 12, 2009, at 3:45 AM, Uwe Kleine-König wrote:
>
>>> - You will be utterly confused by a local branch whose name is
>>>   "refs/top-bases/foo"
>> You mean a branch that has the full name refs/heads/refs/top-bases/ 
>> foo?
>> Well OK, valid concern.
>
> Yes, you're right, this is a problem.
>
>>> To fix these, you might want to do something like:
>>>
>>> 	if head_=$(git symbolic-ref HEAD)
Shouldn't git symbolic-ref -q HEAD be used here?

>>>        then
>>>                case "$head_" in
>>>                refs/heads/*)
>>>                        echo "${head_#refs/heads/}"
>>>                        ;;
>>>                refs/top-bases/*)
>>>                        echo "${head_#refs/top-bases/}"
>>>                        ;;
>>>                *)
>>>                        echo "$head_"
>>>                        ;;
>>>                esac
>>> 	else
>>>        	whatever you want to do on a detached HEAD
How do I  distinguish between a detached HEAD and another error?  I have
the feeling that git symbolic-ref -q HEAD should exit(0) with a detached
HEAD.

>> Thanks Junio and Brian.
>>
>> Brian, do you update the series?
>
> Sure, I'll send an updated patch.
>
> I'm thinking that for the detached HEAD case, this function should die  
> with a message about not being on a valid branch, and then the call site 
> in tg-summary that doesn't care about being on a valid branch should 
> ignore the error and leave curname empty. Does that sound about right? 
mmh, I would return "" and let the caller handle that.

> Also, has anyone considered writing a test suite for TopGit?
Yes, but I didn't found the time for that until now.  If you'd volunteer
that would be very welcome.

IMHO we should reuse as much as possible from git.git.  For me even
requiring a git.git checkout to use its files would be OK.  I consider
that even better then duplicating the relevant files.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
Peiner Strasse 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686              | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux