git-town icon indicating copy to clipboard operation
git-town copied to clipboard

fatal on existing lock file

Open aeneasr opened this issue 8 years ago • 8 comments

git hack fix-introspect-error

[remove-jose] git fetch --prune
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), done.
From https://github.com/ory/fosite
   9abdfd0..d26aa4a  master     -> origin/master
 * [new tag]         v0.9.3     -> v0.9.3

cd C:/workspace/go/src/github.com/ory/fosite

[remove-jose] git checkout master
Switched to branch 'master'
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
  (use "git pull" to update your local branch)

[master] git rebase origin/master
First, rewinding head to replay your work on top of it...
Fast-forwarded master to origin/master.

[master] git checkout -b fix-introspect-error master
Switched to a new branch 'fix-introspect-error'
2017/06/05 16:10:52 Command: git checkout remove-jose
Output: fatal: Unable to create 'C:/workspace/go/src/github.com/ory/fosite/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

Error: exit status 128


aeneasr avatar Jun 05 '17 14:06 aeneasr

The error message it gives seems to explain the issue. I'm not certain if we can really plan for that type of failure

charlierudolph avatar Jun 05 '17 16:06 charlierudolph

I would expect git-town to roll back any previous actions if possible

aeneasr avatar Jun 05 '17 18:06 aeneasr

Any idea as to why this occurred on git checkout remove-jose (which is being ran at the end to preserve the checkout history) instead of the previous checkout commands?

charlierudolph avatar Jun 05 '17 18:06 charlierudolph

nope, I was not running any parallel git functions which is why this tripped me.

aeneasr avatar Jun 05 '17 18:06 aeneasr

@arekkas did you have another Git client open, like IntelliJ of Github Desktop? They sometimes perform Git commands in the background. Git isn't thread-safe, it errs out when another Git process is currently doing something in the same repo.

@charlierudolph what do you think about automatically retrying (for like 3 times or so) when we encounter this error (with a 1 second delay in between runs to give the other Git process time to finish)?

kevgo avatar Jun 06 '17 08:06 kevgo

Yes, IntelliJ was open, maybe that caused the issue!

aeneasr avatar Jun 06 '17 09:06 aeneasr

@charlierudolph what do you think about automatically retrying (for like 3 times or so) when we encounter this error (with a 1 second delay in between runs to give the other Git process time to finish)?

@kevgo I'm not certain what commands we would do that with. Not all commands can be retried immediately and many fail for different reasons. I think the better approach would be just to plan for this error and allow abort / continue. This was an unexpected error which caused a panic.

charlierudolph avatar Jun 06 '17 16:06 charlierudolph

Okay, allowing abort or continue sounds good as well. Good idea.

kevgo avatar Jun 07 '17 21:06 kevgo

Git Town now exits properly when encountering such issues. When that happens, you can run git town continue to retry or git town undo to abort.

kevgo avatar Apr 14 '24 14:04 kevgo