Empty temp files in the .git/objects subdirectories
I've noticed (sometimes) after using cg-update to pull from Linus's kernel tree, that I have multiple empty files named *.temp in the various subdirectories of .git/objects/.
These *.temp files don't exist in Linus's repository on kernel.org, so I am assuming they must be created locally at my end by either cogito or git (dunno which).
They cause no problems except for annoying warning messages, for example, while doing a git-fsck-*.
I'm using git and cogito(HEAD), both updated by using cg-update from their git repositories on kernel.org, so I'm current up to the very last minute :o)
Any suggestions how I can discover who is leaving behind all these spurious empty *.temp files?
Quoted 4 lines · walt
I've noticed (sometimes) after using cg-update to pull from Linus's kernel tree, that I have multiple empty files named *.temp in the various subdirectories of .git/objects/.
These are created by git-http-fetch to hold data as it's being fetch from the remote repository. They are left behind after a transfer error so that the next time git-http-fetch runs it can pick up where it left off. If they're empty though, it would make more sense to delete them rather than leaving them behind for the next attempt.
This should fix it:
[PATCH] Remove the temp file if it is empty after the request has failed
---
http-fetch.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
applies-to: 55caf3fd962e3b5a25ee12e09c781e6f5a240672 28738a32636e9f0a326f5d9e662df1e6c594851f
http-fetch.c +5 -0
@@ -520,12 +520,17 @@ static void start_request(struct transfestatic void finish_request (struct transfer_request *request) { +struct stat st; +fchmod (request->local,0444 );close (request->local);if (request->http_code ==416 ) {fprintf (stderr,"Warning: requested range invalid; we may already have all the data.\n" ); }else if (request->curl_result !=CURLE_OK ) { +if (stat (request->tmpfile, &st) ==0 ) +if (st.st_size ==0 ) +unlink (request->tmpfile);return ; }
---
0.99.9.GIT
Quoted 5 lines · Nick Hengeveld
These are created by git-http-fetch to hold data as it's being fetch from the remote repository. They are left behind after a transfer error so that the next time git-http-fetch runs it can pick up where it left off. If they're empty though, it would make more sense to delete them rather than leaving them behind for the next attempt.
That makes sense. Thanks.