git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] When copying or renaming, keep the mode, please
@ 2005-08-17  7:01 Johannes Schindelin
  2005-08-17  7:32 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Schindelin @ 2005-08-17  7:01 UTC (permalink / raw)
  To: Junio C Hamano, git

Without this patch, git-apply does not retain the mode when renaming or
copying files.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---

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

8dca30668d7077fa9b9157c3685b3ace8598a514
diff --git a/apply.c b/apply.c
--- a/apply.c
+++ b/apply.c
@@ -1043,8 +1043,12 @@ static int check_patch(struct patch *pat
 			return error("%s: already exists in working directory", new_name);
 		if (errno != ENOENT)
 			return error("%s: %s", new_name, strerror(errno));
-		if (!patch->new_mode)
-			patch->new_mode = S_IFREG | 0644;
+		if (!patch->new_mode) {
+			if (patch->is_new)
+				patch->new_mode = S_IFREG | 0644;
+			else
+				patch->new_mode = patch->old_mode;
+		}
 	}
 
 	if (new_name && old_name) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] When copying or renaming, keep the mode, please
  2005-08-17  7:01 [PATCH] When copying or renaming, keep the mode, please Johannes Schindelin
@ 2005-08-17  7:32 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2005-08-17  7:32 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Good catch.  Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-17  7:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-17  7:01 [PATCH] When copying or renaming, keep the mode, please Johannes Schindelin
2005-08-17  7:32 ` Junio C Hamano

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).