diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-10-21 10:08:56 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-22 13:32:29 +0900 |
commit | ab3e1f78ae8ecb3371cf85a36d73fd341fad3884 (patch) | |
tree | f3f00295b056fb346d5bbba0bcbe53ca7d3b6e3c /worktree.h | |
parent | 061e420a4d3a87ea331eb51f2b92b6b97f3115da (diff) | |
download | git-ab3e1f78ae8ecb3371cf85a36d73fd341fad3884.tar.gz |
revision.c: better error reporting on ref from different worktrees
Make use of the new ref aliases to pass refs from another worktree
around and access them from the current ref store instead. This does
not change any functionality, but when a problem arises, we would like
the reported messages to mention full ref aliases, like this:
fatal: bad object worktrees/ztemp/HEAD
warning: reflog of 'main-worktree/HEAD' references pruned commits
instead of
fatal: bad object HEAD
warning: reflog of 'HEAD' references pruned commits
which does not really tell where the refs are from.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'worktree.h')
-rw-r--r-- | worktree.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/worktree.h b/worktree.h index 440bb219dd..1164ca396f 100644 --- a/worktree.h +++ b/worktree.h @@ -117,4 +117,19 @@ extern const char *worktree_git_path(const struct worktree *wt, */ int parse_worktree_ref(const char *worktree_ref, const char **name, int *name_length, const char **ref); + +/* + * Return a refname suitable for access from the current ref store. + */ +void strbuf_worktree_ref(const struct worktree *wt, + struct strbuf *sb, + const char *refname); + +/* + * Return a refname suitable for access from the current ref + * store. The result will be destroyed at the next call. + */ +const char *worktree_ref(const struct worktree *wt, + const char *refname); + #endif |