git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [REGRESSION] Interrupted clone/fetch leaves .lock files around

From
Jonas Fonseca <fonseca@diku.dk>
Date
Jun 6, 2006, 19:02 UTC
Message-ID
<20060606190255.GB15521@diku.dk>
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. ;)
 
Show 25 quoted lines
> 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;
...
Show 10 quoted lines
> @@ -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
Previous: Jonas FonsecaNext: Junio C Hamano
Message 2 of 4 in “[REGRESSION] Interrupted clone/fetch leaves .lock files around”
  1. Jonas FonsecaJun 6, 2006
  2. Jonas FonsecaJun 6, 2006
  3. Junio C HamanoJun 6, 2006
  4. Junio C HamanoJun 6, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.