Skip to content

Commit e11df2e

Browse files
committed
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 <[email protected]>
1 parent 9e46438 commit e11df2e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ static int read_env_script(struct argv_array *env)
612612
count++;
613613
}
614614

615-
for (i = 0; i < count; i++) {
615+
for (i = 0, p = script.buf; i < count; i++) {
616616
argv_array_push(env, p);
617617
p += strlen(p) + 1;
618618
}

t/t3404-rebase-interactive.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,22 @@ test_expect_success 'retain authorship' '
237237
git show HEAD | grep "^Author: Twerp Snog"
238238
'
239239

240+
test_expect_success 'retain authorship w/ conflicts' '
241+
git reset --hard twerp &&
242+
test_commit a conflict a conflict-a &&
243+
git reset --hard twerp &&
244+
GIT_AUTHOR_NAME=AttributeMe \
245+
test_commit b conflict b conflict-b &&
246+
set_fake_editor &&
247+
test_must_fail git rebase -i conflict-a &&
248+
echo resolved >conflict &&
249+
git add conflict &&
250+
git rebase --continue &&
251+
test $(git rev-parse conflict-a^0) = $(git rev-parse HEAD^) &&
252+
git show >out &&
253+
grep AttributeMe out
254+
'
255+
240256
test_expect_success 'squash' '
241257
git reset --hard twerp &&
242258
echo B > file7 &&

0 commit comments

Comments
 (0)