mbox series

[v2,0/1] remove unnecessary if statement

Message ID 20250406121513.154084-1-usmanakinyemi202@gmail.com (mailing list archive)
Headers show
Series remove unnecessary if statement | expand

Message

Usman Akinyemi April 6, 2025, 12:14 p.m. UTC
In an earlier patch[1] (1a764cdbdc (Merge branch 
'ua/some-builtins-wo-the-repository', 2025-03-26))
which has been merged to the master, we checked `repo` is not NULL
before making call to `repo_config()`. Later, in another patch series[2]
which has been merged to master, `repo_config()` was taught to allow
`repo` to be NULL.

So there is not need for checking if the `repo` is NULL before calling
repo_config() in the earlier patch.

Also, Patrick suggested having the test inside the
"t1517-outside-repo.sh"[3] instead of having it in the individual test
files like[2] and I also think it is a good approach as we will
have all such tests in one place. So, for this patch, I added the
test inside the "t1517-outside-repo.sh". If this is accepted, I will
move the test for previous builtin cmd which has already been merged
to master to "t1517-outside-repo.sh" file.

[1] https://public-inbox.org/git/20250210181103.3609495-1-usmanakinyemi202@gmail.com/
[2] https://public-inbox.org/git/20250307233543.1721552-1-usmanakinyemi202@gmail.com/
[3] https://public-inbox.org/git/Z9vCDFRUG7IzU_AG@pks.im/

Changes since v1
================
- Make reference to the previous commit that this commit depends on
via "git log" 

Usman Akinyemi (1):
  builtin/update-server-info: remove unnecessary if statement

 builtin/update-server-info.c | 4 ++--
 t/t1517-outside-repo.sh      | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

Range-diff versus v1:
1:  d6054cbc0b ! 1:  020b228eb1 builtin/update-server-info: remove unnecessary if statement
    @@ Metadata
      ## Commit message ##
         builtin/update-server-info: remove unnecessary if statement
     
    -    Since we already teach the `repo_config()` to allow `repo`
    -    to be NULL, no need to check if `repo` is NULL before calling
    -    `repo_config()`.
    +    Since we already teach the `repo_config()` in "1a764cdbdc
    +    (Merge branch 'ua/some-builtins-wo-the-repository', 2025-03-26)
    +    to allow `repo` to be NULL, no need to check if `repo` is NULL
    +    before calling `repo_config()`.
     
         Mentored-by: Christian Couder <chriscool@tuxfamily.org>
         Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>

Comments

Usman Akinyemi April 7, 2025, 7:58 p.m. UTC | #1
In an earlier patch[1] (f29f1990b5 (config:
teach repo_config to allow `repo` to be NULL, 2025-03-08))
which has been merged to the master, we checked `repo` is not NULL
before making call to `repo_config()`. Later, in another patch series[2]
which has been merged to master, `repo_config()` was taught to allow
`repo` to be NULL.

So there is not need for checking if the `repo` is NULL before calling
repo_config() in the earlier patch.

Also, Patrick suggested having the test inside the
"t1517-outside-repo.sh"[3] instead of having it in the individual test
files like[2] and I also think it is a good approach as we will
have all such tests in one place. So, for this patch, I added the
test inside the "t1517-outside-repo.sh". If this is accepted, I will
move the test for previous builtin cmd which has already been merged
to master to "t1517-outside-repo.sh" file.

[1] https://public-inbox.org/git/20250210181103.3609495-1-usmanakinyemi202@gmail.com/
[2] https://public-inbox.org/git/20250307233543.1721552-1-usmanakinyemi202@gmail.com/
[3] https://public-inbox.org/git/Z9vCDFRUG7IzU_AG@pks.im/

Changes since 2 
================
- Make reference to commit that teaches repo_config() to be NULL instead
  of the merge commit. 

Usman Akinyemi (1):
  builtin/update-server-info: remove unnecessary if statement

 builtin/update-server-info.c | 4 ++--
 t/t1517-outside-repo.sh      | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

Range-diff versus v2:

1:  020b228eb1 ! 1:  cd359dafe8 builtin/update-server-info: remove unnecessary if statement
    @@ Metadata
      ## Commit message ##
         builtin/update-server-info: remove unnecessary if statement
     
    -    Since we already teach the `repo_config()` in "1a764cdbdc
    -    (Merge branch 'ua/some-builtins-wo-the-repository', 2025-03-26)
    +    Since we already teach the `repo_config()` in "f29f1990b5
    +    (config: teach repo_config to allow `repo` to be NULL, 2025-03-08)"
         to allow `repo` to be NULL, no need to check if `repo` is NULL
         before calling `repo_config()`.