From: Sven Verdoolaege <skimo@kotnet.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Steffen Prohaska <prohaska@zib.de>,
Johannes.Schindelin@gmx.de
Subject: Re: [PATCH v4] git-apply: apply submodule changes
Date: Tue, 14 Aug 2007 10:39:40 +0200 [thread overview]
Message-ID: <20070814083940.GN999MdfPADPa@greensroom.kotnet.org> (raw)
In-Reply-To: <7vd4xqeilh.fsf@assigned-by-dhcp.cox.net>
On Mon, Aug 13, 2007 at 11:27:38PM -0700, Junio C Hamano wrote:
> * write_out_one_result() calls remove_file() and create_file()
> to match the work tree to the result you prepared with
> apply_data().
>
> - remove_file() is changed not to do any for gitlink. We
> _might_ want to try rmdir() if there is an otherwise empty
> directory there, but currently we cannot do much to the
> failure on that, so I did not bother with it.
We could at least warn about it, which is what my patch did.
> - create_file() does three things:
> - create a file in the work tree to match the result;
> - update the index with the patch result;
> - invalidate cache-tree entry for the path.
>
> For the first task, create_one_file() is usually used to
> create a blob (either regular file or a symlink). For
> gitlinks, we do not affect the work tree for now, just like
> checkout_entry().
It creates the subdirectory, though, and git-apply should do so
too since it expects the subdirectory to be there for subsequent
patches (at least in the --index case).
> diff --git a/builtin-apply.c b/builtin-apply.c
Did you remove the documentation on purpose ?
> +static int verify_index_match(struct cache_entry *ce, struct stat *st)
> +{
> + if (!ce_match_stat(ce, st, 1))
> + return 0;
> + if (S_ISGITLINK(ntohl(ce->ce_mode))) {
> + if (S_ISDIR(st->st_mode))
> + return 0;
> + }
Not a big deal, but ce_match_stat already checks for that.
That's why I was checking for TYPE_CHANGED in its return
value.
> @@ -2096,16 +2142,22 @@ static int check_patch(struct patch *patch, struct patch *prev_patch)
> lstat(old_name, &st))
> return -1;
> }
> - if (!cached)
> - changed = ce_match_stat(ce, &st, 1);
> - if (changed)
> + if (!cached && verify_index_match(ce, &st))
> return error("%s: does not match index",
> old_name);
> if (cached)
> st_mode = ntohl(ce->ce_mode);
> + } else if (stat_ret < 0) {
> + if (errno == ENOENT && S_ISGITLINK(patch->old_mode))
> + /*
> + * It is Ok not to have the submodule
> + * checked out at all.
> + */
> + ;
> + else
> + return error("%s: %s", old_name,
> + strerror(errno));
> }
Shouldn't you be consistent with the --index case and require the
subdirectory to exist?
skimo
next prev parent reply other threads:[~2007-08-14 8:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-10 9:30 [PATCH] git-apply: apply submodule changes Sven Verdoolaege
2007-08-10 12:34 ` Johannes Schindelin
2007-08-10 12:39 ` Johannes Schindelin
2007-08-10 13:57 ` [PATCH resend] " Sven Verdoolaege
2007-08-11 5:43 ` Junio C Hamano
2007-08-11 6:45 ` Sven Verdoolaege
2007-08-11 7:00 ` Junio C Hamano
2007-08-12 14:23 ` [PATCH v3] " Sven Verdoolaege
2007-08-12 18:16 ` Junio C Hamano
2007-08-12 18:50 ` Sven Verdoolaege
2007-08-12 19:24 ` Junio C Hamano
2007-08-13 9:37 ` Sven Verdoolaege
2007-08-13 17:13 ` [PATCH v4] " Sven Verdoolaege
2007-08-13 20:26 ` Junio C Hamano
[not found] ` <7vd4xqeilh.fsf@assigned-by-dhcp.cox.net>
2007-08-14 8:39 ` Sven Verdoolaege [this message]
2007-08-14 9:09 ` Junio C Hamano
2007-08-15 17:22 ` [PATCH v6] " Sven Verdoolaege
2007-08-16 0:02 ` Junio C Hamano
2007-08-14 20:00 ` [PATCH v4] " Junio C Hamano
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=20070814083940.GN999MdfPADPa@greensroom.kotnet.org \
--to=skimo@kotnet.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=prohaska@zib.de \
--cc=skimo@liacs.nl \
/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).