From: "Philip Peterson via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Philip Peterson <philip.c.peterson@gmail.com>,
Philip Peterson <philip.c.peterson@gmail.com>
Subject: [PATCH 1/2] add-patch: do not use the_repository
Date: Tue, 28 May 2024 06:32:00 +0000 [thread overview]
Message-ID: <c0bb37db12ea8724431fe4294d591cd8cef73e66.1716877921.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1728.git.git.1716877921.gitgitgadget@gmail.com>
From: Philip Peterson <philip.c.peterson@gmail.com>
Because usage of the global the_repository is deprecated, remove
the usage of it in favor of a passed arg representing the repository.
Signed-off-by: Philip Peterson <philip.c.peterson@gmail.com>
---
add-patch.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/add-patch.c b/add-patch.c
index 2252895c280..b7f09122e1f 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -399,7 +399,7 @@ static void complete_file(char marker, struct hunk *hunk)
hunk->splittable_into++;
}
-static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
+static int parse_diff(struct repository *r, struct add_p_state *s, const struct pathspec *ps)
{
struct strvec args = STRVEC_INIT;
const char *diff_algorithm = s->s.interactive_diff_algorithm;
@@ -419,7 +419,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
strvec_push(&args,
/* could be on an unborn branch */
!strcmp("HEAD", s->revision) &&
- repo_get_oid(the_repository, "HEAD", &oid) ?
+ repo_get_oid(r, "HEAD", &oid) ?
empty_tree_oid_hex() : s->revision);
}
color_arg_index = args.nr;
@@ -1768,7 +1768,7 @@ int run_add_p(struct repository *r, enum add_p_mode mode,
(!s.mode->index_only &&
repo_refresh_and_write_index(r, REFRESH_QUIET, 0, 1,
NULL, NULL, NULL) < 0) ||
- parse_diff(&s, ps) < 0) {
+ parse_diff(r, &s, ps) < 0) {
add_p_state_clear(&s);
return -1;
}
--
gitgitgadget
next prev parent reply other threads:[~2024-05-28 6:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 6:31 [PATCH 0/2] Remove some usages of the_repository Philip Peterson via GitGitGadget
2024-05-28 6:32 ` Philip Peterson via GitGitGadget [this message]
2024-05-28 21:41 ` [PATCH 1/2] add-patch: do not use the_repository Junio C Hamano
2024-05-28 6:32 ` [PATCH 2/2] apply: " Philip Peterson via GitGitGadget
2024-05-28 7:28 ` Patrick Steinhardt
2024-05-28 16:33 ` Junio C Hamano
2024-05-28 17:22 ` Patrick Steinhardt
2024-05-28 17:37 ` 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=c0bb37db12ea8724431fe4294d591cd8cef73e66.1716877921.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=philip.c.peterson@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).