Skip to content

Commit

Permalink
Fix edo show when prev is null
Browse files Browse the repository at this point in the history
When STAGE~0 specified and just one index with null in prev, edo would
read rsha1 (or base sha1) instead of lsha1 (last).
This is due test on prev == null. Should be different test.
  • Loading branch information
danko committed Dec 13, 2019
1 parent 14a6108 commit 8930eca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api/EdoCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class EdoCache {
index = await EdoCache.readIndex(index.prev);
} else {
if ( (i + 1) == backref) {
index.prev = 'null'; // set to null in case sha1 doesn't exist (because of gc)
index.prev = 'base'; // set to base in case sha1 doesn't exist (because of gc)
break; // if we are
}
throw new Error(`Invalid object name ${stage}~${backref}`);
Expand Down
5 changes: 4 additions & 1 deletion src/cli/EdoShow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export class EdoShow {
let stage: string = refs[1];
let backref: number = parseInt(refs[3]);
let file: string = refs[4];
if (refs[1] == 'remote/STAGE') {
stage = 'remote/' + (await FileUtils.readStage(true));
}
if (refs[1] == 'STAGE' || refs[1] == 'HEAD') {
stage = await FileUtils.readStage(true);
}
Expand All @@ -54,7 +57,7 @@ export class EdoShow {
process.exit(1);
}
let fileSha1 = index.elem[file][0];
if (index.prev == 'null') {
if (index.prev == 'base') {
fileSha1 = index.elem[file][1];
}
const out: Buffer = await EdoCache.getSha1Object(fileSha1, EdoCache.OBJ_BLOB);
Expand Down

0 comments on commit 8930eca

Please sign in to comment.