Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
5fa0db56
Commit
5fa0db56
authored
Sep 06, 2015
by
Derek Willian Stavis
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18 from oh-my-fish/repo-functions
Add repo functions to omf utily
parents
ef4d4aff
61f71f3c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
32 deletions
+50
-32
pkg/omf/cli/omf.install.fish
pkg/omf/cli/omf.install.fish
+3
-3
pkg/omf/cli/omf.repo.clone.fish
pkg/omf/cli/omf.repo.clone.fish
+3
-0
pkg/omf/cli/omf.repo.pull.fish
pkg/omf/cli/omf.repo.pull.fish
+43
-0
pkg/omf/cli/omf.update.fish
pkg/omf/cli/omf.update.fish
+0
-16
pkg/omf/omf.fish
pkg/omf/omf.fish
+1
-1
pkg/omf/util/omf.util_fork_repo.fish
pkg/omf/util/omf.util_fork_repo.fish
+0
-4
pkg/omf/util/omf.util_sync.fish
pkg/omf/util/omf.util_sync.fish
+0
-8
No files found.
pkg/omf/cli/omf.install.fish
View file @
5fa0db56
...
...
@@ -28,7 +28,7 @@ function omf.install -a type_flag name_or_url
echo (omf::err)"Error: $local_name $install_type already installed."(omf::off) 1^&2
else
echo (omf::dim)"Trying to clone from URL..."(omf::off)
if
git clone -q
$name_or_url $OMF_PATH/$parent_path/$local_name
if
omf.repo.clone
$name_or_url $OMF_PATH/$parent_path/$local_name
omf.persist $install_type $name_or_url
_display_success "$install_type $name_or_url"
else
...
...
@@ -41,12 +41,12 @@ function omf.install -a type_flag name_or_url
if test -e $OMF_PATH/$target
echo (omf::dim)"Updating $name_or_url $install_type..."(omf::off)
pushd $OMF_PATH/$target
omf.
util_sync "origin" >/dev/null ^&1
omf.
repo.pull
popd
echo (omf::em)"✔ $name_or_url $install_type up to date."(omf::off)
else
echo (omf::dim)"Installing $name_or_url $install_type..."(omf::off)
if
git clone (cat $OMF_PATH/db/$target) $OMF_PATH/$target >/dev/null ^&1
if
omf.repo.clone (cat $OMF_PATH/db/$target) $OMF_PATH/$target
omf.persist $install_type $name_or_url
_display_success "$install_type $name_or_url"
else
...
...
pkg/omf/cli/omf.repo.clone.fish
0 → 100644
View file @
5fa0db56
function omf.repo.clone -a url path
command git clone --quiet $url $path
end
pkg/omf/cli/omf.repo.pull.fish
0 → 100644
View file @
5fa0db56
function omf.repo.pull
if test (command git config --get remote.upstream.url)
set repository upstream
else
set repository origin
end
set initial_branch (command git symbolic-ref -q --short HEAD); or return $OMF_UNKNOWN_ERR
set initial_revision (command git rev-parse -q --verify HEAD); or return $OMF_UNKNOWN_ERR
if not command git diff --quiet
echo (omf::em)"Stashing your changes:"(omf::off)
command git status --short --untracked-files
command git stash save --include-untracked --quiet
set stashed true
end
if test "$initial_branch" != master
command git checkout master --quiet
end
# the refspec ensures that '$repository/master' gets updated
command git pull --rebase --quiet $repository "refs/heads/master:refs/remotes/$repository/master"
if test $status -eq 2 #SIGINT
command git checkout $initial_branch
command git reset --hard $initial_revision
test "$stashed" = true; and command git stash pop
end
if test "$initial_branch" != master
command git checkout $initial_branch --quiet
end
if test "$stashed" = true
command git stash pop --quiet
echo (omf::em)"Restored your changes:"(omf::off)
command git status --short --untracked-files
end
return 0
end
pkg/omf/cli/omf.update.fish
deleted
100644 → 0
View file @
ef4d4aff
function omf.update
set -l repo "upstream"
test -z (git config --get remote.upstream.url)
and set -l repo "origin"
if git diff-index --quiet HEAD -- >/dev/null ^&1
git pull $repo master >/dev/null ^&1
else
git stash >/dev/null ^&1
if git pull --rebase $repo master >/dev/null ^&1
git stash apply >/dev/null ^&1
else
omf.util_sync "origin"
end
end
end
pkg/omf/omf.fish
View file @
5fa0db56
...
...
@@ -125,7 +125,7 @@ function omf -d "Oh My Fish"
case "u" "up" "upd" "update"
pushd $OMF_PATH
echo (omf::em)"Updating Oh My Fish..."(omf::off)
if omf.
update
if omf.
repo.pull
echo (omf::em)"Oh My Fish is up to date."(omf::off)
else
echo (omf::err)"Oh My Fish failed to update."(omf::off)
...
...
pkg/omf/util/omf.util_fork_repo.fish
deleted
100644 → 0
View file @
ef4d4aff
function omf.util_fork_repo -a user repo
curl -u "$user" --fail --silent https://api.github.com/repos/$repo/forks \
-d "{\"user\":\"$user\"}" >/dev/null ^&1
end
pkg/omf/util/omf.util_sync.fish
deleted
100644 → 0
View file @
ef4d4aff
function omf.util_sync -a remote
set -l repo $remote
set -q argv[1]; and set repo $argv[1]
git fetch origin master
git reset --hard FETCH_HEAD
git clean -df
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment