git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH(TIC)] push: annoy all users by deprecating the default semantics

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 19, 2008, 16:41 UTC
Message-ID
<alpine.LSU.1.00.0802191638520.30505@racer.site>
In-Reply-To
<E7DE807861E8474E8AC3DC7AC2C75EE50542F7F6@34093-EVS2C1.exchange.rackspace.com>
Hi,
On Tue, 19 Feb 2008, Jason Garber wrote:
Show 14 quoted lines
> +	if (!all && argc < 2)
> +		warning("Pushing without branch names is deprecated.\n"
> +			"Too many users just assumed what it should
> do\n"
> +			"according to them, got burned, and blamed
> us,\n"
> +			"the good git developers.\n\n"
> +			"So everybody has to suffer now, and get used
> to\n"
> +			"new semantics.\n\n"
> +			"Thank you for your time.\n");
> 
> 
> Quite accurate... lol.

Heh. FWIW I think I might just go on with that patch, until those who _should_ care deeply enough about it shut me up with code...

Note that even if I vent here a bit, there's a good side to it: my patch should be a good start (actually, I think it is more than just a start, but hey, it's not like I want my patch to _really_ go into mainline).

This is my current state:
 Documentation/git-push.txt |   16 +++++++++++++---
 builtin-push.c             |   18 ++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 5f24944..d373d05 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -9,8 +9,10 @@ git-push - Update remote refs along with associated objects
 SYNOPSIS
 --------
 [verse]
-'git-push' [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
-           [--repo=all] [-f | --force] [-v | --verbose] [<repository> <refspec>...]
+'git-push' [--all] [-m | --matching] [--dry-run] [--tags]
+	   [--receive-pack=<git-receive-pack>]
+	   [--repo=all] [-f | --force] [-v | --verbose]
+	   [<repository> <refspec>...]
 
 DESCRIPTION
 -----------
@@ -49,7 +51,8 @@ Note: If no explicit refspec is found, (that is neither
 on the command line nor in any Push line of the
 corresponding remotes file---see below), then all the
 heads that exist both on the local side and on the remote
-side are updated.
+side are updated.  This behavior is DEPRECATED and will go
+away in the future.  Use the `--matching` option in the future.
 +
 `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
 +
@@ -63,6 +66,13 @@ the remote repository.
 	Instead of naming each ref to push, specifies that all
 	refs under `$GIT_DIR/refs/heads/` be pushed.
 
+-m, \--matching::
+	Push all refs that are present both locally and remotely.
+	This used to be the default action if no ref was specified,
+	until a few users who cannot read man pages prevailed in
+	their assumption that the default action should not be what
+	it was documented to be.
+
 \--mirror::
 	Instead of naming each ref to push, specifies that all
 	refs under `$GIT_DIR/refs/heads/` and `$GIT_DIR/refs/tags/`
diff --git a/builtin-push.c b/builtin-push.c
index c8cb63e..1194800 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -104,6 +104,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 	int dry_run = 0;
 	int force = 0;
 	int tags = 0;
+	int matching = 0;
 	const char *repo = NULL;	/* default repository */
 
 	struct option options[] = {
@@ -117,6 +118,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 		OPT_BOOLEAN( 0 , "thin", &thin, "use thin pack"),
 		OPT_STRING( 0 , "receive-pack", &receivepack, "receive-pack", "receive pack program"),
 		OPT_STRING( 0 , "exec", &receivepack, "receive-pack", "receive pack program"),
+		OPT_BOOLEAN('m', "matching", &matching, "push matching refs"),
 		OPT_END()
 	};
 
@@ -134,6 +136,22 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 		flags |= TRANSPORT_PUSH_ALL;
 	if (mirror)
 		flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);
+	if (all && argc > 1)
+		die ("Do you want to push explicit refs or --all?");
+	if (matching && all)
+		die ("--matching and --all are mutually exclusive");
+	if (matching && argc > 1)
+		die ("--matching and explicit refs are mutually exclusive");
+	if (!matching && !all && argc < 2)
+		warning("Pushing without branch names is deprecated.\n"
+			"Too many users just assumed what it should do\n"
+			"according to them, got burned, and blamed us,\n"
+			"the good git developers.\n\n"
+			"So everybody has to suffer now, and get used to\n"
+			"new semantics.\n\n"
+			"What used to be default will need the --matching\n"
+			"option in the future.\n\n"
+			"Thank you for your time.\n");
 
 	if (argc > 0) {
 		repo = argv[0];
Previous: Jason GarberNext: Jeff King
Message 10 of 19 in “git push [rejected] question”
  1. Jason GarberFeb 18, 2008
  2. Jeff KingFeb 19, 2008
  3. Jay SoffianFeb 19, 2008
  4. Jeff KingFeb 19, 2008
  5. Jay SoffianFeb 19, 2008
  6. Jeff KingFeb 19, 2008
  7. Johannes SchindelinFeb 19, 2008
  8. push: annoy all users by deprecating the default semanticsJohannes Schindelin, Feb 19, 2008
  9. Jason GarberFeb 19, 2008
  10. Johannes SchindelinFeb 19, 2008
  11. Jeff KingFeb 19, 2008
  12. Johannes SchindelinFeb 19, 2008
  13. Jeff KingFeb 19, 2008
  14. Govind SalinasFeb 20, 2008
  15. Junio C HamanoFeb 20, 2008
  16. Govind SalinasFeb 20, 2008
  17. Junio C HamanoFeb 20, 2008
  18. Jay SoffianFeb 19, 2008
  19. Jeff KingFeb 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.