mbox series

[v2,0/5] merge-tree --stdin: flush stdout

Message ID pull.1862.v2.git.1739895879.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series merge-tree --stdin: flush stdout | expand

Message

Phillip Wood via GitGitGadget Feb. 18, 2025, 4:24 p.m. UTC
Thanks to Elijah for his comments on V1. I've updated the commit message of
patch 2 as he suggested. The rest of the patches are unchanged.

V1 Cover Letter:

I tried to squash some fixup commits with "git merge-tree --stdin" and found
that my script deadlocked because the output of "git merge-tree" is not
flushed after each merge. The first patch fixes that and the rest are
cleanups I noticed while reading the code and documentation. This series is
based on maint.

Phillip Wood (5):
  merge-tree --stdin: flush stdout to avoid deadlock
  merge-tree: remove redundant code
  merge-tree: only use basic merge config
  merge-tree: improve docs for --stdin
  merge-tree: fix link formatting in html docs

 Documentation/git-merge-tree.txt | 11 ++++++++---
 builtin/merge-tree.c             | 11 +++++------
 2 files changed, 13 insertions(+), 9 deletions(-)


base-commit: f93ff170b93a1782659637824b25923245ac9dd1
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1862%2Fphillipwood%2Fmerge-tree-flush-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1862/phillipwood/merge-tree-flush-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1862

Range-diff vs v1:

 1:  3b317978509 = 1:  3b317978509 merge-tree --stdin: flush stdout to avoid deadlock
 2:  16fec87766f ! 2:  63b09dbe1b7 merge-tree: remove redundant code
     @@ Commit message
      
          real_merge() only ever returns "0" or "1" as it dies if the merge status
          is less than zero. Therefore the check for "result < 0" is redundant and
     -    the result variable is not needed.
     +    the result variable is not needed. The return value of real_merge() is
     +    ignored because exit status of "git merge-tree --stdin" is "0" for both
     +    successful and conflicted merges (the status of each merge is written to
     +    stdout). The return type of real_merge() is not changed as it is used
     +    for the program's exit status when "--stdin" is not given.
      
          Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
      
 3:  bf1dc603a15 = 3:  f95a15a4203 merge-tree: only use basic merge config
 4:  4c416850634 = 4:  1645b0e747e merge-tree: improve docs for --stdin
 5:  89722894c87 = 5:  a0179820092 merge-tree: fix link formatting in html docs

Comments

Elijah Newren Feb. 18, 2025, 4:46 p.m. UTC | #1
On Tue, Feb 18, 2025 at 8:24 AM Phillip Wood via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> Thanks to Elijah for his comments on V1. I've updated the commit message of
> patch 2 as he suggested. The rest of the patches are unchanged.
>
> V1 Cover Letter:
>
> I tried to squash some fixup commits with "git merge-tree --stdin" and found
> that my script deadlocked because the output of "git merge-tree" is not
> flushed after each merge. The first patch fixes that and the rest are
> cleanups I noticed while reading the code and documentation. This series is
> based on maint.
>
> Phillip Wood (5):
>   merge-tree --stdin: flush stdout to avoid deadlock
>   merge-tree: remove redundant code
>   merge-tree: only use basic merge config
>   merge-tree: improve docs for --stdin
>   merge-tree: fix link formatting in html docs
>
>  Documentation/git-merge-tree.txt | 11 ++++++++---
>  builtin/merge-tree.c             | 11 +++++------
>  2 files changed, 13 insertions(+), 9 deletions(-)
>
>
> base-commit: f93ff170b93a1782659637824b25923245ac9dd1
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1862%2Fphillipwood%2Fmerge-tree-flush-v2
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1862/phillipwood/merge-tree-flush-v2
> Pull-Request: https://github.com/gitgitgadget/git/pull/1862
>
> Range-diff vs v1:
>
>  1:  3b317978509 = 1:  3b317978509 merge-tree --stdin: flush stdout to avoid deadlock
>  2:  16fec87766f ! 2:  63b09dbe1b7 merge-tree: remove redundant code
>      @@ Commit message
>
>           real_merge() only ever returns "0" or "1" as it dies if the merge status
>           is less than zero. Therefore the check for "result < 0" is redundant and
>      -    the result variable is not needed.
>      +    the result variable is not needed. The return value of real_merge() is
>      +    ignored because exit status of "git merge-tree --stdin" is "0" for both
>      +    successful and conflicted merges (the status of each merge is written to
>      +    stdout). The return type of real_merge() is not changed as it is used
>      +    for the program's exit status when "--stdin" is not given.
>
>           Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
>
>  3:  bf1dc603a15 = 3:  f95a15a4203 merge-tree: only use basic merge config
>  4:  4c416850634 = 4:  1645b0e747e merge-tree: improve docs for --stdin
>  5:  89722894c87 = 5:  a0179820092 merge-tree: fix link formatting in html docs

This round looks good to me; thanks.
Phillip Wood Feb. 18, 2025, 4:54 p.m. UTC | #2
On 18/02/2025 16:46, Elijah Newren wrote:
> On Tue, Feb 18, 2025 at 8:24 AM Phillip Wood via GitGitGadget
>> Range-diff vs v1:
>>
>>   1:  3b317978509 = 1:  3b317978509 merge-tree --stdin: flush stdout to avoid deadlock
>>   2:  16fec87766f ! 2:  63b09dbe1b7 merge-tree: remove redundant code
>>       @@ Commit message
>>
>>            real_merge() only ever returns "0" or "1" as it dies if the merge status
>>            is less than zero. Therefore the check for "result < 0" is redundant and
>>       -    the result variable is not needed.
>>       +    the result variable is not needed. The return value of real_merge() is
>>       +    ignored because exit status of "git merge-tree --stdin" is "0" for both
>>       +    successful and conflicted merges (the status of each merge is written to
>>       +    stdout). The return type of real_merge() is not changed as it is used
>>       +    for the program's exit status when "--stdin" is not given.
>>
>>            Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
>>
>>   3:  bf1dc603a15 = 3:  f95a15a4203 merge-tree: only use basic merge config
>>   4:  4c416850634 = 4:  1645b0e747e merge-tree: improve docs for --stdin
>>   5:  89722894c87 = 5:  a0179820092 merge-tree: fix link formatting in html docs
> 
> This round looks good to me; thanks.

That's great, thanks very much for reviewing these patches

Best Wishes

Phillip
Junio C Hamano Feb. 18, 2025, 7:35 p.m. UTC | #3
Elijah Newren <newren@gmail.com> writes:

> On Tue, Feb 18, 2025 at 8:24 AM Phillip Wood via GitGitGadget
> ...
>>  3:  bf1dc603a15 = 3:  f95a15a4203 merge-tree: only use basic merge config
>>  4:  4c416850634 = 4:  1645b0e747e merge-tree: improve docs for --stdin
>>  5:  89722894c87 = 5:  a0179820092 merge-tree: fix link formatting in html docs
>
> This round looks good to me; thanks.

Thanks, both.  Queued.