From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Branchaud Subject: Re: [PATCH v2 23/32] prune: strategies for linked checkouts Date: Mon, 22 Sep 2014 17:06:06 -0400 Message-ID: <54208F3E.1030609@xiplink.com> References: <1409387642-24492-1-git-send-email-pclouds@gmail.com> <1410388928-32265-1-git-send-email-pclouds@gmail.com> <1410388928-32265-24-git-send-email-pclouds@gmail.com> <5411C16C.9010406@xiplink.com> <20140921102936.GA9438@lanh> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Git List , Junio C Hamano To: Duy Nguyen , Eric Sunshine X-From: git-owner@vger.kernel.org Mon Sep 22 23:06:00 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 1XWAnv-0006Ms-C1 for gcvg-git-2@plane.gmane.org; Mon, 22 Sep 2014 23:05:52 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754886AbaIVVFr convert rfc822-to-quoted-printable (ORCPT ); Mon, 22 Sep 2014 17:05:47 -0400 Received: from smtp130.ord.emailsrvr.com ([173.203.6.130]:40962 "EHLO smtp130.ord.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754835AbaIVVFq (ORCPT ); Mon, 22 Sep 2014 17:05:46 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp21.relay.ord1a.emailsrvr.com (SMTP Server) with ESMTP id 59395380232; Mon, 22 Sep 2014 17:05:45 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp21.relay.ord1a.emailsrvr.com (Authenticated sender: mbranchaud-AT-xiplink.com) with ESMTPSA id 029BC38021B; Mon, 22 Sep 2014 17:05:44 -0400 (EDT) X-Sender-Id: mbranchaud@xiplink.com Received: from [10.10.1.32] ([UNAVAILABLE]. [192.252.130.194]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA) by 0.0.0.0:465 (trex/5.2.10); Mon, 22 Sep 2014 21:05:45 GMT User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 In-Reply-To: <20140921102936.GA9438@lanh> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On 14-09-21 06:29 AM, Duy Nguyen wrote: > Here we go again. Thanks both for the suggestions. The documentation looks good to me. =46WIW: Signed-off-by: Marc Branchaud M. > -- 8< -- > Subject: [PATCH] prune: strategies for linked checkouts >=20 > (alias R=3D$GIT_COMMON_DIR/worktrees/) >=20 > - 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. >=20 > - 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, > worktrees/ is to be pruned. >=20 > - If $R/locked exists, worktrees/ 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. >=20 > - "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. >=20 > Helped-by: Marc Branchaud > Helped-by: Eric Sunshine > Signed-off-by: Nguy=E1=BB=85n Th=C3=A1i Ng=E1=BB=8Dc Duy > --- > Documentation/git-checkout.txt | 20 +++++++ > Documentation/git-prune.txt | 3 + > Documentation/gitrepository-layout.txt | 19 ++++++ > builtin/checkout.c | 19 +++++- > builtin/prune.c | 95 ++++++++++++++++++++= ++++++++++ > setup.c | 13 ++++ > t/t2026-prune-linked-checkouts.sh (new +x) | 84 ++++++++++++++++++++= ++++++ > 7 files changed, 251 insertions(+), 2 deletions(-) > create mode 100755 t/t2026-prune-linked-checkouts.sh >=20 > diff --git a/Documentation/git-checkout.txt b/Documentation/git-check= out.txt > index c101575..0fd3bab 100644 > --- a/Documentation/git-checkout.txt > +++ b/Documentation/git-checkout.txt > @@ -434,6 +434,26 @@ thumb is do not make any assumption about whethe= r a path belongs to > $GIT_DIR or $GIT_COMMON_DIR when you need to directly access somethi= ng > inside $GIT_DIR. Use `git rev-parse --git-path` to get the final pat= h. > =20 > +When you are done with a linked working tree you can simply delete i= t. > +You can clean up any stale $GIT_DIR/worktrees entries via `git prune > +--worktrees` in the main worktree or any linked worktree. > + > +If you move a linked working directory to another file system, or > +within a file system that does not support hard links, you need to r= un > +at least one git command inside the linked working directory > +(e.g. `git status`) in order to update its entry in $GIT_DIR/worktre= es > +so that it does not get automatically removed. > + > +To prevent `git prune --worktrees` from deleting a $GIT_DIR/worktree= s > +entry (which can be useful in some situations, such as when the > +entry's working tree is stored on a portable device), add a file nam= ed > +'locked' to the entry's directory. The file contains the reason in > +plain text. For example, if a linked working tree's `.git` file poin= ts > +to `/path/main/.git/worktrees/test-next` then a file named > +`/path/main/.git/worktrees/test-next/locked` will prevent the > +`test-next` entry from being pruned. See > +linkgit:gitrepository-layout[5] for details. > + > EXAMPLES > -------- > =20 > diff --git a/Documentation/git-prune.txt b/Documentation/git-prune.tx= t > index 7a493c8..a0ea381 100644 > --- a/Documentation/git-prune.txt > +++ b/Documentation/git-prune.txt > @@ -48,6 +48,9 @@ OPTIONS > --expire