Skip to content

Commit

Permalink
WIP: add upstream flag
Browse files Browse the repository at this point in the history
TODO: explain fetching
  • Loading branch information
miallo committed Jan 3, 2024
1 parent 7f291e1 commit 135863b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 9 additions & 0 deletions create_challenge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ commit -m 'README: add explanation on status and diff'
git init --bare ./.git/my-origin
git remote add origin ./.git/my-origin
git push --set-upstream origin @
(
cd .git
git clone ./my-origin another-downstream
cd another-downstream
reproducibility_setup 2
echo "Flag: SwimmingUpstream" >> README.md
commit -a --amend --no-edit
git push -f
)

# tmp file, because gnused and MacOS/FreeBSD sed handle "-i" differently
# `{N;N;d:}` for deleting the following (empty) line as well
Expand Down
4 changes: 2 additions & 2 deletions lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ reproducibility_setup() {
export GIT_CONFIG_GLOBAL=""

# use fixed user
git config user.name "Nuggit Challenge"
git config user.email nuggit-challenge@gmail.com
git config user.name "Nuggit$1 Challenge"
git config user.email "nuggit-challenge${1:+"+$1"}@gmail.com"
}
4 changes: 4 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ fi
echo 'restore should not show Switcheridoo flag'
git restore README.md 2>&1 | grep --quiet "Flag: Switcheridoo" && exit 1 || :

echo 'SwimmingUpstream in origin/main'
git fetch -q
git show origin/main | grep --quiet "Flag: SwimmingUpstream"

echo 'ShowMeMore in branch commit'
exec $(sed -n '/^```sh$/,/^```$/{n;p;}' commit.md) | grep --quiet "Flag: ShowMeMore"

Expand Down

0 comments on commit 135863b

Please sign in to comment.