Git development
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: git@vger.kernel.org
Subject: Re: [REGRESSION] Interrupted clone/fetch leaves .lock files around
Date: Tue, 6 Jun 2006 21:02:55 +0200	[thread overview]
Message-ID: <20060606190255.GB15521@diku.dk> (raw)
In-Reply-To: <20060606185148.GA15521@diku.dk>

Jonas Fonseca <fonseca@diku.dk> wrote Tue, Jun 06, 2006:
> Below is my feeble attempt at a (tested) fix.

Ok, so maybe I didn't test it so well, other than continuously
interrupting the fetch. ;)
 
> diff --git a/fetch.c b/fetch.c
> index e040ef9..861dc60 100644
> --- a/fetch.c
> +++ b/fetch.c
> @@ -214,9 +216,19 @@ static int mark_complete(const char *pat
>  	return 0;
>  }
>  
> +static struct ref_lock *lock = NULL;
> +
> +static void remove_lockfile_on_signal(int signo)
> +{
> +	if (lock)
> +		unlock_ref(lock);
> +	lock = NULL;
> +	signal(SIGINT, SIG_DFL);
> +	raise(signo);
> +}
> +
>  int pull(char *target)
>  {
> -	struct ref_lock *lock = NULL;
>  	unsigned char sha1[20];
>  	char *msg;
>  	int ret;
...
> @@ -261,6 +263,10 @@ int pull(char *target)
>  		if (msg)
>  			free(msg);
>  		return ret;
> +	} else {
> +		return 0;
>  	}
> -	return 0;
> +
> +	remove_lockfile_on_signal(0);

This will end up calling raise().

> +	return -1;
>  }

-- 
Jonas Fonseca

  reply	other threads:[~2006-06-06 19:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-06 18:51 [REGRESSION] Interrupted clone/fetch leaves .lock files around Jonas Fonseca
2006-06-06 19:02 ` Jonas Fonseca [this message]
2006-06-06 19:09 ` Junio C Hamano
2006-06-06 21:58   ` 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=20060606190255.GB15521@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    /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