git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Don Zickus <dzickus@redhat.com>,
	Alexander Potashev <aspotashev@gmail.com>
Subject: [PATCH] builtin-apply.c: do not set bogus mode in check_preimage() for deleted path
Date: Wed, 28 Jan 2009 15:27:54 -0800	[thread overview]
Message-ID: <7vocxrj9j9.fsf@gitster.siamese.dyndns.org> (raw)

If it is deleted, it is deleted.  Do not set the current mode to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * This updates 1f7903a (builtin-apply: prevent non-explicit permission
   changes, 2009-01-02).  It should not change the behaviour in the normal
   case, because we do not explicitly check the final mode of a deletion
   patch.  We do check the deletion patch creates an empty result, and we
   might want to fix that someday, and at that point the existing code
   will break.

   Also I suspect this codepath has been broken the use case 7a07841
   (git-apply: handle a patch that touches the same path more than once
   better, 2008-06-27) wanted to support, and if that is the case, this
   would fix it.

 builtin-apply.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index b415daf..1e7f917 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2453,7 +2453,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
 	if (st_mode != patch->old_mode)
 		fprintf(stderr, "warning: %s has type %o, expected %o\n",
 			old_name, st_mode, patch->old_mode);
-	if (!patch->new_mode)
+	if (!patch->new_mode && !patch->is_delete)
 		patch->new_mode = st_mode;
 	return 0;
 
-- 
1.6.1.1.278.g6a817

             reply	other threads:[~2009-01-28 23:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 23:27 Junio C Hamano [this message]
2009-01-29  1:46 ` [PATCH] builtin-apply.c: do not set bogus mode in check_preimage() for deleted path Don Zickus

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=7vocxrj9j9.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=aspotashev@gmail.com \
    --cc=dzickus@redhat.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).