Skip to content

Commit

Permalink
ensure the remote upstream-url is set
Browse files Browse the repository at this point in the history
  • Loading branch information
aho-dips committed Feb 7, 2024
1 parent 3cc285d commit ce141d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 10 additions & 4 deletions smud-cli/functions-init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

default_upstream="https://github.com/DIPSAS/DIPS-GitOps-Template.git"

# Rewrite this to not use arg array
set_upstream()
{
Expand Down Expand Up @@ -108,7 +110,14 @@ init()

remote_origin=$(git config --get remote.origin.url)
remote_upstream=$(git config --get remote.upstream.url)


if [ ! "$remote_upstream" ]; then
if [ ! "$upstream_url" ]; then
upstream_url="$default_upstream"
fi
set_upstream "$upstream_url"
fi

if [ ! "$is_repo" ]; then
local yes_no="y"
ask yes_no $yellow "The current directory does not seem to be a git repository\nWould you like to initialize the repository and merge the remote upstream? (yes/no)"
Expand All @@ -117,9 +126,6 @@ init()
exit 0
fi
init_repo
if [ ! -n "$remote_upstream" ]; then
set_upstream "$upstream_url"
fi
fetch_upstream
merge_upstream
else
Expand Down
3 changes: 0 additions & 3 deletions smud-cli/functions.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env bash

default_upstream="https://github.com/DIPSAS/DIPS-GitOps-Template.git"


show_valid_commands()
{
echo "Commands:"
Expand Down

0 comments on commit ce141d0

Please sign in to comment.