git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Russell Stuart <russell+git.vger.kernel.org@stuart.id.au>
Cc: git@vger.kernel.org
Subject: Re: "git worktree repair" modifies the wrong repository
Date: Thu, 19 Sep 2024 06:47:43 -0400	[thread overview]
Message-ID: <CAPig+cTkpLLoTxTa-8xfycNGFibN_M71+kkHtT-wgp6HRPi-aw@mail.gmail.com> (raw)
In-Reply-To: <3b579ddd-b386-4daa-ad63-1e75522b7462@stuart.id.au>

On Thu, Sep 19, 2024 at 6:16 AM Russell Stuart
<russell+git.vger.kernel.org@stuart.id.au> wrote:
> I can't resist pointing out if "git worktree add" had of preserved the
> relative paths I gave it, it would not have happened.

The idea of relative paths has been discussed previously[*] but was
never implemented; although they may help some cases, they break other
cases or at least make the other cases more difficult. For instance,
relative paths only help if the main and linked worktrees move
together in some uniform fashion, but don't help if they move in
distinct ways. Storing *both* the absolute and relative paths rather
than only the absolute path was also discussed and seemed promising,
but concerns were raised that doing so could break other Git-related
tools or non-canonical Git implementations (or even perhaps older
versions of Git itself), thus was never pursued.

FOOTNOTES

[*] The previous discussion was in the context of an earlier
implementation of git-worktree, long before there was a "repair"
subcommand. In fact, the very original implementation of linked
worktrees (which was actually `git checkout --to=<path>` would attempt
to automatically repair itself whenever any Git command discovered
some sort of breakage, however, that initial implementation was buggy
in some fashion (I don't have the details at hand), so the auto-repair
feature was removed very early on. The "repair" subcommand came much
later and took the conservative approach of addressing common problems
people were reporting at the time, and was extended as new reports
came in, rather than trying to tackle every possible way in which
someone could wield a foot-gun.

  reply	other threads:[~2024-09-19 10:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-19  1:12 "git worktree repair" modifies the wrong repository Russell Stuart
2024-09-19  8:58 ` Eric Sunshine
2024-09-19 10:16   ` Russell Stuart
2024-09-19 10:47     ` Eric Sunshine [this message]
2024-09-19 11:40       ` Russell Stuart
2024-09-23 18:52         ` Eric Sunshine
2024-09-24 13:53           ` Phillip Wood
2024-10-03  6:28             ` Eric Sunshine
2024-10-04  9:15               ` phillip.wood123
2024-10-04 15:50                 ` Junio C Hamano
2024-09-25  9:31           ` Russell Stuart

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=CAPig+cTkpLLoTxTa-8xfycNGFibN_M71+kkHtT-wgp6HRPi-aw@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=russell+git.vger.kernel.org@stuart.id.au \
    /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).