Skip to content

Command regression in 8d02097 #1137

@andrew-knackstedt-pango

Description

@andrew-knackstedt-pango

This regex improperly matches repository names: 8d02097#diff-06e9ab5e3ff93fdcdf7a5013218682676c6f1395e8d59d2c252026744f5a0524R19

The function isCloneSwitch incorrectly identifies any argument containing the letter u as an unsafe -u (upload-pack) flag if the start of the string matches a specific set of "flag characters", throwing the following error:

error: Use of clone with option -u is not permitted without enabling allowUnsafePack
   task: {
  commands: [ "clone", "-b", "non-default-branch", "https://github.com/example/non-super-example.git",
    "/tmp/target"
  ],
  format: "utf-8",
  parser: [Function: parser],
},
 plugin: "unsafe",

It can easily be reproduced on 3.32.3 with the following sample:

import { simpleGit } from 'simple-git';

const git = simpleGit();

await git.clone('https://github.com/example/bruno.git', '/tmp/target', ['-b', 'non-default-branch']);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions