Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
36a6bc08
You need to sign in or sign up before continuing.
Commit
36a6bc08
authored
Jun 01, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: move no longer crash for non-existant sub-directory dest
parent
4632330d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
git.js
server/libs/git.js
+12
-9
create.pug
server/views/pages/create.pug
+1
-1
No files found.
server/libs/git.js
View file @
36a6bc08
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
const
Git
=
require
(
'git-wrapper2-promise'
)
const
Git
=
require
(
'git-wrapper2-promise'
)
const
Promise
=
require
(
'bluebird'
)
const
Promise
=
require
(
'bluebird'
)
const
path
=
require
(
'path'
)
const
path
=
require
(
'path'
)
const
fs
=
Promise
.
promisifyAll
(
require
(
'fs'
))
const
fs
=
Promise
.
promisifyAll
(
require
(
'fs
-extra
'
))
const
_
=
require
(
'lodash'
)
const
_
=
require
(
'lodash'
)
const
URL
=
require
(
'url'
)
const
URL
=
require
(
'url'
)
...
@@ -37,7 +37,7 @@ module.exports = {
...
@@ -37,7 +37,7 @@ module.exports = {
*
*
* @return {Object} Git model instance
* @return {Object} Git model instance
*/
*/
init
()
{
init
()
{
let
self
=
this
let
self
=
this
// -> Build repository path
// -> Build repository path
...
@@ -67,7 +67,7 @@ module.exports = {
...
@@ -67,7 +67,7 @@ module.exports = {
* @param {Object} appconfig The application config
* @param {Object} appconfig The application config
* @return {Object} Promise
* @return {Object} Promise
*/
*/
_initRepo
(
appconfig
)
{
_initRepo
(
appconfig
)
{
let
self
=
this
let
self
=
this
winston
.
info
(
'Checking Git repository...'
)
winston
.
info
(
'Checking Git repository...'
)
...
@@ -141,7 +141,7 @@ module.exports = {
...
@@ -141,7 +141,7 @@ module.exports = {
*
*
* @return {String} The repo path.
* @return {String} The repo path.
*/
*/
getRepoPath
()
{
getRepoPath
()
{
return
this
.
_repo
.
path
||
path
.
join
(
ROOTPATH
,
'repo'
)
return
this
.
_repo
.
path
||
path
.
join
(
ROOTPATH
,
'repo'
)
},
},
...
@@ -150,7 +150,7 @@ module.exports = {
...
@@ -150,7 +150,7 @@ module.exports = {
*
*
* @return {Promise} Resolve on sync success
* @return {Promise} Resolve on sync success
*/
*/
resync
()
{
resync
()
{
let
self
=
this
let
self
=
this
// Is git remote disabled?
// Is git remote disabled?
...
@@ -199,7 +199,7 @@ module.exports = {
...
@@ -199,7 +199,7 @@ module.exports = {
* @param {String} entryPath The entry path
* @param {String} entryPath The entry path
* @return {Promise} Resolve on commit success
* @return {Promise} Resolve on commit success
*/
*/
commitDocument
(
entryPath
,
author
)
{
commitDocument
(
entryPath
,
author
)
{
let
self
=
this
let
self
=
this
let
gitFilePath
=
entryPath
+
'.md'
let
gitFilePath
=
entryPath
+
'.md'
let
commitMsg
=
''
let
commitMsg
=
''
...
@@ -225,11 +225,13 @@ module.exports = {
...
@@ -225,11 +225,13 @@ module.exports = {
* @param {String} newEntryPath The new entry path
* @param {String} newEntryPath The new entry path
* @return {Promise<Boolean>} Resolve on success
* @return {Promise<Boolean>} Resolve on success
*/
*/
moveDocument
(
entryPath
,
newEntryPath
)
{
moveDocument
(
entryPath
,
newEntryPath
)
{
let
self
=
this
let
self
=
this
let
gitFilePath
=
entryPath
+
'.md'
let
gitFilePath
=
entryPath
+
'.md'
let
gitNewFilePath
=
newEntryPath
+
'.md'
let
gitNewFilePath
=
newEntryPath
+
'.md'
let
destPathObj
=
path
.
parse
(
this
.
getRepoPath
()
+
'/'
+
gitNewFilePath
)
return
fs
.
ensureDir
(
destPathObj
.
dir
).
then
(()
=>
{
return
self
.
_git
.
exec
(
'mv'
,
[
gitFilePath
,
gitNewFilePath
]).
then
((
cProc
)
=>
{
return
self
.
_git
.
exec
(
'mv'
,
[
gitFilePath
,
gitNewFilePath
]).
then
((
cProc
)
=>
{
let
out
=
cProc
.
stdout
.
toString
()
let
out
=
cProc
.
stdout
.
toString
()
if
(
_
.
includes
(
out
,
'fatal'
))
{
if
(
_
.
includes
(
out
,
'fatal'
))
{
...
@@ -238,6 +240,7 @@ module.exports = {
...
@@ -238,6 +240,7 @@ module.exports = {
}
}
return
true
return
true
})
})
})
},
},
/**
/**
...
@@ -246,7 +249,7 @@ module.exports = {
...
@@ -246,7 +249,7 @@ module.exports = {
* @param {String} msg The commit message
* @param {String} msg The commit message
* @return {Promise} Resolve on commit success
* @return {Promise} Resolve on commit success
*/
*/
commitUploads
(
msg
)
{
commitUploads
(
msg
)
{
let
self
=
this
let
self
=
this
msg
=
msg
||
'Uploads repository sync'
msg
=
msg
||
'Uploads repository sync'
...
@@ -257,7 +260,7 @@ module.exports = {
...
@@ -257,7 +260,7 @@ module.exports = {
})
})
},
},
getHistory
(
entryPath
)
{
getHistory
(
entryPath
)
{
let
self
=
this
let
self
=
this
let
gitFilePath
=
entryPath
+
'.md'
let
gitFilePath
=
entryPath
+
'.md'
...
...
server/views/pages/create.pug
View file @
36a6bc08
...
@@ -9,7 +9,7 @@ block rootNavRight
...
@@ -9,7 +9,7 @@ block rootNavRight
a.button.is-outlined(v-on:click='$store.dispatch("modalDiscardPage/open")')
a.button.is-outlined(v-on:click='$store.dispatch("modalDiscardPage/open")')
i.icon-cross
i.icon-cross
span= t('nav.discard')
span= t('nav.discard')
a.button(v-on:click='$root.$emit("editor
-
save")')
a.button(v-on:click='$root.$emit("editor
/
save")')
i.icon-check
i.icon-check
span= t('nav.savedocument')
span= t('nav.savedocument')
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment