git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Federico Kircheis <federico.kircheis@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git aliases and GIT_PREFIX
Date: Tue, 2 Nov 2021 15:26:05 +0100 (CET)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.2111021520370.56@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <2e328484-d0e3-8801-61da-07544cc93eef@gmail.com>

Hi Federico,

On Thu, 28 Oct 2021, Federico Kircheis wrote:

> today I reported what I believed to be a bug on
>
>  https://github.com/git-for-windows/git/issues/3496
>
> and learned about GIT_DIR when working with aliases and git worktree.
>
> It's annoying that GIT_DIR it is defined only if (as far as I've understood)
> working from a worktrees or submodule, as it does not seem to be related to
> those type of repositories.

To clarify: `GIT_DIR` is set when executing an alias in a worktree other
than the primary one (and probably also in submodules), but not when
executing in a primary worktree.

> This is also irritating because apparently working aliases breaks when being
> executed from those repositories.

To clarify: an alias that wants to switch to a different repository and
execute Git commands there works well in a primary worktree. But when you
switch to a different repository while executing an alias from a secondary
worktree, it will fail because of `GIT_DIR` having been set.

> I believe it would be better if GIT_DIR it's either always set or never
> (could someone enlighten me why the variable is needed in first place?).

The fact that `GIT_DIR` is not set when calling an alias in a primary
worktree suggests that the behavior in secondary worktrees is not by
design. We should therefore be able to stop setting it there.

The question is: what code is responsible for setting it only in some
circumstances but not others?

Federico, do you have any experience in debugging C code? If so, it would
be good if you could take a crack at investigating this.

Ciao,
Johannes

  parent reply	other threads:[~2021-11-02 14:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 19:03 git aliases and GIT_PREFIX Federico Kircheis
2021-10-29 10:59 ` Ævar Arnfjörð Bjarmason
2021-11-02 14:26 ` Johannes Schindelin [this message]
2021-11-02 17:26   ` Federico Kircheis
2021-11-04  0:02     ` Johannes Schindelin

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.2111021520370.56@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=federico.kircheis@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).