diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-07-02 23:35:05 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-07-09 16:42:22 -0700 |
commit | daba53aeaf6565b4bbdd6783c659480453ec3c5e (patch) | |
tree | c4d4c9ef0161760d0ffb2f051b683fd3f50d8db7 /cache.h | |
parent | d5f6b1d756a29255efedee3cb6e8526aedcfeb00 (diff) | |
download | git-daba53aeaf6565b4bbdd6783c659480453ec3c5e.tar.gz |
sha1_name.c: add support for disambiguating other types
This teaches the revision parser that in "$name:$path" (used for a
blob object name), "$name" must be a tree-ish.
There are many more places where we know what types of objects are
called for. This patch adds support for "commit", "treeish", "tree",
and "blob", which could be used in the following contexts:
- "git apply --build-fake-ancestor" reads the "index" lines from
the patch; they must name blob objects (not even "blob-ish");
- "git commit-tree" reads a tree object name (not "tree-ish"), and
zero or more commit object names (not "committish");
- "git reset $rev" wants a committish; "git reset $rev -- $path"
wants a treeish.
They will come in later patches in the series.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -811,13 +811,20 @@ struct object_context { unsigned mode; }; -#define GET_SHA1_QUIETLY 01 -#define GET_SHA1_COMMIT 02 -#define GET_SHA1_COMMITTISH 04 +#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_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); |