git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John Cai via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: John Cai <johncai86@gmail.com>
Subject: [PATCH 0/2] Consolidate find_header logic into one function
Date: Mon, 27 Dec 2021 18:26:36 +0000	[thread overview]
Message-ID: <pull.1125.git.git.1640629598.gitgitgadget@gmail.com> (raw)

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

             reply	other threads:[~2021-12-27 18:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27 18:26 John Cai via GitGitGadget [this message]
2021-12-27 18:26 ` [PATCH 1/2] receive-pack.c: consolidate find header logic John Cai via GitGitGadget
2021-12-27 22:33   ` Junio C Hamano
2021-12-27 18:26 ` [PATCH 2/2] commit.c: rename find_commit_header to find_header John Cai via GitGitGadget
2021-12-29  6:19 ` [PATCH v2] receive-pack.c: consolidate find header logic John Cai via GitGitGadget
2021-12-30 23:01   ` Junio C Hamano
2021-12-31  6:17   ` [PATCH v3] " John Cai via GitGitGadget
2022-01-04  1:56     ` Junio C Hamano
2022-01-04 15:12       ` John Cai
2022-01-05 15:21     ` [PATCH v4] " John Cai via GitGitGadget
2022-01-05 20:10       ` Junio C Hamano
2022-01-06  0:51       ` [PATCH v5] " John Cai via GitGitGadget
2022-01-06 19:40         ` Junio C Hamano
2022-01-06 20:07         ` [PATCH v6] " John Cai via GitGitGadget
2022-01-08  4:54           ` John Cai
2022-01-08  7:11           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1125.git.git.1640629598.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johncai86@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).