mirror of
https://github.com/git/git
synced 2024-10-03 23:29:36 +00:00
sha1_name.c: hide get_sha1_with_context_1() ugliness
There is no outside caller that cares about the "only-to-die" ugliness. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a1b475eeb4
commit
f01cc14c3c
6
cache.h
6
cache.h
|
@ -817,11 +817,7 @@ static inline int get_sha1_with_mode(const char *str, unsigned char *sha1, unsig
|
||||||
{
|
{
|
||||||
return get_sha1_with_mode_1(str, sha1, mode, 0, NULL);
|
return get_sha1_with_mode_1(str, sha1, mode, 0, NULL);
|
||||||
}
|
}
|
||||||
extern int get_sha1_with_context_1(const char *name, unsigned char *sha1, struct object_context *orc, int only_to_die, const char *prefix);
|
extern int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc);
|
||||||
static inline int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc)
|
|
||||||
{
|
|
||||||
return get_sha1_with_context_1(str, sha1, orc, 0, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to read a SHA1 in hexadecimal format from the 40 characters
|
* Try to read a SHA1 in hexadecimal format from the 40 characters
|
||||||
|
|
27
sha1_name.c
27
sha1_name.c
|
@ -992,16 +992,6 @@ static void diagnose_invalid_index_path(int stage,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int get_sha1_with_mode_1(const char *name, unsigned char *sha1, unsigned *mode,
|
|
||||||
int only_to_die, const char *prefix)
|
|
||||||
{
|
|
||||||
struct object_context oc;
|
|
||||||
int ret;
|
|
||||||
ret = get_sha1_with_context_1(name, sha1, &oc, only_to_die, prefix);
|
|
||||||
*mode = oc.mode;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *resolve_relative_path(const char *rel)
|
static char *resolve_relative_path(const char *rel)
|
||||||
{
|
{
|
||||||
if (prefixcmp(rel, "./") && prefixcmp(rel, "../"))
|
if (prefixcmp(rel, "./") && prefixcmp(rel, "../"))
|
||||||
|
@ -1019,7 +1009,7 @@ static char *resolve_relative_path(const char *rel)
|
||||||
rel);
|
rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_sha1_with_context_1(const char *name, unsigned char *sha1,
|
static int get_sha1_with_context_1(const char *name, unsigned char *sha1,
|
||||||
struct object_context *oc,
|
struct object_context *oc,
|
||||||
int only_to_die, const char *prefix)
|
int only_to_die, const char *prefix)
|
||||||
{
|
{
|
||||||
|
@ -1134,3 +1124,18 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get_sha1_with_mode_1(const char *name, unsigned char *sha1, unsigned *mode,
|
||||||
|
int only_to_die, const char *prefix)
|
||||||
|
{
|
||||||
|
struct object_context oc;
|
||||||
|
int ret;
|
||||||
|
ret = get_sha1_with_context_1(name, sha1, &oc, only_to_die, prefix);
|
||||||
|
*mode = oc.mode;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_sha1_with_context(const char *str, unsigned char *sha1, struct object_context *orc)
|
||||||
|
{
|
||||||
|
return get_sha1_with_context_1(str, sha1, orc, 0, NULL);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue