Skip to content

Commit

Permalink
fix: Refresh Git index in release clone before diff ⚓ (#100)
Browse files Browse the repository at this point in the history
- In certain circumstances (e.g. Githooks installed in containers) it can happen that the release clone's index
  is out of sync. As a workaround, just refresh the index.
  • Loading branch information
gabyx authored Feb 10, 2023
1 parent 9f62102 commit 3f9b4e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions githooks/updates/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ func FetchUpdates(
reclone := false

// Check if clone is dirty, if so error out.
// Git index can be out of sync (when this is installed in containers),
// so update the index first.
// To make the `diff-index` command work correctly.
_ = gitx.Check("update-index", "--refresh")
exitCode, e := gitx.GetExitCode("diff-index", "--quiet", git.HEAD)
if e != nil {
return false,
Expand Down

0 comments on commit 3f9b4e8

Please sign in to comment.