git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Yuri <yuri@rawbw.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: Git re-creates newly added directory when it is pushed
Date: Mon, 30 Aug 2021 19:15:58 -0700	[thread overview]
Message-ID: <CABPp-BFE_LB=MYcJ80g=6OjvcXh-SjR_9_ynVdX5i9ruGBqh2Q@mail.gmail.com> (raw)
In-Reply-To: <xmqqv93n7q1v.fsf@gitster.g>

On Sun, Aug 29, 2021 at 5:07 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Elijah Newren <newren@gmail.com> writes:
>
> >> Why does Git have to delete and then create again the directory when it
> >> is already there?
> >>
> >>
> >> This isn't a big issue, but it is very odd that git deletes the working
> >> directory.
> >
> > It was deleted by the rebase operation, because rebase (currently)
> > works by first checking out the target commit onto which it will apply
> > all your local patches.  That target didn't have the directory; the
> > directory was added by your local patches.  So checking out that
> > commit necessarily deletes the directory.  Then rebase applies each of
> > your local patches, one by one, updating the working directory as it
> > applies them.  Since your local patches create that directory, it gets
> > re-created by this process.
>
> This is one of the reasons why "rebase" (especially "rebase -i") may
> want to insist starting at the top-level of the working tree, like
> "git bisect" does.  Because running the command from a subdirectory
> works most of the time until it doesn't, people tend to complain why
> they should go up to the top-level before they can run the command.
>
> And this is why---it causes end-user confusion.

Makes sense to me; I'll submit a patch.

  parent reply	other threads:[~2021-08-31  2:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-28  3:46 Git re-creates newly added directory when it is pushed Yuri
2021-08-28  5:33 ` Elijah Newren
2021-08-28  5:43   ` Yuri
2021-08-30  0:07   ` Junio C Hamano
2021-08-30  0:14     ` Yuri
2021-08-30  0:29       ` Junio C Hamano
2021-08-30  9:27         ` Philip Oakley
2021-08-31  2:15     ` Elijah Newren [this message]
2021-08-31  4:41       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABPp-BFE_LB=MYcJ80g=6OjvcXh-SjR_9_ynVdX5i9ruGBqh2Q@mail.gmail.com' \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=yuri@rawbw.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).