[BUG] git push --mirror ignores refs outside head & tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

TL;DR: "git push --mirror" does not in fact push all refs, despite
documentation stating it does. It ONLY pushes refs in refs/heads/ and
refs/tags/.

I ran into this while preparing to migrate Gentoo's primary Git server
(which uses Gitolite).

Gitolite ships a post-receive hook, "save-push-signatures" [1] that save
Push certificates into refs/push-certs.

Gitolite mirroring invokes 'git push --mirror' to mirror from the
primary location to replicas.

I was surprised to find, on the new server presently configured as
replica, but intended to take over as the primary, that the
refs/push-certs was missing on every single repo.

```
# git push -h |grep -e mirror -e all
    --all                 push all refs
	--mirror              mirror all refs
```
git-push(1):
```
--mirror
    Instead of naming each ref to push, specifies that all refs under refs/ (which includes
    but is not limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the
    remote repository. ...
```

git --version: 2.32.0

Attached I also include the trace ref & trace packet output as well that shows
it on a sample repo.
```
GIT_TRACE_REFS=/tmp/trace-refs \
GIT_TRACE_PACKET=/tmp/trace-packet \
git push --mirror $REPLICA:$REPO
```

The repo's gitconfig does not contain any remotes, because that's the way gitolite is built.

[1] https://github.com/sitaramc/gitolite/blob/master/contrib/hooks/repo-specific/save-push-signatures

-- 
Robin Hugh Johnson
Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
E-Mail   : robbat2@xxxxxxxxxx
GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136
23:07:49.011947 pkt-line.c:80           packet:         push< bd7bd3a513c8ddc554e211316c990b5f98110982 refs/heads/bug450326\0report-status report-status-v2 delete-refs side-band-64k quiet atomic ofs-delta push-cert=1636931268-40bfd0dc11027620d3ea77024b5aa5aa90ed2342 object-format=sha1 agent=git/2.32.0
23:07:49.011987 pkt-line.c:80           packet:         push< 65c923b603247af68f1b4405363d92c1c19009eb refs/heads/bug504458
23:07:49.011993 pkt-line.c:80           packet:         push< 6e81ff9f85736180516941e630b1db78bd9bf2a2 refs/heads/iw
23:07:49.011998 pkt-line.c:80           packet:         push< e860f40ffd07a41e47a6b49d9400ad20e6a8b7ca refs/heads/master
23:07:49.012002 pkt-line.c:80           packet:         push< 56dd91ee7737dd3d4ebc57185632f407a2cdf3c1 refs/heads/remove-bash-arrays
23:07:49.012007 pkt-line.c:80           packet:         push< 09c6d951fe3c4419317fcd9488df907bd11ac02c refs/tags/0.1
23:07:49.012012 pkt-line.c:80           packet:         push< cb257cea980b74aa7dff4b7bfcfb66b82565bb01 refs/tags/0.2
23:07:49.012016 pkt-line.c:80           packet:         push< 22b3841561b0b686919be466f1caeae6833e30ba refs/tags/0.2.1
23:07:49.012021 pkt-line.c:80           packet:         push< 47d23f5abdac4a2bd95bcbbaadacf994773cbf51 refs/tags/0.2.2
23:07:49.012025 pkt-line.c:80           packet:         push< e2e76bb9c2a7bee77e29faf8f9afb2a89fe19e11 refs/tags/0.2.3
23:07:49.012030 pkt-line.c:80           packet:         push< 986029121ae49984c98a76efa83d4e48d5c9f650 refs/tags/0.3.0
23:07:49.012035 pkt-line.c:80           packet:         push< 904d1b04cb0a147fe39f9952a281563faeb19d48 refs/tags/0.3.1
23:07:49.012039 pkt-line.c:80           packet:         push< a143c1b3a6896cdfe62dd24a0e95ee442c5469e2 refs/tags/0.4.0
23:07:49.012044 pkt-line.c:80           packet:         push< edd52106d7c868c86c396e0c2f486e58a6132d3c refs/tags/0.5.0
23:07:49.012048 pkt-line.c:80           packet:         push< c1b5722fe2dd9aee540cc08b73e7ac59c2f22c4d refs/tags/0.5.1
23:07:49.012055 pkt-line.c:80           packet:         push< 8ec196c7c708340e888573f66e34f9c5171efabf refs/tags/0.6.0
23:07:49.012060 pkt-line.c:80           packet:         push< 7ba81c3198da28101290eed259aef6645d258ebc refs/tags/0.6.1
23:07:49.012064 pkt-line.c:80           packet:         push< 8cdfc30e5cca5da9ea12b7e275f044d452e6894d refs/tags/0.7.0
23:07:49.012069 pkt-line.c:80           packet:         push< 646886f098efddd62162bebb655e413fd99c214e refs/tags/0.7.1
23:07:49.012073 pkt-line.c:80           packet:         push< 93a79ef4b89ee383cdfb5e4be5f07c2ce4e61c90 refs/tags/0.7.2
23:07:49.012078 pkt-line.c:80           packet:         push< 3067e568abbf803e8f47a6e16bc39412a4539b1c refs/tags/0.7.3
23:07:49.012082 pkt-line.c:80           packet:         push< 0000
23:07:49.012126 pkt-line.c:80           packet:         push> 0000
23:07:48.501620 refs/debug.c:27         ref_store for .
23:07:48.501670 refs/debug.c:252        read_raw_ref: HEAD: 0000000000000000000000000000000000000000 (=> refs/heads/master) type 1: 0
23:07:48.501687 refs/debug.c:252        read_raw_ref: refs/heads/master: e860f40ffd07a41e47a6b49d9400ad20e6a8b7ca (=> refs/heads/master) type 2: 0
23:07:48.501738 refs/debug.c:235        ref_iterator_begin:  (0x0)
23:07:48.501790 refs/debug.c:191        iterator_advance: refs/heads/bug450326 (0)
23:07:48.501797 refs/debug.c:191        iterator_advance: refs/heads/bug504458 (0)
23:07:48.501801 refs/debug.c:191        iterator_advance: refs/heads/iw (0)
23:07:48.501805 refs/debug.c:191        iterator_advance: refs/heads/master (0)
23:07:48.501809 refs/debug.c:191        iterator_advance: refs/heads/remove-bash-arrays (0)
23:07:48.501812 refs/debug.c:191        iterator_advance: refs/push-certs (0)
23:07:48.501816 refs/debug.c:191        iterator_advance: refs/tags/0.1 (0)
23:07:48.501820 refs/debug.c:191        iterator_advance: refs/tags/0.2 (0)
23:07:48.501823 refs/debug.c:191        iterator_advance: refs/tags/0.2.1 (0)
23:07:48.501827 refs/debug.c:191        iterator_advance: refs/tags/0.2.2 (0)
23:07:48.501831 refs/debug.c:191        iterator_advance: refs/tags/0.2.3 (0)
23:07:48.501834 refs/debug.c:191        iterator_advance: refs/tags/0.3.0 (0)
23:07:48.501838 refs/debug.c:191        iterator_advance: refs/tags/0.3.1 (0)
23:07:48.501841 refs/debug.c:191        iterator_advance: refs/tags/0.4.0 (0)
23:07:48.501845 refs/debug.c:191        iterator_advance: refs/tags/0.5.0 (0)
23:07:48.501848 refs/debug.c:191        iterator_advance: refs/tags/0.5.1 (0)
23:07:48.501852 refs/debug.c:191        iterator_advance: refs/tags/0.6.0 (0)
23:07:48.501855 refs/debug.c:191        iterator_advance: refs/tags/0.6.1 (0)
23:07:48.501861 refs/debug.c:191        iterator_advance: refs/tags/0.7.0 (0)
23:07:48.501865 refs/debug.c:191        iterator_advance: refs/tags/0.7.1 (0)
23:07:48.501868 refs/debug.c:191        iterator_advance: refs/tags/0.7.2 (0)
23:07:48.501872 refs/debug.c:191        iterator_advance: refs/tags/0.7.3 (0)
23:07:48.501875 refs/debug.c:189        iterator_advance: (-1)
23:07:49.042542 refs/debug.c:252        read_raw_ref: HEAD: 0000000000000000000000000000000000000000 (=> refs/heads/master) type 1: 0
23:07:49.042563 refs/debug.c:252        read_raw_ref: refs/heads/master: e860f40ffd07a41e47a6b49d9400ad20e6a8b7ca (=> refs/heads/master) type 2: 0

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux