git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Hengeveld <nickh@reactrix.com>
To: walt <wa1ter@myrealbox.com>
Cc: git@vger.kernel.org
Subject: Re: Empty temp files in the .git/objects subdirectories
Date: Thu, 3 Nov 2005 17:54:52 -0800	[thread overview]
Message-ID: <20051104015452.GB3001@reactrix.com> (raw)
In-Reply-To: <dkebkq$ova$1@sea.gmane.org>

On Thu, Nov 03, 2005 at 04:56:58PM -0800, walt wrote:

> 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

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>


---

 http-fetch.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

applies-to: 55caf3fd962e3b5a25ee12e09c781e6f5a240672
28738a32636e9f0a326f5d9e662df1e6c594851f
diff --git a/http-fetch.c b/http-fetch.c
index a1b03cd..b12779d 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -520,12 +520,17 @@ static void start_request(struct transfe
 
 static 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

  reply	other threads:[~2005-11-04  1:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04  0:56 Empty temp files in the .git/objects subdirectories walt
2005-11-04  1:54 ` Nick Hengeveld [this message]
2005-11-04  2:32   ` Junio C Hamano

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=20051104015452.GB3001@reactrix.com \
    --to=nickh@reactrix.com \
    --cc=git@vger.kernel.org \
    --cc=wa1ter@myrealbox.com \
    /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).