git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bug: git mv dir with submodule in dir/sub
@ 2015-03-03 15:52 Jason Woofenden
  0 siblings, 0 replies; only message in thread
From: Jason Woofenden @ 2015-03-03 15:52 UTC (permalink / raw)
  To: git

Hi all,

First, many thanks for all your work on git. It has been an
invaluable tool.

I believe I've found a bug. Submodules break when I use ``git mv``
to rename a directory, which contains a submodule as one of its
_sub_directories.

Here's the script I've been using to reproduce:

	#!/bin/bash

	# Settings
	REPO_TO_CLONE="$HOME/www/wfpl.git"

	# run in new directory
	export REPODIR="git-bug-$(date '+%s')"
	mkdir "$REPODIR" || exit $?
	cd "$REPODIR" || exit $?

	git --version

	# make a git repo with a submodule
	git init || exit $?
	mkdir old || exit $?
	git submodule add ~/www/wfpl.git old/wfpl || exit $?

	# run the command that borks the submodule
	git mv old new || exit $?

	# demonstrate that it's borked:
	git status || exit $?
	# for me this command produces:
	#     fatal: Could not chdir to '../../../../old/wfpl': No such file or directory
	#     fatal: 'git status --porcelain' failed in submodule new/wfpl

I run that and get this:

	git version 2.3.1.431.g836cf63
	Initialized empty Git repository in
	/home/jasonwoof/git-bug/git-bug-1425397321/.git/
	Cloning into 'old/wfpl'...
	done.
	fatal: Could not chdir to '../../../../old/wfpl': No such file or
	directory
	fatal: 'git status --porcelain' failed in submodule new/wfpl
	zsh: exit 128   ./script.sh

I got this same error (every time) with git-2.1.4-2.1 from debian
unstable, and from github's master (7f4ba4b6e3ba7), and from
github's pu branch (836cf6345)

All of the above running on debian unstable.

You'll need to change REPO_TO_CLONE of course.

It's probably worth noting that if I use ``git mv`` on the
submodule directly, it works fine. eg if I replace the ``git mv``
line in the above script with:

	mkdir new
	git mv old/wfpl new/wfpl

then it works fine (no error messages).


I am not subscribed to this list, so please remember to reply-all
if I can be of further assistance.

Thanks you!

-- 
Jason

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-03 16:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 15:52 bug: git mv dir with submodule in dir/sub Jason Woofenden

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).