Re: [PATCH] Add git-bundle - pack objects and references for disconnected transfer

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

 



Junio C Hamano <junkio@xxxxxxx> wrote:
> Mark Levedahl <mdl123@xxxxxxxxxxx> 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.  ;-)
 
> > +	# 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.
-
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]