Skip to content

Commit

Permalink
fix: use git show instead of git log (#118)
Browse files Browse the repository at this point in the history
git log showed all commits to the given commit and hence was running out of memory
  • Loading branch information
eseliger committed Oct 20, 2018
1 parent d8fecf4 commit b8121af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/adapter.ts
Expand Up @@ -30,9 +30,9 @@ export interface TableRow {
id: number
name: string
type: TaskType
commit: string
commit: string | null
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
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
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

0 comments on commit b8121af

Please sign in to comment.