Re: [PATCH] Add option -b/--branch to clone for select a new HEAD

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

 



On Tue, Aug 25, 2009 at 12:42:48AM +0400, Kirill A. Korinskiy wrote:

> Sometimes (especially on production systems) we need to use only one
> remote branch for building software. It really annoying to clone
> origin and then swith branch by hand everytime. So this patch provide
> functionality to clone remote branch with one command without using
> checkout after clone.

If you are doing this a lot, it is probably a sign that you should
repoint the "HEAD" of the parent repository.

That being said, you may want one branch half the time, and another
branch the other half. So I think this is a good feature.

A few comments:

> ---
>  Documentation/git-clone.txt |    4 ++++
>  builtin-clone.c             |   26 +++++++++++++++++++++++---
>  2 files changed, 27 insertions(+), 3 deletions(-)

Tests?

> -	const struct ref *refs, *head_points_at, *remote_head, *mapped_refs;
> -	struct strbuf key = STRBUF_INIT, value = STRBUF_INIT;
> +	const struct ref *refs, *head_points_at, *remote_head = NULL, *mapped_refs;
> +	struct strbuf key = STRBUF_INIT, value = STRBUF_INIT, branch_head = STRBUF_INIT;

Style nit: I don't know if we have a style guideline for declaring
variables, but I find these "many variables on a line" declarations
annoying for reviewing, since it is hard to see what actually changed
(and yes, you only added a declaration on one, so I am partially
complaining about the person who came before you :) ).

> +		if (option_branch)
> +			die("--bare and --branch %s options are incompatible.",
> +			    option_branch);

Hmm. Would it perhaps make sense to have "--bare --branch foo" point the
HEAD of the newly created bare repo, but not impact the (nonexistent)
working tree?

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