All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randall S. Becker" <rsbecker@nexbridge.com>
To: "'Junio C Hamano'" <gitster@pobox.com>
Cc: <git@vger.kernel.org>
Subject: RE: [Patch 2/3] Documentation/config.txt: add worktree includeIf conditionals.
Date: Wed, 14 Jul 2021 13:30:44 -0400	[thread overview]
Message-ID: <001101d778d5$fd6c7670$f8456350$@nexbridge.com> (raw)
In-Reply-To: <xmqqczrkyg77.fsf@gitster.g>

On July 14, 2021 1:10 PM, Junio C Hamano
>"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"?

I think I over-complicated the first test case and got myself into a mess. Will fix that.

>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.

That sounds like a plan. Will go for it in V2.

-Randall


  reply	other threads:[~2021-07-14 17:30 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
2021-07-14 17:30         ` Randall S. Becker [this message]
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='001101d778d5$fd6c7670$f8456350$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.