Skip to content

Commit

Permalink
Update attribution handling in Loz constructor
Browse files Browse the repository at this point in the history
Refactor attribution handling in the Loz constructor to ensure
proper configuration and error handling. Fix potential bugs and
improve code readability.

Generated by gpt-3.5-turbo
  • Loading branch information
joone committed Mar 18, 2024
1 parent d73678a commit 7b61a11
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/loz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,20 @@ export class Loz {
fs.mkdirSync(LOG_DEV_PATH);
}

const attributionValue = await this.git.configLoz("attribution");
if (attributionValue === "") {
this.git.configLoz("attribution", "false");
this.attribution = false;
} else {
if (attributionValue.trimEnd() === "true") {
this.attribution = true;
} else {
try {
const attributionValue = await this.git.configLoz("attribution");
if (attributionValue === "") {
this.git.configLoz("attribution", "false");
this.attribution = false;
} else {
if (attributionValue.trimEnd() === "true") {
this.attribution = true;
} else {
this.attribution = false;
}
}
} catch (error: any) {
if (DEBUG) console.log("Error reading git config: " + error);
}
}

Expand Down

0 comments on commit 7b61a11

Please sign in to comment.