Re: [PATCH v3 3/3] refspec: make @ a synonym of HEAD

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

 



Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:

> Since commit 9ba89f484e git learned how to push to a remote branch using
> the source @, for example:
>
>   git push origin @:master
>
> However, if the right-hand side is missing, the push fails:
>
>   git push origin @
>
> It is obvious what is the desired behavior, and allowing the push makes
> things more consistent.
>
> Additionally, @:master now has the same semantics as HEAD:master.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---
>  refspec.c             |   5 +-
>  t/t5511-refspec.sh    |   2 +
>  t/t5516-fetch-push.sh | 106 ++++++++++++++++++++++--------------------
>  3 files changed, 61 insertions(+), 52 deletions(-)

Sorry, but I cannot queue this version in today's pushout due to
time constraints.

> -test_expect_success 'push with HEAD' '
> +for head in HEAD @; do

Style: replace "; " with a LF.

> +	test_expect_success "push with $head" "

Don't open the test body with double-quote; keep using the original
single-quote and the reference to $head is resolved while running
the test, not when the test body is formulated before eval'ed.

Two benefits are

 - (obvious) you do not need extra quoting, e.g. \$the_commit etc.

 - in this case it does not matter, but it works intuitively when
   the variable has $IFS whitespace in it.  If you write in the test
   body that is enclosed in a single-quote pair,

		git push testrepo "$head"

   would correctly give the contents of variable head as a single
   element in argv[] of "git push".

For the latter reason, it is encouraged to make it a habit to do so.

Thanks.



[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