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

[PATCH 0/2] Consolidate find_header logic into one function

From
John Cai via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 27, 2021, 18:26 UTC
Message-ID
<pull.1125.git.git.1640629598.gitgitgadget@gmail.com>
This addresses the NEEDSWORK comment in builtin/receive-pack.c:
 /**
   * NEEDSWORK: reuse find_commit_header() from jk/commit-author-parsing
   * after dropping "_commit" from its name and possibly moving it out
   * of commit.c
   **/

There is some duplicated logic between find_header and find_commit_header that can be consolidated instead of having two places in the code that do essentially the same thing. For the sake of simpler and more DRY code, use find_commit_header and rename it to find_header since it is not limited to finding headers for only commits.

This is my first attempt to address a NEEDSWORK issue, and I'm relatively new to C so any feedback would be appreciated!

John Cai (2):
  receive-pack.c: consolidate find header logic
  commit.c: rename find_commit_header to find_header
 builtin/am.c                |  2 +-
 builtin/commit.c            |  2 +-
 builtin/receive-pack.c      | 48 ++++++++++++++++---------------------
 commit.c                    |  7 +++---
 commit.h                    |  2 +-
 gpg-interface.c             |  2 +-
 pretty.c                    |  2 +-
 sequencer.c                 |  2 +-
 t/helper/test-fast-rebase.c |  2 +-
 9 files changed, 32 insertions(+), 37 deletions(-)
base-commit: 2ae0a9cb8298185a94e5998086f380a355dd8907
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1125%2Fjohn-cai%2Fjc%2Freplace-find-header-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1125/john-cai/jc/replace-find-header-v1
Pull-Request: https://github.com/git/git/pull/1125
-- 
gitgitgadget
Next: John Cai via GitGitGadget
Message 1 of 16 in “Consolidate find_header logic into one function”
  1. 0/2 Consolidate find_header logic into one functionJohn Cai via GitGitGadget, Dec 27, 2021
  2. 1/2 receive-pack.c: consolidate find header logicJohn Cai via GitGitGadget, Dec 27, 2021
  3. Junio C HamanoDec 27, 2021
  4. 2/2 commit.c: rename find_commit_header to find_headerJohn Cai via GitGitGadget, Dec 27, 2021
  5. receive-pack.c: consolidate find header logicJohn Cai via GitGitGadget, Dec 29, 2021
  6. Junio C HamanoDec 30, 2021
  7. receive-pack.c: consolidate find header logicJohn Cai via GitGitGadget, Dec 31, 2021
  8. Junio C HamanoJan 4, 2022
  9. John CaiJan 4, 2022
  10. receive-pack.c: consolidate find header logicJohn Cai via GitGitGadget, Jan 5, 2022
  11. Junio C HamanoJan 5, 2022
  12. receive-pack.c: consolidate find header logicJohn Cai via GitGitGadget, Jan 6, 2022
  13. Junio C HamanoJan 6, 2022
  14. receive-pack.c: consolidate find header logicJohn Cai via GitGitGadget, Jan 6, 2022
  15. John CaiJan 8, 2022
  16. Junio C HamanoJan 8, 2022

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.