mirror of
https://github.com/S2-/gitlit
synced 2025-08-02 12:20:05 +02:00
better lfs ls-files separator handling
This commit is contained in:
19
app/main.js
19
app/main.js
@@ -12,7 +12,8 @@ const args = require('minimist')(process.defaultApp ? process.argv.slice(2) : pr
|
|||||||
const repoDir = path.resolve(path.normalize(args._.join(' ')));
|
const repoDir = path.resolve(path.normalize(args._.join(' ')));
|
||||||
|
|
||||||
function getLfsFileList(dir, cb) {
|
function getLfsFileList(dir, cb) {
|
||||||
exec('git lfs ls-files', {maxBuffer: 1024 * 1024}, {
|
exec('git lfs ls-files', {
|
||||||
|
maxBuffer: 1024 * 1024,
|
||||||
cwd: dir
|
cwd: dir
|
||||||
},
|
},
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
@@ -25,9 +26,12 @@ function getLfsFileList(dir, cb) {
|
|||||||
if (stdout) {
|
if (stdout) {
|
||||||
let files = stdout.split('\n');
|
let files = stdout.split('\n');
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
file = file.split(' * ');
|
let pos = file.search(/ \* | \- /);
|
||||||
if (file[1]) {
|
if (pos) {
|
||||||
parsedFiles.push(file[1].trim());
|
file = file.substring(pos + 3);
|
||||||
|
if (file) {
|
||||||
|
parsedFiles.push(file.trim());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -40,6 +44,7 @@ function getLfsFileList(dir, cb) {
|
|||||||
|
|
||||||
function getLfsLocks(dir, cb) {
|
function getLfsLocks(dir, cb) {
|
||||||
exec('git lfs locks', {
|
exec('git lfs locks', {
|
||||||
|
maxBuffer: 1024 * 1024,
|
||||||
cwd: dir
|
cwd: dir
|
||||||
},
|
},
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
@@ -133,7 +138,8 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.on('unlock', (event, file) => {
|
ipcMain.on('unlock', (event, file) => {
|
||||||
exec('git lfs unlock "' + file + '"', {maxBuffer: 1024 * 1024}, {
|
exec('git lfs unlock "' + file + '"', {
|
||||||
|
maxBuffer: 1024 * 1024,
|
||||||
cwd: repoDir
|
cwd: repoDir
|
||||||
},
|
},
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
@@ -155,7 +161,8 @@ ipcMain.on('unlock', (event, file) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('lock', (event, file) => {
|
ipcMain.on('lock', (event, file) => {
|
||||||
exec('git lfs lock --json "' + file + '"', {maxBuffer: 1024 * 1024}, {
|
exec('git lfs lock --json "' + file + '"', {
|
||||||
|
maxBuffer: 1024 * 1024,
|
||||||
cwd: repoDir
|
cwd: repoDir
|
||||||
},
|
},
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
|
Reference in New Issue
Block a user