git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Peter Collingbourne <peter@pcc.me.uk>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 7/9] git rm: do not abort due to an initialised submodule
Date: Sat, 10 Apr 2010 18:25:31 -0700	[thread overview]
Message-ID: <7vaatasruc.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1270923830-11830-8-git-send-email-peter@pcc.me.uk> (Peter Collingbourne's message of "Sat\, 10 Apr 2010 19\:23\:48 +0100")

Peter Collingbourne <peter@pcc.me.uk> writes:

> This patch causes the "git rm" command to consider "directory not
> empty" errors as nonfatal, which will be caused by a submodule being
> in an initialised state.  As this is a normal state for a submodule,
> ...
> Signed-off-by: Peter Collingbourne <peter@pcc.me.uk>
> ---
>  builtin/rm.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/rm.c b/builtin/rm.c
> index 6ac5114..02ee259 100644
> --- a/builtin/rm.c
> +++ b/builtin/rm.c
> @@ -250,7 +250,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
>  	 * abort the "git rm" (but once we've successfully removed
>  	 * any file at all, we'll go ahead and commit to it all:
>  	 * by then we've already committed ourselves and can't fail
> -	 * in the middle)
> +	 * in the middle).  However failure to remove a submodule
> +	 * directory due to the submodule being initialised is never
> +	 * a fatal condition.
>  	 */


Your messages both in the commit log and comment talk only about
submodules, ...

> @@ -261,7 +263,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
>  				removed = 1;
>  				continue;
>  			}
> -			if (!removed)
> +			if (!removed && errno != EEXIST && errno != ENOTEMPTY)
>  				die_errno("git rm: '%s'", path);
>  			else
>  				warning("git rm: '%s': %s", path, strerror(errno));

... but the code does not seem to limit itself to the case where a
submodule removal has failed.

How does this patch affect the failure case for regular files and
directories without any submodules?

  reply	other threads:[~2010-04-11  1:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-10 18:23 [PATCH v2 0/9] Improve handling of moving and removing submodules Peter Collingbourne
2010-04-10 18:23 ` [PATCH v2 1/9] Generate unique ID for submodules created using "git submodule add" Peter Collingbourne
2010-04-10 18:41   ` Sverre Rabbelier
2010-04-10 18:23 ` [PATCH v2 2/9] Implement "git mv" for submodules Peter Collingbourne
2010-04-11  1:25   ` Junio C Hamano
2010-04-10 18:23 ` [PATCH v2 3/9] git rm: test failure behaviour for multiple removals Peter Collingbourne
2010-04-10 18:23 ` [PATCH v2 4/9] git rm: display a warning for every unremovable file Peter Collingbourne
2010-04-10 18:23 ` [PATCH v2 5/9] git rm: collect file modes Peter Collingbourne
2010-04-10 18:23 ` [PATCH v2 6/9] Add a mode parameter to the remove_path function Peter Collingbourne
2010-04-11  1:25   ` Junio C Hamano
2010-04-10 18:23 ` [PATCH v2 7/9] git rm: do not abort due to an initialised submodule Peter Collingbourne
2010-04-11  1:25   ` Junio C Hamano [this message]
2010-04-10 18:23 ` [PATCH v2 8/9] git submodule: infrastructure for reading .gitmodules files in arbitrary locations Peter Collingbourne
2010-04-10 18:23 ` [PATCH v2 9/9] git rm: remove submodule entries from .gitmodules Peter Collingbourne

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

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

  git send-email \
    --in-reply-to=7vaatasruc.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peter@pcc.me.uk \
    /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.
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 NNTP newsgroup(s).