Skip to content

Commit

Permalink
Hide the .git directory in the repository list
Browse files Browse the repository at this point in the history
  • Loading branch information
james-strauss-uwa committed Nov 1, 2024
1 parent 739112f commit a0cbd5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ export class Repository {
// first copy the entries to a temp directory, for sorting
const entries: [string, FileSystemHandle][] = [];
for await (const entry of dirHandle.entries()){
entries.push(entry);
if (entry[1].kind !== 'directory' || Utils.verifyFolderName(entry[0])){
entries.push(entry);
}
}

// sort
Expand Down
16 changes: 11 additions & 5 deletions src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export class Utils {
"daliuge", "dlg" // for logical graphs templates containing graph configurations
];

// disallowed folder names
static readonly DISALLOWED_FOLDER_NAMES: string[] = [
".git",
];

static ojsGraphSchema : object = {};


Expand Down Expand Up @@ -224,11 +229,12 @@ export class Utils {
const fileExtension = Utils.getFileExtension(filename);

// Check if the extension is in the list of allowed extensions
if ($.inArray(fileExtension, Utils.FILE_EXTENSIONS) != -1) {
return true;
} else {
return false;
}
return $.inArray(fileExtension, Utils.FILE_EXTENSIONS) !== -1;
}

static verifyFolderName(folderName: string): boolean {
// check if the name is in the list of disallowed
return $.inArray(folderName, Utils.DISALLOWED_FOLDER_NAMES) === -1;
}

/**
Expand Down

0 comments on commit a0cbd5b

Please sign in to comment.