Skip to content

Prepare GitService related code for TS migration

This MR makes all code changes that are necessary for semless migration of GitService to TS. There is no change in user-facing behaviour.

The WIP full migration can be seen in 219-migrate-git-service-to-ts branch see how the migration is done on top of this MR.

The best way is to review each commit separatelly. Each commit has a good title and body in the commit message and should be easily understood:

$ git log

commit 9af388e98b965fa2db937bb065667ea8a3b0eb3c
Author: Tomas Vik <tvik@gitlab.com>
Date:   Wed Sep 23 10:26:12 2020 +0200

    chore: update execa to version 4
    
    We were using version 1 which doesn't have type definitions. The upgrade
    is trivial and hence easier than writing our own type definitions.

commit 8d29cb658a0ecf48b5bb392381e75f8789837335
Author: Tomas Vik <tvik@gitlab.com>
Date:   Wed Sep 23 10:03:44 2020 +0200

    refactor: don't expose protocol from parseGitRemote
    
    The `protocol` attribute was only ever used in tests, omitting it
    simplifies the interface and tests at no cost. The attribute can be
    easily introduced in the future if we need it.

commit 92f525a40a356df6c63550614cb646c4ce63629e
Author: Tomas Vik <tvik@gitlab.com>
Date:   Wed Sep 23 09:54:04 2020 +0200

    refactor: parseGitRemote returns object instead off an array
    
    The only client of the parseGitRemote function is gitService and it took
    the returned array and turned it into an object anyway. Returning object
    allows us to annotate the parameters instead of relying on the index. We
    will also be able to crate a return type once we migrate to TS

commit 98c0d663f3878b57a23978ee773f4f8e746136c0
Author: Tomas Vik <tvik@gitlab.com>
Date:   Wed Sep 23 08:57:54 2020 +0200

    refactor: parseGitRemote requries instanceUrl
    
    There has been only one usage without the instanceUrl. It was in GitService and it
    was much better relplaced with url.parse. That will allow us to have stronger
    type definition in TS.

Part of #219 (closed)

Merge request reports