Re: fatal: unable to create '.git/index': File exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/5/07, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
Hi,

On Fri, 5 Jan 2007, Len Brown wrote:

> I kicked off a pull.
> Realized I was on the wrong branch
> and immediately did a ^C
>
> Now I can't change branches:
>
> # git checkout release
> fatal: unable to create '.git/index': File exists

This usually means that .git/index.lock exists. Try removing that file.

However, it _should_ be removed by the atexit() handler, methinks. I have
no idea why it does not.

We will get SIGINT when the user hits ^C so I don't think the atexit handler
will run. However, we also install a signal handler for SIGINT which removes
the lock file, so I don't really see how it can be left around...

There is a small race condition between open and signal as we do

   fd = open(lk->filename, O_RDWR | O_CREAT | O_EXCL, 0666);
   ...
   signal(SIGINT, remove_lock_file_on_signal);
   atexit(remove_lock_file);

in lock_file:lockfile.c. But I think it is very improbable that the user hits ^C
between  "open" and "signal". It might be worth fixing though.

Are there any other signals we might get when the user hits ^C? SIGPIPE?

- Fredrik
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]