Skip to content
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: look for .git dir in parents of input dir #7

Merged
merged 1 commit into from
May 25, 2018
Merged

Conversation

nexdrew
Copy link
Owner

@nexdrew nexdrew commented May 25, 2018

PR #2 changed the git command used by next-build-id from using the -C flag to using the --git-dir and --work-tree flags, which are more strict in the sense that if the directory path given does not exist, git will fail, whereas the -C flag will work for any subdirectory within a git project.

Unfortunately the test suite for next-build-id was not smart enough to accurately mimic this git behavior, so the problem was unknown until I started using an upgraded version of this lib.

This PR fixes that regression by:

  1. Changing the logic that issues the git command to first find the parent directory that contains a valid .git dir (if it exists) before calling the git command
  2. Improving the mocked git command for tests such that it will fail if the --git-dir path does not exist

PR #2 introduced a regression that broke support for non-project-root input dirs and the test suite was not smart enough to find it, this fixes that
@nexdrew nexdrew merged commit bcc374b into master May 25, 2018
@nexdrew nexdrew deleted the fix-git-dir branch May 25, 2018 20:02
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.

None yet

1 participant