object-name: move related functions to object-name
Move object-name-related functions from strbuf.[ch] to object-name.[ch] so that strbuf is focused on string manipulation routines with minimal dependencies. dir.h relied on the forward declration of the repository struct in strbuf.h. Since that is removed in this patch, add the forward declaration to dir.h. Signed-off-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
f89854362c
commit
f94018506c
16
strbuf.c
16
strbuf.c
@ -3,7 +3,6 @@
|
||||
#include "environment.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "object-name.h"
|
||||
#include "repository.h"
|
||||
#include "strbuf.h"
|
||||
#include "string-list.h"
|
||||
@ -1024,21 +1023,6 @@ void strbuf_addftime(struct strbuf *sb, const char *fmt, const struct tm *tm,
|
||||
strbuf_setlen(sb, sb->len + len);
|
||||
}
|
||||
|
||||
void strbuf_repo_add_unique_abbrev(struct strbuf *sb, struct repository *repo,
|
||||
const struct object_id *oid, int abbrev_len)
|
||||
{
|
||||
int r;
|
||||
strbuf_grow(sb, GIT_MAX_HEXSZ + 1);
|
||||
r = repo_find_unique_abbrev_r(repo, sb->buf + sb->len, oid, abbrev_len);
|
||||
strbuf_setlen(sb, sb->len + r);
|
||||
}
|
||||
|
||||
void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid,
|
||||
int abbrev_len)
|
||||
{
|
||||
strbuf_repo_add_unique_abbrev(sb, the_repository, oid, abbrev_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the length of a line, without trailing spaces.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user