HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/node_modules/git-parse/dist/git_log_stream.js.flow
import childProcess from 'child_process';
import {
  gitLogCommitMarker,
  gitLogMessageMarker,
  gitLogFileMarker
} from './constants/git_log_format_markers';

const gitLogFormatString = `${gitLogCommitMarker}%n%H%n%an%n%ae%n%aD%n${gitLogMessageMarker}%n%B%n${gitLogFileMarker}`;

/*
  Returns a stream of git log data from a git repository
*/
const gitLogStream = (pathToRepo, options = {}) => {
  const sinceCommit = options.sinceCommit ? `${options.sinceCommit}..HEAD` : '';
  const gitParams = [
    'log',
    `--pretty=format:${gitLogFormatString}`,
    '--name-status',
    sinceCommit,
    '--',
    './*',
    ':!node_modules'
  ].filter(elt => elt !== '');

  const gitProcess = childProcess.spawn('git', gitParams, {cwd: pathToRepo});
  const errorHandlers = [];
  gitProcess.on('error', e => errorHandlers.forEach(handler => handler(e)));
  return {
    stream: gitProcess.stdout,
    addErrorHandler: fn => errorHandlers.push(fn)
  };
};

export default gitLogStream;