All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/3] git-gui: use the actual worktree
Date: Wed, 18 Feb 2009 09:22:19 -0800	[thread overview]
Message-ID: <20090218172219.GF22848@spearce.org> (raw)
In-Reply-To: <1234144850-2903-3-git-send-email-giuseppe.bilotta@gmail.com>

Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:
> Don't rely on the git worktree being the updir of the gitdir, since it
> might not be. Instead, define (and use) a new _gitworktree global
> variable, setting it to $GIT_WORK_TREE if present, or to whatever we
> guess the correct worktree is.
> 
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> ---
>  git-gui/git-gui.sh |   25 +++++++++++++++++++------
>  1 files changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
> index 658a728..94317c7 100755
> --- a/git-gui/git-gui.sh
> +++ b/git-gui/git-gui.sh
> @@ -1062,13 +1063,19 @@ if {![file isdirectory $_gitdir]} {
>  	error_popup [strcat [mc "Git directory not found:"] "\n\n$_gitdir"]
>  	exit 1
>  }
> +set _gitworktree $env(GIT_WORK_TREE)

In TCL it is an error if an environment variable is undefined
when accessed.  You need to wrap this up in a catch block to handle
the error:

Error in startup script: can't read "env(GIT_WORK_TREE)": no such variable
    while executing
"set _gitworktree $env(GIT_WORK_TREE)"
    (file "./git-gui.sh" line 1066)

Also, what about honoring core.worktree as a setting, in
addition to $env(GIT_WORK_TREE) like the git wrapper does?

-- 
Shawn.

  reply	other threads:[~2009-02-18 17:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09  2:00 [PATCH 0/3] git-gui: generic and robust worktree/gitdir support Giuseppe Bilotta
2009-02-09  2:00 ` [PATCH 1/3] git-gui: properly check for a bare repo Giuseppe Bilotta
2009-02-18 17:16   ` Shawn O. Pearce
2009-02-18 21:47     ` Giuseppe Bilotta
2009-02-18 21:53       ` Shawn O. Pearce
2009-02-09  2:00 ` [PATCH 2/3] git-gui: use the actual worktree Giuseppe Bilotta
2009-02-18 17:22   ` Shawn O. Pearce [this message]
2009-02-09  2:00 ` [PATCH 3/3] git-gui: define correct GIT_DIR for gitk Giuseppe Bilotta
2009-02-18 17:22   ` Shawn O. Pearce

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=20090218172219.GF22848@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=giuseppe.bilotta@gmail.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.