|
|
@ -13,46 +13,31 @@ export interface GitStatusProps { |
|
|
|
export default function GitStatus({ plugin, gitBranchName, setGitBranchName }: GitStatusProps) { |
|
|
|
export default function GitStatus({ plugin, gitBranchName, setGitBranchName }: GitStatusProps) { |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
const run = async () => { |
|
|
|
plugin.on('filePanel', 'setWorkspace', async (workspace) => { |
|
|
|
plugin.on('filePanel', 'setWorkspace', async (workspace) => { |
|
|
|
const isGit = await plugin.call('fileManager', 'isGitRepo') |
|
|
|
const isGit = await plugin.call('fileManager', 'isGitRepo') |
|
|
|
if (isGit) { |
|
|
|
if (isGit) { |
|
|
|
setGitBranchName(workspace.name) |
|
|
|
setGitBranchName(workspace.name) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setGitBranchName('Not a git repo') |
|
|
|
setGitBranchName('Not a git repo') |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
plugin.on('filePanel', 'workspaceInitializationCompleted', async () => { |
|
|
|
} |
|
|
|
const isGit = await plugin.call('fileManager', 'isGitRepo') |
|
|
|
run() |
|
|
|
if (isGit) { |
|
|
|
}, [gitBranchName, plugin.isGitRepo]) |
|
|
|
const workspace = localStorage.getItem('currentWorkspace') |
|
|
|
|
|
|
|
setGitBranchName(workspace) |
|
|
|
useEffect(() => { |
|
|
|
} else { |
|
|
|
const run = async () => { |
|
|
|
setGitBranchName('Not a git repo') |
|
|
|
plugin.on('filePanel', 'workspaceInitializationCompleted', async () => { |
|
|
|
} |
|
|
|
const isGit = await plugin.call('fileManager', 'isGitRepo') |
|
|
|
}) |
|
|
|
if (isGit) { |
|
|
|
plugin.on('dGitProvider', 'init', async () => { |
|
|
|
const workspace = localStorage.getItem('currentWorkspace') |
|
|
|
const isGit = await plugin.call('fileManager', 'isGitRepo') |
|
|
|
setGitBranchName(workspace) |
|
|
|
if (isGit) { |
|
|
|
} else { |
|
|
|
const workspace = localStorage.getItem('currentWorkspace') |
|
|
|
setGitBranchName('Not a git repo') |
|
|
|
setGitBranchName(workspace) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, []) |
|
|
|
run() |
|
|
|
|
|
|
|
}, [gitBranchName, plugin.isGitRepo]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
const run = async () => { |
|
|
|
|
|
|
|
plugin.on('dGitProvider', 'init', async () => { |
|
|
|
|
|
|
|
const isGit = await plugin.call('fileManager', 'isGitRepo') |
|
|
|
|
|
|
|
if (isGit) { |
|
|
|
|
|
|
|
const workspace = localStorage.getItem('currentWorkspace') |
|
|
|
|
|
|
|
setGitBranchName(workspace) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
run() |
|
|
|
|
|
|
|
}, [gitBranchName, plugin.isGitRepo]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const lightDgitUp = async () => { |
|
|
|
const lightDgitUp = async () => { |
|
|
|
const isActive = await plugin.call('manager', 'isActive', 'dgit') |
|
|
|
const isActive = await plugin.call('manager', 'isActive', 'dgit') |
|
|
|