git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Steffen Prohaska <prohaska@zib.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 2/2] push: Add '--current', which pushes only the current branch
Date: Mon, 19 Nov 2007 07:41:59 +0100	[thread overview]
Message-ID: <EA5C3227-12E1-43C4-96E8-43BABF26792B@zib.de> (raw)
In-Reply-To: <7vwssfqb0w.fsf@gitster.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 6202 bytes --]


On Nov 19, 2007, at 2:28 AM, Junio C Hamano wrote:

> Steffen Prohaska <prohaska@zib.de> writes:
>
>> Often you want to push only the current branch to the default
>> remote.  This was awkward to do in the past.
>
> While I think --current is a handy shorthand to have, I do not
> think the above description is correct.
>
> Wouldn't your earlier patch have allowed the configuration setting:
>
> 	[remote "$there"]
>         	push = HEAD
> 	[branch "$current"]
>         	remote = $there
>
> to work very well already?

No.  This was the case in the verst first version of the patch
series.  Someone, I don't remember who, proposed to put the
resolution of HEAD into builtin-push.c.  This simplified code
a lot.  Now, HEAD is resolved when parsing the command line.
At that time it is replaced with the full local refname.
The refspec parsing code never sees HEAD, and it won't
understand it.  Try the above setup, and you'll see that it
doesn't work.

Anyway it's not needed if we proceed as outlined below.


> I do not think it is "Often you want" that makes it awkward.
>
> Instead, the awkward case is if you do the "only the current"
> push NOT often enough.  If it is often enough, you set the
> configuration once and the awkwardness is behind you.
>
> If however it is not often enough, you cannot afford to have the
> configuration above, because that would force you to tell from
> the command line which branches, not just the current one, to
> push, and that is inconvenient because it is not rare enough.

Will try to rephrase the commit message.


> Together with your [PATCH 1/2], I like the general direction
> these patckes are taking us, but it feels a bit too hasty.  I
> personally am not convinced that switching to --current for
> everybody is a good move.
>
>> ...
>> Maybe in two years (that's twice an eternity in git time scales):
>>
>> 4) make "git push --current" the default.
>
> If these, both the uncertainly expressed by "Maybe" and "twice
> an eternity" are true, which they are, the new warning in the
> current patch are inappropriate.  Many people's settings depend
> on a working "push the matching refs" behaviour, and we need a
> very good excuse to annoy the existing happy users with such a
> warning.

I think 3) is the interesting case.  "git push" should do
nothing by default.  Either you can configure "git push" to do
something by setting a remote.$remote.push line or you need
to provide a command line switch.  But if you do not tell
explicitly what you want, "git push" will not do anything
for you.

I'm not sure if we ever switch to 4).  But already with 3) the
default changed.  So a warning seems to be appropriate.  But if
we go as outlined below, it's probably a different warning.

I attached a patch that illustrates what "do nothing by default"
means.  This patch should _not_ be applied.  It's only an
illustration what I'm working on.


> Remember, how much vocal the dissenters might have been on the
> list in the recent discussions, we need to consider the needs of
> the silent majority that has been content with the current
> behaviour for a long time.
>
> The "warning" to annoy them may be a way to get their attention
> and get them involved in a discussion to decide what the default
> should be.  But changing the default without giving the people
> who do not like the _new_ default a way to avoid inconvenience
> of always typing --matching or --current is not nice.  And
> honestly, I do not think there is one single default that is
> good for everybody.

Personally, I'd switch to the do-nothing default immediately.
But you are right.  More work is needed to have a smooth transition.


> We should be doing better.
>
> A smoother transition route would be:
>
>  - Keep "matching" the built-in default for now;
>
>  - Take your patches (but drop "warning" bits at this point) to
>    introduce 'matching' and 'current' behaviours, and a way to
>    override the built-in default from the command line;
>
>  - Introduce a configuration 'push.defaultRefs' ('matching' or
>    'current') to override that built-in default, so people who
>    prefer 'current' can override the built-in default, without
>    having to type --current every time.

Sounds like a plan.

If we have the configuration variable, maybe we could switch
off the default behaviour immediately.  Setting a single global
config variable once would be sufficient to get it back.  So,
we could change the default and print a recommendation to run
'git config --global push.defaultRefs matching' to get it back.

...

> After all that happens, we can start discussing what the
> built-in default should be.  When it is changed after the
> discussion concludes (which may never happen), people who want
> to keep 'matching' behaviour would have had the configuration
> mechanism to override that built-in default for some time during
> the discussion period.  So the beginning of that discussion
> period is when we should start talking about "We might change
> the default soon; set the configuration to your liking if you do
> not want to get affected" in the warning.

... And we'd not even start the discussion.  Because there's no
need to.  Every user should make a choice, once.  We do not
provide a default (which obviously will trigger another discussion ;)


> Then after that, we may or may not decide to change the default.
> Even if we end up not changing the default, 'current' people
> will then have a way (push.matching = false) to tailor their git
> for their liking, so everybody wins.
>
>>  DESCRIPTION
>> @@ -63,6 +63,12 @@ the remote repository.
>>  	Instead of naming each ref to push, specifies that all
>>  	refs under `$GIT_DIR/refs/heads/` be pushed.
>>
>> +\--matching::
>> +	Instead of naming each ref to push, specifies that matching
>> +	refs under `$GIT_DIR/refs/heads/` be pushed.  Matching means
>> +	the branch exists locally and at the remote under the same name.
>> +	Currently, this is the default.  But this will change in the  
>> future.
>
> For the above reason, "But this will..." is a bit premature.

I'll change the plan and will come back with a full
implementation.

Thanks for the helpful comments.

	Steffen



[-- Attachment #2: 0001-push-do-nothing-by-default.patch --]
[-- Type: application/octet-stream, Size: 3054 bytes --]

From a97c117794c631f556f87419a3dbaa702b858d95 Mon Sep 17 00:00:00 2001
From: Steffen Prohaska <prohaska@zib.de>
Date: Sun, 18 Nov 2007 19:22:30 +0100
Subject: [PATCH] push: do nothing by default

We used to push all matching branches.  This behaviour
was suitable in many situations, but sometimes confusing.

This commit switches off the default.  push now dies instead.

WORK IN PROGRESS.  NOT-SIGNED-OFF.
---
 builtin-push.c        |    9 +++++++--
 t/t5516-fetch-push.sh |   13 ++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/builtin-push.c b/builtin-push.c
index e5646d4..e637540 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -143,8 +143,13 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 		fprintf(stderr, "--all, --matching, and --current are mutual exclusive.\n");
 		usage_with_options(push_usage, options);
 	}
-	if ((all || matching || current) && refspec)
-		usage_with_options(push_usage, options);
+	if (all || matching || current) {
+		if (refspec)
+			usage_with_options(push_usage, options);
+	} else {
+		if (!refspec)
+			die("No default action found.");
+	}
 	if (!all && !matching && !current && !refspec)
 		fprintf(stderr, "Warning: assuming '--matching'."
 		                " This default will change in the future.\n");
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 20e0796..48689b9 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -108,11 +108,6 @@ test_expect_code 129 'push command line options (2)' '
 	git push --matching testrepo master
 '
 
-test_expect_success 'push command line options (3)' '
-	git push testrepo 2>stderr.txt &&
-	grep -q "Warning: assuming.*--matching" stderr.txt
-'
-
 test_expect_code 129 'push command line options (4)' '
 	git push --all --current testrepo
 '
@@ -154,7 +149,7 @@ test_expect_success 'push with wildcard' '
 test_expect_success 'push with matching heads' '
 
 	mk_test heads/master &&
-	git push testrepo &&
+	git push --matching testrepo &&
 	check_push_result $the_commit heads/master
 
 '
@@ -319,7 +314,7 @@ test_expect_success 'push with dry-run' '
 	cd testrepo &&
 	old_commit=$(git show-ref -s --verify refs/heads/master) &&
 	cd .. &&
-	git push --dry-run testrepo &&
+	git push --dry-run --matching testrepo &&
 	check_push_result $old_commit heads/master
 '
 
@@ -331,7 +326,7 @@ test_expect_success 'push updates local refs' '
 	cd .. &&
 	git clone parent child && cd child &&
 		echo two >foo && git commit -a -m two &&
-		git push &&
+		git push --matching &&
 	test $(git rev-parse master) = $(git rev-parse remotes/origin/master)
 
 '
@@ -346,7 +341,7 @@ test_expect_success 'push does not update local refs on failure' '
 	cd .. &&
 	git clone parent child && cd child &&
 		echo two >foo && git commit -a -m two || exit 1
-		git push && exit 1
+		git push --matching && exit 1
 	test $(git rev-parse master) != $(git rev-parse remotes/origin/master)
 
 '
-- 
1.5.3.5.750.gc43b


[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



  reply	other threads:[~2007-11-19  6:41 UTC|newest]

Thread overview: 168+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22  6:32 What's cooking in git/spearce.git (topics) Shawn O. Pearce
2007-10-22  6:59 ` Jeff King
2007-10-22  7:16 ` Jeff King
2007-10-23  2:32   ` Linus Torvalds
2007-10-23  3:48     ` Jeff King
2007-10-22  7:24 ` Pierre Habouzit
2007-10-22 15:27 ` Steffen Prohaska
2007-10-23  1:26 ` Junio C Hamano
2007-10-23  3:34   ` Shawn O. Pearce
2007-10-24 12:51 ` What's cooking in git.git (topics) Junio C Hamano
2007-10-24 13:09   ` David Symonds
2007-10-24 16:08   ` Scott Parish
2007-10-24 18:27     ` Andreas Ericsson
2007-10-25  0:35       ` Scott Parish
2007-11-01  5:41   ` Junio C Hamano
2007-11-01 11:02     ` Jakub Narebski
2007-11-01 20:57       ` Junio C Hamano
2007-11-01 18:33     ` Linus Torvalds
2007-11-01 19:19       ` Geert Bosch
2007-11-01 20:27         ` Junio C Hamano
2007-11-01 20:47           ` Mike Hommey
2007-11-01 21:20             ` Junio C Hamano
2007-11-02  0:32               ` Junio C Hamano
2007-11-01 21:44             ` Pierre Habouzit
2007-11-01 21:17           ` Geert Bosch
2007-11-02  0:00             ` Jonas Fonseca
2007-11-01 21:18           ` Theodore Tso
2007-11-01 21:26             ` Melchior FRANZ
2007-11-01 21:32           ` Johan Herland
2007-11-01 21:51             ` Junio C Hamano
2007-11-01 22:05               ` Linus Torvalds
2007-11-01 22:26                 ` Bill Lear
2007-11-01 22:50                 ` Junio C Hamano
2007-11-02  2:19                 ` Petr Baudis
2007-11-01 21:42           ` Pierre Habouzit
2007-11-02  9:39             ` Andreas Ericsson
2007-11-01 21:57       ` Pierre Habouzit
2007-11-02  0:04       ` Jakub Narebski
2007-11-02  2:23         ` Petr Baudis
2007-11-02  7:25           ` Jakub Narebski
2007-11-02  7:28             ` Jakub Narebski
2007-11-02  8:42               ` Pierre Habouzit
2007-11-02  6:06       ` Miles Bader
2007-11-02 15:13         ` Miles Bader
2007-11-02  9:38       ` Andreas Ericsson
2007-11-02 11:03         ` Johannes Schindelin
2007-11-01 21:41     ` Brian Downing
2007-11-01 21:46       ` Pierre Habouzit
2007-11-02 10:26       ` Wincent Colaiuta
2007-11-04  4:14     ` Junio C Hamano
2007-11-04  9:43       ` Jakub Narebski
2007-11-04 11:38       ` Pierre Habouzit
2007-11-08  8:08       ` Junio C Hamano
2007-11-08 20:44         ` Steffen Prohaska
2007-11-12  7:09         ` Junio C Hamano
2007-11-12 12:21           ` Johannes Schindelin
2007-11-12 12:26             ` Pierre Habouzit
2007-11-12 12:33               ` Johannes Schindelin
2007-11-12 13:11                 ` [PATCH] rebase: brown paper bag fix after the detached HEAD patch Johannes Schindelin
2007-11-12 14:53                 ` What's cooking in git.git (topics) Pierre Habouzit
2007-11-12 14:27             ` Steffen Prohaska
2007-11-12 15:02               ` Johannes Schindelin
2007-11-18 16:13                 ` [PATCH 1/2] push: Add '--matching' option and print warning if it should be used Steffen Prohaska
2007-11-18 16:13                   ` [PATCH 2/2] push: Add '--current', which pushes only the current branch Steffen Prohaska
2007-11-19  1:28                     ` Junio C Hamano
2007-11-19  6:41                       ` Steffen Prohaska [this message]
2007-11-19  7:27                         ` Junio C Hamano
2007-11-19  7:50                           ` Junio C Hamano
2007-11-19  9:27                             ` Andreas Ericsson
2007-11-19  8:17                           ` Steffen Prohaska
2007-11-19  8:35                             ` Junio C Hamano
2007-11-19  9:54                               ` Steffen Prohaska
2007-11-19 16:51                                 ` [PATCH] push: Add "--current", " Steffen Prohaska
2007-11-19 11:17                               ` [PATCH 2/2] push: Add '--current', " Jakub Narebski
2007-11-19 19:57                                 ` Junio C Hamano
2007-11-19 21:04                                   ` Jakub Narebski
2007-11-19 22:15                                     ` Junio C Hamano
2007-11-19 22:29                                       ` Jakub Narebski
2007-11-19  9:24                         ` Andreas Ericsson
2007-11-12 15:15           ` [PATCH] git-commit: Add tests for invalid usage of -a/--interactive with paths Björn Steinbrink
2007-11-15  0:18           ` What's cooking in git.git (topics) Junio C Hamano
2007-11-15  0:49             ` Johannes Schindelin
2007-11-15 14:49               ` [PATCH] t7501-commit: Add test for git commit <file> with dirty index Kristian Høgsberg
2007-11-15 15:55                 ` Johannes Schindelin
2007-11-15 16:11                 ` [PATCH] builtin-commit: fix "git add x y && git commit y" committing x, too Johannes Schindelin
2007-11-15 16:37                   ` Johannes Schindelin
2007-11-15 17:01                   ` Kristian Høgsberg
2007-11-16  0:43                     ` Johannes Schindelin
2007-11-17  8:45                       ` Junio C Hamano
2007-11-18  9:18                         ` Junio C Hamano
2007-11-17 12:40             ` What's cooking in git.git (topics) Jeff King
2007-11-17 20:51             ` Junio C Hamano
2007-11-17 23:42               ` Alex Riesen
2007-11-18  1:29                 ` Junio C Hamano
2007-11-21  9:23               ` Junio C Hamano
2007-11-23  8:48                 ` Junio C Hamano
2007-11-23 10:30                   ` Jeff King
2007-11-23 13:23                     ` Johannes Schindelin
2007-11-24 11:38                       ` Jeff King
2007-11-24 15:47                         ` Nicolas Pitre
2007-11-24 19:09                           ` Junio C Hamano
2007-11-25 21:51                             ` J. Bruce Fields
2007-11-25 22:42                               ` Junio C Hamano
2007-11-25 23:08                                 ` J. Bruce Fields
2007-11-26  4:02                               ` Nicolas Pitre
2007-11-26  4:15                                 ` J. Bruce Fields
2007-11-26  4:29                                   ` Nicolas Pitre
2007-11-26  4:45                                     ` J. Bruce Fields
2007-11-26  9:03                                     ` Jakub Narebski
2007-11-26  9:09                                       ` Andreas Ericsson
2007-11-26 19:11                                       ` Nicolas Pitre
2007-11-26 19:24                                         ` David Kastrup
2007-11-26 20:25                                           ` Nicolas Pitre
2007-11-26 20:40                                             ` Junio C Hamano
2007-11-26 20:45                                             ` David Kastrup
2007-11-26 21:09                                               ` Nicolas Pitre
2007-11-26 21:22                                                 ` David Kastrup
2007-11-26 22:02                                                   ` Nicolas Pitre
2007-11-26 23:05                                                     ` David Kastrup
2007-11-26 23:28                                                       ` Nicolas Pitre
2007-11-26 23:52                                                         ` David Kastrup
2007-11-27  4:05                                                           ` Nicolas Pitre
2007-12-05 21:58                                                 ` Miles Bader
2007-11-26 21:14                                             ` Jakub Narebski
2007-11-26 21:36                                               ` Johannes Schindelin
2007-11-26 21:47                                                 ` Nicolas Pitre
2007-11-26  6:15                                   ` Jan Hudec
2007-11-25 20:27                   ` Junio C Hamano
2007-11-25 20:36                     ` Jakub Narebski
2007-11-25 20:53                       ` J. Bruce Fields
2007-12-01  2:37                     ` Junio C Hamano
2007-12-01  8:55                       ` Eric Wong
2007-12-02 14:14                       ` [PATCH, next version] Add 'git fast-export', the sister of 'git fast-import' Johannes Schindelin
2007-12-02 14:40                       ` What's cooking in git.git (topics) Johannes Schindelin
2007-12-04  8:43                       ` Junio C Hamano
2007-12-04  9:40                         ` Johannes Sixt
2007-12-04 10:08                           ` msysGit on FAT32 (was: What's cooking in git.git (topics)) Jakub Narebski
2007-12-04 13:30                             ` Johannes Schindelin
2007-12-04 13:48                               ` msysGit on FAT32 Johannes Sixt
2007-12-04 14:37                                 ` Johannes Schindelin
2007-12-04 20:03                           ` What's cooking in git.git (topics) Steffen Prohaska
2007-12-05 10:59                         ` Junio C Hamano
2007-12-05 11:08                           ` Jakub Narebski
2007-12-05 11:10                           ` Jakub Narebski
2007-12-06  4:43                             ` Jeff King
2007-12-05 11:37                           ` [PATCH] Soft aliases: add "less" and minimal documentation Johannes Schindelin
2007-12-05 19:45                             ` Junio C Hamano
2007-12-06  4:50                               ` Jeff King
2007-12-06  4:32                           ` What's cooking in git.git (topics) Jeff King
2007-12-07  9:51                           ` Junio C Hamano
2007-12-07 11:11                             ` Jakub Narebski
2007-12-07 19:29                               ` Junio C Hamano
2007-12-07 21:36                             ` Miklos Vajna
2007-12-09 10:27                             ` Junio C Hamano
2007-12-13  2:48                               ` Junio C Hamano
2007-12-13  3:22                                 ` Nicolas Pitre
2007-12-13 22:31                                   ` [PATCH 1/2] xdl_diff: identify call sites Junio C Hamano
2007-12-14  7:03                                     ` Junio C Hamano
2007-12-13 22:31                                   ` [PATCH 2/2] xdi_diff: trim common trailing lines Junio C Hamano
2007-12-14  9:06                                     ` Peter Baumann
2007-12-14 19:15                                       ` Junio C Hamano
2007-12-17  8:40                                 ` What's cooking in git.git (topics) Junio C Hamano
2007-12-23  9:20                                   ` Junio C Hamano
2007-12-31 10:47                                     ` checkout --push/--pop idea (Re: What's cooking in git.git (topics)) Jan Hudec
2008-01-05 11:01                                     ` What's cooking in git.git (topics) Junio C Hamano
2008-01-05 16:04                                       ` Johannes Schindelin
2008-01-22  8:47                                       ` What will be cooking in git.git post 1.5.4 (topics) Junio C Hamano
2007-12-04 16:18                       ` What's cooking in git.git (topics) Brian Downing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EA5C3227-12E1-43C4-96E8-43BABF26792B@zib.de \
    --to=prohaska@zib.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).