Re: [PATCH v2 0/9] Introduce publish tracking branch

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

 



Matthieu Moy wrote:
> Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:
> 
> > As it has been discussed before, our support for triangular workflows is
> > lacking, and the following patch series aims to improve that situation.
> 
> I'm not a heavy user of triangular workflow, so I'm not in the best
> position to comment (and I have no time for a real review, sorry).
> 
> On overall, I do like the change. I played a bit with it, and do not
> understand what "git push" does:
> 
>   $ git status
>   On branch master
>   Your branch is ahead of 'origin/new' by 4 commits.
>     (use "git push" to publish your local commits)
> 
> => OK, it's using the publish branch to tell me whether I should push.
> 
>   $ git push -v
>   Pushing to /tmp/git
>   To /tmp/git
>    = [up to date]      master -> master
>   updating local tracking ref 'refs/remotes/origin/master'
>   Everything up-to-date
> 
> => Err, it still pushes to the upstream branch ... Wasn't that the point
> of the change to push to publish? Did I do something wrong?

My patch series only affects push.default=simple, perhaps you have a
different configuration.

Maybe we want the publish branch to override any push.default, so:

--- a/builtin/push.c
+++ b/builtin/push.c
@@ -195,11 +195,7 @@ static void setup_push_current(struct remote *remote, struct branch *branch)
 static void setup_push_simple(struct remote *remote, struct branch *branch,
                int triangular)
 {
-       if (branch->push_name) {
-               struct strbuf refspec = STRBUF_INIT;
-               strbuf_addf(&refspec, "%s:%s", branch->name, branch->push_name);
-               add_refspec(refspec.buf);
-       } else if (triangular) {
+       if (triangular) {
                setup_push_current(remote, branch);
        } else {
                setup_push_upstream(remote, branch, triangular);
@@ -260,8 +256,16 @@ static struct branch *get_current_branch(struct remote *remote)
 
 static void setup_default_push_refspecs(struct remote *remote)
 {
+       struct branch *branch = branch_get(NULL);
        int triangular = is_workflow_triangular(remote);
 
+       if (branch && branch->push_name) {
+               struct strbuf refspec = STRBUF_INIT;
+               strbuf_addf(&refspec, "%s:%s", branch->name, branch->push_name);
+               add_refspec(refspec.buf);
+               return;
+       }
+
        switch (push_default) {
        default:
        case PUSH_DEFAULT_UNSPECIFIED:

-- 
Felipe Contreras
--
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]