Re: [PATCH v4 13/15] scalar: implement the `delete` command
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 6, 2021, 20:48 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2110062243420.395@tvgsbejvaqbjf.bet>
- In-Reply-To
- <468CE4B8-D2C9-4FBC-B801-739F86C88ACB@outlook.com>
Hi Matthew and Elijah,
On Mon, 4 Oct 2021, Matthew Cheetham wrote:
Show 20 quoted lines
> On 28 Sep 2021, at 7:24 am, Elijah Newren <newren@gmail.com> wrote: > > > But if the current directory is inside the enlistment's directory, > > didn't that happen because the parent process' current directory was > > inside the enlistment directory? Or was there some kind of directory > > switching that scalar itself was doing causing it to be inside the > > enlistment directory? > > Yes to the latter. `setup_enlistment_directory` changes the current > directory much like `setup_git_directory`. > > > If the the current directory was inside the enlistment's directory > > because it inherited a parent process' current directory, wouldn't > > that also prevent deleting it? If so, should there be a special check > > for that case and pre-emptively returning an error rather than > > attempting the recursive directory deletion and just spitting out an > > error when it fails? > > You are correct. Speaking to Johannes about this I believe he is looking > to add a check/error in a new patch series revision.
Indeed, I did notice GGG#1037, and I changed the code so that it detects whether `scalar delete` was called from within the enlistment, and refuses to run in that case. Users will have to call `scalar delete <path>` from outside the enlistment.
Ciao, Dscho