Skip to content

Commit

Permalink
Remove sco function
Browse files Browse the repository at this point in the history
  • Loading branch information
meribold committed Jun 18, 2022
1 parent 7e29b71 commit 121ed58
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions git-snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,11 @@ fi

git diff --staged > "$index" || exit

# See [1].
sco() {
git symbolic-ref HEAD "$1"
}

sco "refs/heads/$snapshot_branch" || exit
git symbolic-ref HEAD "refs/heads/$snapshot_branch" || exit

# Use a trap to make sure we restore HEAD and the index no matter what.
cleanup() {
sco "$HEAD" &&
git symbolic-ref HEAD "$HEAD" &&
# Restore the index.
git reset -q &&
if [[ -s $index ]]; then
Expand All @@ -39,7 +34,3 @@ git -c advice.statusHints=false commit -uno --no-verify -am 'Snapshot
This is a snapshot commit created by git-snap.
https://github.com/meribold/git-snap'

# [1]: https://stackoverflow.com/q/6070179
# "Switching branches without touching the working tree?"
# [2]: https://github.com/qw3rtman/git-fire

0 comments on commit 121ed58

Please sign in to comment.