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 14:13:05 -0700 [thread overview]
Message-ID: <xmqqfuui4o4e.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqqk2ju4ozy.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Mon, 18 Apr 2016 13:54:09 -0700")
Junio C Hamano <gitster@pobox•com> writes:
> 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?
In other words, I was wondering if this part should read more like
this:
builtin/mv.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/builtin/mv.c b/builtin/mv.c
index aeae855..37ed0fc 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -252,9 +252,14 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
int pos;
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)
+ ;
+ else {
+ if (mode != INDEX && rename(src, dst) < 0) {
+ if (ignore_errors)
+ continue;
die_errno(_("renaming '%s' failed"), src);
+ }
if (submodule_gitfile[i]) {
if (submodule_gitfile[i] != SUBMODULE_WITH_GITDIR)
connect_work_tree_and_git_dir(dst, submodule_gitfile[i]);
next prev parent reply other threads:[~2016-04-18 21:13 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
2016-04-18 21:13 ` Junio C Hamano [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfuui4o4e.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=Jens.Lehmann@web$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=gmane@otterhall$(echo .)com \
--cc=sbeller@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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