All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ignacio Encinas Rubio <ignacio@iencinas.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] config: learn the "hostname:" includeIf condition
Date: Sat, 09 Mar 2024 09:38:10 -0800	[thread overview]
Message-ID: <xmqq8r2re265.fsf@gitster.g> (raw)
In-Reply-To: <01a9baa2-b36b-4b4e-8e54-7645e35d1a47@iencinas.com> (Ignacio Encinas Rubio's message of "Sat, 9 Mar 2024 11:47:55 +0100")

Ignacio Encinas Rubio <ignacio@iencinas.com> writes:

>>> +test_expect_success 'conditional include, hostname' '
>>> +	echo "[includeIf \"hostname:$(hostname)a\"]path=bar12" >>.git/config &&
>>> +	echo "[test]twelve=12" >.git/bar12 &&
>>> +	test_must_fail git config test.twelve &&
>> 
>> Emulating other tests in this file that uses here document may make
>> it a bit easier to read?  E.g.,
>> 
>> 	cat >>.gitconfig <<-EOF &&
>> 	[includeIf "hostname:$(hostname)a"]
>> 		path = bar12
>> 	EOF
>
> Thanks for pointing that out. I just read the last tests from that file
> where they used the echo "..." >> approach. Do you think it is
> worthwhile rewriting those tests to use the approach you suggested?

I had an impression that existing ones do not have ugliness of
backslash-quoting and do not benefit from such a rewrite to use
here-document as much as the one you added does.  

If that is not the case, and existing ones would concretely improve
the readability with such a rewrite to use here-document, surely.
If we want to do that route, we should either do one of the two.

 - The patch [1/2] does such a "style update" only on existing tests
   to improve their readability, and then patch [2/2] then does your
   addition to the tests, together with the code change.

 - Or you do this patch alone, without touching existing tests, but
   with your tests added in an easier-to-read style.  And then after
   the dust settles, a separate "style udpate" patch clean the
   existing ones up.

> By the way, before contributing, I saw there is some work on moving to
> unit tests. I wasn't sure how to test this particular feature there, so
> I went with the "old" approach as it seemed more natural. Is this ok?

We are not really "moving to".  We did not have a test framework for
effective unit tests, so some tests that would have been easier to
manage as unit tests were instead written as an end-to-end
integration tests, which was what we had a framework for.  These
tests are moving to, but for a test like "the user uses the
'[includeIf X:Y] path = P' construct---does the git command really
shows the effect of include from P when condition X:Y holds?", the
unit testing framework would not be a better fit than the end-to-end
behaviour test, I would say.



  reply	other threads:[~2024-03-09 17:38 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 20:50 [RFC PATCH 0/1] Add hostname condition to includeIf Ignacio Encinas
2024-03-07 20:50 ` [RFC PATCH 1/1] config: learn the "hostname:" includeIf condition Ignacio Encinas
2024-03-07 21:40   ` Junio C Hamano
2024-03-09 10:47     ` Ignacio Encinas Rubio
2024-03-09 17:38       ` Junio C Hamano [this message]
2024-03-09 18:18 ` [PATCH v2 0/1] Add hostname condition to includeIf Ignacio Encinas
2024-03-09 18:18   ` [PATCH v2 1/1] config: learn the "hostname:" includeIf condition Ignacio Encinas
2024-03-10 16:59     ` Junio C Hamano
2024-03-10 18:46       ` Ignacio Encinas Rubio
2024-03-11 17:39         ` Junio C Hamano
2024-03-13 21:53           ` Ignacio Encinas Rubio
2024-03-16  6:57     ` Jeff King
2024-03-16 11:19       ` Ignacio Encinas Rubio
2024-03-16 16:00         ` Taylor Blau
2024-03-16 16:46           ` Ignacio Encinas Rubio
2024-03-16 17:02       ` Junio C Hamano
2024-03-16 17:41         ` rsbecker
2024-03-16 18:05           ` Ignacio Encinas Rubio
2024-03-16 18:49             ` rsbecker
2024-03-18  8:17         ` Jeff King
2024-03-16 16:01     ` Taylor Blau
2024-03-16 16:50       ` Ignacio Encinas Rubio
2024-03-19 18:37   ` [PATCH v3 0/2] Add hostname condition to includeIf Ignacio Encinas
2024-03-19 18:37     ` [PATCH v3 1/2] t: add a test helper for getting hostname Ignacio Encinas
2024-03-19 20:31       ` Junio C Hamano
2024-03-19 20:57         ` Jeff King
2024-03-19 21:00           ` Junio C Hamano
2024-03-19 21:11             ` Jeff King
2024-03-19 21:44               ` Junio C Hamano
2024-03-21  0:11                 ` Chris Torek
2024-03-19 20:56       ` Jeff King
2024-03-19 18:37     ` [PATCH v3 2/2] config: learn the "hostname:" includeIf condition Ignacio Encinas
2024-03-19 20:53       ` Junio C Hamano
2024-03-19 21:04       ` Jeff King
2024-03-19 21:32         ` Ignacio Encinas Rubio
2024-03-19 20:55     ` [PATCH v3 0/2] Add hostname condition to includeIf Eric Sunshine
2024-03-19 21:12       ` Junio C Hamano
2024-03-19 21:13         ` Eric Sunshine
2024-03-20  0:19           ` Jeff King
2024-03-20  2:49             ` Eric Sunshine
2024-03-20  3:07               ` Eric Sunshine
2024-03-20 14:34                 ` Chris Torek
2024-03-20 16:37                   ` Eric Sunshine
2024-03-20 20:51                     ` Jeff King
2024-03-20 16:49                   ` Junio C Hamano
2024-03-19 21:36         ` Dirk Gouders
2024-03-19 22:03           ` rsbecker
2024-03-19 22:26             ` Dirk Gouders
2024-03-19 22:31               ` rsbecker
2024-03-19 22:59                 ` Junio C Hamano
2024-03-19 21:22       ` Ignacio Encinas Rubio

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=xmqq8r2re265.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=ignacio@iencinas.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.