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>
This commit is contained in:
committed by
Junio C Hamano
parent
061e420a4d
commit
ab3e1f78ae
15
worktree.h
15
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
|
||||
|
||||
Reference in New Issue
Block a user