3 # Copyright (c) 2006 Yann Dirson
6 test_description
='Exercise pushing patches applied upstream.
8 Especially, consider the case of a patch that adds a file, while a
9 subsequent one modifies it, so we have to use --merged for push to
10 detect the merge. Reproduce the common workflow where one does not
11 specify --merged, then rollback and retry with the correct flag.'
15 # don't need this repo, but better not drop it, see t1100
18 # Need a repo to clone
22 'Clone tree and setup changes' '
27 git notes add -m note1 &&
28 printf "a\nc\n" > file &&
32 git notes add -m note2 &&
33 printf "a\nb\nc\n" > file &&
35 [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
36 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
41 'Port those patches to orig tree' '
44 GIT_DIR=../bar/.git git format-patch --stdout \
45 $(cd ../bar && stg id master:{base})..HEAD | git am -3 -k
50 'Pull to sync with parent, preparing for the problem' '
59 'Attempt to push the first of those patches without --merged' '
71 [ "$(echo $(stg series --applied --noprefix))" = "" ] &&
72 [ "$(echo $(stg series --unapplied --noprefix))" = "p1 p2" ]
77 'Push those patches while checking they were merged upstream' '
80 stg push --merged --all &&
81 [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
82 [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
83 [ "$(git notes show $(stg id p1))" = "note1" ] &&
84 [ "$(git notes show)" = "note2" ]
89 'pop then push a patch with a change to a submodule should not produce a conflict' '
92 stg clone ../foo baz &&
94 git submodule add ../foo baz &&
96 (cd baz && git reset --hard HEAD^) &&