Re: [PATCH] Introduce git-mirror, a tool for exactly mirroring another repository.

4 messages, 3 authors, 2016-08-11 · open the first message on its own page

Re: [PATCH] Introduce git-mirror, a tool for exactly mirroring another repository.

From: Junio C Hamano <hidden>
Date: 2016-08-11 19:59:32

Sergey Vlasov [off-list ref] writes:
What is the current state of packed-refs implementation?
Scheduled for "master" probably tomorrow, with some disclaimers.
BTW, I was thinking about the possibility to save removed refs under,
e.g., refs/old/`date -I`/; maybe even non-fast-forward refs could be
saved there - this will ensure that no object will ever disappear from
the mirror, no matter what is done on the master side.  Obviously, in
this case remote refs like refs/old/* should be filtered.
I do not think that belongs to git-mirror.  It might be better to
have that option in update-ref machinery so that you would even
be protected from a `git branch -d` ran by mistake.

Re: [PATCH] Introduce git-mirror, a tool for exactly mirroring another repository.

From: Jakub Narebski <hidden>
Date: 2016-08-11 19:29:39

Junio C Hamano wrote:
Sergey Vlasov [off-list ref] writes:
 
quoted
BTW, I was thinking about the possibility to save removed refs under,
e.g., refs/old/`date -I`/; maybe even non-fast-forward refs could be
saved there - this will ensure that no object will ever disappear from
the mirror, no matter what is done on the master side.  Obviously, in
this case remote refs like refs/old/* should be filtered.
I do not think that belongs to git-mirror.  It might be better to
have that option in update-ref machinery so that you would even
be protected from a `git branch -d` ran by mistake.
Perhaps just don't remove log when branch is deleted. I tend for example
to be careful when reordering commits on a branch, and use git branch -f
instead of deleting and recreating branch to not lose reflog.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

Re: [PATCH] Introduce git-mirror, a tool for exactly mirroring another repository.

From: Sergey Vlasov <hidden>
Date: 2016-08-11 20:38:01

On Wed, 01 Nov 2006 02:08:08 +0100 Jakub Narebski wrote:
Junio C Hamano wrote:
quoted
Sergey Vlasov [off-list ref] writes:
quoted
BTW, I was thinking about the possibility to save removed refs under,
e.g., refs/old/`date -I`/; maybe even non-fast-forward refs could be
saved there - this will ensure that no object will ever disappear from
the mirror, no matter what is done on the master side.  Obviously, in
this case remote refs like refs/old/* should be filtered.
I do not think that belongs to git-mirror.  It might be better to
have that option in update-ref machinery so that you would even
be protected from a `git branch -d` ran by mistake.
I agree - this would be even better.

What name format should be used for such saved refs?  refs/old/`date -I`
is not unique enough; probably `date --utc +%Y.%m.%d-%H.%M.%S`?  And it
would be good if multiple refs which were deleted or modified in a
non-fast-forward way during a single operation (like git-mirror) would
be saved together - which may be tricky if they are saved at the lower
level (in update-ref).

Adding the fast-forward check into update-ref also does not look nice,
but this check is required for full safety.
Perhaps just don't remove log when branch is deleted. I tend for example
to be careful when reordering commits on a branch, and use git branch -f
instead of deleting and recreating branch to not lose reflog.
Keeping the reflog does not help - reflog entries are not refs, and do
not keep the referenced objects live in the repository.  Therefore old
objects will be lost when the repository is repacked and pruned.

Also, the reflog really must be deleted together with the ref itself -
otherwise it may cause a file/directory conflict when another ref is
created.  Of course, if the ref is renamed instead of deleting, the
corresponding reflog may be renamed too.

Re: [PATCH] Introduce git-mirror, a tool for exactly mirroring another repository.

From: Jakub Narebski <hidden>
Date: 2016-08-11 20:43:28

Sergey Vlasov wrote:
quoted
Perhaps just don't remove log when branch is deleted. I tend for example
to be careful when reordering commits on a branch, and use git branch -f
instead of deleting and recreating branch to not lose reflog.
Keeping the reflog does not help - reflog entries are not refs, and do
not keep the referenced objects live in the repository.  Therefore old
objects will be lost when the repository is repacked and pruned.
Well, now to reorder and choose which commits on branch to save, and
optionally also rebase, I use
$ git branch tmp
$ git branch -f <branch> <upstream>
$ git checkout <branch>
$ git cherry-pick tmp~<n>
...
$ git branch -D tmp
Also, the reflog really must be deleted together with the ref itself -
otherwise it may cause a file/directory conflict when another ref is
created.  Of course, if the ref is renamed instead of deleting, the
corresponding reflog may be renamed too.
There is currently no command to rename branch (and rename reflog).
It would be nice if git-branch could also rename branch (and reflog).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help