git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Woofenden <jason@jasonwoof.com>
To: git@vger.kernel.org
Subject: bug: git mv dir with submodule in dir/sub
Date: Tue, 3 Mar 2015 10:52:07 -0500	[thread overview]
Message-ID: <20150303155207.GM30045@compy.jasonwoof.org> (raw)

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

                 reply	other threads:[~2015-03-03 16:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150303155207.GM30045@compy.jasonwoof.org \
    --to=jason@jasonwoof.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).