git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git push --delete <url> <branch> fails if run outside a repository
@ 2022-06-06  8:05 Adam Dinwoodie
  2022-06-06 17:29 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Dinwoodie @ 2022-06-06  8:05 UTC (permalink / raw)
  To: git

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

When using `git push`, rather than specifying a remote by name, one can
also specify a remote by URL, and this includes when the only operations
being performed are to delete refs on the remote.  This doesn't require
any information about any local repository, but it fails unless the
command is run from within an existing local Git repo.

This seems like a bug to me: there's no reason this shouldn't work.
Clearly low priority, though, as this is a rare use case, and there's a
simple workaround: just `cd` into any existing Git repo, or create a
temporary empty repo to run the command from.

Simple test case attached; I've verified the behaviour the test script
demonstrates on Git v2.36.1 on Cygwin, and on Git v2.34.1 (strictly,
v2.34.1-1~bpo11) on Debian 11.

Cheers,

Adam

[-- Attachment #2: git-push-delete-bug.sh --]
[-- Type: application/x-sh, Size: 422 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: git push --delete <url> <branch> fails if run outside a repository
  2022-06-06  8:05 git push --delete <url> <branch> fails if run outside a repository Adam Dinwoodie
@ 2022-06-06 17:29 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-06-06 17:29 UTC (permalink / raw)
  To: Adam Dinwoodie; +Cc: git

Adam Dinwoodie <adam@dinwoodie.org> writes:

> When using `git push`, rather than specifying a remote by name, one can
> also specify a remote by URL, and this includes when the only operations
> being performed are to delete refs on the remote.  This doesn't require
> any information about any local repository, but it fails unless the
> command is run from within an existing local Git repo.
>
> This seems like a bug to me: there's no reason this shouldn't work.

Perhaps.

While I fully agree with you that there is no reason this shouldn't
work, I am not sure if there is a good reason to make it work,
either.  Any other push needs to have objects on _our_ side and
requiring you to be in a repository is a sure way to do so.  I am
not convinced that it is worth our engineering effort to add a
special case for this, but patches that are cleanly done without
making too much damage to the existing code in readability and
maintainability are probably welcome.

Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-06 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06  8:05 git push --delete <url> <branch> fails if run outside a repository Adam Dinwoodie
2022-06-06 17:29 ` Junio C Hamano

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).