isomorphic-git 1.44.4 → 1.44.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -393,9 +393,11 @@ const schema = {
393
393
  // section is alphanumeric (ASCII) with - and .
394
394
  // section is case insensitive
395
395
  // subsection is optional
396
- // subsection is specified after section and one or more spaces
397
- // subsection is specified between double quotes
398
- const SECTION_LINE_REGEX = /^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/;
396
+ // subsection is specified after section and one or more spaces or tabs
397
+ // subsection is specified between double quotes, where \ escapes the next character
398
+ // a comment can follow the section header
399
+ const SECTION_LINE_REGEX =
400
+ /^\[([A-Za-z0-9-.]+)(?:[ \t]+"((?:[^"\\]|\\.)*)")?\][ \t]*(?:[#;].*)?$/;
399
401
  const SECTION_REGEX = /^[A-Za-z0-9-.]+$/;
400
402
 
401
403
  // variable lines contain a name, and equal sign and then a value
@@ -411,7 +413,8 @@ const extractSectionLine = line => {
411
413
  const matches = SECTION_LINE_REGEX.exec(line);
412
414
  if (matches != null) {
413
415
  const [section, subsection] = matches.slice(1);
414
- return [section, subsection]
416
+ // Like canonical git, drop the backslash of an escaped character
417
+ return [section, subsection && subsection.replace(/\\(.)/g, '$1')]
415
418
  }
416
419
  return null
417
420
  };
package/managers/index.js CHANGED
@@ -386,9 +386,11 @@ const schema = {
386
386
  // section is alphanumeric (ASCII) with - and .
387
387
  // section is case insensitive
388
388
  // subsection is optional
389
- // subsection is specified after section and one or more spaces
390
- // subsection is specified between double quotes
391
- const SECTION_LINE_REGEX = /^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/;
389
+ // subsection is specified after section and one or more spaces or tabs
390
+ // subsection is specified between double quotes, where \ escapes the next character
391
+ // a comment can follow the section header
392
+ const SECTION_LINE_REGEX =
393
+ /^\[([A-Za-z0-9-.]+)(?:[ \t]+"((?:[^"\\]|\\.)*)")?\][ \t]*(?:[#;].*)?$/;
392
394
  const SECTION_REGEX = /^[A-Za-z0-9-.]+$/;
393
395
 
394
396
  // variable lines contain a name, and equal sign and then a value
@@ -404,7 +406,8 @@ const extractSectionLine = line => {
404
406
  const matches = SECTION_LINE_REGEX.exec(line);
405
407
  if (matches != null) {
406
408
  const [section, subsection] = matches.slice(1);
407
- return [section, subsection]
409
+ // Like canonical git, drop the backslash of an escaped character
410
+ return [section, subsection && subsection.replace(/\\(.)/g, '$1')]
408
411
  }
409
412
  return null
410
413
  };