remote.c: introduce branch_get_upstream helper