Re: [PATCH v2 4/5] worktree: add "lock" command
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 23, 2016, 04:36 UTC
- Message-ID
- <CAPig+cRSROJw74K0cu1qApNnuVJY3=YphgVVCYfU1_nh+STMAg@mail.gmail.com>
- In-Reply-To
- <20160522104341.656-5-pclouds@gmail.com>
On Sun, May 22, 2016 at 6:43 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 11 quoted lines
> Helped-by: Eric Sunshine <sunshine@sunshineco.com> > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > --- > diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt > @@ -150,7 +161,8 @@ instead. > > To prevent a $GIT_DIR/worktrees entry from being pruned (which > can be useful in some situations, such as when the > -entry's working tree is stored on a portable device), add a file named > +entry's working tree is stored on a portable device), use the > +`git worktree lock` comamnd, which adds a file named
s/comamnd/command/
Show 11 quoted lines
> 'locked' to the entry's directory. The file contains the reason in > plain text. For example, if a linked working tree's `.git` file points > to `/path/main/.git/worktrees/test-next` then a file named > diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh > @@ -0,0 +1,54 @@ > +test_expect_success 'lock linked worktree from another worktree' ' > + rm .git/worktrees/source/locked && > + git worktree add elsewhere && > + ( > + cd elsewhere && > + git worktree lock --reason hahaha ../source
Could use "git -C elsewhere worktree lock ..." and drop the subshell, but not worth a re-roll.
Show 9 quoted lines
> + ) && > + echo hahaha >expected && > + test_cmp expected .git/worktrees/source/locked > +' > + > +test_expect_success 'lock worktree twice (from the locked worktree)' ' > + ( > + cd source && > + test_must_fail git worktree lock .
Likewise, -C.
> + ) && > + echo hahaha >expected && > + test_cmp expected .git/worktrees/source/locked > +'