Skip to content

Commit 908ec3c

Browse files
committed
test: StGit branch config handling
Ensure that the StGit and branch specific config section is being handled correctly for `stg branch --rename`, `--delete`, and `--cleanup`.
1 parent 7c0fb79 commit 908ec3c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

t/t1001-branch-rename.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,14 @@ test_expect_success \
120120
grep "The value .bop. was provided to .* but it wasn.t expecting any more values" err
121121
'
122122

123+
test_expect_success \
124+
'Config section is renamed' '
125+
_assert_current_branch_name "xxx"
126+
git config --local branch.xxx.stgit.autostash true &&
127+
stg branch --rename yyy &&
128+
_assert_branch_exists yyy &&
129+
git config branch.yyy.stgit.autostash &&
130+
! git config --get-regexp "branch\\.xxx\\."
131+
'
132+
123133
test_done

t/t1005-branch-delete.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ test_description='Attempt to delete branches'
44

55
. ./test-lib.sh
66

7-
test_expect_success 'Initialize repo' '
7+
test_expect_success 'Initialize master branch' '
88
stg init &&
99
test_commit p0 &&
1010
test_commit p1 &&
11-
stg uncommit -n 2
11+
stg uncommit -n 2 &&
12+
git config branch.master.stgit.autostash true
1213
'
1314

1415
test_expect_success 'Create a branch (and switch to it)' '
@@ -29,7 +30,9 @@ test_expect_success 'Make sure the branch ref was deleted' '
2930
'
3031

3132
test_expect_success 'Make sure the branch config was deleted' '
32-
[ -z "$(git config -l | grep branch\\.master | tee /dev/stderr)" ]
33+
[ -z "$(git config -l | grep branch\\.master | tee /dev/stderr)" ] &&
34+
[ -z "$(git config -l | grep branch\\.master\\.stgit | tee /dev/stderr)" ] &&
35+
test_expect_code 128 git config --remove-section branch.master.stgit
3336
'
3437

3538
test_expect_success 'Make sure the branch files were deleted' '

t/t1006-branch-cleanup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ test_expect_success 'Force cleanup branch with patches' '
3636
test "$(stg series --noprefix --all)" = "" &&
3737
command_error stg new -m p1 2>err &&
3838
grep "Branch \`foo2\` not initialized" err &&
39-
test_expect_code 1 git config --get-regexp branch\\.foo2\\.stgit
39+
test_expect_code 1 git config --get-regexp branch\\.foo2\\.stgit &&
40+
test_expect_code 128 git config --remove-section branch.foo2.stgit
4041
'
4142

4243
test_expect_success 'Commit patches' '

0 commit comments

Comments
 (0)