forked from cunymatthieu/tgenv
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating a tgenv version updater to TGENV (cunymatthieu#17)
- Loading branch information
Weyder Ferreira
authored
Apr 23, 2023
1 parent
dc04b91
commit 79d2d0b
Showing
3 changed files
with
114 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
########################################## | ||
# | ||
# This script just works like a software | ||
# version updater. It's a shortcut to | ||
# $ git checkout master && git pull | ||
# | ||
########################################## | ||
|
||
set -e | ||
[ -n "${TGENV_DEBUG}" ] && set -x | ||
source "${TGENV_ROOT}/libexec/helpers" | ||
|
||
TGENV_GITBRANCH=$(git branch) | ||
TGENV_GITCHECKOUTMAIN=$(git -C $TGENV_GITBRANCH checkout main) | ||
TGENV_GITPULL=$(git pull) | ||
TGENV_GITLOG=$(git -C $TGENV_GITBRANCH log -1) | ||
TGENV_GITSTASH=$(git stash) | ||
|
||
# If branch it was different of main executes the checkout them | ||
if [$TGENV_GITBRANCH != 'main']; | ||
then | ||
$TGENV_GITSTASH | ||
$TGENV_GITCHECKOUTMAIN | ||
else | ||
$TGENV_GITPULL | ||
fi; | ||
|
||
echo $TGENV_GITLOG | ||
|
||
exit 0 |