Felipe Contreras [off-list ref] 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?
Your series lacks documentation of branch.<name>.* in
Documentation/config.txt.
It seems strange to me to name the config variables "branch.<name>.push"
and "branch.<name>.pushremote" and call the same thing "@{publish}"
elsewhere. We're already not consistant with @{upstream} corresponding
to branch.<name>.merge, but I do not consider it as a good reason to
introduce one more inconsistancy.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Matthieu Moy wrote:
Felipe Contreras [off-list ref] writes:
quoted
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