{"thread":{"id":"17423","subject":"[PATCH] builtin-apply.c: do not set bogus mode in check_preimage() for deleted path","startedAt":"2009-01-28T23:27:54Z","lastAt":"2009-01-29T01:46:20Z","messageCount":2,"participants":["Junio C Hamano","Don Zickus"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"102371","messageId":"7vocxrj9j9.fsf@gitster.siamese.dyndns.org","threadId":"17423","inReplyTo":null,"subject":"[PATCH] builtin-apply.c: do not set bogus mode in check_preimage() for deleted path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-28T23:27:54Z","receivedAt":"2009-01-28T23:27:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"If it is deleted, it is deleted.  Do not set the current mode to it.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * This updates 1f7903a (builtin-apply: prevent non-explicit permission\n   changes, 2009-01-02).  It should not change the behaviour in the normal\n   case, because we do not explicitly check the final mode of a deletion\n   patch.  We do check the deletion patch creates an empty result, and we\n   might want to fix that someday, and at that point the existing code\n   will break.\n\n   Also I suspect this codepath has been broken the use case 7a07841\n   (git-apply: handle a patch that touches the same path more than once\n   better, 2008-06-27) wanted to support, and if that is the case, this\n   would fix it.\n\n builtin-apply.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-apply.c b/builtin-apply.c\nindex b415daf..1e7f917 100644\n--- a/builtin-apply.c\n+++ b/builtin-apply.c\n@@ -2453,7 +2453,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s\n \tif (st_mode != patch->old_mode)\n \t\tfprintf(stderr, \"warning: %s has type %o, expected %o\\n\",\n \t\t\told_name, st_mode, patch->old_mode);\n-\tif (!patch->new_mode)\n+\tif (!patch->new_mode && !patch->is_delete)\n \t\tpatch->new_mode = st_mode;\n \treturn 0;\n \n-- \n1.6.1.1.278.g6a817\n"},{"id":"102382","messageId":"20090129014620.GE13271@redhat.com","threadId":"17423","inReplyTo":"7vocxrj9j9.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] builtin-apply.c: do not set bogus mode in check_preimage() for deleted path","fromName":"Don Zickus","fromEmail":"dzickus@redhat.com","sentAt":"2009-01-29T01:46:20Z","receivedAt":"2009-01-29T01:46:20Z","isPatch":true,"sender":{"key":"dzickus@redhat.com","avatar":null},"body":"On Wed, Jan 28, 2009 at 03:27:54PM -0800, Junio C Hamano wrote:\n>    Also I suspect this codepath has been broken the use case 7a07841\n>    (git-apply: handle a patch that touches the same path more than once\n>    better, 2008-06-27) wanted to support, and if that is the case, this\n>    would fix it.\n\nActually deleting patches weren't that interesting to me, I deal more with\npatches modifying the same patch repeatedly.  Regardless the patch below\nseems ok to me.\n\nAcked-by: Don Zickus <dzickus@redhat.com>\n\n> \n>  builtin-apply.c |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> \n> diff --git a/builtin-apply.c b/builtin-apply.c\n> index b415daf..1e7f917 100644\n> --- a/builtin-apply.c\n> +++ b/builtin-apply.c\n> @@ -2453,7 +2453,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s\n>  \tif (st_mode != patch->old_mode)\n>  \t\tfprintf(stderr, \"warning: %s has type %o, expected %o\\n\",\n>  \t\t\told_name, st_mode, patch->old_mode);\n> -\tif (!patch->new_mode)\n> +\tif (!patch->new_mode && !patch->is_delete)\n>  \t\tpatch->new_mode = st_mode;\n>  \treturn 0;\n>  \n> -- \n> 1.6.1.1.278.g6a817\n> \n"}]}