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

[PATCH] remote add: disallow --master and --mirror with non-bare repositories

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 22, 2008, 17:23 UTC
Message-ID
<alpine.DEB.1.00.0804221823010.4460@eeepc-johanness>
In-Reply-To
<7vd4ohzvda.fsf@gitster.siamese.dyndns.org>

In most cases, --master or --mirror in a non-bare repository is an error. In those cases where it is not, the user is most likely editing the config herself anyway.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	On Tue, 22 Apr 2008, Junio C Hamano wrote:
	> I personally do not think --mirror option makes sense with 
	> --track, nor it makes sense in a non-bare repository for that matter.
	Obviously meant for application together with Peff's patch.
 builtin-remote.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/builtin-remote.c b/builtin-remote.c
index d4f2132..63f025c 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -79,6 +79,12 @@ static int add(int argc, const char **argv)
 
 	argc = parse_options(argc, argv, options, builtin_remote_usage, 0);
 
+	if (mirror && is_bare_repository())
+		die("--mirror with non-bare repository.");
+
+	if (master && is_bare_repository())
+		die("--master with non-bare repository.");
+
 	if (argc < 2)
 		usage_with_options(builtin_remote_usage, options);
 
Previous: Junio C HamanoNext: Paolo Bonzini
Message 25 of 28 in “git remote update -> rejected”
  1. Mike GalbraithApr 22, 2008
  2. Jeff KingApr 22, 2008
  3. Mike GalbraithApr 22, 2008
  4. Jeff KingApr 22, 2008
  5. Johannes SchindelinApr 22, 2008
  6. Jeff KingApr 22, 2008
  7. Johannes SchindelinApr 22, 2008
  8. Jeff KingApr 22, 2008
  9. builtin-remote: resurrect forced updates to tracked branchesJohannes Schindelin, Apr 22, 2008
  10. Junio C HamanoApr 22, 2008
  11. Teemu LikonenApr 22, 2008
  12. Johannes SchindelinApr 22, 2008
  13. Jeff KingApr 22, 2008
  14. Johannes SchindelinApr 22, 2008
  15. Paolo BonziniApr 22, 2008
  16. Teemu LikonenApr 22, 2008
  17. Johannes SchindelinApr 22, 2008
  18. Teemu LikonenApr 22, 2008
  19. Paolo BonziniApr 22, 2008
  20. Johannes SchindelinApr 22, 2008
  21. Paolo BonziniApr 22, 2008
  22. Paolo BonziniApr 22, 2008
  23. Johannes SchindelinApr 22, 2008
  24. Junio C HamanoApr 22, 2008
  25. remote add: disallow --master and --mirror with non-bare repositoriesJohannes Schindelin, Apr 22, 2008
  26. Paolo BonziniApr 22, 2008
  27. Paolo BonziniApr 22, 2008
  28. Johannes SchindelinApr 22, 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.