git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Jens Lehmann" <Jens.Lehmann@web.de>,
	"Albin Otterhäll" <gmane@otterhall.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: 'git mv' doesn't move submodule if it's in a subdirectory
Date: Fri, 15 Apr 2016 11:24:56 -0700	[thread overview]
Message-ID: <CAGZ79kajE-R84=dSpBBFttwwDg4DbF59gnmzaN-C2w6U3rFwVw@mail.gmail.com> (raw)
In-Reply-To: <xmqqlh4ebumv.fsf@gitster.mtv.corp.google.com>

On Fri, Apr 15, 2016 at 11:21 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>> I think I can reproduce the problem. A regression test (which currently fails)
>> could look like
>
> Thanks.  I however do not think this is a regression.
>
> Changes around 0656781f (mv: update the path entry in .gitmodules
> for moved submodules, 2013-08-06) did introduce "git mv dir1 dir2"
> when 'dir1' is a submodule, but I do not think it went beyond that.
> I do not see any effort to treat a submodule that is discovered by
> scanning a directory that was given from the command line,
> i.e. prepare_move_submodule() is not called for them, and the
> entries in the submodule_gitfile[] array that correspond to them are
> explicitly set to NULL in the loop.

Also I just realize this is not exactly the same bug as reported.
Albin complains about the .gitmodules file not being adjusted, whereas
the test case I wrote breaks commands in your superproject, i.e. `git status`
or `git diff` just dies.

(Manually inspecting the .gitmodules file turns out it is not adjusted as well.)

>
>
>> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
>> index 4008fae..3b96a9a 100755
>> --- a/t/t7001-mv.sh
>> +++ b/t/t7001-mv.sh
>> @@ -292,6 +292,9 @@ test_expect_success 'setup submodule' '
>>         echo content >file &&
>>         git add file &&
>>         git commit -m "added sub and file" &&
>> +       mkdir -p deep/directory/hierachy &&
>> +       git submodule add ./. deep/directory/hierachy/sub &&
>> +       git commit -m "added another submodule" &&
>>         git branch submodule
>>  '
>>
>> @@ -475,4 +478,14 @@ test_expect_success 'mv -k does not accidentally
>> destroy submodules' '
>>         git checkout .
>>  '
>>
>> +test_expect_failure 'moving a submodule in nested directories' '
>> +       (
>> +               cd deep &&
>> +               git mv directory ../ &&
>> +               git status
>> +               # currently git status exits with 128
>> +               # fatal: Not a git repository:
>> directory/hierachy/sub/../../../../.git/modules/deep/directory/hierachy/sub
>> +       )
>> +'
>> +
>>  test_done

  reply	other threads:[~2016-04-15 18:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  8:14 'git mv' doesn't move submodule if it's in a subdirectory Albin Otterhäll
2016-04-15 17:18 ` Stefan Beller
2016-04-15 17:59   ` Stefan Beller
2016-04-15 18:21     ` Junio C Hamano
2016-04-15 18:24       ` Stefan Beller [this message]
2016-04-15 19:11         ` [PATCH] mv: allow moving nested submodules Stefan Beller
2016-04-15 19:39   ` 'git mv' doesn't move submodule if it's in a subdirectory Albin Otterhäll

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CAGZ79kajE-R84=dSpBBFttwwDg4DbF59gnmzaN-C2w6U3rFwVw@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gmane@otterhall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).