@@ -116,7 +116,7 @@ export default class LinkIndex extends Command {
116116 try {
117117 currentBranch = execSync ( "git symbolic-ref --short HEAD" , { encoding : "utf-8" } ) . trim ( ) ;
118118 } catch ( error ) {
119- this . log ( chalk . red ( "Unable to determine the current branch. Are you inside a Git repository? " ) ) ;
119+ this . log ( chalk . red ( "Unable to determine the current branch." ) ) ;
120120 throw error ;
121121 }
122122
@@ -129,9 +129,9 @@ export default class LinkIndex extends Command {
129129 this . exit ( 1 ) ;
130130 }
131131
132- const hasRemoteOrigin = await hasGitRemoteUrl ( gitConfigFilePath ) ;
132+ const remoteUrl = await getGitRemoteUrl ( gitConfigFilePath ) ;
133133
134- if ( ! hasRemoteOrigin ) {
134+ if ( ! remoteUrl ) {
135135 this . log ( chalk . red ( "`hyp link` requires a git remote to work" ) ) ;
136136 const gitRoot = execSync ( "git rev-parse --show-toplevel" , { encoding : "utf-8" } ) . trim ( ) ;
137137 const projectName = path . basename ( gitRoot ) ;
@@ -143,8 +143,6 @@ export default class LinkIndex extends Command {
143143 this . exit ( 1 ) ;
144144 }
145145
146- const gitUrl = await getGitRemoteUrl ( gitConfigFilePath ) ;
147-
148146 // check the .hypermode/settings.json and see if there is a installationId with a key for the github owner. if there is,
149147 // continue, if not send them to github app installation page, and then go to callback server, and add installation id to settings.json
150148
@@ -161,7 +159,7 @@ export default class LinkIndex extends Command {
161159 return ;
162160 }
163161
164- const { gitOwner, repoName } = parseGitUrl ( gitUrl ) ;
162+ const { gitOwner, repoName } = parseGitUrl ( remoteUrl ) ;
165163
166164 const repoFullName = `${ gitOwner } /${ repoName } ` ;
167165
@@ -175,7 +173,7 @@ export default class LinkIndex extends Command {
175173 }
176174
177175 // call hypermode getRepoId with the installationId and the git url, if it returns a repoId, continue, if not, throw an error
178- const repoId = await sendGetRepoIdReq ( settings . jwt , installationId , gitUrl ) ;
176+ const repoId = await sendGetRepoIdReq ( settings . jwt , installationId , remoteUrl ) ;
179177
180178 if ( ! repoId ) {
181179 throw new Error ( "No repoId found for the given installationId and gitUrl" ) ;
0 commit comments