All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Randall S. Becker" <rsbecker@nexbridge.com>
Cc: <git@vger.kernel.org>
Subject: Re: [Patch 2/3] Documentation/config.txt: add worktree includeIf conditionals.
Date: Wed, 14 Jul 2021 10:10:20 -0700	[thread overview]
Message-ID: <xmqqczrkyg77.fsf@gitster.g> (raw)
In-Reply-To: <006b01d778b6$b74b8600$25e29200$@nexbridge.com> (Randall S. Becker's message of "Wed, 14 Jul 2021 09:46:52 -0400")

"Randall S. Becker" <rsbecker@nexbridge.com> writes:

>>Assuming that I guessed correctly, is this a deliberate design
>>decision not to "automatically add ** after a pattern that ends
>>with a slash", and if so why?  I would have thought that "in the
>>worktrees that I create inside /var/tmp/, please enable these
>>configuration variables" would be a fairly natural thing to ask,
>>and I do not immediately see a reason why we want to apply
>>different syntax rules between "gitdir" and "worktree".

> The reason for this comes down to what is in
>*the_repository.

Sorry, but I still do not understand.

> Essentially, the_repository->gitdir always has a /path/to/.git
> directory with full qualification.

Yes.

> the_repository->worktree does not have /.git added
> for obvious reasons, so the /path/to is bare of the trailing
>/.

It may be the case, but /path/to/.git does not have trailing slash,
either, so I do not see the relevance.

When you say [includeIf "gitdir:/path/"], the "behave as if ** is
added after the slash at the end" rule kicks in, and the pattern
"/path/**" is used to see if it matches "/path/to/.git" and it does,
right?  When you say [includeIf "worktree:/path/"], wouldn't the
resulting "/path/**" match "/path/to"?

By the way, I think [PATCH 1/3] should turn the body of
include_by_gitdir() to a common helper function that

 - accepts a path to a directory and a pattern
 - turns it into a relpath
 - prepares the pattern with prepare_include_condition_pattern()
 - do the match include_by_gitdir() does.

and make include_by_gitdir() a very thin wrapper that passes
opts->git_dir to that common helper.  Then you do not have to copy
the entire function to create your new include_by_worktree(); it can
be another very thin wrapper that passes the_repository->worktree
instead of opts->git_dir to the common helper, as there is no other
difference in these two functions.

Thanks.

  reply	other threads:[~2021-07-14 17:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 22:31 [Patch 0/3] includeIf series for worktrees randall.becker
2021-07-12 22:31 ` [Patch 1/3] config.c: add conditional include based on worktree randall.becker
2021-07-13 13:03   ` Johannes Schindelin
2021-07-12 22:31 ` [Patch 2/3] Documentation/config.txt: add worktree includeIf conditionals randall.becker
2021-07-14  1:04   ` Junio C Hamano
2021-07-14 13:46     ` Randall S. Becker
2021-07-14 17:10       ` Junio C Hamano [this message]
2021-07-14 17:30         ` Randall S. Becker
2021-07-12 22:31 ` [Patch 3/3] t1305: add tests for includeIf:worktree randall.becker

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=xmqqczrkyg77.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rsbecker@nexbridge.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.