From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Subject: [PATCH v7 25/31] prune: strategies for linked checkouts Date: Sun, 13 Jul 2014 11:51:02 +0700 Message-ID: <1405227068-25506-26-git-send-email-pclouds@gmail.com> References: <1404891197-18067-1-git-send-email-pclouds@gmail.com> <1405227068-25506-1-git-send-email-pclouds@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Junio C Hamano , Max Kirillov , Eric Sunshine , =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sun Jul 13 06:55:33 2014 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X6Box-0001UC-GF for gcvg-git-2@plane.gmane.org; Sun, 13 Jul 2014 06:55:32 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753054AbaGMEz1 convert rfc822-to-quoted-printable (ORCPT ); Sun, 13 Jul 2014 00:55:27 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:56195 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753039AbaGMEzZ (ORCPT ); Sun, 13 Jul 2014 00:55:25 -0400 Received: by mail-pa0-f44.google.com with SMTP id rd3so3598030pab.17 for ; Sat, 12 Jul 2014 21:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=pTF8XhYwizRUm2fxSjwPgXhKPl+lCAHxhjQQdgeFA8M=; b=mtvoNOcV6i+0KmQ+pE003SU1ti2ubw4pKNbrXofb9NcxQjNsUe1AtwmLZS3YrwdsDr k3bVp+YOkP3lI7mbexKbx+I6hhd+txY3CCdRSfybNmjV4TWqx+fPqqNKuHKCMVP/JKQV hvzNfIfHM5gBjOYpOO6FPMSy+mzs6EKO3wX7RtM3wVC0ymU0n3eIC/exJ5bxdZSeqr22 W0IvBE8xG8FmdV7l7mHPH+5kwhXzK+qVwI6Z47teRZqTUF09AG6luJ8h5fu/TxVdtBQN yKZCCNDegiZ/XAW0A4IiwEuqAPZOY47P3m10BFwkS0Ei0Kzxdpa3duHv+KhUw1GaN7Td 3vOw== X-Received: by 10.66.161.4 with SMTP id xo4mr9096654pab.36.1405227325113; Sat, 12 Jul 2014 21:55:25 -0700 (PDT) Received: from lanh ([115.73.227.1]) by mx.google.com with ESMTPSA id e14sm5581790pdm.86.2014.07.12.21.55.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jul 2014 21:55:24 -0700 (PDT) Received: by lanh (sSMTP sendmail emulation); Sun, 13 Jul 2014 11:55:25 +0700 X-Mailer: git-send-email 1.9.1.346.ga2b5940 In-Reply-To: <1405227068-25506-1-git-send-email-pclouds@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: (alias R=3D$GIT_COMMON_DIR/repos/) - linked checkouts are supposed to keep its location in $R/gitdir up to date. The use case is auto fixup after a manual checkout move. - linked checkouts are supposed to update mtime of $R/gitdir. If $R/gitdir's mtime is older than a limit, and it points to nowhere, repos/ is to be pruned. - If $R/locked exists, repos/ is not supposed to be pruned. If $R/locked exists and $R/gitdir's mtime is older than a really long limit, warn about old unused repo. - "git checkout --to" is supposed to make a hard link named $R/link pointing to the .git file on supported file systems to help detect the user manually deleting the checkout. If $R/link exists and its link count is greated than 1, the repo is kept. Signed-off-by: Nguy=E1=BB=85n Th=C3=A1i Ng=E1=BB=8Dc Duy --- Documentation/git-prune.txt | 3 + Documentation/gitrepository-layout.txt | 19 ++++++ builtin/checkout.c | 14 +++++ builtin/prune.c | 99 ++++++++++++++++++++++= ++++++++ setup.c | 13 ++++ t/t2026-prune-linked-checkouts.sh (new +x) | 84 ++++++++++++++++++++++= +++ 6 files changed, 232 insertions(+) create mode 100755 t/t2026-prune-linked-checkouts.sh diff --git a/Documentation/git-prune.txt b/Documentation/git-prune.txt index 7a493c8..50e39ec 100644 --- a/Documentation/git-prune.txt +++ b/Documentation/git-prune.txt @@ -48,6 +48,9 @@ OPTIONS --expire