1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-02 20:30:05 +02:00

6 Commits

Author SHA1 Message Date
s2
b841785adb 1.0.8 2019-06-12 15:53:41 +02:00
s2
9eae13612e fix lock/unlock refresh 2019-06-12 15:52:58 +02:00
s2
36f71da17a 1.0.7 2019-06-12 11:21:52 +02:00
s2
e0f88f12e1 fix show locks when in a subfolder 2019-06-12 11:21:15 +02:00
s2
c7dab12990 1.0.6 2019-06-07 12:40:17 +02:00
s2
9b0377efc9 show all lockable files 2019-06-07 12:37:30 +02:00
4 changed files with 39 additions and 18 deletions

View File

@@ -43,16 +43,18 @@
}
if (notification.event && notification.event === 'unlock') {
$('[data-file="' + notification.file + '"].js-unlock').hide();
$('[data-file="' + notification.file + '"].js-lock').show();
let file = notification.file.replace(/\\/g, '\\\\');
$('[data-file="' + file + '"].js-unlock').hide();
$('[data-file="' + file + '"].js-lock').show();
let text = 'not locked';
$('[data-file="' + notification.file + '"]').parent().prev().text(text);
$('[data-file="' + file + '"]').parent().prev().text(text);
}
if (notification.event && notification.event === 'lock') {
$('[data-file="' + notification.file + '"].js-lock').hide();
$('[data-file="' + notification.file + '"].js-unlock').show();
let file = notification.file.replace(/\\/g, '\\\\');
$('[data-file="' + file + '"].js-lock').hide();
$('[data-file="' + file + '"].js-unlock').show();
let text = notification.data.owner.name + ' (id: ' + notification.data.id + ')';
$('[data-file="' + notification.file + '"]').parent().prev().text(text);
$('[data-file="' + file + '"]').parent().prev().text(text);
}
});

View File

@@ -10,9 +10,10 @@ const args = require('minimist')(process.defaultApp ? process.argv.slice(3) : pr
});
const repoDir = path.resolve(path.normalize(args._.join(' ')));
let repoRootDir = repoDir;
function getLfsFileList(dir, cb) {
exec('git lfs ls-files', {
exec('git ls-files | git check-attr --stdin lockable', {
maxBuffer: 1024 * 1024,
cwd: dir
},
@@ -26,11 +27,12 @@ function getLfsFileList(dir, cb) {
if (stdout) {
let files = stdout.split('\n');
files.forEach((file) => {
let pos = file.search(/ \* | \- /);
if (pos) {
file = file.substring(pos + 3);
if (file) {
parsedFiles.push(file.trim());
let pos = file.split(': lockable: ');
if (pos && pos.length === 2) {
file = pos[0];
status = pos[1];
if (file && status === 'set') {
parsedFiles.push(path.normalize(file.trim()));
}
}
});
@@ -58,7 +60,7 @@ function getLfsLocks(dir, cb) {
let files = stdout.split('\n');
files.forEach((file) => {
if (file) {
let fileName = file.split('\t')[0].trim();
let fileName = path.normalize(file.split('\t')[0].trim());
let lockedBy = file.split('\t')[1].trim();
let id = file.split('ID:')[1].trim();
parsedFiles.push({
@@ -120,12 +122,13 @@ function createWindow() {
return;
}
let allFiles = [];
let repoDirWithoutRoot = repoDir === repoRootDir ? '' : repoDir.replace(path.normalize(repoRootDir + '/'), '');
files.forEach((file) => {
const t = {
file: file,
lockedBy: getArrayObjectByKey(lockedFiles, 'file', file, 'lockedBy'),
id: getArrayObjectByKey(lockedFiles, 'file', file, 'id')
lockedBy: getArrayObjectByKey(lockedFiles, 'file', path.normalize(repoDirWithoutRoot ? repoDirWithoutRoot + '/' + file : file), 'lockedBy'),
id: getArrayObjectByKey(lockedFiles, 'file', path.normalize(repoDirWithoutRoot ? repoDirWithoutRoot + '/' + file : file), 'id')
};
allFiles.push(t);
@@ -184,7 +187,23 @@ ipcMain.on('lock', (event, file) => {
});
});
app.on('ready', createWindow);
app.on('ready', () => {
exec('git rev-parse --show-toplevel', {
maxBuffer: 1024 * 1024,
cwd: repoDir
},
(error, stdout, stderr) => {
if (error) {
console.error(error);
}
if (stdout) {
repoRootDir = path.normalize(stdout.replace(/\n/g, ''));
}
createWindow();
});
});
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {

2
app/package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "gitlit-app",
"version": "1.0.5",
"version": "1.0.8",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "gitlit-app",
"version": "1.0.5",
"version": "1.0.8",
"description": "",
"main": "main.js",
"dependencies": {