git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyen Thai Ngoc Duy" <pclouds@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Subject: [MinGW port] Unable to repack on Clearcase dynamic views
Date: Wed, 30 May 2007 10:42:53 -0400	[thread overview]
Message-ID: <fcaeb9bf0705300742u22b54c78vccbc037fb553141f@mail.gmail.com> (raw)

Hi,

On clearcase dynamic views (kind of virtual drives), "mv -f a b" won't
work if "a" is read-only. Because git-repack.sh removes all write
permission before moving packs, it fails on clearcase dynamic views.

My approach is rather ugly. Does anyone have a better solution?

diff --git a/git-repack.sh b/git-repack.sh
index acb78ba..76a9525 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -86,10 +86,22 @@ else
 	mv -f "$PACKTMP-$name.idx"  "$PACKDIR/pack-$name.idx" &&
 	test -f "$PACKDIR/pack-$name.pack" &&
 	test -f "$PACKDIR/pack-$name.idx" || {
-		echo >&2 "Couldn't replace the existing pack with updated one."
-		echo >&2 "The original set of packs have been saved as"
-		echo >&2 "old-pack-$name.{pack,idx} in $PACKDIR."
-		exit 1
+		# Clearcase dynamic views do not allow to move file without write permission
+		# Try the second time with write allowed
+		chmod u+w "$PACKTMP-$name.pack"
+		chmod u+w "$PACKTMP-$name.idx"
+
+		mv -f "$PACKTMP-$name.pack" "$PACKDIR/pack-$name.pack" &&
+		mv -f "$PACKTMP-$name.idx"  "$PACKDIR/pack-$name.idx" &&
+		test -f "$PACKDIR/pack-$name.pack" &&
+		test -f "$PACKDIR/pack-$name.idx" || {
+			echo >&2 "Couldn't replace the existing pack with updated one."
+			echo >&2 "The original set of packs have been saved as"
+			echo >&2 "old-pack-$name.{pack,idx} in $PACKDIR."
+			exit 1
+		}
+		chmod a-w "$PACKDIR/pack-$name.pack"
+		chmod a-w "$PACKDIR/pack-$name.idx"
 	}
 	rm -f "$PACKDIR/old-pack-$name.pack" "$PACKDIR/old-pack-$name.idx"
 fi


-- 
Duy

             reply	other threads:[~2007-05-30 14:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-30 14:42 Nguyen Thai Ngoc Duy [this message]
2007-05-30 15:11 ` [MinGW port] Unable to repack on Clearcase dynamic views Paolo Teti
2007-05-30 15:33   ` Nguyen Thai Ngoc Duy
2007-05-30 16:30     ` Paolo Teti
2007-05-30 18:28     ` Robin Rosenberg
2007-05-30 18:44       ` Johannes Schindelin
2007-05-30 19:08       ` Nguyen Thai Ngoc Duy
2007-05-30 19:28         ` Robin Rosenberg
2007-05-30 19:48           ` Nguyen Thai Ngoc Duy
2007-05-31  9:46       ` Paolo Teti
2007-05-31 18:51         ` Robin Rosenberg
2007-06-01 18:11       ` Jan Hudec
2007-05-30 15:28 ` Johannes Sixt
     [not found]   ` <fcaeb9bf0705300840w221c46c1y742388fc9e61c2fa@mail.gmail.com>
2007-05-30 15:43     ` Fwd: " Nguyen Thai Ngoc Duy

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=fcaeb9bf0705300742u22b54c78vccbc037fb553141f@mail.gmail.com \
    --to=pclouds@gmail.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).