]> git.ipfire.org Git - thirdparty/git.git/commit
strbuf: introduce strbuf_strip_file_from_path()
authorDerrick Stolee <derrickstolee@github.com>
Thu, 22 Dec 2022 15:14:14 +0000 (15:14 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 25 Dec 2022 07:24:24 +0000 (16:24 +0900)
commit9ea57964953dec11dcbbd5d4bf44a5e3781f5880
tree7f4738556b871d07a2c35dd4697e965d03afe97a
parent738dc7d4a5f42376bc748008dd8792aa4eb25627
strbuf: introduce strbuf_strip_file_from_path()

The strbuf_parent_directory() method was added as a static method in
contrib/scalar by d0feac4e8c0 (scalar: 'register' sets recommended
config and starts maintenance, 2021-12-03) and then removed in
65f6a9eb0b9 (scalar: constrain enlistment search, 2022-08-18), but now
there is a need for a similar method in the bundle URI feature.

Re-add the method, this time in strbuf.c, but with a new name:
strbuf_strip_file_from_path(). The method requirements are slightly
modified to allow a trailing slash, in which case nothing is done, which
makes the name change valuable.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
strbuf.c
strbuf.h