Existing "git push --all" is almost perfect for backing up to
another repository, except that "--all" only means "all
branches" in modern git, and it does not delete old branches and
tags that exist at the back-up repository that you have removed
from your local repository.
This teaches "git-send-pack" a new "--mirror" option. The
difference from the "--all" option are that (1) it sends all
refs, not just branches, and (2) it deletes old refs you no
longer have on the local side from the remote side.
Original patch by Junio C Hamano.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When pushing to overwrite a ref that points at a commit we do
not even have, the recent "terse push" patch tried to get a
unique abbreviation for the non-existent (from our point of
view) object, which resulted in strcpy(buf, NULL) and
segfaulted.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This is really an uninteresting detail, and it just takes
attention away from the actual push updates and posssible
errors.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This changes the output of send-pack to match the new,
more terse fetch output. It looks like this:
To git://host.tld/path/to/repo
+ f3325dc...3b91d1c hasforce -> mirror/hasforce (forced update)
f3325dc..bb022dc master -> mirror/master
! [rejected] needsforce -> mirror/needsforce (non-fast forward)
* [new branch] newbranch -> mirror/newbranch
* [new tag] v1.0 -> v1.0
instead of:
updating 'refs/heads/mirror/hasforce' using 'refs/heads/hasforce'
from f3325dca9c4a34d74012c0e159254f454930cec7
to 3b91d1c310ca9d7b547b85466dd876e143498304
updating 'refs/heads/mirror/master' using 'refs/heads/master'
from f3325dca9c4a34d74012c0e159254f454930cec7
to bb022dc363d5c2aa9aa3026beb9706d44fbe1328
error: remote 'refs/heads/mirror/needsforce' is not an ancestor of
local 'refs/heads/needsforce'.
Maybe you are not up-to-date and need to pull first?
updating 'refs/heads/mirror/newbranch' using 'refs/heads/newbranch'
from 0000000000000000000000000000000000000000
to 3b91d1c310ca9d7b547b85466dd876e143498304
updating 'refs/tags/v1.0'
from 0000000000000000000000000000000000000000
to bb022dc363d5c2aa9aa3026beb9706d44fbe1328
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Also marks some more things as const, as needed.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>