git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Junio Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3] When creating branch c/d check that branch c does not already exists.
Date: Sat, 24 Mar 2007 06:34:13 +0100	[thread overview]
Message-ID: <200703240634.14284.chriscool@tuxfamily.org> (raw)
In-Reply-To: <20070324063010.a114722e.chriscool@tuxfamily.org>

Oops, sorry this is an old mail that was in my Draft folder and should not 
have been sent...

Christian.

Le samedi 24 mars 2007 06:30, Christian Couder a écrit :
> With packed refs, there may not be a ".git/refs/heads/c" file
> when branch c exists. And currently in this case, there is no check
> to prevent creation of branch c/d.
>
> This should probably be rewritten in C and done after the ref lock
> has been taken to make sure no race exists though.
>
> This is mainly to make all test cases in "t3210-pack-refs.sh" work.
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
>  git-branch.sh |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/git-branch.sh b/git-branch.sh
> index 4826c75..4a1e7d9 100755
> --- a/git-branch.sh
> +++ b/git-branch.sh
> @@ -122,6 +122,16 @@ then
>  	done
>  fi
>
> +branchdir=$(dirname $branchname)
> +while test "$branchdir" != "."
> +do
> +	if git-show-ref --verify --quiet -- "refs/heads/$branchdir"
> +	then
> +		die "$branchdir already exists."
> +	fi
> +	branchdir=$(dirname $branchdir)
> +done
> +
>  if git-show-ref --verify --quiet -- "refs/heads/$branchname"
>  then
>  	if test '' = "$force"

  reply	other threads:[~2007-03-24  5:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-28  4:58 [PATCH 1/3] Add pack-refs and show-ref test cases Christian Couder
2007-03-24  5:30 ` [PATCH 2/3] When creating branch c/d check that branch c does not already exists Christian Couder
2007-03-24  5:34   ` Christian Couder [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-09-28  5:00 Christian Couder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200703240634.14284.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).