# ok for git to delete temporary packs on write error?

3 messages from 2007-11-28 to 2007-11-28. Participants: David Tweed, Nicolas Pitre.
Thread: https://gitlist.dev/t/11041

## David Tweed, 2007-11-28 07:42

Subject: ok for git to delete temporary packs on write error?
Message-ID: <e1dab3980711272342x7afad721m113fe21f6879a886@mail.gmail.com>
URL: https://gitlist.dev/e/e1dab3980711272342x7afad721m113fe21f6879a886%40mail.gmail.com

```
Hi, I'd like to check if there's any reason in the overall design of
git which would make deleting tmp_pack's that have suffered
write errors a bad idea? (Before I look further into this I may be missing
a good reason why they shouldn't be auto-deleted.)

My encounter with this comes from using an almost full
usbstick which I discovered when I was poking around
for other reasons several partial packs from occasions
(separated by weeks) where gc failed. On each failure
I'd removed stuff from the drive to clear space and done
a successful gc but hadn't thought to
check below .git for removable stuff so they'd just accumulated.

Below is a output of a test session:

$ git version
git version 1.5.3.6

$ git gc --aggressive --prune
Generating pack...
Done counting 22216 objects.
Deltifying 22216 objects...
 100% (22216/22216) done
Writing 22216 objects...
fatal: sha1 file '/media/usbdiskc/v.git/objects/tmp_pack_QCYYAi' write
error (No space left on device)
error: failed to run repack

$ ls -l /media/usbdiskc/v.git/objects/
total 3944
drwxr-xr-x 2 sis05dst sis05dst    2048 2007-11-28 07:25 info
drwxr-xr-x 2 sis05dst sis05dst    2048 2007-11-28 07:25 pack
-rwxr-xr-x 1 sis05dst sis05dst 4034560 2007-11-28 07:25 tmp_pack_QCYYAi
-rw------- 1 sis05dst sis05dst       0 2007-04-18 23:02 tmp_pack_RYLguI

-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
"we had no idea that when we added templates we were adding a Turing-
complete compile-time language." -- C++ standardisation committee

```

## Nicolas Pitre, 2007-11-28 15:01

Subject: Re: ok for git to delete temporary packs on write error?
Message-ID: <alpine.LFD.0.99999.0711281000590.9605@xanadu.home>
URL: https://gitlist.dev/e/alpine.LFD.0.99999.0711281000590.9605%40xanadu.home
In-Reply-To: <e1dab3980711272342x7afad721m113fe21f6879a886@mail.gmail.com>

```
On Wed, 28 Nov 2007, David Tweed wrote:

> Hi, I'd like to check if there's any reason in the overall design of
> git which would make deleting tmp_pack's that have suffered
> write errors a bad idea? (Before I look further into this I may be missing
> a good reason why they shouldn't be auto-deleted.)
> 
> My encounter with this comes from using an almost full
> usbstick which I discovered when I was poking around
> for other reasons several partial packs from occasions
> (separated by weeks) where gc failed. On each failure
> I'd removed stuff from the drive to clear space and done
> a successful gc but hadn't thought to
> check below .git for removable stuff so they'd just accumulated.

I'd suggest they get removed a part of the prune command.


Nicolas

```

## David Tweed, 2007-11-28 15:48

Subject: Re: ok for git to delete temporary packs on write error?
Message-ID: <e1dab3980711280748s53bf23f4j11be8c0472b7a216@mail.gmail.com>
URL: https://gitlist.dev/e/e1dab3980711280748s53bf23f4j11be8c0472b7a216%40mail.gmail.com
In-Reply-To: <alpine.LFD.0.99999.0711281000590.9605@xanadu.home>

```
On Nov 28, 2007 3:01 PM, Nicolas Pitre <nico@cam.org> wrote:
> On Wed, 28 Nov 2007, David Tweed wrote:
>
> > Hi, I'd like to check if there's any reason in the overall design of
> > git which would make deleting tmp_pack's that have suffered
> > write errors a bad idea? (Before I look further into this I may be missing
> > a good reason why they shouldn't be auto-deleted.)
[snip]
> I'd suggest they get removed a part of the prune command.

Mmm, I hadn't looked at the source and spotted the prune
is actually a separate process to the repack. From a policy
POV is it ok to assume any tmp_pack*'s existing when
prune is run can be deleted? (I know you're not supposed
to be having any other git ops going on whilst git gc works.)

Now I know they aren't being kept around for, say, "emergency
error recovery" I may look to see if I can come up with
an acceptable patch. (Don't hold your breath waiting.)

-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
"we had no idea that when we added templates we were adding a Turing-
complete compile-time language." -- C++ standardisation committee

```
