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
9f3ab255
Commit
9f3ab255
authored
Sep 27, 2015
by
Bruno
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70 from jeremiejig/remove_pushd_popd
Remove some pushd popd, using git --git-dir --work-tree
parents
b31f6f3d
56b1d837
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
24 deletions
+26
-24
bin/install
bin/install
+4
-4
pkg/omf/cli/omf.install.fish
pkg/omf/cli/omf.install.fish
+1
-3
pkg/omf/cli/omf.repo.pull.fish
pkg/omf/cli/omf.repo.pull.fish
+20
-14
pkg/omf/omf.fish
pkg/omf/omf.fish
+1
-3
No files found.
bin/install
View file @
9f3ab255
...
...
@@ -58,13 +58,13 @@ omf_install() {
die
"Could not clone the repository →
${
OMF_PATH
}
:
${
OMF_REPO_BRANCH
}
"
fi
local
git_rev
=
$(
git
-
C
${
OMF_PATH
}
rev-parse HEAD
)
>
/dev/null 2>&1
local
git_upstream
=
$(
git
-
C
${
OMF_PATH
}
config remote.upstream.url
)
local
git_rev
=
$(
git
-
-git-dir
${
OMF_PATH
}
/.git
--work-tree
${
OMF_PATH
}
rev-parse HEAD
)
>
/dev/null 2>&1
local
git_upstream
=
$(
git
-
-git-dir
${
OMF_PATH
}
/.git
--work-tree
${
OMF_PATH
}
config remote.upstream.url
)
if
[
-z
"
${
git_upstream
}
"
]
;
then
git
-
C
${
OMF_PATH
}
remote add upstream
${
git_uri
}
git
-
-git-dir
${
OMF_PATH
}
/.git
--work-tree
${
OMF_PATH
}
remote add upstream
${
git_uri
}
else
git
-
C
${
OMF_PATH
}
remote set-url upstream
${
git_uri
}
git
-
-git-dir
${
OMF_PATH
}
/.git
--work-tree
${
OMF_PATH
}
remote set-url upstream
${
git_uri
}
fi
echo
"Oh My Fish revision id →
${
git_rev
}
"
...
...
pkg/omf/cli/omf.install.fish
View file @
9f3ab255
...
...
@@ -40,9 +40,7 @@ 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.repo.pull
popd
omf.repo.pull $OMF_PATH/$target
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)
...
...
pkg/omf/cli/omf.repo.pull.fish
View file @
9f3ab255
function omf.repo.pull
if test (command git config --get remote.upstream.url)
if test (count $argv) -eq 0
echo (omf::err)"Argument of omf.repo.pull is the repo path."(omf::off)
return $OMF_MISSING_ARG
end
set -l repo_dir $argv[1]
if test (command git --git-dir "$repo_dir"/.git --work-tree "$repo_dir" 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
set initial_branch (command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
symbolic-ref -q --short HEAD); or return $OMF_UNKNOWN_ERR
set initial_revision (command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
rev-parse -q --verify HEAD); or return $OMF_UNKNOWN_ERR
if not command git diff --quiet
if not command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
diff --quiet
echo (omf::em)"Stashing your changes:"(omf::off)
command git status --short --untracked-files
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
status --short --untracked-files
command git stash save --include-untracked --quiet
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
stash save --include-untracked --quiet
set stashed true
end
if test "$initial_branch" != master
command git checkout master --quiet
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
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"
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
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
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
checkout $initial_branch
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
reset --hard $initial_revision
test "$stashed" = true; and command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
stash pop
end
if test "$initial_branch" != master
command git checkout $initial_branch --quiet
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
checkout $initial_branch --quiet
end
if test "$stashed" = true
command git stash pop --quiet
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
stash pop --quiet
echo (omf::em)"Restored your changes:"(omf::off)
command git status --short --untracked-files
command git
--git-dir "$repo_dir"/.git --work-tree "$repo_dir"
status --short --untracked-files
end
return 0
...
...
pkg/omf/omf.fish
View file @
9f3ab255
...
...
@@ -123,9 +123,8 @@ function omf -d "Oh My Fish"
omf.remove_package $argv[2] ; and refresh
case "u" "up" "upd" "update"
pushd $OMF_PATH
echo (omf::em)"Updating Oh My Fish..."(omf::off)
if omf.repo.pull
if omf.repo.pull
$OMF_PATH
echo (omf::em)"Oh My Fish is up to date."(omf::off)
else
echo (omf::err)"Oh My Fish failed to update."(omf::off)
...
...
@@ -133,7 +132,6 @@ function omf -d "Oh My Fish"
end
omf.theme (cat $OMF_CONFIG/theme)
omf.install_package (omf.list_installed_packages)
popd
refresh
case "s" "su" "sub" "submit"
...
...
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