-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically deepen clones to find correct commits (#495)
* Automatically deepen clones to find correct commits This fixes #494 - where we would get the wrong commit that added a file if we were operating in a shallow repository that didn't contain the actual commit - by modifying `getCommitThatAddsFile` so that it automatically deepens a shallow clone until it finds the _real_ commit that added a file. * Switch to a bulk getCommitsThatAddFiles Instead of running multiple getCommitThatAddsFile calls in parallel and trying to figure out how to do shallow-clone-deepening safely in such an environment, we move to a bulk getCommitsThatAddFiles call that itself retrieves commit information for all the files simultaneously and safely deepens the clone as necessary. * Make `isRepoShallow` work on older versions of Git Changesets' CircleCI build is using Git 2.11, which doesn't support `rev-parse --is-shallow-repository`. Testing for the existence of `.git/shallow` is a good workaround for older versions of Git, but in case of future `.git` folder changes, we'll use `--is-shallow-repository` if present. * Move logic to appropriate path Move the recalculation of the `remaining` commits to the only control path that actually uses it to clarify the logic. * Tweak changesets Co-authored-by: Mateusz Burzy艅ski <mateuszburzynski@gmail.com>
- Loading branch information
Showing
8 changed files
with
332 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@changesets/git": minor | ||
--- | ||
|
||
Automatically deepen shallow clones in order to determine the correct commit at which changesets were added. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@changesets/git": minor | ||
--- | ||
|
||
Deprecate the `getCommitThatAddsFile` function. It's replaced with a bulk `getCommitsThatAddFiles` operation which will safely deepen a | ||
shallow repo whilst processing multiple filenames simultaneously. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@changesets/cli": minor | ||
--- | ||
|
||
Automatically deepen shallow clones in order to determine the correct commit at which changesets were added. This helps Git-based changelog generators to always link to the correct commit. From now on it's not required to configure `fetch-depth: 0` for your `actions/checkout` when using [Changesets GitHub action](https://github.com/changesets/action). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
"spawndamnit": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"file-url": "^3.0.0", | ||
"fixturez": "^1.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.