Nguyen Thai Ngoc Duy wrote: > 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? If you do two 'git repack -a -d' in a row, the second one fails even with this patch, right? To fix it, you must 'chmod u+w' in the for-loop right above this hunk, too. Since you 'chmod a-w' after the mv, why not just remove the first ones before the first mv? Then you can get rid of the second try. -- Hannes > > 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html