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

Migration of builtin-blame to parse-option

From
Pierre Habouzit <madcoder@debian.org>
Date
Jul 8, 2008, 09:55 UTC
Message-ID
<1215510964-16664-1-git-send-email-madcoder@debian.org>

This series is twofold. The first 4 patches refactor the revision parsing machine so that it's easier to deal with from a parse-opt based parser:

[PATCH 1/6] revisions: refactor init_revisions and setup_revisions. 21 files changed, 70 insertions(+), 54 deletions(-)

  This is the patch I sent before, revisited.

[PATCH 2/6] revisions: split the pure option parsing out from parse_revisions. 2 files changed, 273 insertions(+), 308 deletions(-)

  This patch splits out the revisions _option_ parsing (as opposed to
  revisions arguments or pseudo arguments like --all, --not, ...) from
  the revision parser. The patch is huge, but quite straightforward.

[PATCH 3/6] revisions: parse_revisions refactor. 1 files changed, 38 insertions(+), 25 deletions(-)

  This patch reworks parse_revisions so that it works internally as if
  it was a parse-opt parser. It's equivalent to the previous code, but
  changes are tricky, and a separate commit is really worth it.

[PATCH 4/6] revisions: split handle_revision_args from parse_revisions. 2 files changed, 52 insertions(+), 46 deletions(-)

  This patch splits out the last bit of parse-revisions (from the
  previous commit) so that what parses revisions arguments (refs and
  pseudo arguments like --all/--not/...) can be called independently.
  The commit is straightforward but moves code around, hence the
  separate commit from patch 3 so that one isn't lost in the code moves
  while reviewing the tricky bits from patch 3.
The second part is the git-blame migration for real:

[PATCH 5/6] git-blame: migrate to incremental parse-option [1/2] 1 files changed, 118 insertions(+), 102 deletions(-)

  This bit is really alike the proof of concept I saw. Most of the code
  is stolen from Linus initial patch. It merely removes the git-blame
  own options and deal with them with a parse-opt parser, in an
  incremental way.
  All in all, it's a pretty straighforward patch.

[PATCH 6/6] git-blame: migrate to incremental parse-option [2/2] 1 files changed, 40 insertions(+), 92 deletions(-)

  This is by far the trickiest patch of the series, though it passes the
  testsuite fine. This patch uses the function from patch 4 to process
  the revision arguments. We know the dashdash position from the
  incremental parse-opt, but we have to deal with the "old way" of
  passing arguments to git-blame.
  The new code is really less involved than before, because we deal with
  a filtered argv array where we only have the revisions arguments (no
  options anymore) and the <path>.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Next: Pierre Habouzit
Message 1 of 15 in “Migration of builtin-blame to parse-option”
  1. Pierre HabouzitJul 8, 2008
  2. 1/6 revisions: refactor init_revisions and setup_revisions.Pierre Habouzit, Jul 8, 2008
  3. 2/6 revisions: split the pure option parsing out from parse_revisions.Pierre Habouzit, Jul 8, 2008
  4. 3/6 revisions: parse_revisions refactor.Pierre Habouzit, Jul 8, 2008
  5. 4/6 revisions: split handle_revision_args from parse_revisions.Pierre Habouzit, Jul 8, 2008
  6. 5/6 git-blame: migrate to incremental parse-option [1/2]Pierre Habouzit, Jul 8, 2008
  7. 6/6 git-blame: migrate to incremental parse-option [2/2]Pierre Habouzit, Jul 8, 2008
  8. Johannes SixtJul 8, 2008
  9. Pierre HabouzitJul 8, 2008
  10. Pierre HabouzitJul 8, 2008
  11. Johannes SchindelinJul 8, 2008
  12. Pierre HabouzitJul 8, 2008
  13. Johannes SchindelinJul 8, 2008
  14. Pierre HabouzitJul 8, 2008
  15. Pierre HabouzitJul 8, 2008

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.