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

Re: [PATCH 03/11] push: reorganize setup_push_simple()

From
Elijah Newren <newren@gmail.com>
Date
May 28, 2021, 21:42 UTC
Message-ID
<CABPp-BG1FoBJ8-swiGHLJRqpE4iQiCNTmCi=8zzyms3bLJAcqQ@mail.gmail.com>
In-Reply-To
<60b1604b66329_2a3717208eb@natae.notmuch>

On Fri, May 28, 2021 at 2:27 PM Felipe Contreras <felipe.contreras@gmail.com> wrote:

Show 14 quoted lines
>
> Elijah Newren wrote:
> > On Fri, May 28, 2021 at 1:10 PM Felipe Contreras
> > <felipe.contreras@gmail.com> wrote:
> > >
> > > Simply move the code around.
> >
> > Not quite, you also deleted dead code.  Made the patch a bit harder to
> > read because I was trying to verify you did what the commit message
> > said and it took me longer than it should have to realize that you
> > were also deleting dead code.  Might be worth including that fact in
> > this sentence here.
>
> OK. I thought that was obvious.

It is if you are familiar with the code, or if you still remember that condition when you get to that point in the review, or if you happen to look at the right line of code while mulling it over. Unfortunately, I'm not familiar with this code, didn't happen to remember the outer if-block when I got to that point in the comparison, and didn't at first look back to the relevant line to realize this. So I started looking elsewhere for why removing that condition didn't amount to functional changes and started trying to figure out a testcase that would give different behavior. I suspect I would have realized sooner if not for the claim that you "simply moved code around", so I just flagged it. Not a big deal, just something that I think could make it easier for other reviewers.

> Shall I update the commit message to include that fact, or shall I add a
> separate patch to remove the dead code?

I'd just tweak the commit message to mention you are just deleting dead code and moving code around.

Show 14 quoted lines
> Either are fine by me.
>
> > > -               if (triangular)
> > > -                       die(_("You are pushing to remote '%s', which is not the upstream of\n"
> > > -                             "your current branch '%s', without telling me what to push\n"
> > > -                             "to update which remote branch."),
> > > -                           remote->name, branch->name);
> >
> > This if-block is safe to delete because we're already in the !triangular case.
> >
> > > -
> > > -               if (1) {
>
> Techically this is removing dead code too.
Yep, true.
Previous: Felipe ContrerasNext: Felipe Contreras
Message 7 of 24 in “Unconvolutize push.default=simple”
  1. 00/11 Unconvolutize push.default=simpleFelipe Contreras, May 28, 2021
  2. 01/11 push: hedge code of default=simpleFelipe Contreras, May 28, 2021
  3. 02/11 push: move code to setup_push_simple()Felipe Contreras, May 28, 2021
  4. 03/11 push: reorganize setup_push_simple()Felipe Contreras, May 28, 2021
  5. Elijah NewrenMay 28, 2021
  6. Felipe ContrerasMay 28, 2021
  7. Elijah NewrenMay 28, 2021
  8. 04/11 push: simplify setup_push_simple()Felipe Contreras, May 28, 2021
  9. Elijah NewrenMay 28, 2021
  10. Felipe ContrerasMay 28, 2021
  11. 05/11 push: remove unused code in setup_push_upstream()Felipe Contreras, May 28, 2021
  12. 06/11 push: merge current and simpleFelipe Contreras, May 28, 2021
  13. 07/11 push: remove redundant checkFelipe Contreras, May 28, 2021
  14. 08/11 push: fix Yoda conditionFelipe Contreras, May 28, 2021
  15. 09/11 push: remove trivial functionFelipe Contreras, May 28, 2021
  16. 11/11 doc: push: explain default=simple correctlyFelipe Contreras, May 28, 2021
  17. Elijah NewrenMay 28, 2021
  18. Bagas SanjayaMay 29, 2021
  19. 10/11 push: flip !triangular for centralizedFelipe Contreras, May 28, 2021
  20. Elijah NewrenMay 28, 2021
  21. Felipe ContrerasMay 28, 2021
  22. Elijah NewrenMay 28, 2021
  23. Felipe ContrerasMay 28, 2021
  24. Elijah NewrenMay 28, 2021

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.