From: Elijah Newren <newren@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Elijah Newren <newren@gmail.com>
Subject: [PATCH v2 6/8] fast-export: allow user to request tags be marked with --mark-tags
Date: Mon, 30 Sep 2019 14:10:16 -0700 [thread overview]
Message-ID: <20190930211018.23633-7-newren@gmail.com> (raw)
In-Reply-To: <20190930211018.23633-1-newren@gmail.com>
Add a new option, --mark-tags, which will output mark identifiers with
each tag object. This improves the incremental export story with
--export-marks since it will allow us to record that annotated tags have
been exported, and it is also needed as a step towards supporting nested
tags.
Signed-off-by: Elijah Newren <newren@gmail.com>
---
Documentation/git-fast-export.txt | 17 +++++++++++++----
builtin/fast-export.c | 7 +++++++
t/t9350-fast-export.sh | 14 ++++++++++++++
3 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-fast-export.txt b/Documentation/git-fast-export.txt
index cc940eb9ad..c522b34f7b 100644
--- a/Documentation/git-fast-export.txt
+++ b/Documentation/git-fast-export.txt
@@ -75,11 +75,20 @@ produced incorrect results if you gave these options.
Before processing any input, load the marks specified in
<file>. The input file must exist, must be readable, and
must use the same format as produced by --export-marks.
+
+--mark-tags::
+ In addition to labelling blobs and commits with mark ids, also
+ label tags. This is useful in conjunction with
+ `--export-marks` and `--import-marks`, and is also useful (and
+ necessary) for exporting of nested tags. It does not hurt
+ other cases and would be the default, but many fast-import
+ frontends are not prepared to accept tags with mark
+ identifiers.
+
-Any commits that have already been marked will not be exported again.
-If the backend uses a similar --import-marks file, this allows for
-incremental bidirectional exporting of the repository by keeping the
-marks the same across runs.
+Any commits (or tags) that have already been marked will not be
+exported again. If the backend uses a similar --import-marks file,
+this allows for incremental bidirectional exporting of the repository
+by keeping the marks the same across runs.
--fake-missing-tagger::
Some old repositories have tags without a tagger. The
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 575e47833b..d32e1e9327 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -40,6 +40,7 @@ static int no_data;
static int full_tree;
static int reference_excluded_commits;
static int show_original_ids;
+static int mark_tags;
static struct string_list extra_refs = STRING_LIST_INIT_NODUP;
static struct string_list tag_refs = STRING_LIST_INIT_NODUP;
static struct refspec refspecs = REFSPEC_INIT_FETCH;
@@ -861,6 +862,10 @@ static void handle_tag(const char *name, struct tag *tag)
if (starts_with(name, "refs/tags/"))
name += 10;
printf("tag %s\n", name);
+ if (mark_tags) {
+ mark_next_object(&tag->object);
+ printf("mark :%"PRIu32"\n", last_idnum);
+ }
if (tagged_mark)
printf("from :%d\n", tagged_mark);
else
@@ -1165,6 +1170,8 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
&reference_excluded_commits, N_("Reference parents which are not in fast-export stream by object id")),
OPT_BOOL(0, "show-original-ids", &show_original_ids,
N_("Show original object ids of blobs/commits")),
+ OPT_BOOL(0, "mark-tags", &mark_tags,
+ N_("Label tags with mark ids")),
OPT_END()
};
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index ea84e2f173..b3fca6ffba 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -66,6 +66,20 @@ test_expect_success 'fast-export ^muss^{commit} muss' '
test_cmp expected actual
'
+test_expect_success 'fast-export --mark-tags ^muss^{commit} muss' '
+ git fast-export --mark-tags --tag-of-filtered-object=rewrite ^muss^{commit} muss >actual &&
+ cat >expected <<-EOF &&
+ tag muss
+ mark :1
+ from $(git rev-parse --verify muss^{commit})
+ $(git cat-file tag muss | grep tagger)
+ data 9
+ valentin
+
+ EOF
+ test_cmp expected actual
+'
+
test_expect_success 'fast-export master~2..master' '
git fast-export master~2..master >actual &&
--
2.23.0.264.gac739dbb79
next prev parent reply other threads:[~2019-09-30 21:10 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 1:39 [PATCH 0/8] fast export/import: handle nested tags, improve incremental exports Elijah Newren
2019-09-25 1:39 ` [PATCH 1/8] fast-export: fix exporting a tag and nothing else Elijah Newren
2019-09-25 1:39 ` [PATCH 2/8] fast-import: fix handling of deleted tags Elijah Newren
2019-09-25 1:40 ` [PATCH 3/8] fast-import: allow tags to be identified by mark labels Elijah Newren
2019-09-25 1:40 ` [PATCH 4/8] fast-import: add support for new 'alias' command Elijah Newren
2019-09-25 1:40 ` [PATCH 5/8] fast-export: add support for --import-marks-if-exists Elijah Newren
2019-09-25 1:40 ` [PATCH 6/8] fast-export: allow user to request tags be marked with --mark-tags Elijah Newren
2019-09-25 1:40 ` [PATCH 7/8] t9350: add tests for tags of things other than a commit Elijah Newren
2019-09-25 1:40 ` [PATCH 8/8] fast-export: handle nested tags Elijah Newren
2019-09-30 21:10 ` [PATCH v2 0/8] fast export/import: handle nested tags, improve incremental exports Elijah Newren
2019-09-30 21:10 ` [PATCH v2 1/8] fast-export: fix exporting a tag and nothing else Elijah Newren
2019-09-30 21:10 ` [PATCH v2 2/8] fast-import: fix handling of deleted tags Elijah Newren
2019-10-03 11:53 ` René Scharfe
2019-09-30 21:10 ` [PATCH v2 3/8] fast-import: allow tags to be identified by mark labels Elijah Newren
2019-09-30 21:10 ` [PATCH v2 4/8] fast-import: add support for new 'alias' command Elijah Newren
2019-09-30 21:10 ` [PATCH v2 5/8] fast-export: add support for --import-marks-if-exists Elijah Newren
2019-09-30 21:10 ` Elijah Newren [this message]
2019-09-30 21:10 ` [PATCH v2 7/8] t9350: add tests for tags of things other than a commit Elijah Newren
2019-09-30 21:10 ` [PATCH v2 8/8] fast-export: handle nested tags Elijah Newren
2019-10-02 15:54 ` [PATCH v2 0/8] fast export/import: handle nested tags, improve incremental exports Elijah Newren
2019-10-02 20:10 ` Junio C Hamano
2019-10-02 21:05 ` Elijah Newren
2019-10-03 1:07 ` Junio C Hamano
2019-10-03 20:27 ` [PATCH -v3 " Elijah Newren
2019-10-03 20:27 ` [PATCH -v3 1/8] fast-export: fix exporting a tag and nothing else Elijah Newren
2019-10-03 20:27 ` [PATCH -v3 2/8] fast-import: fix handling of deleted tags Elijah Newren
2019-10-03 20:27 ` [PATCH -v3 3/8] fast-import: allow tags to be identified by mark labels Elijah Newren
2019-10-03 20:27 ` [PATCH -v3 4/8] fast-import: add support for new 'alias' command Elijah Newren
2019-10-03 20:27 ` [PATCH -v3 5/8] fast-export: add support for --import-marks-if-exists Elijah Newren
2019-10-03 20:27 ` [PATCH -v3 6/8] fast-export: allow user to request tags be marked with --mark-tags Elijah Newren
2019-10-03 20:27 ` [PATCH -v3 7/8] t9350: add tests for tags of things other than a commit Elijah Newren
2019-10-03 20:27 ` [PATCH -v3 8/8] fast-export: handle nested tags Elijah Newren
2019-10-04 5:51 ` [PATCH -v3 0/8] fast export/import: handle nested tags, improve incremental exports Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190930211018.23633-7-newren@gmail.com \
--to=newren@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).