Similar to notice for blob view, mention when there is no pager content
to view and suggest the user to open the prompt to run a command.
#define string_ncopy(dst, src, srclen) \
string_ncopy_do(dst, sizeof(dst), src, srclen)
#define string_ncopy(dst, src, srclen) \
string_ncopy_do(dst, sizeof(dst), src, srclen)
+#define string_copy_rev(dst, src) \
+ string_ncopy_do(dst, SIZEOF_REV, src, SIZEOF_REV - 1)
+
static char *
chomp_string(char *name)
{
static char *
chomp_string(char *name)
{
view->offset = 0;
view->lines = 0;
view->lineno = 0;
view->offset = 0;
view->lines = 0;
view->lineno = 0;
- string_copy(view->vid, id);
+ string_copy_rev(view->vid, id);
char *text = line->data + STRING_SIZE("commit ");
if (view != VIEW(REQ_VIEW_PAGER))
char *text = line->data + STRING_SIZE("commit ");
if (view != VIEW(REQ_VIEW_PAGER))
- string_copy(view->ref, text);
- string_copy(ref_commit, text);
+ string_copy_rev(view->ref, text);
+ string_copy_rev(ref_commit, text);
char *text = line->data + STRING_SIZE("100644 blob ");
if (line->type == LINE_TREE_FILE) {
char *text = line->data + STRING_SIZE("100644 blob ");
if (line->type == LINE_TREE_FILE) {
- string_ncopy(ref_blob, text, 40);
+ string_copy_rev(ref_blob, text);
} else if (line->type != LINE_TREE_DIR) {
return;
}
} else if (line->type != LINE_TREE_DIR) {
return;
}
- string_ncopy(view->ref, text, 40);
+ string_copy_rev(view->ref, text);
}
static struct view_ops tree_ops = {
}
static struct view_ops tree_ops = {
line += STRING_SIZE("commit ");
view->line[view->lines++].data = commit;
line += STRING_SIZE("commit ");
view->line[view->lines++].data = commit;
- string_copy(commit->id, line);
+ string_copy_rev(commit->id, line);
commit->refs = get_refs(commit->id);
graph->commit = commit;
break;
commit->refs = get_refs(commit->id);
graph->commit = commit;
break;
{
struct commit *commit = line->data;
{
struct commit *commit = line->data;
- string_copy(view->ref, commit->id);
- string_copy(ref_commit, view->ref);
+ string_copy_rev(view->ref, commit->id);
+ string_copy_rev(ref_commit, view->ref);
}
static struct view_ops main_ops = {
}
static struct view_ops main_ops = {
ref->name[namelen] = 0;
ref->tag = tag;
ref->remote = remote;
ref->name[namelen] = 0;
ref->tag = tag;
ref->remote = remote;
- string_copy(ref->id, id);
+ string_copy_rev(ref->id, id);