Message ID | 4057d6386125e51fd934f92abd11c62a9d24a832.1728298931.git.code@khaugsbakk.name (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | doc: merge-tree: improve the script example | expand |
On Mon, Oct 7, 2024 at 4:11 AM Kristoffer Haugsbakk <code@khaugsbakk.name> wrote: > > From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> > > From: Kristoffer Haugsbakk <code@khaugsbakk.name> > > Use `||` directly since that is more straightforward than checking the > last exit status. > > Also use `echo` and `exit` since `die` is not defined. Not defined where? It's defined in my scripts... ;-) Just kidding; this is a good change. > Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> > --- > Documentation/git-merge-tree.txt | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt > index 10f8ac7f80a..46091da022d 100644 > --- a/Documentation/git-merge-tree.txt > +++ b/Documentation/git-merge-tree.txt > @@ -211,8 +211,10 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1], > linkgit:git-update-ref[1], and linkgit:git-mktag[1]. Thus, it can be > used as a part of a series of steps such as: > > - newtree=$(git merge-tree --write-tree $branch1 $branch2) > - test $? -eq 0 || die "There were conflicts..." > + newtree=$(git merge-tree --write-tree $branch1 $branch2) || { > + echo "There were conflicts..." 1>&2 > + exit 1 > + } Thanks.
On Mon, Oct 7, 2024, at 17:24, Elijah Newren wrote: > On Mon, Oct 7, 2024 at 4:11 AM Kristoffer Haugsbakk > <code@khaugsbakk.name> wrote: >> >> From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> >> >> From: Kristoffer Haugsbakk <code@khaugsbakk.name> >> >> Use `||` directly since that is more straightforward than checking the >> last exit status. >> >> Also use `echo` and `exit` since `die` is not defined. > > Not defined where? It's defined in my scripts... ;-) > > Just kidding; this is a good change. :D Thanks for taking a look! I’ll send the second version tomorrow.
diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt index 10f8ac7f80a..46091da022d 100644 --- a/Documentation/git-merge-tree.txt +++ b/Documentation/git-merge-tree.txt @@ -211,8 +211,10 @@ linkgit:git-commit-tree[1], linkgit:git-write-tree[1], linkgit:git-update-ref[1], and linkgit:git-mktag[1]. Thus, it can be used as a part of a series of steps such as: - newtree=$(git merge-tree --write-tree $branch1 $branch2) - test $? -eq 0 || die "There were conflicts..." + newtree=$(git merge-tree --write-tree $branch1 $branch2) || { + echo "There were conflicts..." 1>&2 + exit 1 + } newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2) git update-ref $branch1 $newcommit