summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7f8f12b)
raw | patch | inline | side by side (parent: 7f8f12b)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 19 Feb 2009 01:21:39 +0000 (02:21 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 19 Feb 2009 01:21:39 +0000 (02:21 +0100) |
Fixes problem of improper highlighting of current branch after switching
branch and reloading.
branch and reloading.
tig.c | patch | blob | history |
index 5acb3988098720a0748b39380e778e61202bed4e..85fe9811d46f8625f84439330e8647bc2530b858 100644 (file)
--- a/tig.c
+++ b/tig.c
static int
load_refs(void)
{
+ const char *head_argv[] = {
+ "git", "symbolic-ref", "HEAD", NULL
+ };
static const char *ls_remote_argv[SIZEOF_ARG] = {
"git", "ls-remote", opt_git_dir, NULL
};
if (!*opt_git_dir)
return OK;
+ if (run_io_buf(head_argv, opt_head, sizeof(opt_head))) {
+ chomp_string(opt_head);
+ if (!prefixcmp(opt_head, "refs/heads/")) {
+ char *offset = opt_head + STRING_SIZE("refs/heads/");
+
+ memmove(opt_head, offset, strlen(offset) + 1);
+ }
+ }
+
while (refs_size > 0)
free(refs[--refs_size].name);
while (id_refs_size > 0)
static int
load_repo_info(void)
{
- const char *head_argv[] = {
- "git", "symbolic-ref", "HEAD", NULL
- };
const char *rev_parse_argv[] = {
"git", "rev-parse", "--git-dir", "--is-inside-work-tree",
"--show-cdup", "--show-prefix", NULL
};
- if (run_io_buf(head_argv, opt_head, sizeof(opt_head))) {
- chomp_string(opt_head);
- if (!prefixcmp(opt_head, "refs/heads/")) {
- char *offset = opt_head + STRING_SIZE("refs/heads/");
-
- memmove(opt_head, offset, strlen(offset) + 1);
- }
- }
-
return run_io_load(rev_parse_argv, "=", read_repo_info);
}