Skip to content

oidmap: make entry cleanup explicit in oidmap_clear#2169

Open
Seyi007 wants to merge 5 commits intogit:masterfrom
Seyi007:improve-oidmap-clear-func
Open

oidmap: make entry cleanup explicit in oidmap_clear#2169
Seyi007 wants to merge 5 commits intogit:masterfrom
Seyi007:improve-oidmap-clear-func

Conversation

@Seyi007
Copy link
Contributor

@Seyi007 Seyi007 commented Jan 15, 2026

No description provided.

@gitgitgadget-git
Copy link

There are issues in commit 4b47fa7:
oidmap: make entry cleanup explicit in oidmap_clear

  • Commit not signed off
  • Lines in the body of the commit messages should be wrapped between 60 and 76 characters.
    Indented lines, and lines without whitespace, are exempt

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from 4b47fa7 to 1f5e841 Compare January 15, 2026 11:48
@gitgitgadget-git
Copy link

There is an issue in commit 1f5e841:
oidmap: make entry cleanup explicit in oidmap_clear

  • Lines in the body of the commit messages should be wrapped between 60 and 76 characters.
    Indented lines, and lines without whitespace, are exempt

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from 1f5e841 to 462048a Compare January 15, 2026 11:57
@gitgitgadget-git
Copy link

There is an issue in commit 462048a:
oidmap: make entry cleanup explicit in oidmap_clear

  • Lines in the body of the commit messages should be wrapped between 60 and 76 characters.
    Indented lines, and lines without whitespace, are exempt

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from 462048a to 422aaa6 Compare January 15, 2026 12:10
Copy link

@subratakundu2312-web subratakundu2312-web left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TANNY NANDY @ 270GMAIL .COM

@subratakundu2312-web
Copy link

ADD OFF FIND OR CHECK NO : 7500143

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from 422aaa6 to 89809ea Compare February 27, 2026 22:28
@gitgitgadget-git
Copy link

There is an issue in commit 010b49c:
builtin/rev-list: migrate missing_objects cleanup to

  • The first line must be separated from the rest by an empty line

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from 89809ea to 9f889ff Compare February 27, 2026 22:41
@gitgitgadget-git
Copy link

Invalid author email in a0ab068: "[email protected]"

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from 9f889ff to ea883be Compare February 27, 2026 23:01
@gitgitgadget-git
Copy link

Invalid author email in a0ab068: "[email protected]"

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from ea883be to 4fc6e71 Compare February 27, 2026 23:07
@gitgitgadget-git
Copy link

Invalid author email in a0ab068: "[email protected]"

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from 4fc6e71 to fba6a40 Compare February 27, 2026 23:17
@gitgitgadget-git
Copy link

There is an issue in commit 05e8cb9:
builtin/rev-list: migrate missing_objects cleanup to oidmap_clear_with_free()

  • First line of commit message is too long (> 76 columns)

@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from fba6a40 to 3de04be Compare February 27, 2026 23:34
@gitgitgadget-git
Copy link

Invalid author email in 14f46e1: "[email protected]"

Replace oidmap's use of hashmap_clear_() and layout-dependent freeing
with an explicit iteration and optional free callback. This removes
reliance on struct layout assumptions while keeping the existing API
intact.

Add tests for oidmap_clear_with_free behavior.
test_oidmap__clear_with_free_callback verifies that entries are freed
when a callback is provided, while
test_oidmap__clear_without_free_callback verifies that entries are not
freed when no callback is given. These tests ensure the new clear
implementation behaves correctly and preserves ownership semantics.

Signed-off-by: Seyi Kuforiji <[email protected]>
oidmap_clear_with_free()

As part of the conversion away from oidmap_clear(), switch the
missing_objects map to use oidmap_clear_with_free().

missing_objects stores struct missing_objects_map_entry instances,
which own an xstrdup()'d path string in addition to the container
struct itself. Previously, rev-list manually freed entry->path
before calling oidmap_clear(&missing_objects, true).

Introduce a dedicated free callback and pass it to
oidmap_clear_with_free(), consolidating entry teardown into a
single place and making cleanup semantics explicit. This improves
clarity and maintainability.

Signed-off-by: Seyi Kuforiji <[email protected]>
Replace the use of oidmap_clear(&seen_at_depth, 1) in
filter_trees_free() with oidmap_clear_with_free().

The seen_at_depth map stores heap-allocated struct
seen_map_entry objects. Previously, passing 1 relied on
oidmap_clear() internally calling free() on each entry.

Convert this to the explicit oidmap_clear_with_free() API
and provide a typed free_seen_map_entry() helper to free
each container entry.

This makes the ownership and cleanup policy explicit and
removes reliance on the legacy boolean free_entries
parameter.

Signed-off-by: Seyi Kuforiji <[email protected]>
Replace the direct oidmap_clear() call in odb_free() with
oidmap_clear_with_free(), and introduce a free_replace_map_entry()
helper to properly free each struct replace_object stored in the map.

This centralizes cleanup logic and ensures entries are released
correctly via a dedicated callback.

Signed-off-by: Seyi Kuforiji <[email protected]>
Switch cleanup of the string_entry oidmap to
oidmap_clear_with_free() and introduce a free_string_entry()
helper to properly free each allocated struct string_entry.

This aligns with the ongoing migration to use the callback-based
oidmap cleanup API.

Signed-off-by: Seyi Kuforiji <[email protected]>
@Seyi007 Seyi007 force-pushed the improve-oidmap-clear-func branch from 3de04be to 16f2979 Compare February 27, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants