summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-02 10:19:35 -0700
committerJunio C Hamano <gitster@pobox.com>2012-07-02 11:22:57 -0700
commitf01cc14c3c70cfd820114505d2ddc153c28f6f89 (patch)
tree0a30640d834ff7005ab5e4745e76cc19eebdbf10 /sha1_name.c
parenta1b475eeb40dc29246d4ce7465474479639769d0 (diff)
downloadgit-f01cc14c3c70cfd820114505d2ddc153c28f6f89.tar.gz
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>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 5b0c845d85..10932bfe1d 100644
--- a/sha1_name.c
+++ b/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)
{
if (prefixcmp(rel, "./") && prefixcmp(rel, "../"))
@@ -1019,9 +1009,9 @@ static char *resolve_relative_path(const char *rel)
rel);
}
-int get_sha1_with_context_1(const char *name, unsigned char *sha1,
- struct object_context *oc,
- int only_to_die, const char *prefix)
+static int get_sha1_with_context_1(const char *name, unsigned char *sha1,
+ struct object_context *oc,
+ int only_to_die, const char *prefix)
{
int ret, bracket_depth;
int namelen = strlen(name);
@@ -1134,3 +1124,18 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
}
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);
+}