All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] t1100: modernize test script
@ 2026-07-13 14:01 Shlok Kulshreshtha
  2026-07-13 14:01 ` [PATCH 1/2] t1100: modernize test style Shlok Kulshreshtha
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-13 14:01 UTC (permalink / raw)
  To: git; +Cc: Shlok Kulshreshtha

Hi,

This is a GSoC/Outreachy microproject ("Modernize a test script").  It
cleans up t/t1100-commit-tree-options.sh following the guidance Eric
Sunshine gave for t7001 in:

  https://lore.kernel.org/git/CAPig+cQpUu2UO-+jWn1nTaDykWnxwuEitzVB7PnW2SS_b7V8Hg@mail.gmail.com/

Each patch makes a single kind of change:

  1/2 converts the tests from the old backslash-continued
      test_expect_success style with space-indented bodies to the
      modern quoted-body form indented with tabs.

  2/2 moves the here-doc that creates the "expected" file out of the
      script's top level and into the existing setup test, so it runs
      under the protection of the test harness.

There is no change to what the tests actually verify; t1100 continues to
pass all 5 tests after each patch.

I confirmed t1100 does not appear to be currently claimed on the list;
please let me know if someone is already working on it.

Thanks,
Shlok

Shlok Kulshreshtha (2):
  t1100: modernize test style
  t1100: move creation of expected output into setup test

 t/t1100-commit-tree-options.sh | 59 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 30 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] t1100: modernize test style
  2026-07-13 14:01 [PATCH 0/2] t1100: modernize test script Shlok Kulshreshtha
@ 2026-07-13 14:01 ` Shlok Kulshreshtha
  2026-07-13 16:30   ` Junio C Hamano
  2026-07-14  7:39   ` Patrick Steinhardt
  2026-07-13 14:01 ` [PATCH 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
  2026-07-14  7:16 ` [PATCH v2 0/2] t1100: modernize test script Shlok Kulshreshtha
  2 siblings, 2 replies; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-13 14:01 UTC (permalink / raw)
  To: git; +Cc: Shlok Kulshreshtha, Junio C Hamano

The tests in this script use the old style in which the test title and
body are passed as separate backslash-continued arguments, with bodies
indented using spaces:

    test_expect_success \
        'title' \
        'body'

Convert them to the modern style in which the body is a single-quoted
block on its own lines, indented with a tab:

    test_expect_success 'title' '
        body
    '

This is a style-only change; no test logic is modified.

Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
---
 t/t1100-commit-tree-options.sh | 44 +++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index ae66ba5bab..fabe5a97cb 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -22,28 +22,28 @@ committer Committer Name <committer@email> 1117150200 +0000
 comment text
 EOF
 
-test_expect_success \
-    'test preparation: write empty tree' \
-    'git write-tree >treeid'
-
-test_expect_success \
-    'construct commit' \
-    'echo comment text |
-     GIT_AUTHOR_NAME="Author Name" \
-     GIT_AUTHOR_EMAIL="author@email" \
-     GIT_AUTHOR_DATE="2005-05-26 23:00" \
-     GIT_COMMITTER_NAME="Committer Name" \
-     GIT_COMMITTER_EMAIL="committer@email" \
-     GIT_COMMITTER_DATE="2005-05-26 23:30" \
-     TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null'
-
-test_expect_success \
-    'read commit' \
-    'git cat-file commit $(cat commitid) >commit'
-
-test_expect_success \
-    'compare commit' \
-    'test_cmp expected commit'
+test_expect_success 'test preparation: write empty tree' '
+	git write-tree >treeid
+'
+
+test_expect_success 'construct commit' '
+	echo comment text |
+	GIT_AUTHOR_NAME="Author Name" \
+	GIT_AUTHOR_EMAIL="author@email" \
+	GIT_AUTHOR_DATE="2005-05-26 23:00" \
+	GIT_COMMITTER_NAME="Committer Name" \
+	GIT_COMMITTER_EMAIL="committer@email" \
+	GIT_COMMITTER_DATE="2005-05-26 23:30" \
+	TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null
+'
+
+test_expect_success 'read commit' '
+	git cat-file commit $(cat commitid) >commit
+'
+
+test_expect_success 'compare commit' '
+	test_cmp expected commit
+'
 
 
 test_expect_success 'flags and then non flags' '
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] t1100: move creation of expected output into setup test
  2026-07-13 14:01 [PATCH 0/2] t1100: modernize test script Shlok Kulshreshtha
  2026-07-13 14:01 ` [PATCH 1/2] t1100: modernize test style Shlok Kulshreshtha
@ 2026-07-13 14:01 ` Shlok Kulshreshtha
  2026-07-13 16:10   ` Junio C Hamano
  2026-07-14  7:16 ` [PATCH v2 0/2] t1100: modernize test script Shlok Kulshreshtha
  2 siblings, 1 reply; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-13 14:01 UTC (permalink / raw)
  To: git; +Cc: Shlok Kulshreshtha, Junio C Hamano

The "expected" file was created at the top level of the script, outside
of any test. Code that runs outside of a test is not protected by the
test harness: a failure there is not reported as a test failure and is
easy to miss.

Move the here-doc that creates "expected" into the existing setup test
("test preparation: write empty tree"), using a "<<-" here-doc so its
body can be indented along with the rest of the test.

Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
---
 t/t1100-commit-tree-options.sh | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index fabe5a97cb..b434d1848e 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -14,15 +14,14 @@ Also make sure that command line parser understands the normal
 
 . ./test-lib.sh
 
-cat >expected <<EOF
-tree $EMPTY_TREE
-author Author Name <author@email> 1117148400 +0000
-committer Committer Name <committer@email> 1117150200 +0000
-
-comment text
-EOF
-
 test_expect_success 'test preparation: write empty tree' '
+	cat >expected <<-EOF &&
+	tree $EMPTY_TREE
+	author Author Name <author@email> 1117148400 +0000
+	committer Committer Name <committer@email> 1117150200 +0000
+
+	comment text
+	EOF
 	git write-tree >treeid
 '
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] t1100: move creation of expected output into setup test
  2026-07-13 14:01 ` [PATCH 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
@ 2026-07-13 16:10   ` Junio C Hamano
  0 siblings, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2026-07-13 16:10 UTC (permalink / raw)
  To: Shlok Kulshreshtha; +Cc: git

Shlok Kulshreshtha <diy2903@gmail.com> writes:

> The "expected" file was created at the top level of the script, outside

Use the present tense to describe what the current code does.  For
example:

    The 'expected' file is created at the top-level of the script,
    outside ...

> of any test. Code that runs outside of a test is not protected by the
> test harness: a failure there is not reported as a test failure and is
> easy to miss.
>
> Move the here-doc that creates "expected" into the existing setup test
> ("test preparation: write empty tree"), using a "<<-" here-doc so its
> body can be indented along with the rest of the test.
>
> Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
> ---
>  t/t1100-commit-tree-options.sh | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)

Trivially correct.

Thanks.

>
> diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
> index fabe5a97cb..b434d1848e 100755
> --- a/t/t1100-commit-tree-options.sh
> +++ b/t/t1100-commit-tree-options.sh
> @@ -14,15 +14,14 @@ Also make sure that command line parser understands the normal
>  
>  . ./test-lib.sh
>  
> -cat >expected <<EOF
> -tree $EMPTY_TREE
> -author Author Name <author@email> 1117148400 +0000
> -committer Committer Name <committer@email> 1117150200 +0000
> -
> -comment text
> -EOF
> -
>  test_expect_success 'test preparation: write empty tree' '
> +	cat >expected <<-EOF &&
> +	tree $EMPTY_TREE
> +	author Author Name <author@email> 1117148400 +0000
> +	committer Committer Name <committer@email> 1117150200 +0000
> +
> +	comment text
> +	EOF
>  	git write-tree >treeid
>  '

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] t1100: modernize test style
  2026-07-13 14:01 ` [PATCH 1/2] t1100: modernize test style Shlok Kulshreshtha
@ 2026-07-13 16:30   ` Junio C Hamano
  2026-07-14  7:39   ` Patrick Steinhardt
  1 sibling, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2026-07-13 16:30 UTC (permalink / raw)
  To: Shlok Kulshreshtha; +Cc: git

Shlok Kulshreshtha <diy2903@gmail.com> writes:

> The tests in this script use the old style in which the test title and
> body are passed as separate backslash-continued arguments, with bodies
> indented using spaces:
>
>     test_expect_success \
>         'title' \
>         'body'
>
> Convert them to the modern style in which the body is a single-quoted
> block on its own lines, indented with a tab:
>
>     test_expect_success 'title' '
>         body
>     '
>
> This is a style-only change; no test logic is modified.

Cleanly done.  Running "git show -w" on this patch clearly
demonstrates that no code has changed.

Thanks.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 0/2] t1100: modernize test script
  2026-07-13 14:01 [PATCH 0/2] t1100: modernize test script Shlok Kulshreshtha
  2026-07-13 14:01 ` [PATCH 1/2] t1100: modernize test style Shlok Kulshreshtha
  2026-07-13 14:01 ` [PATCH 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
@ 2026-07-14  7:16 ` Shlok Kulshreshtha
  2026-07-14  7:16   ` [PATCH v2 1/2] t1100: modernize test style Shlok Kulshreshtha
                     ` (2 more replies)
  2 siblings, 3 replies; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-14  7:16 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Shlok Kulshreshtha

This is v2 of the microproject cleaning up
t/t1100-commit-tree-options.sh ("Modernize a test script").

Thanks to Junio for reviewing v1.  The only change since v1 is in the
commit message of patch 2/2: it now uses the present tense ("is
created") to describe the current behavior of the script, as suggested.
Patch 1/2 is unchanged.

  1/2 converts the tests from the old backslash-continued
      test_expect_success style with space-indented bodies to the
      modern quoted-body form indented with tabs.

  2/2 moves the here-doc that creates "expected" out of the script's
      top level and into the existing setup test, so it runs under the
      protection of the test harness.

t1100 continues to pass all 5 tests.

Shlok Kulshreshtha (2):
  t1100: modernize test style
  t1100: move creation of expected output into setup test

 t/t1100-commit-tree-options.sh | 59 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 30 deletions(-)

Range-diff against v1:
1:  45f590f110 = 1:  45f590f110 t1100: modernize test style
2:  f74c71c104 ! 2:  36ea70be9d t1100: move creation of expected output into setup test
    @@ Metadata
      ## Commit message ##
         t1100: move creation of expected output into setup test
     
    -    The "expected" file was created at the top level of the script, outside
    +    The "expected" file is created at the top-level of the script, outside
         of any test. Code that runs outside of a test is not protected by the
         test harness: a failure there is not reported as a test failure and is
         easy to miss.
-- 
2.52.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 1/2] t1100: modernize test style
  2026-07-14  7:16 ` [PATCH v2 0/2] t1100: modernize test script Shlok Kulshreshtha
@ 2026-07-14  7:16   ` Shlok Kulshreshtha
  2026-07-14  7:16   ` [PATCH v2 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
  2026-07-14 12:20   ` [PATCH v3 0/2] t1100: modernize test script Shlok Kulshreshtha
  2 siblings, 0 replies; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-14  7:16 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Shlok Kulshreshtha

The tests in this script use the old style in which the test title and
body are passed as separate backslash-continued arguments, with bodies
indented using spaces:

    test_expect_success \
        'title' \
        'body'

Convert them to the modern style in which the body is a single-quoted
block on its own lines, indented with a tab:

    test_expect_success 'title' '
        body
    '

This is a style-only change; no test logic is modified.

Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
---
 t/t1100-commit-tree-options.sh | 44 +++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index ae66ba5bab..fabe5a97cb 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -22,28 +22,28 @@ committer Committer Name <committer@email> 1117150200 +0000
 comment text
 EOF
 
-test_expect_success \
-    'test preparation: write empty tree' \
-    'git write-tree >treeid'
-
-test_expect_success \
-    'construct commit' \
-    'echo comment text |
-     GIT_AUTHOR_NAME="Author Name" \
-     GIT_AUTHOR_EMAIL="author@email" \
-     GIT_AUTHOR_DATE="2005-05-26 23:00" \
-     GIT_COMMITTER_NAME="Committer Name" \
-     GIT_COMMITTER_EMAIL="committer@email" \
-     GIT_COMMITTER_DATE="2005-05-26 23:30" \
-     TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null'
-
-test_expect_success \
-    'read commit' \
-    'git cat-file commit $(cat commitid) >commit'
-
-test_expect_success \
-    'compare commit' \
-    'test_cmp expected commit'
+test_expect_success 'test preparation: write empty tree' '
+	git write-tree >treeid
+'
+
+test_expect_success 'construct commit' '
+	echo comment text |
+	GIT_AUTHOR_NAME="Author Name" \
+	GIT_AUTHOR_EMAIL="author@email" \
+	GIT_AUTHOR_DATE="2005-05-26 23:00" \
+	GIT_COMMITTER_NAME="Committer Name" \
+	GIT_COMMITTER_EMAIL="committer@email" \
+	GIT_COMMITTER_DATE="2005-05-26 23:30" \
+	TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null
+'
+
+test_expect_success 'read commit' '
+	git cat-file commit $(cat commitid) >commit
+'
+
+test_expect_success 'compare commit' '
+	test_cmp expected commit
+'
 
 
 test_expect_success 'flags and then non flags' '
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/2] t1100: move creation of expected output into setup test
  2026-07-14  7:16 ` [PATCH v2 0/2] t1100: modernize test script Shlok Kulshreshtha
  2026-07-14  7:16   ` [PATCH v2 1/2] t1100: modernize test style Shlok Kulshreshtha
@ 2026-07-14  7:16   ` Shlok Kulshreshtha
  2026-07-14 12:20   ` [PATCH v3 0/2] t1100: modernize test script Shlok Kulshreshtha
  2 siblings, 0 replies; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-14  7:16 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Shlok Kulshreshtha

The "expected" file is created at the top-level of the script, outside
of any test. Code that runs outside of a test is not protected by the
test harness: a failure there is not reported as a test failure and is
easy to miss.

Move the here-doc that creates "expected" into the existing setup test
("test preparation: write empty tree"), using a "<<-" here-doc so its
body can be indented along with the rest of the test.

Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
---
 t/t1100-commit-tree-options.sh | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index fabe5a97cb..b434d1848e 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -14,15 +14,14 @@ Also make sure that command line parser understands the normal
 
 . ./test-lib.sh
 
-cat >expected <<EOF
-tree $EMPTY_TREE
-author Author Name <author@email> 1117148400 +0000
-committer Committer Name <committer@email> 1117150200 +0000
-
-comment text
-EOF
-
 test_expect_success 'test preparation: write empty tree' '
+	cat >expected <<-EOF &&
+	tree $EMPTY_TREE
+	author Author Name <author@email> 1117148400 +0000
+	committer Committer Name <committer@email> 1117150200 +0000
+
+	comment text
+	EOF
 	git write-tree >treeid
 '
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] t1100: modernize test style
  2026-07-13 14:01 ` [PATCH 1/2] t1100: modernize test style Shlok Kulshreshtha
  2026-07-13 16:30   ` Junio C Hamano
@ 2026-07-14  7:39   ` Patrick Steinhardt
  1 sibling, 0 replies; 14+ messages in thread
From: Patrick Steinhardt @ 2026-07-14  7:39 UTC (permalink / raw)
  To: Shlok Kulshreshtha; +Cc: git, Junio C Hamano

On Mon, Jul 13, 2026 at 07:31:40PM +0530, Shlok Kulshreshtha wrote:
> diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
> index ae66ba5bab..fabe5a97cb 100755
> --- a/t/t1100-commit-tree-options.sh
> +++ b/t/t1100-commit-tree-options.sh
> @@ -22,28 +22,28 @@ committer Committer Name <committer@email> 1117150200 +0000
>  comment text
>  EOF
>  
> -test_expect_success \
> -    'test preparation: write empty tree' \
> -    'git write-tree >treeid'
> -
> -test_expect_success \
> -    'construct commit' \
> -    'echo comment text |
> -     GIT_AUTHOR_NAME="Author Name" \
> -     GIT_AUTHOR_EMAIL="author@email" \
> -     GIT_AUTHOR_DATE="2005-05-26 23:00" \
> -     GIT_COMMITTER_NAME="Committer Name" \
> -     GIT_COMMITTER_EMAIL="committer@email" \
> -     GIT_COMMITTER_DATE="2005-05-26 23:30" \
> -     TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null'
> -
> -test_expect_success \
> -    'read commit' \
> -    'git cat-file commit $(cat commitid) >commit'
> -
> -test_expect_success \
> -    'compare commit' \
> -    'test_cmp expected commit'
> +test_expect_success 'test preparation: write empty tree' '
> +	git write-tree >treeid
> +'
> +
> +test_expect_success 'construct commit' '
> +	echo comment text |
> +	GIT_AUTHOR_NAME="Author Name" \
> +	GIT_AUTHOR_EMAIL="author@email" \
> +	GIT_AUTHOR_DATE="2005-05-26 23:00" \
> +	GIT_COMMITTER_NAME="Committer Name" \
> +	GIT_COMMITTER_EMAIL="committer@email" \
> +	GIT_COMMITTER_DATE="2005-05-26 23:30" \
> +	TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null
> +'
> +
> +test_expect_success 'read commit' '
> +	git cat-file commit $(cat commitid) >commit
> +'
> +
> +test_expect_success 'compare commit' '
> +	test_cmp expected commit
> +'
>  
>  
>  test_expect_success 'flags and then non flags' '

Nit: let's remove the extraneous empty line while at it.

Patrick

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 0/2] t1100: modernize test script
  2026-07-14  7:16 ` [PATCH v2 0/2] t1100: modernize test script Shlok Kulshreshtha
  2026-07-14  7:16   ` [PATCH v2 1/2] t1100: modernize test style Shlok Kulshreshtha
  2026-07-14  7:16   ` [PATCH v2 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
@ 2026-07-14 12:20   ` Shlok Kulshreshtha
  2026-07-14 12:20     ` [PATCH v3 1/2] t1100: modernize test style Shlok Kulshreshtha
                       ` (2 more replies)
  2 siblings, 3 replies; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-14 12:20 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Shlok Kulshreshtha

This is v3 of the microproject cleaning up
t/t1100-commit-tree-options.sh ("Modernize a test script").

Apologies, v2 crossed with Patrick's review of v1. This v3 folds in his
feedback as well.

Changes since v2:
  - Patch 1/2: also drop the extraneous blank line before the "flags
    and then non flags" test, as Patrick suggested.

Changes since v1 (carried over from v2):
  - Patch 2/2: reword the commit message to use the present tense, as
    Junio suggested.

The patches themselves:

  1/2 converts the tests from the old backslash-continued
      test_expect_success style with space-indented bodies to the modern
      quoted-body form indented with tabs, and removes an extraneous
      blank line between two tests.

  2/2 moves the here-doc that creates "expected" out of the script's top
      level and into the existing setup test, so it runs under the
      protection of the test harness.

t1100 continues to pass all 5 tests.

Shlok Kulshreshtha (2):
  t1100: modernize test style
  t1100: move creation of expected output into setup test

 t/t1100-commit-tree-options.sh | 58 ++++++++++++++++------------------
 1 file changed, 28 insertions(+), 30 deletions(-)

Range-diff against v2:
1:  45f590f110 ! 1:  e299f096b9 t1100: modernize test style
    @@ Commit message
                 body
             '
     
    +    While at it, remove an extraneous blank line between two tests.
    +
         This is a style-only change; no test logic is modified.
     
         Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
    @@ t/t1100-commit-tree-options.sh: committer Committer Name <committer@email> 11171
     +	GIT_COMMITTER_DATE="2005-05-26 23:30" \
     +	TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null
     +'
    -+
    + 
     +test_expect_success 'read commit' '
     +	git cat-file commit $(cat commitid) >commit
     +'
    @@ t/t1100-commit-tree-options.sh: committer Committer Name <committer@email> 11171
     +	test_cmp expected commit
     +'
      
    - 
      test_expect_success 'flags and then non flags' '
    + 	test_tick &&
2:  36ea70be9d = 2:  5a54427820 t1100: move creation of expected output into setup test
-- 
2.52.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 1/2] t1100: modernize test style
  2026-07-14 12:20   ` [PATCH v3 0/2] t1100: modernize test script Shlok Kulshreshtha
@ 2026-07-14 12:20     ` Shlok Kulshreshtha
  2026-07-14 12:20     ` [PATCH v3 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
  2026-07-14 13:56     ` [PATCH v3 0/2] t1100: modernize test script Patrick Steinhardt
  2 siblings, 0 replies; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-14 12:20 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Shlok Kulshreshtha

The tests in this script use the old style in which the test title and
body are passed as separate backslash-continued arguments, with bodies
indented using spaces:

    test_expect_success \
        'title' \
        'body'

Convert them to the modern style in which the body is a single-quoted
block on its own lines, indented with a tab:

    test_expect_success 'title' '
        body
    '

While at it, remove an extraneous blank line between two tests.

This is a style-only change; no test logic is modified.

Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
---
 t/t1100-commit-tree-options.sh | 43 +++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 22 deletions(-)

diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index ae66ba5bab..9a639f946c 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -22,29 +22,28 @@ committer Committer Name <committer@email> 1117150200 +0000
 comment text
 EOF
 
-test_expect_success \
-    'test preparation: write empty tree' \
-    'git write-tree >treeid'
-
-test_expect_success \
-    'construct commit' \
-    'echo comment text |
-     GIT_AUTHOR_NAME="Author Name" \
-     GIT_AUTHOR_EMAIL="author@email" \
-     GIT_AUTHOR_DATE="2005-05-26 23:00" \
-     GIT_COMMITTER_NAME="Committer Name" \
-     GIT_COMMITTER_EMAIL="committer@email" \
-     GIT_COMMITTER_DATE="2005-05-26 23:30" \
-     TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null'
-
-test_expect_success \
-    'read commit' \
-    'git cat-file commit $(cat commitid) >commit'
-
-test_expect_success \
-    'compare commit' \
-    'test_cmp expected commit'
+test_expect_success 'test preparation: write empty tree' '
+	git write-tree >treeid
+'
+
+test_expect_success 'construct commit' '
+	echo comment text |
+	GIT_AUTHOR_NAME="Author Name" \
+	GIT_AUTHOR_EMAIL="author@email" \
+	GIT_AUTHOR_DATE="2005-05-26 23:00" \
+	GIT_COMMITTER_NAME="Committer Name" \
+	GIT_COMMITTER_EMAIL="committer@email" \
+	GIT_COMMITTER_DATE="2005-05-26 23:30" \
+	TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null
+'
 
+test_expect_success 'read commit' '
+	git cat-file commit $(cat commitid) >commit
+'
+
+test_expect_success 'compare commit' '
+	test_cmp expected commit
+'
 
 test_expect_success 'flags and then non flags' '
 	test_tick &&
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 2/2] t1100: move creation of expected output into setup test
  2026-07-14 12:20   ` [PATCH v3 0/2] t1100: modernize test script Shlok Kulshreshtha
  2026-07-14 12:20     ` [PATCH v3 1/2] t1100: modernize test style Shlok Kulshreshtha
@ 2026-07-14 12:20     ` Shlok Kulshreshtha
  2026-07-14 13:56     ` [PATCH v3 0/2] t1100: modernize test script Patrick Steinhardt
  2 siblings, 0 replies; 14+ messages in thread
From: Shlok Kulshreshtha @ 2026-07-14 12:20 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Shlok Kulshreshtha

The "expected" file is created at the top-level of the script, outside
of any test. Code that runs outside of a test is not protected by the
test harness: a failure there is not reported as a test failure and is
easy to miss.

Move the here-doc that creates "expected" into the existing setup test
("test preparation: write empty tree"), using a "<<-" here-doc so its
body can be indented along with the rest of the test.

Signed-off-by: Shlok Kulshreshtha <diy2903@gmail.com>
---
 t/t1100-commit-tree-options.sh | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index 9a639f946c..3e888909f5 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -14,15 +14,14 @@ Also make sure that command line parser understands the normal
 
 . ./test-lib.sh
 
-cat >expected <<EOF
-tree $EMPTY_TREE
-author Author Name <author@email> 1117148400 +0000
-committer Committer Name <committer@email> 1117150200 +0000
-
-comment text
-EOF
-
 test_expect_success 'test preparation: write empty tree' '
+	cat >expected <<-EOF &&
+	tree $EMPTY_TREE
+	author Author Name <author@email> 1117148400 +0000
+	committer Committer Name <committer@email> 1117150200 +0000
+
+	comment text
+	EOF
 	git write-tree >treeid
 '
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 0/2] t1100: modernize test script
  2026-07-14 12:20   ` [PATCH v3 0/2] t1100: modernize test script Shlok Kulshreshtha
  2026-07-14 12:20     ` [PATCH v3 1/2] t1100: modernize test style Shlok Kulshreshtha
  2026-07-14 12:20     ` [PATCH v3 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
@ 2026-07-14 13:56     ` Patrick Steinhardt
  2026-07-14 15:34       ` Junio C Hamano
  2 siblings, 1 reply; 14+ messages in thread
From: Patrick Steinhardt @ 2026-07-14 13:56 UTC (permalink / raw)
  To: Shlok Kulshreshtha; +Cc: git, Junio C Hamano

On Tue, Jul 14, 2026 at 05:50:31PM +0530, Shlok Kulshreshtha wrote:
> This is v3 of the microproject cleaning up
> t/t1100-commit-tree-options.sh ("Modernize a test script").
> 
> Apologies, v2 crossed with Patrick's review of v1. This v3 folds in his
> feedback as well.
> 
> Changes since v2:
>   - Patch 1/2: also drop the extraneous blank line before the "flags
>     and then non flags" test, as Patrick suggested.
> 
> Changes since v1 (carried over from v2):
>   - Patch 2/2: reword the commit message to use the present tense, as
>     Junio suggested.

Thanks, this version looks good to me.

Patrick

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 0/2] t1100: modernize test script
  2026-07-14 13:56     ` [PATCH v3 0/2] t1100: modernize test script Patrick Steinhardt
@ 2026-07-14 15:34       ` Junio C Hamano
  0 siblings, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2026-07-14 15:34 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: Shlok Kulshreshtha, git

Patrick Steinhardt <ps@pks.im> writes:

> On Tue, Jul 14, 2026 at 05:50:31PM +0530, Shlok Kulshreshtha wrote:
>> This is v3 of the microproject cleaning up
>> t/t1100-commit-tree-options.sh ("Modernize a test script").
>> 
>> Apologies, v2 crossed with Patrick's review of v1. This v3 folds in his
>> feedback as well.
>> 
>> Changes since v2:
>>   - Patch 1/2: also drop the extraneous blank line before the "flags
>>     and then non flags" test, as Patrick suggested.
>> 
>> Changes since v1 (carried over from v2):
>>   - Patch 2/2: reword the commit message to use the present tense, as
>>     Junio suggested.
>
> Thanks, this version looks good to me.

Thanks.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-07-14 15:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 14:01 [PATCH 0/2] t1100: modernize test script Shlok Kulshreshtha
2026-07-13 14:01 ` [PATCH 1/2] t1100: modernize test style Shlok Kulshreshtha
2026-07-13 16:30   ` Junio C Hamano
2026-07-14  7:39   ` Patrick Steinhardt
2026-07-13 14:01 ` [PATCH 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
2026-07-13 16:10   ` Junio C Hamano
2026-07-14  7:16 ` [PATCH v2 0/2] t1100: modernize test script Shlok Kulshreshtha
2026-07-14  7:16   ` [PATCH v2 1/2] t1100: modernize test style Shlok Kulshreshtha
2026-07-14  7:16   ` [PATCH v2 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
2026-07-14 12:20   ` [PATCH v3 0/2] t1100: modernize test script Shlok Kulshreshtha
2026-07-14 12:20     ` [PATCH v3 1/2] t1100: modernize test style Shlok Kulshreshtha
2026-07-14 12:20     ` [PATCH v3 2/2] t1100: move creation of expected output into setup test Shlok Kulshreshtha
2026-07-14 13:56     ` [PATCH v3 0/2] t1100: modernize test script Patrick Steinhardt
2026-07-14 15:34       ` Junio C Hamano

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.