git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] fast-import: checkpoint: dump branches/tags/marks even if object_count==0
@ 2017-09-26  3:30 Eric Rannaud
  2017-09-26  4:25 ` Junio C Hamano
  0 siblings, 1 reply; 20+ messages in thread
From: Eric Rannaud @ 2017-09-26  3:30 UTC (permalink / raw)
  To: git; +Cc: jeremy.serror, Shawn O . Pearce, Eric Rannaud

The checkpoint command cycles packfiles if object_count != 0, a sensible
test or there would be no pack files to write. Since 820b931012, the
command also dumps branches, tags and marks, but still conditionally.
However, it is possible for a command stream to modify refs or create
marks without creating any new objects.

For example, reset a branch:

	$ git fast-import
	reset refs/heads/master
	from refs/heads/master^

	checkpoint

but refs/heads/master remains unchanged.

Other example: a commit command that re-creates an object that already
exists in the object database.

This fix unconditionally calls dump_{branches,tags,marks}() for all
checkpoint commands. dump_branches() and dump_tags() are cheap to call
in the case of a no-op.

Signed-off-by: Eric Rannaud <e@nanocritical.com>
---
 fast-import.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index 35bf671f12c4..d5e4cf0bad41 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -3189,10 +3189,10 @@ static void checkpoint(void)
 	checkpoint_requested = 0;
 	if (object_count) {
 		cycle_packfile();
-		dump_branches();
-		dump_tags();
-		dump_marks();
 	}
+	dump_branches();
+	dump_tags();
+	dump_marks();
 }
 
 static void parse_checkpoint(void)
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-09-29  9:35 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-26  3:30 [PATCH] fast-import: checkpoint: dump branches/tags/marks even if object_count==0 Eric Rannaud
2017-09-26  4:25 ` Junio C Hamano
2017-09-26  9:53   ` [PATCH 1/1] " Eric Rannaud
2017-09-27  3:37     ` Junio C Hamano
2017-09-27 19:46       ` [PATCH] " Eric Rannaud
2017-09-27 23:19         ` Ramsay Jones
2017-09-28  3:48         ` Junio C Hamano
2017-09-28  4:56           ` Eric Rannaud
2017-09-28  5:07             ` [PATCH 1/1] " Eric Rannaud
2017-09-28 10:35               ` Junio C Hamano
2017-09-28 20:30                 ` Eric Rannaud
2017-09-28 12:59               ` Adam Dinwoodie
2017-09-28 21:03                 ` [PATCH] " Eric Rannaud
2017-09-29  2:44                 ` [PATCH 1/1] " Junio C Hamano
2017-09-29  3:09                   ` [PATCH] " Eric Rannaud
2017-09-29  3:51                     ` Junio C Hamano
2017-09-29  5:40                       ` Eric Rannaud
2017-09-29  9:35                         ` Junio C Hamano
2017-09-28  6:02             ` Junio C Hamano
2017-09-28  6:44               ` Eric Rannaud

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).