Re: [PATCH] pull: replace unnecessary sed invocation

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

 



On 03/18/2010 08:30 AM, Gabriel Filion wrote:
> On 2010-03-18 01:10, Stephen Boyd wrote:
>> Getting the shortened branch name is as easy as using the shell's
>> parameter expansion.
>>
>>  curr_branch=$(git symbolic-ref -q HEAD)
>> -curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
>> +curr_branch_short="${curr_branch#refs/heads/}"
> 
> This modification is a bashism. This syntax is not compatible with other
> shells.

But, there is already precedence for using syntax in scripts, so it
is probably ok.

$ egrep -- '\$\{[^}]+#[^}]+\}' *.sh
git-bisect.sh:                  start_head="${head#refs/heads/}"
git-filter-branch.sh:           ref="${ref#refs/tags/}"
git-parse-remote.sh:        heads/*) remote=${remote#heads/} ;;
git-parse-remote.sh:        refs/heads/*) remote=${remote#refs/heads/} ;;
git-pull.sh:    curr_branch=${curr_branch#refs/heads/}
git-pull.sh:            echo "Your configuration specifies to $op_type $op_prep the ref '${upstream#refs/heads/}'"
git-rebase--interactive.sh:             pend="${pend# $p}"
git-rebase--interactive.sh:                     new_parents=${new_parents# $first_parent}
git-rebase--interactive.sh:             if      left=${1%...*} right=${1#*...} &&
git-rebase.sh:  eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
git-rebase.sh:  if      left=${onto_name%...*} right=${onto_name#*...} &&
git-stash.sh:           branch=${branch#refs/heads/}
git-submodule.sh:                       url="${url#../}"
git-submodule.sh:                       url="${url#./}"
--
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]