{"thread":{"id":"38691","subject":"bug: git mv dir with submodule in dir/sub","startedAt":"2015-03-03T15:52:07Z","lastAt":"2015-03-03T15:52:07Z","messageCount":1,"participants":["Jason Woofenden"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"256910","messageId":"20150303155207.GM30045@compy.jasonwoof.org","threadId":"38691","inReplyTo":null,"subject":"bug: git mv dir with submodule in dir/sub","fromName":"Jason Woofenden","fromEmail":"jason@jasonwoof.com","sentAt":"2015-03-03T15:52:07Z","receivedAt":"2015-03-03T15:52:07Z","isPatch":false,"sender":{"key":"jason@jasonwoof.com","avatar":null},"body":"Hi all,\n\nFirst, many thanks for all your work on git. It has been an\ninvaluable tool.\n\nI believe I've found a bug. Submodules break when I use ``git mv``\nto rename a directory, which contains a submodule as one of its\n_sub_directories.\n\nHere's the script I've been using to reproduce:\n\n\t#!/bin/bash\n\n\t# Settings\n\tREPO_TO_CLONE=\"$HOME/www/wfpl.git\"\n\n\t# run in new directory\n\texport REPODIR=\"git-bug-$(date '+%s')\"\n\tmkdir \"$REPODIR\" || exit $?\n\tcd \"$REPODIR\" || exit $?\n\n\tgit --version\n\n\t# make a git repo with a submodule\n\tgit init || exit $?\n\tmkdir old || exit $?\n\tgit submodule add ~/www/wfpl.git old/wfpl || exit $?\n\n\t# run the command that borks the submodule\n\tgit mv old new || exit $?\n\n\t# demonstrate that it's borked:\n\tgit status || exit $?\n\t# for me this command produces:\n\t#     fatal: Could not chdir to '../../../../old/wfpl': No such file or directory\n\t#     fatal: 'git status --porcelain' failed in submodule new/wfpl\n\nI run that and get this:\n\n\tgit version 2.3.1.431.g836cf63\n\tInitialized empty Git repository in\n\t/home/jasonwoof/git-bug/git-bug-1425397321/.git/\n\tCloning into 'old/wfpl'...\n\tdone.\n\tfatal: Could not chdir to '../../../../old/wfpl': No such file or\n\tdirectory\n\tfatal: 'git status --porcelain' failed in submodule new/wfpl\n\tzsh: exit 128   ./script.sh\n\nI got this same error (every time) with git-2.1.4-2.1 from debian\nunstable, and from github's master (7f4ba4b6e3ba7), and from\ngithub's pu branch (836cf6345)\n\nAll of the above running on debian unstable.\n\nYou'll need to change REPO_TO_CLONE of course.\n\nIt's probably worth noting that if I use ``git mv`` on the\nsubmodule directly, it works fine. eg if I replace the ``git mv``\nline in the above script with:\n\n\tmkdir new\n\tgit mv old/wfpl new/wfpl\n\nthen it works fine (no error messages).\n\n\nI am not subscribed to this list, so please remember to reply-all\nif I can be of further assistance.\n\nThanks you!\n\n-- \nJason\n"}]}