aboutsummaryrefslogtreecommitdiff
path: root/builtin/fast-export.c
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2014-04-20 13:59:28 -0500
committerJunio C Hamano <gitster@pobox.com>2014-04-21 11:47:34 -0700
commit60ed26438c909fd273528e67b399ee6ca4028e1e (patch)
treeae393edaa6f26f96c0409e5e74b5b5658ffdd8cf /builtin/fast-export.c
parent4ee1b225b99f155cc9372397b5e120c2c0eee2bf (diff)
downloadgit-60ed26438c909fd273528e67b399ee6ca4028e1e.tar.gz
git-60ed26438c909fd273528e67b399ee6ca4028e1e.tar.xz
fast-export: add support to delete refs
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fast-export.c')
-rw-r--r--builtin/fast-export.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index ad9c17e8e..ef4481615 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -673,6 +673,19 @@ static void import_marks(char *input_file)
fclose(f);
}
+static void handle_deletes(void)
+{
+ int i;
+ for (i = 0; i < refspecs_nr; i++) {
+ struct refspec *refspec = &refspecs[i];
+ if (*refspec->src)
+ continue;
+
+ printf("reset %s\nfrom %s\n\n",
+ refspec->dst, sha1_to_hex(null_sha1));
+ }
+}
+
int cmd_fast_export(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
@@ -764,6 +777,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
}
handle_tags_and_duplicates();
+ handle_deletes();
if (export_filename && lastimportid != last_idnum)
export_marks(export_filename);