Skip to content

Commit

Permalink
Support git 2.29 sha256 (#1436)
Browse files Browse the repository at this point in the history
* Support git 2.29 sha256

* Update CHANGELOG.md
  • Loading branch information
campersau committed Oct 21, 2020
1 parent 90ca5f4 commit c106484
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@ We are following the [Keep a Changelog](https://keepachangelog.com/) format.

### Fixed
- branches - can't re-enable disabled groups [#1434](https://github.com/FredrikNoren/ungit/issues/1434)
- Support git 2.29 sha256 [#1436](https://github.com/FredrikNoren/ungit/pull/1436)

## [1.5.11](https://github.com/FredrikNoren/ungit/compare/v1.5.10...v1.5.11)

Expand Down
8 changes: 7 additions & 1 deletion source/git-promise.js
Expand Up @@ -8,6 +8,7 @@ const _ = require('lodash');
const isWindows = /^win/.test(process.platform);
const fs = require('fs').promises;
const gitEmptyReproSha1 = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'; // https://stackoverflow.com/q/9765453
const gitEmptyReproSha256 = '6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321'; // https://stackoverflow.com/q/9765453
const gitConfigArguments = [
'-c',
'color.ui=false',
Expand Down Expand Up @@ -364,7 +365,12 @@ git.binaryFileContent = (repoPath, filename, version, outPipe) => {
git.diffFile = (repoPath, filename, oldFilename, sha1, ignoreWhiteSpace) => {
if (sha1) {
return git(['rev-list', '--max-parents=0', sha1], repoPath).then((initialCommitSha1) => {
const prevSha1 = sha1 == initialCommitSha1.trim() ? gitEmptyReproSha1 : `${sha1}^`;
const prevSha1 =
sha1 == initialCommitSha1.trim()
? sha1.length == 64
? gitEmptyReproSha256
: gitEmptyReproSha1
: `${sha1}^`;
if (oldFilename && oldFilename !== filename) {
return git(
[
Expand Down

0 comments on commit c106484

Please sign in to comment.