From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, Jens.Lehmann@web.de, gmane@otterhall.com
Subject: Re: [PATCH] mv: allow moving nested submodules
Date: Mon, 18 Apr 2016 13:54:09 -0700 [thread overview]
Message-ID: <xmqqk2ju4ozy.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1460998489-2155-1-git-send-email-sbeller@google.com> (Stefan Beller's message of "Mon, 18 Apr 2016 09:54:49 -0700")
Stefan Beller <sbeller@google.com> writes:
> if (show_only || verbose)
> printf(_("Renaming %s to %s\n"), src, dst);
> - if (!show_only && mode != INDEX) {
> - if (rename(src, dst) < 0 && !ignore_errors)
> + if (!show_only) {
> + if (mode != INDEX &&
> + rename(src, dst) < 0 &&
> + !ignore_errors)
> die_errno(_("renaming '%s' failed"), src);
> +
If ignore-errors is set and rename fails, this would fall through
and try to touch this codepath...
> if (submodule_gitfile[i]) {
> if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
> connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
... but I am not sure if this thing is prepared to cope with such a
case? src should have been moved to dst but if rename() failed we
wouldn't see what we expect at dst, or would we?
> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
> index 4008fae..4a2570e 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,17 @@ test_expect_success 'mv -k does not accidentally destroy submodules' '
> git checkout .
> '
>
> +test_expect_success 'moving a submodule in nested directories' '
> + (
> + cd deep &&
> + git mv directory ../ &&
> + # git status would fail if the update of linking git dir to
> + # work dir of the submodule failed.
> + git status &&
> + git config -f ../.gitmodules submodule.deep/directory/hierachy/sub.path >../actual &&
> + echo "directory/hierachy/sub" >../expect
> + ) &&
> + test_cmp actual expect
> +'
> +
> test_done
next prev parent reply other threads:[~2016-04-18 20:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 16:54 [PATCH] mv: allow moving nested submodules Stefan Beller
2016-04-18 20:54 ` Junio C Hamano [this message]
2016-04-18 21:13 ` Junio C Hamano
2016-04-18 21:26 ` Stefan Beller
-- strict thread matches above, loose matches on Subject: below --
2016-04-19 18:32 Stefan Beller
2016-04-15 18:24 'git mv' doesn't move submodule if it's in a subdirectory Stefan Beller
2016-04-15 19:11 ` [PATCH] mv: allow moving nested submodules Stefan Beller
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=xmqqk2ju4ozy.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gmane@otterhall.com \
--cc=sbeller@google.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).