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]

 



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)
       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
	fi
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? I'm fairly new to doing Bourne shell scripting, so I don't yet have a good sense of how these things should be structured.

Also, has anyone considered writing a test suite for TopGit? I actually got fairly deep in to a series of 10 or so patches before I hit these problems, since tg-create worked fine as long as I only supplied one dependency, and I didn't notice the second issue until I tried to do a tg-update after modifying one of my base patches.

-- Brian--
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