Thread (4 messages) flat view 4 messages, 2 authors, 2016-06-15

Re: [PATCH v3] status: always show tracking branch even no change

From: Jiang Xin <hidden>
Date: 2016-06-15 22:58:24

Possibly related (same subject, not in this thread)

2013/8/12 Junio C Hamano [off-list ref]:
Jiang Xin [off-list ref] writes:
quoted
2013/8/10 Junio C Hamano [off-list ref]:
quoted
Jiang Xin [off-list ref] writes:
quoted
So always show the remote tracking branch in the output of "git status"
and other commands will help users to see where the current branch
will push to and pull from. E.g.
...
Hmmph.

I do not know if this will help any case you described above, even
though this might help some other cases.  The added output is to
always show the current branch and its upstream, but the thing is,
the original issue in $gmane/198703 was *not* that the current
branch was pushed and up to date.  It was that there was no current
branch to be pushed.  The same thing would happen if you are on a
local branch that is not set to be pushed to the other side
(e.g. the configuration is set to "matching" and there is no such
branch on the other end).
How about write the commit log like this:
...
Then if there is no tracking info reported, the user may need to do
something. Maybe the current branch is a new branch that needs to be
pushed out, or maybe it's a branch which should add remote tracking
settings.
Would that help anybody, though?
I will split the patch into two. The 1st patch resolves a real problem:

    branch: not report invalid tracking branch

    Command "git branch -vv" will report tracking branches, but invalid
    tracking branches are also reported. This is because the function
    stat_tracking_info() can not distinguish whether the upstream branch
    does not exist, or nothing is changed between one branch and its
    upstream.

    This patch changes the return value of function stat_tracking_info().
    Only returns false when there is no tracking branch or the tracking
    branch is invalid, otherwise true. If the caller does not like to
    report tracking info when nothing changed between the branch and its
    upstream, simply checks if num_theirs and num_ours are both 0.

And in the 2nd patch, I will not mention "git push" (current not be
pushed out ...) any more, and only focus on "git status". It's just
a suggestion, may only fit small group of users' taste.


-- 
Jiang Xin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help