Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2022-10-30 14:47:02 +0300
committerTaylor Blau <me@ttaylorr.com>2022-10-30 21:04:35 +0300
commit48750b2d0d22f07d60c6179a7c3726446060136a (patch)
tree51281a36bbd4de3fc3c7e3b6314290f1ca10a51c /bisect.c
parent75c92a0540dd866b1ccf5454c4cc540d926a6139 (diff)
bisect: simplify building "checkout" argument list
Reduce the scope of argv_checkout, which allows to fully build it during initialization. Use oid_to_hex() instead of oid_to_hex_r(), because that's simpler and using the static buffer of the former is just as safe as the old static argv_checkout. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'bisect.c')
-rw-r--r--bisect.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/bisect.c b/bisect.c
index fd581b85a7..090aa5c4b4 100644
--- a/bisect.c
+++ b/bisect.c
@@ -22,8 +22,6 @@ static struct oid_array skipped_revs;
static struct object_id *current_bad_oid;
-static const char *argv_checkout[] = {"checkout", "-q", NULL, "--", NULL};
-
static const char *term_bad;
static const char *term_good;
@@ -729,19 +727,20 @@ static int is_expected_rev(const struct object_id *oid)
enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
int no_checkout)
{
- char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
struct commit *commit;
struct pretty_print_context pp = {0};
struct strbuf commit_msg = STRBUF_INIT;
- oid_to_hex_r(bisect_rev_hex, bisect_rev);
update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
- argv_checkout[2] = bisect_rev_hex;
if (no_checkout) {
update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
} else {
+ const char *argv_checkout[] = {
+ "checkout", "-q", oid_to_hex(bisect_rev), "--", NULL
+ };
+
if (run_command_v_opt(argv_checkout, RUN_GIT_CMD))
/*
* Errors in `run_command()` itself, signaled by res < 0,