git/t/helper
Patrick Steinhardt 5e7fe8a7b8 commit-reach: use `size_t` to track indices when computing merge bases
The functions `repo_get_merge_bases_many()` and friends accepts an array
of commits as well as a parameter that indicates how large that array
is. This parameter is using a signed integer, which leads to a couple of
warnings with -Wsign-compare.

Refactor the code to use `size_t` to track indices instead and adapt
callers accordingly. While most callers are trivial, there are two
callers that require a bit more scrutiny:

  - builtin/merge-base.c:show_merge_base() subtracts `1` from the
    `rev_nr` before calling `repo_get_merge_bases_many_dirty()`, so if
    the variable was `0` it would wrap. This code is fine though because
    its only caller will execute that code only when `argc >= 2`, and it
    follows that `rev_nr >= 2`, as well.

  - bisect.ccheck_merge_bases() similarly subtracts `1` from `rev_nr`.
    Again, there is only a single caller that populates `rev_nr` with
    `good_revs.nr`. And because a bisection always requires at least one
    good revision it follws that `rev_nr >= 1`.

Mark the file as -Wsign-compare-clean.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-12-27 08:12:40 -08:00
..
.gitignore
meson.build Introduce support for the Meson build system 2024-12-07 07:52:14 +09:00
test-advise.c
test-bitmap.c
test-bloom.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
test-bundle-uri.c
test-cache-tree.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-chmtime.c
test-config.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-crontab.c
test-csprng.c t/helper: don't depend on implicit wraparound 2024-12-06 20:20:05 +09:00
test-date.c
test-delete-gpgsig.c
test-delta.c
test-dir-iterator.c
test-drop-caches.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-dump-cache-tree.c
test-dump-fsmonitor.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
test-dump-split-index.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
test-dump-untracked-cache.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
test-env-helper.c
test-example-tap.c Merge branch 'jk/mark-unused-parameters' 2024-08-26 11:32:23 -07:00
test-fake-ssh.c
test-find-pack.c packfile: use object_id in find_pack_entry_one() 2024-10-25 17:35:46 -04:00
test-fsmonitor-client.c
test-genrandom.c t/helper: don't depend on implicit wraparound 2024-12-06 20:20:05 +09:00
test-genzeros.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-getcwd.c
test-hash-speed.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
test-hash.c
test-hashmap.c t/helper: mark more unused argv/argc arguments 2024-08-17 09:46:11 -07:00
test-hexdump.c
test-json-writer.c
test-lazy-init-name-hash.c
test-match-trees.c
test-mergesort.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-mktemp.c
test-online-cpus.c
test-pack-mtimes.c
test-parse-options.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
test-parse-pathspec-file.c
test-partial-clone.c t/helper: fix leaking repository in partial-clone helper 2024-09-30 11:23:05 -07:00
test-path-utils.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-pcre2-config.c
test-pkt-line.c
test-proc-receive.c t/helper: fix leaks in proc-receive helper 2024-09-30 11:23:08 -07:00
test-progress.c drop trailing newline from warning/error/die messages 2024-09-05 09:07:12 -07:00
test-reach.c commit-reach: use `size_t` to track indices when computing merge bases 2024-12-27 08:12:40 -08:00
test-read-cache.c t/helper: stop re-initialization of `the_repository` 2024-11-04 22:37:56 -08:00
test-read-graph.c t/helper: fix leaking commit graph in "read-graph" subcommand 2024-11-21 08:23:45 +09:00
test-read-midx.c midx: pass `repository` to `load_multi_pack_index` 2024-12-04 10:32:20 +09:00
test-ref-store.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
test-reftable.c reftable/system: stop depending on "hash.h" 2024-11-19 12:23:10 +09:00
test-regex.c
test-repository.c
test-revision-walking.c diff.h: fix index used to loop through unsigned integer 2024-12-06 20:20:03 +09:00
test-rot13-filter.c t/helper: fix a typo 2024-10-10 13:31:13 -07:00
test-run-command.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-scrap-cache-tree.c
test-serve-v2.c
test-sha1.c
test-sha1.sh
test-sha256.c
test-sigchain.c
test-simple-ipc.c
test-string-list.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-submodule-config.c
test-submodule-nested-repo-config.c t/helper: fix leaking subrepo in nested submodule config helper 2024-09-27 08:25:35 -07:00
test-submodule.c
test-subprocess.c
test-tool-utils.h
test-tool.c global: trivial conversions to fix `-Wsign-compare` warnings 2024-12-06 20:20:04 +09:00
test-tool.h Merge branch 'cp/unit-test-reftable-stack' 2024-09-16 14:22:53 -07:00
test-trace2.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
test-truncate.c
test-userdiff.c
test-wildmatch.c
test-windows-named-pipe.c
test-write-cache.c
test-xml-encode.c