Re: [PATCH] Add git-bundle - pack objects and references for disconnected transfer
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Feb 16, 2007, 04:41 UTC
- Message-ID
- <20070216044158.GB28894@spearce.org>
- In-Reply-To
- <7vodnuc0me.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 10 quoted lines
> Mark Levedahl <mdl123@verizon.net> writes:
> > +# we do things a slow way if max-age or min-age are given
> > +fast=
> > +[ "${fullrevargs##*--max-age}" == "$fullrevargs" ] && \
> > +[ "${fullrevargs##*--min-age}" == "$fullrevargs" ] && fast=1
>
> Style.
>
> Our scripts tend to spell the test command "test" and equality test
> operator as single '='.Using "test" is a style thing, but using "=" rather than "==" is a portability issue. "==" is accepted by bash as a synonym for "=", but its not valid elsewhere.
I've made my fair share of patches with "==" in them, only to have someone else have a problem on their system and then submit a fix to change them to "=". Just say no to "==" in Git shell scripts. ;-)
Show 8 quoted lines
> > + # get immediate parents of each commit to include > > + parents= > > + for c in $commits ; do > > + parents="$parents $(git-rev-list --parents $c | head -1 | cut -b42-)" > > + done > > Nicely done, but you seemed to have used "head -n 1" elsewhere, > which is more portable.
What about:
parents="$parents $(git-rev-list --max-count=1 --parents $c | cut -b42-)"
?
I just used that trick recently. Oh yea it was in git-gui's GIT-VERSION-GEN script. Though I did not know about using cut like that...
-- Shawn.