diff --git a/NEWS.adoc b/NEWS.adoc index e13e1c199..cbf9c5f14 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -12,6 +12,7 @@ Bug fixes: - Fix wrapping of lines with multibyte characters. (#988) - Improve highlighting of search with $ regex. (#1000) + - Update tracking branch when refreshing status view. (#1015) tig-2.5.1 --------- diff --git a/src/repo.c b/src/repo.c index 69c978153..d26aeed64 100644 --- a/src/repo.c +++ b/src/repo.c @@ -23,6 +23,7 @@ #define REPO_INFO_SHOW_PREFIX "--show-prefix" #define REPO_INFO_SYMBOLIC_HEAD "--symbolic-full-name" #define REPO_INFO_RESOLVED_HEAD "HEAD" +#define REPO_INFO_REMOTE "--abbrev-ref" struct repo_info_state { const char **argv; @@ -72,6 +73,10 @@ read_repo_info(char *name, size_t namelen, char *value, size_t valuelen, void *d add_ref(repo.head_id, name, repo.remote, repo.head); } state->argv++; + + } else if (!strcmp(arg, REPO_INFO_REMOTE)) { + string_ncopy(repo.remote, name, namelen); + state->argv++; } return SUCCESS; @@ -103,11 +108,16 @@ load_repo_info(void) enum status_code load_repo_head(void) { + const char *rev_parse_remote_argv[] = { + "git", "rev-parse", REPO_INFO_REMOTE, "@{upstream}", NULL + }; const char *rev_parse_argv[] = { "git", "rev-parse", REPO_INFO_RESOLVED_HEAD, REPO_INFO_SYMBOLIC_HEAD, "HEAD", NULL }; + memset(repo.remote, 0, sizeof(repo.remote)); + reload_repo_info(rev_parse_remote_argv); memset(repo.head, 0, sizeof(repo.head)); memset(repo.head_id, 0, sizeof(repo.head_id)); return reload_repo_info(rev_parse_argv); diff --git a/test/main/all-arg-test b/test/main/all-arg-test index 0261f183e..90c23a9ff 100755 --- a/test/main/all-arg-test +++ b/test/main/all-arg-test @@ -46,7 +46,7 @@ EOF assert_equals 'detached.screen' < Commit 10 B diff --git a/test/reflog/default-test b/test/reflog/default-test index 984037db3..1cba1ffbb 100755 --- a/test/reflog/default-test +++ b/test/reflog/default-test @@ -23,8 +23,8 @@ test_tig reflog assert_equals 'reflog-default.screen' < checkout: moving from r1.0 to r1.1.2 HEAD@{1} [r1.0] checkout: moving from master to r1.0 -HEAD@{2} [master] {origin/master} {max-power/master} {origin/HEAD} reset: moving -HEAD@{3} [master] {origin/master} {max-power/master} {origin/HEAD} clone: from / +HEAD@{2} [master] {max-power/master} {origin/HEAD} {origin/master} reset: moving +HEAD@{3} [master] {max-power/master} {origin/HEAD} {origin/master} clone: from / diff --git a/test/refs/branch-checkout-test b/test/refs/branch-checkout-test index 64051622d..78e6e02c9 100755 --- a/test/refs/branch-checkout-test +++ b/test/refs/branch-checkout-test @@ -76,8 +76,8 @@ assert_equals 'refs-checked-out-branch.screen' <