Merge branch 'jc/sha1-name-more'
Teaches the object name parser things like a "git describe" output is always a commit object, "A" in "git log A" must be a committish, and "A" and "B" in "git log A...B" both must be committish, etc., to prolong the lifetime of abbreviated object names. * jc/sha1-name-more: (27 commits) t1512: match the "other" object names t1512: ignore whitespaces in wc -l output rev-parse --disambiguate=<prefix> rev-parse: A and B in "rev-parse A..B" refer to committish reset: the command takes committish commit-tree: the command wants a tree and commits apply: --build-fake-ancestor expects blobs sha1_name.c: add support for disambiguating other types revision.c: the "log" family, except for "show", takes committish revision.c: allow handle_revision_arg() to take other flags sha1_name.c: introduce get_sha1_committish() sha1_name.c: teach lookup context to get_sha1_with_context() sha1_name.c: many short names can only be committish sha1_name.c: get_sha1_1() takes lookup flags sha1_name.c: get_describe_name() by definition groks only commits sha1_name.c: teach get_short_sha1() a commit-only option sha1_name.c: allow get_short_sha1() to take other flags get_sha1(): fix error status regression sha1_name.c: restructure disambiguation of short names sha1_name.c: correct misnamed "canonical" and "res" ...
This commit is contained in:
28
cache.h
28
cache.h
@ -790,17 +790,25 @@ struct object_context {
|
||||
unsigned mode;
|
||||
};
|
||||
|
||||
#define GET_SHA1_QUIETLY 01
|
||||
#define GET_SHA1_COMMIT 02
|
||||
#define GET_SHA1_COMMITTISH 04
|
||||
#define GET_SHA1_TREE 010
|
||||
#define GET_SHA1_TREEISH 020
|
||||
#define GET_SHA1_BLOB 040
|
||||
#define GET_SHA1_ONLY_TO_DIE 04000
|
||||
|
||||
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 only_to_die, 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, 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);
|
||||
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);
|
||||
}
|
||||
extern int get_sha1_commit(const char *str, unsigned char *sha1);
|
||||
extern int get_sha1_committish(const char *str, unsigned char *sha1);
|
||||
extern int get_sha1_tree(const char *str, unsigned char *sha1);
|
||||
extern int get_sha1_treeish(const char *str, unsigned char *sha1);
|
||||
extern int get_sha1_blob(const char *str, unsigned char *sha1);
|
||||
extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
|
||||
extern int get_sha1_with_context(const char *str, unsigned flags, unsigned char *sha1, struct object_context *orc);
|
||||
|
||||
typedef int each_abbrev_fn(const unsigned char *sha1, void *);
|
||||
extern int for_each_abbrev(const char *prefix, each_abbrev_fn, void *);
|
||||
|
||||
/*
|
||||
* Try to read a SHA1 in hexadecimal format from the 40 characters
|
||||
|
Reference in New Issue
Block a user