Re: [PATCH 5/6] t1500: avoid setting environment variables outside of tests

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

 



On Tue, May 10, 2016 at 03:59:42PM -0400, Eric Sunshine wrote:

> On Tue, May 10, 2016 at 3:48 PM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> > Actually, I think we can have improved encapsulation and maintain
> > readability like this:
> >
> >     case "$1" in
> >     ...
> >     -g) env="$2"; shift;  shift ;;
> >     ...
> >     esac
> >
> >     ...
> >     test_expect_success "..." '
> >         if test -n "$env"
> >         do
> >             test_when_finished "unset GIT_DIR"
> >             GIT_DIR="$env"
> >             export GIT_DIR
> >         fi
> >         ...
> >     '
> 
> At this point, I'd also rename 'env' to 'gitdir' to be more meaningful.

Yeah, I like this even better. As much as I enjoy eval tricks, I think
this case is more readable with the condition written out.

-Peff
--
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]