Mark received pack file and generated .idx read-only
commitff09f7e201c285af38fd1293fe5ac08019ae45dc
authorShawn O. Pearce <spearce@spearce.org>
Tue, 8 Apr 2008 07:23:39 +0000 (8 03:23 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 8 Apr 2008 07:35:26 +0000 (8 03:35 -0400)
treea13fec0aca0149975586c4a15abac5af56bd7b36
parentd1282aead44dc31e449b410f82ad196b432f3ba3
Mark received pack file and generated .idx read-only

Historically git marks pack files as read-only once they have
been fully written out to disk, as this can prevent accidental
modifications from destroying important data.

We now mark both our pack and our index file read-only if we created
them and did not fail during the processing.

The test case for IndexPack was not creating the output pack or index
within a temporary directory, which meant the files were being left
over from the prior run.  This would have caused IO errors when we
ran the tests a second time as the pack and index were both marked
read-only, and thus were not writable.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit.test/tst/org/spearce/jgit/fetch/IndexPackTest.java
org.spearce.jgit/src/org/spearce/jgit/fetch/IndexPack.java