MCPcopy Index your code
hub / github.com/github/docs / undoFolder

Function undoFolder

script/move-content.js:266–287  ·  view source on GitHub ↗
(oldPath, newPath, files, opts)

Source from the content-addressed store, hash-verified

264}
265
266function undoFolder(oldPath, newPath, files, opts) {
267 const { verbose, git: useGit } = opts
268
269 if (useGit) {
270 let cmd = `git mv ${oldPath} ${newPath}`
271 execSync(cmd)
272 if (verbose) {
273 console.log(`git mv command: ${chalk.grey(cmd)}`)
274 }
275
276 cmd = `git commit -a -m "renamed ${files.length} files"`
277 execSync(cmd)
278 if (verbose) {
279 console.log(`git commit command: ${chalk.grey(cmd)}`)
280 }
281 } else {
282 fs.renameSync(oldPath, newPath)
283 if (verbose) {
284 console.log(`Renamed folder ${chalk.bold(oldPath)} to ${chalk.bold(newPath)}`)
285 }
286 }
287}
288
289function getBasename(fileOrDirectory) {
290 // Note, can't use fs.lstatSync().isDirectory() because it's just a string

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected