Message ID | 97f16cb68e059792ddc7d1897ab6e93d536fe19c.1728298931.git.code@khaugsbakk.name (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | doc: merge-tree: improve the script example | expand |
Hi Kristoffer On 07/10/2024 12:10, Kristoffer Haugsbakk wrote: > From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> > > From: Kristoffer Haugsbakk <code@khaugsbakk.name> > > This is easier to read. I think that is a matter of taste, one could argue that using uppercase variable names makes them stand out so the user can see which arguments are parameters more clearly. Best Wishes Phillip > Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> > --- > Documentation/git-merge-tree.txt | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt > index 590cbf5df79..10f8ac7f80a 100644 > --- a/Documentation/git-merge-tree.txt > +++ b/Documentation/git-merge-tree.txt > @@ -211,12 +211,12 @@ 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) > + newtree=$(git merge-tree --write-tree $branch1 $branch2) > test $? -eq 0 || die "There were conflicts..." > - NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2) > - git update-ref $BRANCH1 $NEWCOMMIT > + newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2) > + git update-ref $branch1 $newcommit > > -Note that when the exit status is non-zero, `NEWTREE` in this sequence > +Note that when the exit status is non-zero, `newtree` in this sequence > will contain a lot more output than just a tree. > > For conflicts, the output includes the same information that you'd get
On Mon, Oct 7, 2024 at 7:58 AM Phillip Wood <phillip.wood123@gmail.com> wrote: > > Hi Kristoffer > > On 07/10/2024 12:10, Kristoffer Haugsbakk wrote: > > From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> > > > > From: Kristoffer Haugsbakk <code@khaugsbakk.name> > > > > This is easier to read. > > I think that is a matter of taste, one could argue that using uppercase > variable names makes them stand out so the user can see which arguments > are parameters more clearly. Yeah, I wrote it as uppercase because I thought that was easier to read for the reasons Phillip gives. It's not a strong preference, but I do think the commit message needs a more detailed rationale or link to an agreed project coding style or something, otherwise the commit message may appear to be false to half the readers.
diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt index 590cbf5df79..10f8ac7f80a 100644 --- a/Documentation/git-merge-tree.txt +++ b/Documentation/git-merge-tree.txt @@ -211,12 +211,12 @@ 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) + newtree=$(git merge-tree --write-tree $branch1 $branch2) test $? -eq 0 || die "There were conflicts..." - NEWCOMMIT=$(git commit-tree $NEWTREE -mMerge -p $BRANCH1 -p $BRANCH2) - git update-ref $BRANCH1 $NEWCOMMIT + newcommit=$(git commit-tree $newtree -mMerge -p $branch1 -p $branch2) + git update-ref $branch1 $newcommit -Note that when the exit status is non-zero, `NEWTREE` in this sequence +Note that when the exit status is non-zero, `newtree` in this sequence will contain a lot more output than just a tree. For conflicts, the output includes the same information that you'd get