refs.c: add repo_dwim_ref()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
0b1dbf53df
commit
d8984c532a
12
refs.c
12
refs.c
|
@ -555,14 +555,20 @@ static char *substitute_branch_name(struct repository *r,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dwim_ref(const char *str, int len, struct object_id *oid, char **ref)
|
int repo_dwim_ref(struct repository *r, const char *str, int len,
|
||||||
|
struct object_id *oid, char **ref)
|
||||||
{
|
{
|
||||||
char *last_branch = substitute_branch_name(the_repository, &str, &len);
|
char *last_branch = substitute_branch_name(r, &str, &len);
|
||||||
int refs_found = expand_ref(the_repository, str, len, oid, ref);
|
int refs_found = expand_ref(r, str, len, oid, ref);
|
||||||
free(last_branch);
|
free(last_branch);
|
||||||
return refs_found;
|
return refs_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dwim_ref(const char *str, int len, struct object_id *oid, char **ref)
|
||||||
|
{
|
||||||
|
return repo_dwim_ref(the_repository, str, len, oid, ref);
|
||||||
|
}
|
||||||
|
|
||||||
int expand_ref(struct repository *repo, const char *str, int len,
|
int expand_ref(struct repository *repo, const char *str, int len,
|
||||||
struct object_id *oid, char **ref)
|
struct object_id *oid, char **ref)
|
||||||
{
|
{
|
||||||
|
|
1
refs.h
1
refs.h
|
@ -149,6 +149,7 @@ struct argv_array;
|
||||||
void expand_ref_prefix(struct argv_array *prefixes, const char *prefix);
|
void expand_ref_prefix(struct argv_array *prefixes, const char *prefix);
|
||||||
|
|
||||||
int expand_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
|
int expand_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
|
||||||
|
int repo_dwim_ref(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
|
||||||
int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
|
int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
|
||||||
int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
|
int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue