git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Do not rename read-only files during a push
@ 2008-09-22 17:20 Petr Baudis
  2008-10-03 10:20 ` Petr Baudis
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2008-09-22 17:20 UTC (permalink / raw)
  To: git, git; +Cc: gitster

Win32 does not allow renaming read-only files (at least on a Samba
share), making push into a local directory to fail. Thus, defer
the chmod() call in index-pack.c:final() only after
move_temp_to_file() was called.

Signed-off-by: Petr Baudis <pasky@suse.cz>

---
 index-pack.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/index-pack.c b/index-pack.c
index a6e91fe..2af72d6 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -786,7 +786,6 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
 		err = close(output_fd);
 		if (err)
 			die("error while closing pack file: %s", strerror(errno));
-		chmod(curr_pack_name, 0444);
 	}
 
 	if (keep_msg) {
@@ -820,8 +819,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
 		if (move_temp_to_file(curr_pack_name, final_pack_name))
 			die("cannot store pack file");
 	}
+	chmod(final_pack_name, 0444);
 
-	chmod(curr_index_name, 0444);
 	if (final_index_name != curr_index_name) {
 		if (!final_index_name) {
 			snprintf(name, sizeof(name), "%s/pack/pack-%s.idx",
@@ -831,6 +830,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
 		if (move_temp_to_file(curr_index_name, final_index_name))
 			die("cannot store index file");
 	}
+	chmod(final_index_name, 0444);
 
 	if (!from_stdin) {
 		printf("%s\n", sha1_to_hex(sha1));
-- 
tg: (fe33b33..) t/pack/rdonly (depends on: vanilla/master)

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

* Re: [PATCH] Do not rename read-only files during a push
  2008-09-22 17:20 [PATCH] Do not rename read-only files during a push Petr Baudis
@ 2008-10-03 10:20 ` Petr Baudis
  2008-10-03 14:16   ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2008-10-03 10:20 UTC (permalink / raw)
  To: git; +Cc: spearce

On Mon, Sep 22, 2008 at 07:20:29PM +0200, Petr Baudis wrote:
> Win32 does not allow renaming read-only files (at least on a Samba
> share), making push into a local directory to fail. Thus, defer
> the chmod() call in index-pack.c:final() only after
> move_temp_to_file() was called.
> 
> Signed-off-by: Petr Baudis <pasky@suse.cz>

Ping?

				Petr "Pasky" Baudis

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

* Re: [PATCH] Do not rename read-only files during a push
  2008-10-03 10:20 ` Petr Baudis
@ 2008-10-03 14:16   ` Shawn O. Pearce
  2008-10-03 14:19     ` Miklos Vajna
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn O. Pearce @ 2008-10-03 14:16 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> wrote:
> On Mon, Sep 22, 2008 at 07:20:29PM +0200, Petr Baudis wrote:
> > Win32 does not allow renaming read-only files (at least on a Samba
> > share), making push into a local directory to fail. Thus, defer
> > the chmod() call in index-pack.c:final() only after
> > move_temp_to_file() was called.
> > 
> > Signed-off-by: Petr Baudis <pasky@suse.cz>
> 
> Ping?

Hmmph.  It got dropped by accident.  I don't remember seeing this
patch via email, and its not on GMane.  I found it on marc and am
applying it right now.  Thanks for the reminder.

-- 
Shawn.

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

* Re: [PATCH] Do not rename read-only files during a push
  2008-10-03 14:16   ` Shawn O. Pearce
@ 2008-10-03 14:19     ` Miklos Vajna
  0 siblings, 0 replies; 4+ messages in thread
From: Miklos Vajna @ 2008-10-03 14:19 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Petr Baudis, git

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

On Fri, Oct 03, 2008 at 07:16:28AM -0700, "Shawn O. Pearce" <spearce@spearce.org> wrote:
> Hmmph.  It got dropped by accident.  I don't remember seeing this
> patch via email, and its not on GMane.

It has a duplicated To: header, probably it was filtered out as spam.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2008-10-03 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 17:20 [PATCH] Do not rename read-only files during a push Petr Baudis
2008-10-03 10:20 ` Petr Baudis
2008-10-03 14:16   ` Shawn O. Pearce
2008-10-03 14:19     ` Miklos Vajna

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