Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/thin-pumas-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@changesets/apply-release-plan": minor
"@changesets/cli": minor
---

Avoid using short commit IDs
5 changes: 2 additions & 3 deletions packages/apply-release-plan/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function getCommitsThatAddChangesets(
cwd: string
) {
const paths = changesetIds.map((id) => `.changeset/${id}.md`);
const commits = await git.getCommitsThatAddFiles(paths, { cwd, short: true });
const commits = await git.getCommitsThatAddFiles(paths, { cwd });

if (commits.every(stringDefined)) {
// We have commits for all files
Expand All @@ -52,8 +52,7 @@ async function getCommitsThatAddChangesets(

const legacyPaths = missingIds.map((id) => `.changeset/${id}/changes.json`);
const commitsForLegacyPaths = await git.getCommitsThatAddFiles(legacyPaths, {
cwd,
short: true,
cwd
});

// Fill in the blanks in the array of commits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function getReleaseLine(changeset: NewChangeset, cwd: string) {

const [commitThatAddsFile] = await getCommitsThatAddFiles(
[`.changeset/${changeset.id}.md`],
{ cwd, short: true }
{ cwd }
);

return `- [${commitThatAddsFile}] ${firstLine}\n${futureLines
Expand Down
4 changes: 2 additions & 2 deletions packages/changelog-git/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getReleaseLine = async (
.map((l) => l.trimRight());

let returnVal = `- ${
changeset.commit ? `${changeset.commit}: ` : ""
changeset.commit ? `${changeset.commit.slice(0, 7)}: ` : ""
}${firstLine}`;

if (futureLines.length > 0) {
Expand All @@ -33,7 +33,7 @@ const getDependencyReleaseLine = async (
const changesetLinks = changesets.map(
(changeset) =>
`- Updated dependencies${
changeset.commit ? ` [${changeset.commit}]` : ""
changeset.commit ? ` [${changeset.commit.slice(0, 7)}]` : ""
}`
);

Expand Down
3 changes: 2 additions & 1 deletion packages/changelog-github/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ const changelogFunctions: ChangelogFunctions = {
pull: prFromSummary,
});
if (commitFromSummary) {
const shortCommitId = commitFromSummary.slice(0, 7);
links = {
...links,
commit: `[\`${commitFromSummary}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`,
commit: `[\`${shortCommitId}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`,
};
}
return links;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/version/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default async function version(
? {
tag: options.snapshot === true ? undefined : options.snapshot,
commit: config.snapshot.prereleaseTemplate?.includes("{commit}")
? await getCurrentCommitId({ cwd, short: true })
? await getCurrentCommitId({ cwd })
: undefined,
}
: undefined
Expand Down
4 changes: 2 additions & 2 deletions packages/get-github-info/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export async function getInfo(request: {
user: user ? user.login : null,
pull: associatedPullRequest ? associatedPullRequest.number : null,
links: {
commit: `[\`${request.commit}\`](${data.commitUrl})`,
commit: `[\`${request.commit.slice(0, 7)}\`](${data.commitUrl})`,
pull: associatedPullRequest
? `[#${associatedPullRequest.number}](${associatedPullRequest.url})`
: null,
Expand Down Expand Up @@ -255,7 +255,7 @@ export async function getInfoFromPullRequest(request: {
commit: commit ? commit.abbreviatedOid : null,
links: {
commit: commit
? `[\`${commit.abbreviatedOid}\`](${commit.commitUrl})`
? `[\`${commit.abbreviatedOid.slice(0, 7)}\`](${commit.commitUrl})`
: null,
pull: `[#${request.pull}](https://github.com/${request.repo}/pull/${request.pull})`,
user: user ? `[@${user.login}](${user.url})` : null,
Expand Down