diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-05-27 13:59:10 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-27 13:59:11 -0700 |
| commit | f9cdaa2860e20f3f36595646b7a82082aa772df8 (patch) | |
| tree | 40513df8eb4aec40cc4ec28e0ba4855d532be476 /builtin/fetch.c | |
| parent | Merge branch 'sj/use-mmap-to-check-packed-refs' (diff) | |
| parent | sequencer: stop pretending that an assignment is a condition (diff) | |
| download | git-f9cdaa2860e20f3f36595646b7a82082aa772df8.tar.gz git-f9cdaa2860e20f3f36595646b7a82082aa772df8.zip | |
Merge branch 'js/misc-fixes'
Assorted fixes for issues found with CodeQL.
* js/misc-fixes:
sequencer: stop pretending that an assignment is a condition
bundle-uri: avoid using undefined output of `sscanf()`
commit-graph: avoid using stale stack addresses
trace2: avoid "futile conditional"
Avoid redundant conditions
fetch: avoid unnecessary work when there is no current branch
has_dir_name(): make code more obvious
upload-pack: rename `enum` to reflect the operation
commit-graph: avoid malloc'ing a local variable
fetch: carefully clear local variable's address after use
commit: simplify code
Diffstat (limited to 'builtin/fetch.c')
| -rw-r--r-- | builtin/fetch.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index cda6eaf1fd..40a0e8d244 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1728,7 +1728,7 @@ static int do_fetch(struct transport *transport, if (transport->remote->follow_remote_head != FOLLOW_REMOTE_NEVER) do_set_head = 1; } - if (branch_has_merge_config(branch) && + if (branch && branch_has_merge_config(branch) && !strcmp(branch->remote_name, transport->remote->name)) { int i; for (i = 0; i < branch->merge_nr; i++) { @@ -2560,6 +2560,7 @@ int cmd_fetch(int argc, if (server_options.nr) gtransport->server_options = &server_options; result = transport_fetch_refs(gtransport, NULL); + gtransport->smart_options->acked_commits = NULL; oidset_iter_init(&acked_commits, &iter); while ((oid = oidset_iter_next(&iter))) |
