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

Re: [PATCH 5/7] git mv: Support moving submodules

From
Petr Baudis <pasky@suse.cz>
Date
Jul 17, 2008, 13:06 UTC
Message-ID
<20080717130651.GU32184@machine.or.cz>
In-Reply-To
<7vhcapme0q.fsf@gitster.siamese.dyndns.org>
  Hi!
On Wed, Jul 16, 2008 at 07:37:57PM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> Petr Baudis <pasky@suse.cz> writes:
> 
> > ... The horrid
> > index_path_src_sha1 hack is unfortunately much worse,
> 
> This one certainly is ugly beyond words.
  ;-)
Show 23 quoted lines
> By the way, why is it even necessary to rehash the contents when you run
> "mv"?
> 
> IOW,
> 
> 	$ >foo
>         $ git add foo
>         $ echo 1 >foo
>         $ git mv foo bar
> 
> makes "foo" disappear from the index and adds "bar", but it makes the
> local change added to the index at the same time.
> 
> 	Side note. It actually is a lot worse than that.  When you move
> 	something to another existing entry, the code does not even add
> 	the object name of moved entry recorded in the index, nor rehashes
> 	the moved file.  This is totally inconsistent!
> 
> I personally think these buggy behaviours you are trying to inherit are
> making this patch more complex than necessary.  Perhaps this needs to be
> fixed up even further (you did some fix with the first patch) before
> adding new features?  For example, I think it is a bug that the
> "overwrite" codepath does not work with symlinks.
  I agree that it would be much cleaner to fix this; I got puzzled about
this behaviour a bit, but I was afraid to break the traditional
behaviour. However, if you are feeling this brave, patch to follow up
shortly. :-)
>  * Then, only for case (1), you do not call add_file_to_cache() -- because
>    you know you do not have anything you can rehash; instead, factor out
>    the codepath "git-update-index --cacheinfo" uses and call that.
  This is excellent hint, sort of what I hoped for, thanks! I forgot
about --cacheinfo completely, which is truly a shame especially when I
look at the history of this switch. ;-) (BTW, curiously, the commit
lists Linus as an author even though the patch is yours. Maybe this was
merely some imperfection of the early scripts around Git, though.)
I really did not touch git internals for way too long.
-- 
				Petr "Pasky" Baudis
GNU, n. An animal of South Africa, which in its domesticated state
resembles a horse, a buffalo and a stag. In its wild condition it is
something like a thunderbolt, an earthquake and a cyclone. -- A. Pierce
Previous: Junio C HamanoNext: Petr Baudis
Message 8 of 56 in “Submodule support in git mv, git rm”
  1. Petr BaudisJul 16, 2008
  2. 1/7 git-mv: Remove dead code branchPetr Baudis, Jul 16, 2008
  3. 2/7 t7400: Add short "git submodule add" testsuitePetr Baudis, Jul 16, 2008
  4. 3/7 git submodule add: Fix naming clash handlingPetr Baudis, Jul 16, 2008
  5. 4/7 submodule.*: Introduce simple C interface for submodule lookup by pathPetr Baudis, Jul 16, 2008
  6. 5/7 git mv: Support moving submodulesPetr Baudis, Jul 16, 2008
  7. Junio C HamanoJul 17, 2008
  8. Petr BaudisJul 17, 2008
  9. git-mv: Keep moved index entries inactPetr Baudis, Jul 17, 2008
  10. git mv: Support moving submodulesPetr Baudis, Jul 17, 2008
  11. Junio C HamanoJul 19, 2008
  12. Petr BaudisJul 21, 2008
  13. [PATCHv2] git-mv: Keep moved index entries inactPetr Baudis, Jul 21, 2008
  14. Junio C HamanoJul 21, 2008
  15. Junio C HamanoJul 26, 2008
  16. Petr BaudisJul 27, 2008
  17. t/t7001-mv.sh: Propose ability to use git-mv on conflicting entriesPetr Baudis, Jul 27, 2008
  18. Junio C HamanoJul 28, 2008
  19. Junio C HamanoJul 28, 2008
  20. SZEDER GáborJul 28, 2008
  21. Johannes SchindelinJul 28, 2008
  22. Johannes SchindelinJul 28, 2008
  23. Johannes SchindelinJul 28, 2008
  24. Junio C HamanoJul 28, 2008
  25. Johannes SchindelinJul 28, 2008
  26. Johannes SchindelinJul 28, 2008
  27. Petr BaudisJul 29, 2008
  28. Junio C HamanoJul 29, 2008
  29. Junio C HamanoJul 29, 2008
  30. Not going beyond symbolic linksJunio C Hamano, Aug 4, 2008
  31. 1/2 update-index: refuse to add working tree items beyond symlinksJunio C Hamano, Aug 4, 2008
  32. 2/2 add: refuse to add working tree items beyond symlinksJunio C Hamano, Aug 4, 2008
  33. Linus TorvaldsAug 5, 2008
  34. Junio C HamanoAug 5, 2008
  35. Linus TorvaldsAug 5, 2008
  36. Johannes SchindelinAug 5, 2008
  37. Linus TorvaldsAug 5, 2008
  38. Junio C HamanoAug 5, 2008
  39. Dmitry PotapovAug 5, 2008
  40. Junio C HamanoAug 5, 2008
  41. Linus TorvaldsAug 5, 2008
  42. Junio C HamanoAug 5, 2008
  43. Johannes SchindelinAug 5, 2008
  44. Junio C HamanoAug 5, 2008
  45. david@lang.hmAug 5, 2008
  46. Junio C HamanoAug 7, 2008
  47. Junio C HamanoAug 8, 2008
  48. Linus TorvaldsAug 8, 2008
  49. Johannes SchindelinJul 21, 2008
  50. Petr BaudisJul 21, 2008
  51. Junio C HamanoJul 21, 2008
  52. 6/7 git rm: Support for removing submodulesPetr Baudis, Jul 16, 2008
  53. Johannes SchindelinJul 16, 2008
  54. Petr BaudisJul 17, 2008
  55. Johannes SchindelinJul 17, 2008
  56. 7/7 t7403: Submodule git mv, git rm testsuitePetr Baudis, Jul 16, 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.