Skip to content

Commit

Permalink
Really make the LF after reset in fast-import optional
Browse files Browse the repository at this point in the history
cmd_from() ends with a call to read_next_command(), which is needed
when using cmd_from() from commands where from is not the last element.

With reset, however, "from" is the last command, after which the flow
returns to the main loop, which calls read_next_command() again.

Because of this, always set unread_command_buf in cmd_reset_branch(),
even if cmd_from() was successful.

Add a test case for this in t9300-fast-import.sh.

Signed-off-by: Adeodato Simó <dato@net.com.org.es>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Adeodato Simó authored and Junio C Hamano committed Mar 8, 2008
1 parent 972b9a8 commit 655e851
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,8 @@ static void cmd_reset_branch(void)
else
b = new_branch(sp);
read_next_command();
if (!cmd_from(b) && command_buf.len > 0)
cmd_from(b);
if (command_buf.len > 0)
unread_command_buf = 1;
}

Expand Down
2 changes: 2 additions & 0 deletions t/t9300-fast-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,8 @@ zcommits
COMMIT
reset refs/tags/O3-2nd
from :5
reset refs/tags/O3-3rd
from :5
INPUT_END

cat >expect <<INPUT_END
Expand Down

0 comments on commit 655e851

Please sign in to comment.