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

[PATCH] push: change needlessly ambiguous example in error

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 13, 2018, 20:39 UTC
Message-ID
<20181113203909.30740-1-avarab@gmail.com>

Change an example push added in b55e677522 ("push: introduce new push.default mode "simple"", 2012-04-24) to always mean the same thing whether the current setting happens to be "simple" or not.

This error is only emitted under "simple", but message is explaining to the user that they can get two sorts of different behaviors by these two invocations.

Let's use "git push <remote> HEAD" which always means push the current branch name to that remote, instead of "git push <remote> <current-branch-name>" which will do that under "simple", but is not guaranteed to do under "upstream".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/push.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/push.c b/builtin/push.c
index d09a42062c..8bb8a0849b 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -173,10 +173,10 @@ static NORETURN int die_push_simple(struct branch *branch, struct remote *remote
 	      "\n"
 	      "To push to the branch of the same name on the remote, use\n"
 	      "\n"
-	      "    git push %s %s\n"
+	      "    git push %s HEAD\n"
 	      "%s"),
 	    remote->name, short_upstream,
-	    remote->name, branch->name, advice_maybe);
+	    remote->name, advice_maybe);
 }
 
 static const char message_detached_head_die[] =
-- 
2.19.1.1182.g4ecb1133ce
Next: Matthieu Moy
Message 1 of 6 in “push: change needlessly ambiguous example in error”
  1. push: change needlessly ambiguous example in errorÆvar Arnfjörð Bjarmason, Nov 13, 2018
  2. Matthieu MoyNov 13, 2018
  3. Ævar Arnfjörð BjarmasonNov 13, 2018
  4. Junio C HamanoNov 14, 2018
  5. Matthieu MoyNov 14, 2018
  6. Junio C HamanoNov 14, 2018

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.