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

Re: [PATCH 2/5] status: refactor colopts handling

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
May 8, 2012, 13:27 UTC
Message-ID
<CACsJy8ADt0C=gyom8R15GoM+_6oHDvWasMgSqnwbiKqnXGwxug@mail.gmail.com>
In-Reply-To
<20120507212333.GB19567@sigill.intra.peff.net>
On Tue, May 8, 2012 at 4:23 AM, Jeff King <peff@peff.net> wrote:
Show 26 quoted lines
> The current code reads the config and command-line options
> into a separate "colopts" variable, and then copies the
> contents of that variable into the "struct wt_status". We
> can eliminate the extra variable and copy just write
> straight into the wt_status struct.
>
> This simplifies the "status" code a little bit.
> Unfortunately, it makes the "commit" code one line more
> complex; a side effect of the separate variable was that
> "commit" did not copy the colopts variable, so any
> column.status configuration had no effect.
>
> The result still ends up cleaner, though. In the previous
> version, it was unclear whether commit simply forgot to copy
> the colopt variable, or whether it was intentional. Now it
> explicitly turns off column options. Furthermore, if commit
> later learns to respect column.status, this will make the
> end result simpler. I punted on just adding that feature
> now, because it was sufficiently non-obvious that it should
> not go into a refactoring patch.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> For the reasons mentioned above, this ended up as a less impressive
> cleanup than I had hoped. I think it's still worth doing, but I won't be
> too sad if it gets dropped.
I'm neutral. But this patch reduces one line so it wins a "yes" from me.
>  builtin/commit.c | 13 ++++++-------
>  wt-status.h      |  2 +-
>  2 files changed, 7 insertions(+), 8 deletions(-)
-- 
Duy
Previous: Jeff KingNext: Jeff King
Message 8 of 16 in “correct git-status Porcelain Format documentation”
  1. correct git-status Porcelain Format documentationJeff King, May 6, 2012
  2. Jeff KingMay 6, 2012
  3. Junio C HamanoMay 7, 2012
  4. Jeff KingMay 7, 2012
  5. Jeff KingMay 7, 2012
  6. 1/5 commit: refactor option parsingJeff King, May 7, 2012
  7. 2/5 status: refactor colopts handlingJeff King, May 7, 2012
  8. Nguyen Thai Ngoc DuyMay 8, 2012
  9. 3/5 status: refactor null_termination optionJeff King, May 7, 2012
  10. 4/5 status: fix null termination with "-b"Jeff King, May 7, 2012
  11. 5/5 status: respect "-b" for porcelain formatJeff King, May 7, 2012
  12. Jeff KingMay 7, 2012
  13. Junio C HamanoMay 8, 2012
  14. Jeff KingMay 8, 2012
  15. Junio C HamanoMay 8, 2012
  16. Junio C HamanoMay 7, 2012

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.