-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: recover when there is unreleased lock file #914
Conversation
main.go
Outdated
@@ -1227,6 +1227,19 @@ func (git *repoSync) removeStaleWorktrees() (int, error) { | |||
return count, nil | |||
} | |||
|
|||
func hasGitLockFile(gitRoot absPath) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about also returning the name of the first detected lockfile which , so the caller can log it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Just one super small point, then LGTM. Thanks! |
2aaecde
to
36c9c74
Compare
If a previous git invocation crashes, it is possible that an orphaned lock file (e.g. shallow.lock) is left on the filesystem. This previously caused git-sync to crash loop because the lock file is never deleted. This change adds a check in sanityCheckRepo for the existence of a git lock file. If the git lock file exists at this stage, then initRepo will re-initialize the repository.
36c9c74
to
ae22b20
Compare
Thanks! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sdowell, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
If a previous git invocation crashes, it is possible that an orphaned lock file (e.g. shallow.lock) is left on the filesystem. This previously caused git-sync to crash loop because the lock file is never deleted.
This change adds a check in sanityCheckRepo for the existence of a git lock file. If the git lock file exists at this stage, then initRepo will re-initialize the repository.