git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 7/9] git rm: do not abort due to an initialised submodule

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 11, 2010, 01:25 UTC
Message-ID
<7vaatasruc.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1270923830-11830-8-git-send-email-peter@pcc.me.uk>
Peter Collingbourne <peter@pcc.me.uk> writes:
Show 22 quoted lines
> 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, ...

Show 9 quoted lines
> @@ -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?

Previous: Peter CollingbourneNext: Peter Collingbourne
Message 12 of 14 in “Improve handling of moving and removing submodules”
  1. 0/9 Improve handling of moving and removing submodulesPeter Collingbourne, Apr 10, 2010
  2. 1/9 Generate unique ID for submodules created using "git submodule add"Peter Collingbourne, Apr 10, 2010
  3. Sverre RabbelierApr 10, 2010
  4. 2/9 Implement "git mv" for submodulesPeter Collingbourne, Apr 10, 2010
  5. Junio C HamanoApr 11, 2010
  6. 3/9 git rm: test failure behaviour for multiple removalsPeter Collingbourne, Apr 10, 2010
  7. 4/9 git rm: display a warning for every unremovable filePeter Collingbourne, Apr 10, 2010
  8. 5/9 git rm: collect file modesPeter Collingbourne, Apr 10, 2010
  9. 6/9 Add a mode parameter to the remove_path functionPeter Collingbourne, Apr 10, 2010
  10. Junio C HamanoApr 11, 2010
  11. 7/9 git rm: do not abort due to an initialised submodulePeter Collingbourne, Apr 10, 2010
  12. Junio C HamanoApr 11, 2010
  13. 8/9 git submodule: infrastructure for reading .gitmodules files in arbitrary locationsPeter Collingbourne, Apr 10, 2010
  14. 9/9 git rm: remove submodule entries from .gitmodulesPeter Collingbourne, Apr 10, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.