-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add untracked branch message * lint * fix tests
- Loading branch information
Showing
7 changed files
with
87 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { useCallback } from 'react'; | ||
import { Box, Text, useInput } from 'ink'; | ||
import { useAsyncValue } from '../hooks/use-async-value.js'; | ||
import { useGit } from '../hooks/use-git.js'; | ||
|
||
const TRACK_BRANCH_COMMAND = 'gum branch track'; | ||
|
||
export const UntrackedBranch = () => { | ||
const git = useGit(); | ||
|
||
const getCurrentBranch = useCallback(async () => { | ||
return await git.currentBranch(); | ||
}, [git.currentBranch]); | ||
|
||
const { value: currentBranch } = useAsyncValue({ | ||
getValue: getCurrentBranch, | ||
}); | ||
|
||
return ( | ||
<Box flexDirection="column"> | ||
<Text color="red"> | ||
Cannot perform this operation on untracked branch{' '} | ||
<Text color="yellow">{currentBranch}</Text>. | ||
</Text> | ||
<Text color="red"> | ||
You can start tracking it with{' '} | ||
<Text color="cyan">{TRACK_BRANCH_COMMAND}</Text>. | ||
</Text> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters