[PATCH 0/2] remote: optimize rm/prune ref deletion

2014-05-20 Thread Jens Lindström
ance improves from many CPU minutes (long enough that I could never be bothered to let it run to completion) to around a few seconds, when removing ~15000 refs. Jens Lindström (2): remote: defer repacking packed-refs when deleting refs remote prune: optimize "dangling symre

[PATCH 1/2] remote: defer repacking packed-refs when deleting refs

2014-05-20 Thread Jens Lindström
To avoid this, defer the repacking until after all refs have been deleted (by delete_ref()), and then call repack_without_refs() once to repack without all the deleted refs. Signed-off-by: Jens Lindström --- This patch changes behavior when the operation is aborted in the middle, so that loose ref

[PATCH 2/2] remote prune: optimize "dangling symref" check/warning

2014-05-20 Thread Jens Lindström
using the new warn_dangling_symrefs() function which makes one pass over all refs and checks for all the deleted refs in one go, after they have all been deleted. Signed-off-by: Jens Lindström --- builtin/remote.c | 6 +- refs.c | 19 ++- refs.h | 1

Re: [PATCH 1/2] remote: defer repacking packed-refs when deleting refs

2014-05-23 Thread Jens Lindström
On Tue, May 20, 2014 at 10:29 PM, Junio C Hamano wrote: > Junio C Hamano writes: > >> A bit safer way to organize might be to first create a list of the >> refs to be removed in-core, update packed-refs without these refs to >> be removed, and then finally remove the loose ones, but I haven't >>

[PATCH v2 0/3] remote: optimize rm/prune ref deletion

2014-05-23 Thread Jens Lindström
Changes since previous version: * Additionally change the order that 'remote rm' does things so that it removes the remote configuration as the last step and only if the other steps succeeded. * Change the packed-refs repacking patch to repack before deleting refs instead of after. Th

[PATCH v2 1/3] remote rm: delete remote configuration as the last

2014-05-23 Thread Jens Lindström
When removing a remote, delete the remote-tracking branches before deleting the remote configuration. This way, if the operation fails or is aborted while deleting the remote-tracking branches, the command can be rerun to complete the operation. Signed-off-by: Jens Lindström --- builtin

[PATCH v2 2/3] remote: repack packed-refs once when deleting multiple refs

2014-05-23 Thread Jens Lindström
the deleted refs. Signed-off-by: Jens Lindström --- Note: remove_branches() no longer checks that the remote-tracking branches it deletes point at the right object before deleting them by passing the expected SHA-1 to delete_ref(). This was a required change since all packed refs have been delet

[PATCH v2 3/3] remote prune: optimize "dangling symref" check/warning

2014-05-23 Thread Jens Lindström
using the new warn_dangling_symrefs() function which makes one pass over all refs and checks for all the deleted refs in one go, after they have all been deleted. Signed-off-by: Jens Lindström --- builtin/remote.c | 7 ++- refs.c | 19 ++- refs.h | 1

Re: [PATCH 1/2] remote: defer repacking packed-refs when deleting refs

2014-05-24 Thread Jens Lindström
On Fri, May 23, 2014 at 7:09 PM, Junio C Hamano wrote: > Jens Lindström writes: >> One additional change was required in >> builtin/remote.c:remove_branches(). It used to pass in the expected >> SHA-1 of the ref to delete_ref(), which only works if the ref exists. >>

Bug: git-push crash due to double-close of file descriptor

2013-10-22 Thread Jens Lindström
In a repository, I have a repeatable crash when pushing a ref to a remote. The cause seems very simple, and it's more unclear to me why this doesn't happen more often. The cause, as I understand it: git_transport_push() calls send_pack() which calls pack_objects() which calls start_command(), whi

[PATCH] Clear fd after closing to avoid double-close error

2013-10-22 Thread Jens Lindström
open file. Signed-off-by: Jens Lindström --- send-pack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/send-pack.c b/send-pack.c index 7d172ef..7def2af 100644 --- a/send-pack.c +++ b/send-pack.c @@ -302,6 +302,9 @@ int send_pack(struct send_pack_args *args

Re: [PATCH] Clear fd after closing to avoid double-close error

2013-10-22 Thread Jens Lindström
efs_via_pack() closes the handle again. I'll update the patch to clear that fd as well. >> Signed-off-by: Jens Lindström >> --- >> send-pack.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/send-pack.c b/send-pack.c >> index 7d172e

[PATCH v2] Clear fd after closing to avoid double-close error

2013-10-22 Thread Jens Lindström
(), closing the fd again, possibly incorrectly closing some other open file; or similarly with fetch_refs_from_pack(), indirect caller of get_pack(). Signed-off-by: Jens Lindström --- fetch-pack.c | 4 send-pack.c | 4 2 files changed, 8 insertions(+) diff --git a/fetch-pack.c b/fetch

Re: [PATCH] Clear fd after closing to avoid double-close error

2013-10-23 Thread Jens Lindström
On Tue, Oct 22, 2013 at 8:42 PM, Junio C Hamano wrote: > Duy Nguyen writes: >> Life would have been simpler if fd[1] was _always_ closed by >> send_pack(), like in c20181e (start_command(), if .in/.out > 0, closes >> file descriptors, not the callers - 2008-02-21). > > Yeah, that was also my fir

Re: [PATCH] clone: Skip pack-*.keep files when cloning locally

2013-07-01 Thread Jens Lindström
On Fri, Jun 28, 2013 at 8:38 PM, Junio C Hamano wrote: >> The pack-*.keep files are temporary, and serve no purpose in the >> clone. > > They are not temporary, actually. A user can deliberatey create a > "keep" marker after packing with a good set of parameters, so that > the resulting pack will

Re: [PATCH] clone: Skip pack-*.keep files when cloning locally

2013-07-03 Thread Jens Lindström
On Mon, Jul 1, 2013 at 6:20 PM, Junio C Hamano wrote: > I am not sure if we should care that deeply about them in the first > place. Fine by me; I don't really have a strong opinion on the matter. > Besides, I think you can make a hardlink to a file that you cannot > read. Not always. The Linu

Re: [PATCH] clone: Skip pack-*.keep files when cloning locally

2013-07-03 Thread Jens Lindström
On Wed, Jul 3, 2013 at 7:26 PM, Junio C Hamano wrote: > Jens Lindström writes: > >> Not always. The Linux kernel can at least be configured not to allow >> it. It seems this is enabled by default in at least Debian. > > You learn a new thing every day, I guess.