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: use git show instead of git log #118

Merged
merged 1 commit into from
Oct 20, 2018
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
8 changes: 4 additions & 4 deletions src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export interface TableRow {
id: number
name: string
type: TaskType
commit: string
commit: string | null
Copy link
Owner

Choose a reason for hiding this comment

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

This says null but below it assigns undefined?

head: string
applied_at: Date
applied_at: Date | null
}

export abstract class DbAdapter {
Expand Down Expand Up @@ -85,9 +85,9 @@ export abstract class DbAdapter {
id: row.id,
type: row.type,
migration: new Migration(row.name),
commit: new Commit({ sha1: row.commit }),
commit: row.commit ? new Commit({ sha1: row.commit }) : undefined,
head: new Commit({ sha1: row.head }),
appliedAt: row.applied_at,
appliedAt: row.applied_at || undefined,
})
return task
}
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class PostgresAdapter extends DbAdapter {
CREATE TABLE IF NOT EXISTS "merkel_meta" (
"id" SERIAL NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"type" merkel_migration_type,
"type" merkel_migration_type NOT NULL,
"commit" TEXT,
"head" TEXT NOT NULL,
"applied_at" TIMESTAMP WITH TIME ZONE
Expand Down
2 changes: 1 addition & 1 deletion src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class Commit {
*/
public async loadSubject(): Promise<void> {
if (this.message === undefined) {
const [stdout] = await execFile('git', ['log', '--format=%B', this.sha1])
const [stdout] = await execFile('git', ['show', '--format=%B', this.sha1])
this.message = stdout.toString()
}
}
Expand Down