Really make the LF after reset in fast-import optional
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>
Adeodato Simó committed
Mar 7, 2008 at 21:22 UTC
655e8515f279c01f525745d443f509f97cd805ab
2 files changed
+4
-1
fast-import.c
+2
-1
@@ -2261,7 +2261,8 @@ static void cmd_reset_branch(void)
2261
else
2262
b = new_branch(sp);
2263
read_next_command();
2264
- if (!cmd_from(b) && command_buf.len > 0)
2264
+ cmd_from(b);
2265
+ if (command_buf.len > 0)
2266
unread_command_buf = 1;
2267
}
2268
t/t9300-fast-import.sh
+2
@@ -869,6 +869,8 @@ zcommits
869
COMMIT
870
reset refs/tags/O3-2nd
871
from :5
872
+reset refs/tags/O3-3rd
873
+from :5
874
INPUT_END
875
876
cat >expect <<INPUT_END