Comparing version 1.3.7 to 1.3.8
{ | ||
"name": "depsync", | ||
"version": "1.3.7", | ||
"version": "1.3.8", | ||
"author": "Dom Chen", | ||
@@ -5,0 +5,0 @@ "homepage": "http://www.idom.me/", |
@@ -47,4 +47,3 @@ <p align="left"> | ||
"commit": "1fe3162541ab2f5ce69aca2e2b593fab60520d34", | ||
"dir": "third_party/libwebp", | ||
"shallow": false | ||
"dir": "third_party/libwebp" | ||
}, | ||
@@ -59,6 +58,3 @@ { | ||
"commit": "5948d72a0a5320a1ea055f23bc8312b07ab6d72c", | ||
"dir": "third_party/tgfx", | ||
"keeps": [ | ||
"third_party" | ||
] | ||
"dir": "third_party/tgfx" | ||
} | ||
@@ -65,0 +61,0 @@ ] |
@@ -87,18 +87,2 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
item.dir = path.resolve(projectPath, item.dir); | ||
let shallow = item.shallow; | ||
if (typeof shallow == "string") { | ||
shallow = formatString(shallow, vars); | ||
item.shallow = (shallow !== "false"); | ||
} else if (typeof shallow != "boolean") { | ||
item.shallow = true; | ||
} | ||
let keeps = item.keeps; | ||
item.keeps = []; | ||
if (keeps instanceof Array) { | ||
for (let keep of keeps) { | ||
keep = formatString(keep, vars); | ||
keep = path.resolve(item.dir, keep); | ||
item.keeps.push(keep); | ||
} | ||
} | ||
list.push(item); | ||
@@ -105,0 +89,0 @@ } |
@@ -54,13 +54,5 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
let shallowFile = path.join(item.dir, ".git", "shallow"); | ||
let wasShallow = fs.existsSync(shallowFile); | ||
let commit = ""; | ||
if (wasShallow) { | ||
commit = Utils.readFile(shallowFile).substr(0, 40); | ||
} else { | ||
let fetchHeadFile = path.join(item.dir, ".git", "FETCH_HEAD"); | ||
commit = Utils.readFile(fetchHeadFile).substr(0, 40); | ||
} | ||
let repoDirty = false; | ||
if (commit !== item.commit || wasShallow !== item.shallow) { | ||
repoDirty = true; | ||
let commit = Utils.readFile(shallowFile).substring(0, 40); | ||
let repoDirty = commit !== item.commit; | ||
if (repoDirty) { | ||
tasks.push(new RepoTask(item)); | ||
@@ -67,0 +59,0 @@ } |
@@ -69,20 +69,26 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
} | ||
let shallowFile = path.join(item.dir, ".git", "shallow"); | ||
let wasShallow = fs.existsSync(shallowFile); | ||
if (wasShallow !== item.shallow || item.shallow) { | ||
Utils.deletePath(item.dir, item.keeps); | ||
} | ||
let fetchHeadFile = path.join(item.dir, ".git", "FETCH_HEAD"); | ||
if (!fs.existsSync(fetchHeadFile)) { | ||
let lfsDir = path.join(item.dir, ".git", "lfs"); | ||
let indexFile = path.join(item.dir, ".git", "index"); | ||
let tempLFSDir = path.join(item.dir + ".git", "lfs"); | ||
let tempIndexFile = path.join(item.dir + ".git", "index"); | ||
Utils.movePath(lfsDir, tempLFSDir); | ||
Utils.movePath(indexFile, tempIndexFile); | ||
Utils.deletePath(path.join(item.dir, ".git")); | ||
if (!fs.existsSync(item.dir)) { | ||
Utils.createDirectory(item.dir); | ||
Utils.exec("git init -q", item.dir); | ||
Utils.exec("git remote add origin " + url, item.dir); | ||
} | ||
if (item.shallow) { | ||
Utils.exec("git fetch --depth 1 origin " + item.commit, item.dir); | ||
} else { | ||
Utils.exec("git fetch origin " + item.commit, item.dir); | ||
Utils.exec("git init -q", item.dir); | ||
Utils.exec("git remote add origin " + url, item.dir); | ||
Utils.exec("git fetch --depth 1 origin " + item.commit, item.dir); | ||
Utils.movePath(tempLFSDir, lfsDir); | ||
Utils.movePath(tempIndexFile, indexFile); | ||
Utils.deleteEmptyDir(path.dirname(tempIndexFile)); | ||
process.env["GIT_LFS_SKIP_SMUDGE"] = "1"; | ||
Utils.exec("git reset --hard FETCH_HEAD && git clean -f -q", item.dir); | ||
let shallowFile = path.join(item.dir, ".git", "shallow"); | ||
Utils.writeFile(shallowFile, item.commit + "\n"); | ||
let lfsConfig = path.join(item.dir, ".gitattributes"); | ||
if (fs.existsSync(lfsConfig)) { | ||
Utils.exec("git lfs prune", item.dir); | ||
} | ||
process.env["GIT_LFS_SKIP_SMUDGE"]="1"; | ||
Utils.exec("git reset --hard FETCH_HEAD", item.dir); | ||
callback && callback(); | ||
@@ -89,0 +95,0 @@ }; |
@@ -48,4 +48,4 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
} | ||
let glfConfig = path.resolve(repoPath, ".gitattributes"); | ||
if (fs.existsSync(glfConfig)) { | ||
let lfsConfig = path.resolve(repoPath, ".gitattributes"); | ||
if (fs.existsSync(lfsConfig)) { | ||
if (!LFSInited) { | ||
@@ -57,3 +57,3 @@ Utils.exec("git lfs install", repoPath, true); | ||
if (result.indexOf("Git LFS fsck OK") === -1) { | ||
Utils.log("【depsync】downloading git lfs objects for: " + repoPath); | ||
Utils.log("【depsync】downloading git lfs objects to: " + repoPath); | ||
Utils.exec("git lfs pull", repoPath, false); | ||
@@ -60,0 +60,0 @@ } |
@@ -103,2 +103,16 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
function movePath(srcPath, dstPath) { | ||
if (!fs.existsSync(srcPath)) { | ||
return; | ||
} | ||
try { | ||
fs.renameSync(srcPath, dstPath); | ||
} catch (e) { | ||
if (e.code === "EXDEV") { | ||
copyPath(srcPath, dstPath); | ||
deletePath(srcPath); | ||
} | ||
} | ||
} | ||
function readFile(filePath) { | ||
@@ -221,2 +235,3 @@ try { | ||
exports.deletePath = deletePath; | ||
exports.movePath = movePath; | ||
exports.readFile = readFile; | ||
@@ -223,0 +238,0 @@ exports.writeFile = writeFile; |
Sorry, the diff of this file is not supported yet
52128
1231
114