@ -147,7 +147,6 @@ export const showCurrentBranch = async () => {
const branch = await currentBranch ( ) ;
const branch = await currentBranch ( ) ;
const currentcommitoid = await getCommitFromRef ( "HEAD" ) ;
const currentcommitoid = await getCommitFromRef ( "HEAD" ) ;
if ( typeof branch === "undefined" || branch . name === "" ) {
if ( typeof branch === "undefined" || branch . name === "" ) {
//toast.warn(`You are in a detached state`);
//toast.warn(`You are in a detached state`);
plugin . call ( 'notification' , 'alert' , {
plugin . call ( 'notification' , 'alert' , {
@ -288,7 +287,6 @@ export const add = async (args: string | undefined) => {
}
}
}
}
const getLastCommmit = async ( ) = > {
const getLastCommmit = async ( ) = > {
try {
try {
let currentcommitoid = "" ;
let currentcommitoid = "" ;
@ -299,7 +297,6 @@ const getLastCommmit = async () => {
}
}
}
}
export const rm = async ( args : any ) = > {
export const rm = async ( args : any ) = > {
const filename = args ;
const filename = args ;
await plugin . call ( "dGitProvider" , "rm" , {
await plugin . call ( "dGitProvider" , "rm" , {
@ -308,7 +305,6 @@ export const rm = async (args: any) => {
plugin . call ( 'notification' , 'toast' , ` Removed ${ filename } from git ` )
plugin . call ( 'notification' , 'toast' , ` Removed ${ filename } from git ` )
}
}
export const checkoutfile = async ( filename : string ) = > {
export const checkoutfile = async ( filename : string ) = > {
const oid = await getLastCommmit ( ) ;
const oid = await getLastCommmit ( ) ;
if ( oid )
if ( oid )
@ -426,7 +422,6 @@ const tokenWarning = async () => {
}
}
}
}
const parseError = async ( e : any ) = > {
const parseError = async ( e : any ) = > {
console . log ( e )
console . log ( e )
// if message conttains 401 Unauthorized, show token warning
// if message conttains 401 Unauthorized, show token warning
@ -462,7 +457,7 @@ const parseError = async (e: any) => {
} else if ( e . toString ( ) . includes ( 'NotFoundError' ) && ! e . toString ( ) . includes ( 'fetch' ) ) {
} else if ( e . toString ( ) . includes ( 'NotFoundError' ) && ! e . toString ( ) . includes ( 'fetch' ) ) {
await plugin . call ( 'notification' , 'modal' , {
await plugin . call ( 'notification' , 'modal' , {
title : 'Remote branch not found' ,
title : 'Remote branch not found' ,
message : 'The branch you are trying to fetch does not exist on the remote.\ If you have forked this branch from another branch, you may need to fetch the original branch first or publish this branch on the remote.' ,
message : 'The branch you are trying to fetch does not exist on the remote. If you have forked this branch from another branch, you may need to fetch the original branch first or publish this branch on the remote.' ,
okLabel : 'OK' ,
okLabel : 'OK' ,
type : ModalTypes . alert
type : ModalTypes . alert
} )
} )
@ -484,7 +479,7 @@ export const repositories = async () => {
let hasMoreData = true
let hasMoreData = true
const per_page = 100
const per_page = 100
while ( hasMoreData ) {
while ( hasMoreData ) {
le t pagedResponse = await plugin . call ( 'dGitProvider' as any , 'repositories' , { token , page : page , per_page : per_page } )
cons t pagedResponse = await plugin . call ( 'dGitProvider' as any , 'repositories' , { token , page : page , per_page : per_page } )
if ( pagedResponse . length < per_page ) {
if ( pagedResponse . length < per_page ) {
hasMoreData = false
hasMoreData = false
}
}
@ -520,7 +515,7 @@ export const remoteBranches = async (owner: string, repo: string) => {
let hasMoreData = true
let hasMoreData = true
const per_page = 100
const per_page = 100
while ( hasMoreData ) {
while ( hasMoreData ) {
le t pagedResponse = await plugin . call ( 'dGitProvider' as any , 'remotebranches' , { token , owner , repo , page : page , per_page : per_page } )
cons t pagedResponse = await plugin . call ( 'dGitProvider' as any , 'remotebranches' , { token , owner , repo , page : page , per_page : per_page } )
if ( pagedResponse . length < per_page ) {
if ( pagedResponse . length < per_page ) {
hasMoreData = false
hasMoreData = false
}
}
@ -628,8 +623,6 @@ export const getGitHubUser = async () => {
}
}
}
}
export const statusMatrix = async ( filepaths : string [ ] ) = > {
export const statusMatrix = async ( filepaths : string [ ] ) = > {
const matrix = await plugin . call ( "dGitProvider" , "status" , { ref : "HEAD" , filepaths : filepaths || [ '.' ] } ) ;
const matrix = await plugin . call ( "dGitProvider" , "status" , { ref : "HEAD" , filepaths : filepaths || [ '.' ] } ) ;
const result = ( matrix || [ ] ) . map ( ( x ) = > {
const result = ( matrix || [ ] ) . map ( ( x ) = > {
@ -734,7 +727,6 @@ async function getRepoDetails(url: string) {
return { owner , repo } ;
return { owner , repo } ;
}
}
export const fetchBranch = async ( branch : branch , page : number ) = > {
export const fetchBranch = async ( branch : branch , page : number ) = > {
if ( ! branch . remote || ! branch . remote . url ) return
if ( ! branch . remote || ! branch . remote . url ) return
const token = await tokenWarning ( ) ;
const token = await tokenWarning ( ) ;