Re: [RFC/PATCH] Add multiple workdir support to branch/checkout
- From
Jay Soffian <jaysoffian@gmail.com>
- Date
- Oct 5, 2011, 03:48 UTC
- Message-ID
- <CAG+J_Dx=65RE+QZT_r=tSPhWtGdNMhrZ-bk4A0-TtKk8WgRJZw@mail.gmail.com>
- In-Reply-To
- <1317786204-57335-1-git-send-email-jaysoffian@gmail.com>
On Tue, Oct 4, 2011 at 11:43 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
Show 14 quoted lines
> When using 'git new-workdir', there is no safety mechanism to prevent the > same branch from being checked out twice, nor to prevent a checked out > branch from being deleted. > > By teaching 'checkout' to record the workdir path using > 'branch.<name>.checkout' when switching branches, we can easily check if a > branch is already checked out in another workdir before switching to that > branch. Similarly, we can now add a check before deleting a branch. > > Allow 'checkout -f' to force the checkout and issue a warning > instead of an error. > > Guard this behavior behind 'core.recordCheckouts', which we will > teach 'git new-workdir' to set in a followup commit.
Well, depending upon what folks think of this RFC, anyway.
> Note: when switching away from a branch, we set 'branch.<name>.checkout' > to the empty string, instead of deleting it entirely, since git_config() > otherwise leaves behind an empty section which it does not re-use.
Maybe this is a bug in git_config()? It seems like if it's removed the last item from a section, it should remove the whole section OR it should re-use an empty section.
j.