Re: [PATCH/RFC] improve no-op push output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> So I think we would really need to break down each potentially confusing
> case, and come up with a solution for each. I think we can divide the
> push configuration into three cases: matching, single (which includes
> "upstream", "simple", and "current"), or custom refspecs. Let's ignore
> the final one for now. It's relatively rare, and probably the most
> common use is mirroring (in which case we know we pushed everything,
> anyway). And then we have a few potential confusing situations:

Does "single" include "upstream", "simple" and "current", or does it
consists of these three and nothing else? I think it is the latter,
and I mean the latter in the remainder of my response. Specifically,
I would exclude the case where you have remote.$there.push that only
pushes one ref from "single".

>   1. We are on a detached HEAD; the user expects their current work to
>      be pushed, but it is not. With the "single" cases, we should
>      already error out.

All the "single" cases should error out when run on a detached HEAD
(otherwise they should be fixed).

I have a feeling that it is not the best approach to classify the
"detached HEAD" as a special failure mode for "single".  If you view
"single" as "push the curent branch out, but the name of the
destination ref may be different depending on the mode", the
detached HEAD case is just a natural extension of the error case
"nothing is specified to be updated from this state, hence we error
out".

>      For the "matching" case, we don't want to error
>      out, but it might be worth printing a warning to say "by the way,
>      your HEAD is detached", whether everything is up-to-date or not.

Both "matching" and "specific remote.$there.push" cases are "it does
not matter what branch happens to be checked out; I am giving you
the set of refs I want to push out by default", so even though you
said you ignore the specific refspec case, they fall into the same
category here.

I find the above an unnecessarily roundabout way to help people who
expect the current branch to always be involved in an unnamed push
to say "your HEAD is detached"; it requires them to be intelligent
enough to connect "HEAD detached", "no current branch" and "hence
nothing pushed".  A more direct way "detached HEAD not pushed" may
be better.

>   2. We are on a branch; the user expects it to be pushed, but it is
>      not. This can't happen with the "single" cases, since they always
>      push HEAD (or fail). For matching, again, a solution might be "by
>      the way, your HEAD was not pushed", with the same caveats as above.

Yes, "by the way, your current branch was not pushed" is much better
than "HEAD is detached" you wrote in 1.

>   3. We are on a branch; the user expects some other branch X to be
>      pushed, but it is not.
>      ... So I think the right solution is to just
>      be more specific; say "X is up-to-date", or just show the
>      single-line status table.

OK.

>      For the "matching" case, it's much harder.
>
>      If we show them the whole description of what happened and hoping
>      they notice that their branch is not included.  When something
>      actually gets pushed, we show the status table already, and they
>      may or may not look through it to find the branch in question
>      (indeed, they may not even be trying to push X at the time, but
>      rather may later say "Hey, I thought I pushed everything; why is X
>      not here?).

We can cover both the "here are the list" and the "everything
up-to-date" cases with "(current branch not pushed)" (or "detached
HEAD not pushed)".

>   1. For a single-ref push, always mention the ref name, even if it is
>      up-to-date. My previous patch showed the status table, but we could
>      also just tweak the "Everything up-to-date" to say "Ref X is
>      up-to-date".

I think this is a sane thing to do in any case.

>   2. Introduce a "push.warnMatch" config option, which can be set to one
>      of:
>
>        - "none"; the current behavior
>
>        - "branches"; mention all unmatched refs which are in refs/heads

Doesn't this assume that among many existing branches, what are not
pushed are minority (hence it is easier to spot the presense of the
interesting branch in the output, than to spot the absense of the
list of updated ones)? I am not convinced if that is the case, and I
doubt it would be very useful.

An alternative might be to show the usual list of refs with [up to date]
marks even when we currently say "Everything up-to-date", like "push -v"
does.  I.e. instead of:

        $ git push ko
        Everything up-to-date

we can say

	$ git push ko
	To: kernel.org:/pub/scm/git/git.git
        = [up to date]      maint -> maint
        = [up to date]      master -> master
        = [up to date]      next -> next
        = [up to date]      pu -> pu

omitting "Pushing to $where" at the beginning and "Everything up-to-date"
at the end of the "push -v" output.

>        - "head"; mention the current HEAD if it is unmatched

This might be a sane thing to do unconditionally, especially if it
can be done without taking too much screen real estate.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]