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

Re: [PATCH] git mv: Support moving submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 12, 2008, 22:19 UTC
Message-ID
<7vprn9m2hw.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080912214129.14829.53058.stgit@localhost>
Petr Baudis <pasky@suse.cz> writes:
Show 20 quoted lines
> diff --git a/builtin-mv.c b/builtin-mv.c
> index 4f65b5a..2970acc 100644
> --- a/builtin-mv.c
> +++ b/builtin-mv.c
> @@ -9,6 +9,7 @@
>  #include "cache-tree.h"
>  #include "string-list.h"
>  #include "parse-options.h"
> +#include "submodule.h"
>  
>  static const char * const builtin_mv_usage[] = {
>  	"git mv [options] <source>... <destination>",
> @@ -49,6 +50,24 @@ static const char *add_slash(const char *path)
>  	return path;
>  }
>  
> +static int ce_is_gitlink(int i)
> +{
> +	return i < 0 ? 0 : S_ISGITLINK(active_cache[i]->ce_mode);
> +}

This interface itself is ugly (why should a caller pass "it is unmerged or does not exist" without checking?), and it also makes the hunk that begins at 84/105 ugly. Why not "path_is_gitlink(const char*)" and run cache_name_pos() here instead?

The interface, even if it is internal, should be done with a better taste than that, even though I understand that you wanted to reuse the cache_pos for the source one while you check.

Oh, by the way, what should happen when you have an unmerged path in the index and say "git mv path elsewhere" (this question is *not* limited to submodules). Compared to that, what _does_ happen with the current code, and with your patch?

Previous: Petr BaudisNext: Petr Baudis
Message 13 of 18 in “Submodule support for git mv and git rm”
  1. 0/6 Submodule support for git mv and git rmPetr Baudis, Sep 12, 2008
  2. 1/6 submodule.*: Introduce simple C interface for submodule lookup by pathPetr Baudis, Sep 12, 2008
  3. Junio C HamanoSep 12, 2008
  4. Jakub NarebskiSep 12, 2008
  5. Petr BaudisSep 12, 2008
  6. 2/6 git rm: Support for removing submodulesPetr Baudis, Sep 12, 2008
  7. Junio C HamanoSep 12, 2008
  8. Junio C HamanoSep 12, 2008
  9. Petr BaudisSep 12, 2008
  10. Junio C HamanoSep 12, 2008
  11. 3/6 git mv: Support moving submodulesPetr Baudis, Sep 12, 2008
  12. git mv: Support moving submodulesPetr Baudis, Sep 12, 2008
  13. Junio C HamanoSep 12, 2008
  14. 4/6 t7403: Submodule git mv, git rm testsuitePetr Baudis, Sep 12, 2008
  15. 5/6 t7400: Add short "git submodule add" testsuitePetr Baudis, Sep 12, 2008
  16. 6/6 git submodule add: Fix naming clash handlingPetr Baudis, Sep 12, 2008
  17. Junio C HamanoSep 13, 2008
  18. Lars HjemliSep 13, 2008

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.