git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Barret Rennie <barret@brennie.ca>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Johannes Sixt" <j6t@kdbg.org>, "Git List" <git@vger.kernel.org>,
	"Nguyễn Thái Ngọc" <pclouds@gmail.com>,
	"Michael Rappazzo" <rappazzo@gmail.com>
Subject: Re: [PATCH] builtin/worktree.c: add option for setting worktree name
Date: Mon, 27 Jun 2016 19:11:34 -0400	[thread overview]
Message-ID: <CAPig+cSEwib1iFyWE5h8-qTbsAC+zsaSDSYQnv6otWoOOjWAeA@mail.gmail.com> (raw)
In-Reply-To: <A2F194FC-281D-44DF-88CA-E0B8221A3E68@brennie.ca>

On Mon, Jun 27, 2016 at 1:52 AM, Barret Rennie <barret@brennie.ca> wrote:
> On Jun 26, 2016, at 5:00 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> One thing which hasn't been explained, and about which I'm still
>> confused even after reading this thread in its entirety, is what
>> Barret means when he says that he "breaks" his worktrees. What is the
>> nature of this breakage? Depending upon that answer, would "git
>> rev-parse --git-dir" be sufficient for your needs? Or, would "git
>> worktree list" be able to give you the desired information? (As
>> envisioned, "git worktree list" was intended to provide much more
>> information than it currently does, such as the .git/worktree dir
>> name, and such an enhancement might be welcome.)
>
> My worktree breakages are usually the result of my reorganizing my projects,
> usually because a branch changes name (for example, if branch release-1 gets
> pushed back to release-2). Then I go and rename all my directories and git
> gets unhappy and I have to manually fix them or re-create the worktrees.

Quoting from your earlier email justifying why you consider this patch
desirable:

    ...when I break my worktrees and can’t figure out
    which worktree dir is the one I’ve broken.

But, doesn't "git rev-parse --git-dir" from within a "broken" worktree
answer that question? Or, wouldn't an enhanced "git worktree list"
answer the question from the opposite side?

> Having `git worktree list` give the worktree directory would be very useful,
> but I still would like the ability to change the name of a worktree.

My knee-jerk reaction is that the directory name under .git/worktrees
is an implementation detail (and could easily have been an arbitrary
ID, such as .git/worktrees/7ba84ec0) and rather than exposing it
further and encouraging people to muck around in it manually, we
should be providing higher-level solutions so that they don't have to.

Even without the higher-level solutions, it seems like "git rev-parse
--git-dir" should satisfy your needs, and if someone enhances "git
worktree list" to provide the additional worktree tag name (as
envisioned all along), then you'd likewise have sufficient information
to "fix" your worktrees.

As an example of higher-level solutions, Duy's "git worktree move"
series[1] would, I think, be exactly what you need to avoid such
breakage in the first place (assuming you can retrain your fingers or
fix your scripts, if they are doing the worktree renaming).

I don't know how Duy and Junio feel about it, but my response to this
patch and what it wants to accomplish (even with Junio's input) is
fairly negative. I'd much rather see more missing high-level worktree
features implemented rather than see patches further exposing
git-worktree's internals.

[1]: http://thread.gmane.org/gmane.comp.version-control.git/298194

  reply	other threads:[~2016-06-27 23:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-25  5:15 [PATCH] builtin/worktree.c: add option for setting worktree name Barret Rennie
2016-06-25  6:17 ` Junio C Hamano
2016-06-25  6:28   ` Barret Rennie
2016-06-25  7:15 ` Johannes Sixt
2016-06-25  7:29   ` Barret Rennie
2016-06-25 19:45     ` Junio C Hamano
2016-06-25 20:19       ` Barret Rennie
2016-06-26 18:15       ` Junio C Hamano
2016-06-27  5:40         ` Barret Rennie
2016-06-27 13:17           ` Junio C Hamano
2016-06-26 23:00       ` Eric Sunshine
2016-06-27  5:52         ` Barret Rennie
2016-06-27 23:11           ` Eric Sunshine [this message]
2016-06-29  4:45             ` Barret Rennie
2016-06-25  7:29   ` Barret Rennie
2016-06-25  7:32   ` Barret Rennie

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=CAPig+cSEwib1iFyWE5h8-qTbsAC+zsaSDSYQnv6otWoOOjWAeA@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=barret@brennie.ca \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=pclouds@gmail.com \
    --cc=rappazzo@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.
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).