summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-07-18 13:31:56 -0700
committerJunio C Hamano <gitster@pobox.com>2022-07-18 13:31:57 -0700
commit7f8d098b1b1ca1e5b91b17d05b51bc5b7a7ad6bf (patch)
tree5f4b1b70e19b990092cecc676422042ad12e642a /builtin/merge.c
parent6d003858e5cb82a4ac1892fa6c02604b0aa27fba (diff)
parent06f5f8940c0335f2a5b0a7bbd086115f4659eaa8 (diff)
Merge branch 'ab/cocci-unused'
Add Coccinelle rules to detect the pattern of initializing and then finalizing a structure without using it in between at all, which happens after code restructuring and the compilers fail to recognize as an unused variable. * ab/cocci-unused: cocci: generalize "unused" rule to cover more than "strbuf" cocci: add and apply a rule to find "unused" strbufs cocci: have "coccicheck{,-pending}" depend on "coccicheck-test" cocci: add a "coccicheck-test" target and test *.cocci rules Makefile & .gitignore: ignore & clean "git.res", not "*.res" Makefile: remove mandatory "spatch" arguments from SPATCH_FLAGS
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index d9784d4891..23170f2d2a 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -375,7 +375,6 @@ static void reset_hard(const struct object_id *oid, int verbose)
static void restore_state(const struct object_id *head,
const struct object_id *stash)
{
- struct strbuf sb = STRBUF_INIT;
const char *args[] = { "stash", "apply", NULL, NULL };
if (is_null_oid(stash))
@@ -391,7 +390,6 @@ static void restore_state(const struct object_id *head,
*/
run_command_v_opt(args, RUN_GIT_CMD);
- strbuf_release(&sb);
refresh_cache(REFRESH_QUIET);
}
@@ -502,7 +500,6 @@ static void merge_name(const char *remote, struct strbuf *msg)
{
struct commit *remote_head;
struct object_id branch_head;
- struct strbuf buf = STRBUF_INIT;
struct strbuf bname = STRBUF_INIT;
struct merge_remote_desc *desc;
const char *ptr;
@@ -590,7 +587,6 @@ static void merge_name(const char *remote, struct strbuf *msg)
oid_to_hex(&remote_head->object.oid), remote);
cleanup:
free(found_ref);
- strbuf_release(&buf);
strbuf_release(&bname);
}