Skip to content

fix multiple git update-index invocations - #2531

Merged
ttaylorr merged 1 commit into
masterfrom
lars/fix-update-index
Aug 26, 2017
Merged

ttaylorr merged 1 commit into
masterfrom
lars/fix-update-index

Conversation

@larsxschneider

Copy link
Copy Markdown
Member

The gitIndexer starts a new git update-index process when the first
file is given to it. A reference to this process is stored in the cmd
variable of the gitIndexer struct. This variable was always nil after
the refactoring in ae4d261 ("move git update-index invocation to git
package", 2017-08-02). Consequently, a new git update-index process
was invoked for every file.

Fix this by refactoring the git update-index invocation, again. This
time we return the subprocess pointer. This is necessary because we
want to call Wait() on the process when the gitIndexer is closed.


I noticed the bug in #2439 and realized that I introduced it with my recent refactoring. Sorry!
Has anyone a good idea how to check the number of invoked git update-index processes in a test case?

The gitIndexer starts a new `git update-index` process when the first
file is given to it. A reference to this process is stored in the `cmd`
variable of the gitIndexer struct. This variable was always `nil` after
the refactoring in ae4d261 ("move `git update-index` invocation to git
package", 2017-08-02). Consequently, a new `git update-index` process
was invoked for every file.

Fix this by refactoring the `git update-index` invocation, again. This
time we return the subprocess pointer. This is necessary because we
want to call `Wait()` on the process when the gitIndexer is closed.

@ttaylorr ttaylorr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks great -- and great detective work tracking this down.

I think adding something to the integration tests to measure how many Git processes an individual test spawns and abandons would be interesting future work.

For now, this looks great. I've scheduled it for the next release.

@ttaylorr ttaylorr added this to the v2.3.0 milestone Aug 26, 2017
@ttaylorr
ttaylorr merged commit 05fd09f into master Aug 26, 2017
@ttaylorr
ttaylorr deleted the lars/fix-update-index branch August 26, 2017 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants