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 25/32] prune: strategies for linked checkouts Date: Sat, 30 Aug 2014 15:33:55 +0700 Message-ID: <1409387642-24492-26-git-send-email-pclouds@gmail.com> References: <1409387642-24492-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 , =?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 Sat Aug 30 10:36: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 1XNe98-0003IS-52 for gcvg-git-2@plane.gmane.org; Sat, 30 Aug 2014 10:36:30 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751454AbaH3IgO convert rfc822-to-quoted-printable (ORCPT ); Sat, 30 Aug 2014 04:36:14 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:62101 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751327AbaH3IgI (ORCPT ); Sat, 30 Aug 2014 04:36:08 -0400 Received: by mail-pa0-f49.google.com with SMTP id kq14so8079864pab.22 for ; Sat, 30 Aug 2014 01:36:08 -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=KIwi/IBLMjkBXH8trQNgbC5bu7+PU1N8Q+MvbUATjrs=; b=NYobSI+gBlBzPzbGkuuA13QP/JUAHSShCqVlHLj70inayRFktDdwdmqzEYVomdZ4iS MfayGFaVXRB96js2k9QkpDT6jX/E99uFCyOqhFXqSqvuuSkKJc542CAKPlknQZFgWJ73 mHGU8HvukoyJaU9VjmeWbb8TVy+2LAj5vZwXEiyNugeLbhgSKSQDQv/DttifKtyoP7B9 KxAumV21WgzWv8T2KQPhJ5caK41UySeCn3jFd71lSGuvi7jSTWjEgKnWPh4J1eC3kCk/ S9XsECFY/P2/p/sHJkjudfLlpYWy8GFs4NXmMWldYh4MWBWSbopQsQVUpfah54pC35lR 55nQ== X-Received: by 10.68.201.138 with SMTP id ka10mr6508104pbc.23.1409387768132; Sat, 30 Aug 2014 01:36:08 -0700 (PDT) Received: from lanh ([115.73.195.142]) by mx.google.com with ESMTPSA id fk10sm7549928pab.29.2014.08.30.01.36.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Aug 2014 01:36:07 -0700 (PDT) Received: by lanh (sSMTP sendmail emulation); Sat, 30 Aug 2014 15:36:17 +0700 X-Mailer: git-send-email 2.1.0.rc0.78.gc0d8480 In-Reply-To: <1409387642-24492-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 | 95 ++++++++++++++++++++++= ++++++++ setup.c | 13 ++++ t/t2026-prune-linked-checkouts.sh (new +x) | 84 ++++++++++++++++++++++= ++++ 6 files changed, 228 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