git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] contrib/subtree: add repo url to commit messages

From
MNMathias Nyman <m.nyman@iki.fi>
Date
Mar 3, 2016, 11:42 UTC
Message-ID
<20160303114222.GA9814@iki.fi>
In-Reply-To
<CAPig+cRTz_VYt-2q9y0+COhVCezMs-7Sm-v=jvhUxUSRhiN93g@mail.gmail.com>
On 2016-02-26 14:49-0500, Eric Sunshine wrote:
Show 57 quoted lines
>On Fri, Feb 26, 2016 at 3:28 AM, Mathias Nyman <m.nyman@iki.fi> wrote:
>> On 2016-02-25 17:23-0500, Eric Sunshine wrote:
>>> On Tue, Feb 23, 2016 at 5:25 AM, Mathias Nyman <mathias.nyman@iki.fi>
>>> wrote:
>>>> -       cat <<-EOF
>>>> -               $commit_message
>>>> -
>>>> -               git-subtree-dir: $dir
>>>> -               git-subtree-mainline: $latest_old
>>>> -               git-subtree-split: $latest_new
>>>> -       EOF
>>>> +       echo $commit_message
>>>> +       echo
>>>> +       echo git-subtree-dir: $dir
>>>> +       echo git-subtree-mainline: $latest_old
>>>> +       echo git-subtree-split: $latest_new
>>>
>>> It's not clear why this code was changed to use a series of echo's in
>>> place of the single cat. Although the net result is the same, this
>>> appears to be mere code churn. If your intention was to make it
>>> similar to how squash_msg() uses a series of echo's, then that might
>>> make sense, however, rejoin_msg() uses the same single 'cat' as
>>> add_msg(), so inconsistency remains. Thus, it's not clear what the
>>> intention is.
>>
>> Using a mixutre of heredoc and echo felt messy. But I'll change it
>> back to heredoc here, and through out the commit aim for near-zero
>> refactoring.
>
>An alternative would be to have a preparatory patch which unifies the
>heredoc vs. echo issue across add_msg(), squash_msg(), rejoin_msg(),
>but I wouldn't insist upon it (that's just more work for you). Leaving
>this bit alone is a reasonable choice.
>
>>>> +       repo="$4" # optional
>>>>         newsub_short=$(git rev-parse --short "$newsub")
>>>> -
>>>> +
>>>
>>>
>>> Okay, this change is removing an unnecessary tab. Perhaps the commit
>>> message can say that the patch fixes a few whitespace inconsistencies
>>> while touching nearby code.
>>
>> Will undo the whitespace fixing.
>
>Oh, I wasn't insisting that you should undo the whitespace fix.
>Typically, you'd make such fixes in a preparatory cleanup patch, but
>since there are only two cases here that you've fixed, it probably
>wouldn't hurt to retain them (if that's all there are in the file).
>The reason I suggested mentioning the whitespace fixes in the commit
>message is to let the reviewer know that they weren't cases of you
>accidentally making unwanted whitespace changes (like inserting tabs
>rather than removing them). As it was, as a reviewer, I had to go
>through extra effort to determine whether you had made a fix or had
>accidentally botched something.
>

Not fixing any whitespace inconsistencies felt like the consistent way to go in this commit.

Would be great to have some feedback on the core idea of this change, before spending more time on it. Anyone?

Show 12 quoted lines
>>>>  cmd_merge()
>>>>  {
>>>> -       revs=$(git rev-parse $default --revs-only "$@") || exit $?
>>>> +       revs=$(git rev-parse $default --revs-only "$1") || exit $?
>>>
>>> Why is this variable still named 'revs' (plural) since you're only
>>> passing in $1 now rather than $@?
>>
>> Because technically the result can still be more then one rev I guess.
>> Consider 'git rev-parse HEAD~1..HEAD', which would return two hashes.
>
>Okay, so I was missing something obvious.
Previous: Eric SunshineNext: David A. Greene
Message 5 of 7 in “contrib/subtree: add repo url to commit messages”
  1. contrib/subtree: add repo url to commit messagesMathias Nyman, Feb 23, 2016
  2. Eric SunshineFeb 25, 2016
  3. Mathias NymanFeb 26, 2016
  4. Eric SunshineFeb 26, 2016
  5. Mathias NymanMar 3, 2016
  6. David A. GreeneMay 21, 2016
  7. Mathias NymanMay 31, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.