1+ const { platform } = require ( 'os' )
12const { resolve } = require ( 'path' )
23const { execSync } = require ( 'child_process' )
34const getConfig = require ( './libs/getConfig' )
@@ -50,21 +51,24 @@ function start() {
5051 }
5152
5253 // Create CMDs
53- const cmds = [
54+ const commands = [
5455 `cd ${ resolve ( repo ) } ` ,
5556 'git pull' ,
5657 `git log --pretty=format:"%an|||%ae|||%s|||'%h|||%ad"` ,
5758 ]
5859
60+ // Windows may have multiple disk partitions
5961 // Change the disk path when repo and program are on different disks
60- const curDiskSymbol = process . argv0 . split ( ':' ) [ 0 ]
61- if ( ! String ( repo ) . startsWith ( curDiskSymbol ) ) {
62- const diskSymbol = String ( repo ) . split ( ':' ) [ 0 ]
63- cmds . unshift ( `${ diskSymbol } :` )
62+ if ( platform ( ) === 'win32' ) {
63+ const curDiskSymbol = process . argv0 . split ( ':' ) [ 0 ]
64+ if ( ! String ( repo ) . startsWith ( curDiskSymbol ) ) {
65+ const diskSymbol = String ( repo ) . split ( ':' ) [ 0 ]
66+ commands . unshift ( `${ diskSymbol } :` )
67+ }
6468 }
6569
6670 // Gel full command
67- const cmd = cmds . join ( ' && ' )
71+ const cmd = commands . join ( ' && ' )
6872
6973 // Get commit records from git repo
7074 const res = execSync ( cmd )
@@ -75,7 +79,7 @@ function start() {
7579 . filter ( ( log ) => reg . include . test ( log ) )
7680 . filter ( ( log ) => ! reg . exclude . test ( log ) )
7781
78- // Meger all logs
82+ // Merge all logs
7983 logs . forEach ( ( log ) => allLogs . push ( `${ repoName } |||${ log } ` ) )
8084 } )
8185
0 commit comments