Skip to content

upgrade dugite and use expectedErrors #5302

Closed

Description

@shiftkey

In PRs #5299 and #5298 we were hoping to use expectedErrors to make it clear that we were handling errors, but an upstream change in Git meant the regex we were using was not valid.

This means we needed to upgrade dugite to 1.69.0 to get this corrected regex, but dugite is already running Git 2.18.0, so we need some further testing of the app to ensure no other regexes are affected (as well as our other Git operations).

These two code segments need to be updated:

// TODO: use expectedErrors here to handle a specific error
// see https://github.com/desktop/desktop/pull/5299#discussion_r206603442 for
// discussion about what needs to change
const result = await git(['remote', '-v'], repository.path, 'getRemotes', {
successExitCodes: new Set([0, 128]),
})

// TODO: use expectedErrors here to handle a specific error
// see https://github.com/desktop/desktop/pull/5299#discussion_r206603442 for
// discussion about what needs to change
const result = await git(
['for-each-ref', `--format=${format}`, ...prefixes],
repository.path,
'getBranches',
{ successExitCodes: new Set([0, 128]) }
)

And this is the example from the linked PR about what they should be changed to:

    ...
    'getBranches',
    expectedErrors: new Set([GitError.NotAGitRepository]),
  })

  if (result.gitError === GitError.NotAGitRepository) {
    return []
  }

Activity

  1. added
    tech-debt
    on Jul 31, 2018
  2. self-assigned this
    on Aug 13, 2018
  3. added this to the 1.3.4 milestone on Aug 13, 2018
  4. modified the milestones: 1.3.5, 1.4.0 on Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tech-debt

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions