All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] t1020-subdirectory: test alias expansion in a subdirectory
Date: Mon, 8 Nov 2010 17:20:56 +0700	[thread overview]
Message-ID: <20101108102056.GA12366@do> (raw)
In-Reply-To: <627dc7921dc64a16063e77d542cf9edb22631ddd.1289205059.git.git@drmicha.warpmail.net>

On Mon, Nov 08, 2010 at 09:32:03AM +0100, Michael J Gruber wrote:
> Add a test for alias expansion in a subdirectory of the worktree.
> 
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> 
> ---
>     65f3a9e (Remove all logic from get_git_work_tree(), 2010-11-01) breaks this test,
>     which is why I am adding it.

How about squashing this in?

--8<--
Subject: Allow set_git_work_tree() to be called more than once

Usually one of the setup functions is called once. However alias
handling code needs to look ahead in $GIT_DIR/config for aliases. So
set_git_work_tree() may be called twice: once when alias is searched,
once when the actual command is run.

Loosen the condition and let it through. We can stricten it back when
alias handling is fixed.
---
diff --git a/environment.c b/environment.c
index 6db00da..f0d0b07 100644
--- a/environment.c
+++ b/environment.c
@@ -128,8 +128,6 @@ const char *get_git_dir(void)
 	return git_dir;
 }
 
-static int git_work_tree_initialized;
-
 /*
  * Note.  This works only before you used a work tree.  This was added
  * primarily to support git-clone to work in a new repository it just
@@ -137,9 +135,7 @@ static int git_work_tree_initialized;
  */
 void set_git_work_tree(const char *new_work_tree)
 {
-	if (git_work_tree_initialized)
-		die("internal error: work tree has already been set");
-	git_work_tree_initialized = 1;
+	free(work_tree);
 	work_tree = xstrdup(make_absolute_path(new_work_tree));
 }
 
--8<--
-- 
Duy

  reply	other threads:[~2010-11-08 10:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-08  8:32 [PATCH] t1020-subdirectory: test alias expansion in a subdirectory Michael J Gruber
2010-11-08 10:20 ` Nguyen Thai Ngoc Duy [this message]
2010-11-08 20:25   ` Junio C Hamano
2010-11-09  1:29     ` Nguyen Thai Ngoc Duy
2010-11-08 10:23 ` [PATCH] t0001: test git init when run via an alias Nguyễn Thái Ngọc Duy

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=20101108102056.GA12366@do \
    --to=pclouds@gmail.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.