Thread (3 messages) 3 messages, 3 authors, 2021-09-01

Re: [PATCH] rebase, cherry-pick, revert: only run from toplevel

flat view

From: Elijah Newren <hidden>
Date: 2021-09-01 06:08:49

On Tue, Aug 31, 2021 at 10:29 PM Junio C Hamano [off-list ref] wrote:
Elijah Newren [off-list ref] writes:
quoted
Ooh, this sounds intriguing to me...but what if we changed that rule
slightly and just decided to never make the cwd go away?  Currently,
the checkout code removes directories if they have no tracked or
untracked or ignored files left, i.e. if they're empty.  What if we
decide to only have remove_scheduled_dirs() remove directories that
are empty AND they are not the current working directory?
Is that generally doable?  What would we do when the directory the
subcommand was started from (or one of its parent directories) is
not just missing but has to be a file in the revision the subcommand
is trying to checkout?
The same problem (an untracked directory is in the way) already exists
and has to be handled by all relevant subcommands, right?

In particular, if the current working directory only has untracked
files in it, then the directory cannot be removed.  That will prevent
us from checking out the revision we want, so we have to throw an
error.

So my idea just piggy backs on that, resulting in the same error also
being shown when the current working directory has 0 untracked files
within it.

Since the whole thread started from, "maybe we should throw an error
instead of continuing if it would result in the current working
directory getting deleted", I believe this idea does exactly what we
were looking for...and nicely tailors the new error cases to precisely
the situations we wanted them for -- when the current working
directory would have been removed by the old code.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help