if (status == ERR) {
fprintf(stderr, "Error on line %d, near '%.*s': %s\n",
- config_lineno, optlen, opt, config_msg);
+ config_lineno, (int) optlen, opt, config_msg);
config_errors = TRUE;
}
VIEW_(LOG, "log", &pager_ops, ref_head),
VIEW_(TREE, "tree", &tree_ops, ref_commit),
VIEW_(BLOB, "blob", &blob_ops, ref_blob),
- VIEW_(HELP, "help", &help_ops, ""),
- VIEW_(PAGER, "pager", &pager_ops, ""),
+ VIEW_(HELP, "help", &help_ops, ""),
+ VIEW_(PAGER, "pager", &pager_ops, "stdin"),
VIEW_(STATUS, "status", &status_ops, ""),
};
if (minsize < view->width)
refsize = view->width - minsize + 7;
- string_format_from(buf, &bufpos, " %.*s", refsize, view->ref);
+ string_format_from(buf, &bufpos, " %.*s", (int) refsize, view->ref);
}
if (statelen && bufpos < view->width) {
break;
case REQ_VIEW_PAGER:
- if (!VIEW(REQ_VIEW_PAGER)->lines) {
+ if (!opt_pipe && !VIEW(REQ_VIEW_PAGER)->lines) {
report("No pager content, press %s to run command from prompt",
get_key(REQ_PROMPT));
break;
static int
load_repo_info(void)
{
- return read_properties(popen("git rev-parse --git-dir --show-cdup", "r"),
+ return read_properties(popen("git rev-parse --git-dir --show-cdup 2>/dev/null", "r"),
"=", read_repo_info);
}
string_ncopy(opt_codeset, codeset, strlen(codeset));
}
+ if (load_repo_info() == ERR)
+ die("Failed to load repo info.");
+
+ /* Require a git repository unless when running in pager mode. */
+ if (!opt_git_dir[0])
+ die("Not a git repository");
+
if (load_options() == ERR)
die("Failed to load user config.");
if (load_repo_config() == ERR)
die("Failed to load repo config.");
- if (load_repo_info() == ERR)
- die("Failed to load repo info.");
-
if (!parse_options(argc, argv))
return 0;
if (load_refs() == ERR)
die("Failed to load refs.");
- /* Require a git repository unless when running in pager mode. */
- if (refs_size == 0 && opt_request != REQ_VIEW_PAGER)
- die("Not a git repository");
-
for (i = 0; i < ARRAY_SIZE(views) && (view = &views[i]); i++)
view->cmd_env = getenv(view->cmd_env);