Error pushing to read-only target
Created originally on Bitbucket by jaraco (Jason R. Coombs)
Mercurial allows pushing to a read-only repository and exits without failure if there are no changesets to be pushed.
If one tries to do the same with a git repo, an error occurs:
PS C:\Users\jaraco> hg clone git+ssh://git@github.com:paver/paver
destination directory: paver
["git-upload-pack 'paver/paver'"]
importing git objects into hg
updating to branch default
89 files updated, 0 files merged, 0 files removed, 0 files unresolved
PS C:\Users\jaraco> cd paver
PS C:\Users\jaraco\paver> hg push
pushing to git+ssh://git@github.com:paver/paver
searching for changes
["git-receive-pack 'paver/paver'"]
abort: git remote error: The remote server unexpectedly closed the connection.
To be clear, I don't have access to paver/paver, and I don't expect to be able to write any changes to it. However, it would be nice if an attempt to push would only fail if changesets were due to be pushed.
This issue is particularly relevant when read-only git repos are used in subrepos, as subrepos requires an attempted push of child repos before pushing the parent repo. Thus, such a read-only git repo in a subrepo will block pushing the parent repo.