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 v2 0/5] worktree lock/unlock Date: Sun, 22 May 2016 17:43:36 +0700 Message-ID: <20160522104341.656-1-pclouds@gmail.com> References: <20160510141416.GA22672@lanh> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Junio C Hamano , Eric Sunshine , rethab.ch@gmail.com, rappazzo@gmail.com, =?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 May 22 12:44:15 2016 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 1b4Qrm-0001j6-DC for gcvg-git-2@plane.gmane.org; Sun, 22 May 2016 12:44:14 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752257AbcEVKoL convert rfc822-to-quoted-printable (ORCPT ); Sun, 22 May 2016 06:44:11 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35130 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbcEVKoJ (ORCPT ); Sun, 22 May 2016 06:44:09 -0400 Received: by mail-pf0-f195.google.com with SMTP id f144so662049pfa.2 for ; Sun, 22 May 2016 03:44: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-transfer-encoding; bh=XmwRs9P916SdPxgeJarlHXQwz9xXRJZGwzerbXSzKNs=; b=oWx/FHj11lqsrSkTFs9sXIlPdC4w17PsbJhKbI/6ZwLXkxQ6z9NaEd2vV8PLf9Vail t2vMDaeWDxKNd2T1x18oRlcZ9K6IEZS/ar/PY/hi1M3fK3C/OBIvJrVUcqFFGachT7ET tMy+YHAXUE0nR7opeDiSvZKbTexvwBy++j9bkg6qBGA4LXT+G1V+OO3WREWP2+5SwBwk ycSzjTEq905ph/ItCuFhcnAxDkiRNF/6wYfZEz5PyQLveDU8bDZFxF2Sl2DmMmJryu6Z ZUZpMRXfZvLN4w5zxAjhtD5sTUP7k4b5GMI0GoCUwpoVRnKei+bcFDYLskJqr65OUHDL 48Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XmwRs9P916SdPxgeJarlHXQwz9xXRJZGwzerbXSzKNs=; b=UvULvSr25GvBglytQG7rqzFCczeoF4z1fDWrF8+qzhH9STa1XAADWYp1V7jIT5/R+E hw3iAvA077zW2xppLli86kpS9uNAHZ+SQo0eLZKk7NvB28Ob1au28ArUoVffIKlKvjEz R/h3A1lOZ7FaP2EoTTUoZrNT9oiAbFQuVHlP01B+bfxqockHrMP/unIuKG2URYZknoue lSCxenC9zUwmqjrHkxwQ7YSk91hZmhtEtbIYgQnttfWDsI9ct/WJpnv8elBWMkwQubpH L5/xmk9+w5mQGLDncak5+PEhofo7Hg3cd0JHJayc4GbepsXTrvSuvUntcGiUXRf3s7Zn FT4w== X-Gm-Message-State: AOPr4FUf5j4C34IGatzEtAjbCJIEhVg6p59bkRvzpYhhGrEKz7Hqiz4Bhy/BVn0yYnr+pw== X-Received: by 10.98.38.196 with SMTP id m187mr18674332pfm.57.1463913848144; Sun, 22 May 2016 03:44:08 -0700 (PDT) Received: from ash ([171.232.119.25]) by smtp.gmail.com with ESMTPSA id r86sm38997928pfb.21.2016.05.22.03.44.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 May 2016 03:44:07 -0700 (PDT) Received: by ash (sSMTP sendmail emulation); Sun, 22 May 2016 17:44:03 +0700 X-Mailer: git-send-email 2.8.2.524.g6ff3d78 In-Reply-To: <20160510141416.GA22672@lanh> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: This should address all of Eric's comments (thanks!). An extra change I made is free_worktrees() at the end of {,un}lock_worktree() to avoid leaking. This series depends on nd/worktree-cleanup-post-head-protectio= n. Interdiff -- 8< -- diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktre= e.txt index 9ac1129..e0f2605 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -40,9 +40,8 @@ section "DETAILS" for more information. =20 If a linked working tree is stored on a portable device or network sha= re which is not always mounted, you can prevent its administrative files = from -being pruned by creating a file named 'locked' alongside the other -administrative files, optionally containing a plain text reason that -pruning should be suppressed. See section "DETAILS" for more informati= on. +being pruned by issuing the `git worktree lock` command, optionally +specifying `--reason` to explain why the working tree is locked. =20 COMMANDS -------- @@ -65,9 +64,11 @@ bare, the revision currently checked out, and the br= anch currently checked out =20 lock:: =20 -When a worktree is locked, it cannot be pruned, moved or deleted. For -example, if the worktree is on portable device that is not available -when "git worktree " is executed. +If a working tree is on a portable device or network share which +is not always mounted, lock it to prevent its administrative +files from being pruned automatically. This also prevents it from +being moved or deleted. Optionally, specify a reason for the lock +with `--reason`. =20 prune:: =20 @@ -123,7 +124,7 @@ OPTIONS With `prune`, only expire unused working trees older than