Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Use git hash-object for blob id if available #38

Merged
merged 1 commit into from
Jun 6, 2016
Merged

Conversation

dblandin
Copy link
Contributor

@dblandin dblandin commented Jun 6, 2016

This commit updates file blob_id generation by first shelling out to git hash-object. If git or the file is unavailable, we'll fallback to our sha1
computation.

@codeclimate/review 🔎

This commit updates file blob_id generation by first shelling out to `git
hash-object`. If `git` or the file is unavailable, we'll fallback to our `sha1`
computation.

try {
stdout = childProcess.execSync("git hash-object " + path, { stdio: [0, "pipe", "ignore"] });
} catch (e) { }
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT of adding a log here of "git hash-object failed. Falling back to manual calculation"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this called for every covered file, logging that out could get pretty noisy. On CI environments where git isn't installed, the operation would fail consistently for every file, potentially creating a lot of output.

I'd lean towards falling back gracefully, which we're doing here.

@gdiggs
Copy link
Contributor

gdiggs commented Jun 6, 2016

LGTM

@dblandin dblandin merged commit 3909a8d into master Jun 6, 2016
@dblandin dblandin deleted the devon/git-blob-id branch June 6, 2016 17:51
@dblandin dblandin mentioned this pull request Jun 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants