diff options
| author | Jeff King <peff@peff.net> | 2024-10-25 03:01:25 -0400 |
|---|---|---|
| committer | Taylor Blau <me@ttaylorr.com> | 2024-10-25 17:35:46 -0400 |
| commit | 4390fea963b284a3cc904ffc6c48d4ab02ea5e68 (patch) | |
| tree | 13ff2674faa7f107b3903c24631eef2a7edbf09c /builtin | |
| parent | packfile: drop sha1_pack_name() (diff) | |
| download | git-4390fea963b284a3cc904ffc6c48d4ab02ea5e68.tar.gz git-4390fea963b284a3cc904ffc6c48d4ab02ea5e68.zip | |
packfile: drop sha1_pack_index_name()
Like sha1_pack_name() that we dropped in the previous commit, this
function uses an error-prone static strbuf and the somewhat misleading
name "sha1".
The only caller left is in pack-redundant.c. While this command is
marked for potential removal in our BreakingChanges document, we still
have it for now. But it's simple enough to convert it to use its own
strbuf with the underlying odb_pack_name() function, letting us drop the
otherwise obsolete function.
Note that odb_pack_name() does its own strbuf_reset(), so it's safe to
use directly within a loop like this.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/pack-redundant.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index 5809613002..d2c1c4e5ec 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -13,6 +13,7 @@ #include "packfile.h" #include "object-store-ll.h" +#include "strbuf.h" #define BLKSIZE 512 @@ -591,6 +592,7 @@ static void load_all(void) int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { int i; int i_still_use_this = 0; struct pack_list *min = NULL, *red, *pl; struct llist *ignore; + struct strbuf idx_name = STRBUF_INIT; char buf[GIT_MAX_HEXSZ + 2]; /* hex hash + \n + \0 */ if (argc == 2 && !strcmp(argv[1], "-h")) @@ -688,7 +690,7 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, s pl = red = pack_list_difference(local_packs, min); while (pl) { printf("%s\n%s\n", - sha1_pack_index_name(pl->pack->hash), + odb_pack_name(&idx_name, pl->pack->hash, "idx"), pl->pack->pack_name); pl = pl->next; } @@ -699,5 +701,6 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, s pack_list_free(red); pack_list_free(min); llist_free(ignore); + strbuf_release(&idx_name); return 0; } |
