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

Re: [PATCH] git-mv: improve error message for conflicted file

From
Chris Torek <chris.torek@gmail.com>
Date
Jul 18, 2020, 01:35 UTC
Message-ID
<CAPx1GvduDZw5pmfZHACDGZsMR5YYDowLw6+az+oL6oWLvDyCFA@mail.gmail.com>
In-Reply-To
<CAPig+cQaqg7MbyNZakuWVzezhPCXu=LonCVAw_p13c=0YNBdPw@mail.gmail.com>
On Fri, Jul 17, 2020 at 4:47 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
> Style: write `!ce` rather than `ce == NULL`:

OK, but I'll go with Junio's suggestion of getting `ce` once and then checking `ce_staged` anyway. (I'm used to a different style guide that frowns on `if (ce)` and `if (!ce)`...)

Show 5 quoted lines
> As for bikeshedding the message itself, perhaps:
>
>     _("conflicted");
>
> Though, perhaps that's too succinct.
Maybe.  Succinct is usually good though.
Show 6 quoted lines
> > +       touch conflicted &&
>
> If the timestamp of the file is not relevant to the test -- as is the
> case here -- then we avoid using `touch`. Instead:
>
>     >conflicted &&
OK.
> ... use literal TABs and let the here-doc provide the newlines.

I personally hate depending on literal tabs, as they're really hard to see. If q_to_tab() is OK I'll use that.

Show 11 quoted lines
> I realize that this test script is already filled with this sort of
> thing where actions are performed outside of tests, however, these
> days we frown upon that, and there really isn't a good reason to avoid
> taking care of this clean up via the modern idiom of using
> test_when_finished(), which you would call immediately after creating
> the file in the test. So:
>
>     ...
>     >conflicted &&
>     test_when_finished "rm -f conflicted" &&
>     ...
Indeed, that's where I copied it from.

Should I clean up other instances of separated-out `rm -f`s in this file in a separate commit?

Chris
Previous: Eric SunshineNext: Eric Sunshine
Message 3 of 11 in “git-mv: improve error message for conflicted file”
  1. git-mv: improve error message for conflicted fileChris Torek via GitGitGadget, Jul 17, 2020
  2. Eric SunshineJul 17, 2020
  3. Chris TorekJul 18, 2020
  4. Eric SunshineJul 18, 2020
  5. Junio C HamanoJul 18, 2020
  6. Elijah NewrenJul 18, 2020
  7. Junio C HamanoJul 18, 2020
  8. Elijah NewrenJul 19, 2020
  9. Junio C HamanoJul 19, 2020
  10. git-mv: improve error message for conflicted fileChris Torek via GitGitGadget, Jul 20, 2020
  11. Junio C HamanoJul 20, 2020

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.