diff options
author | Clément Poulain <clement.poulain@ensimag.imag.fr> | 2010-06-09 19:02:06 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-06-18 09:41:29 -0700 |
commit | 573285e55265ccedab5507c47ebd4357f360093f (patch) | |
tree | 54c1fdbb6e6c347d2df115a51996c60e4f6a285d /cache.h | |
parent | 37d29e1051ef8406d21f8b284a659080fcfe3f72 (diff) | |
download | git-573285e55265ccedab5507c47ebd4357f360093f.tar.gz |
sha1_name: add get_sha1_with_context()
Textconv is defined by the diff driver, which is associated with a pathname,
not a blob. This fonction permits to know the context for the sha1 you're
looking for, especially his pathname
Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -730,12 +730,23 @@ static inline unsigned int hexval(unsigned char c) #define MINIMUM_ABBREV 4 #define DEFAULT_ABBREV 7 +struct object_context { + unsigned char tree[20]; + char path[PATH_MAX]; + unsigned mode; +}; + extern int get_sha1(const char *str, unsigned char *sha1); extern int get_sha1_with_mode_1(const char *str, unsigned char *sha1, unsigned *mode, int gently, const char *prefix); static inline int get_sha1_with_mode(const char *str, unsigned char *sha1, unsigned *mode) { return get_sha1_with_mode_1(str, sha1, mode, 1, NULL); } +extern int get_sha1_with_context_1(const char *name, unsigned char *sha1, struct object_context *orc, int gently, const char *prefix); +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, 1, NULL); +} extern int get_sha1_hex(const char *hex, unsigned char *sha1); extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ extern int read_ref(const char *filename, unsigned char *sha1); |