fixup! sequencer: make reading author-script more elegant

An unfortunate regression of formerly battle-tested code sadly crept
into Git for Windows v2.11.0(2): authorship was not retained in case of
conflicts during picks.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2017-01-14 04:43:22 +01:00
parent 9e46438a63
commit e11df2efb3
2 changed files with 17 additions and 1 deletions

View File

@@ -612,7 +612,7 @@ static int read_env_script(struct argv_array *env)
count++;
}
for (i = 0; i < count; i++) {
for (i = 0, p = script.buf; i < count; i++) {
argv_array_push(env, p);
p += strlen(p) + 1;
}

View File

@@ -237,6 +237,22 @@ test_expect_success 'retain authorship' '
git show HEAD | grep "^Author: Twerp Snog"
'
test_expect_success 'retain authorship w/ conflicts' '
git reset --hard twerp &&
test_commit a conflict a conflict-a &&
git reset --hard twerp &&
GIT_AUTHOR_NAME=AttributeMe \
test_commit b conflict b conflict-b &&
set_fake_editor &&
test_must_fail git rebase -i conflict-a &&
echo resolved >conflict &&
git add conflict &&
git rebase --continue &&
test $(git rev-parse conflict-a^0) = $(git rev-parse HEAD^) &&
git show >out &&
grep AttributeMe out
'
test_expect_success 'squash' '
git reset --hard twerp &&
echo B > file7 &&