Skip to content

Commit

Permalink
Fix Stash check
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisamiga committed Jan 5, 2025
1 parent 0a7d220 commit 93fda74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 5 additions & 2 deletions Discord-Bot/commands/utility/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ module.exports = {
try {
// Check if there are any updates to the repo then pull
const status = await git.status();
if (status.files.length > 0) {
let hasChanges = status.files.length > 0;

if (hasChanges) {
await git.add('../');
await git.commit('Stashing changes before pull');
await git.stash();
}

await git.pull('origin', process.env.GIT_BRANCH);

if (status.files.length > 0) {
const stashList = await git.stashList();
if (stashList.total > 0) {
await git.stash(['pop']);
}

Expand Down
13 changes: 8 additions & 5 deletions Discord-Bot/events/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,21 @@ module.exports = {
try {
// Check if there are any updates to the repo then pull
const status = await git.status();
if (status.files.length > 0) {
let hasChanges = status.files.length > 0;

if (hasChanges) {
await git.add('../');
await git.commit('Stashing changes before pull');
await git.stash();
}

await git.pull('origin', process.env.GIT_BRANCH);

if (status.files.length > 0) {

const stashList = await git.stashList();
if (stashList.total > 0) {
await git.stash(['pop']);
}

await git.add('../');
await git.commit(`Added ${itemRemoved} to the wishlist`);
await git.push('origin', process.env.GIT_BRANCH);
Expand Down

0 comments on commit 93fda74

Please sign in to comment.