From 63e0c8b364e334fc7cc975edf1f16fb4c89594b3 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 6 Feb 2007 14:58:30 -0500 Subject: [PATCH] Support RFC 2822 date parsing in fast-import. Since some frontends may be working with source material where the dates are only readily available as RFC 2822 strings, it is more friendly if fast-import exposes Git's parse_date() function to handle the conversion. This way the frontend doesn't need to perform the parsing itself. The new --date-format option to fast-import can be used by a frontend to select which format it will supply date strings in. The default is the standard `raw` Git format, which fast-import has always supported. Format rfc2822 can be used to activate the parse_date() function instead. Because fast-import could also be useful for creating new, current commits, the format `now` is also supported to generate the current system timestamp. The implementation of `now` is a trivial call to datestamp(), but is actually a whole whopping 3 lines so that fast-import can verify the frontend really meant `now`. As part of this change I have added validation of the `raw` date format. Prior to this change fast-import would accept anything in a `committer` command, even if it was seriously malformed. Now fast-import requires the '> ' near the end of the string and verifies the timestamp is formatted properly. Signed-off-by: Shawn O. Pearce --- Documentation/git-fast-import.txt | 95 +++++++++++++++++++++++--- fast-import.c | 107 ++++++++++++++++++++++++++---- t/t9300-fast-import.sh | 36 ++++++++++ 3 files changed, 214 insertions(+), 24 deletions(-) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index 6fc78bff3e..08450de9ac 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -32,6 +32,12 @@ the frontend program in use. OPTIONS ------- +--date-format=:: + Specify the type of dates the frontend will supply to + gfi within `author`, `committer` and `tagger` commands. + See ``Date Formats'' below for details about which formats + are supported, and their syntax. + --max-pack-size=:: Maximum size of each output packfile, expressed in MiB. The default is 4096 (4 GiB) as that is the maximum allowed @@ -53,7 +59,6 @@ OPTIONS Frontends can use this file to validate imports after they have been completed. - Performance ----------- The design of gfi allows it to import large projects in a minimum @@ -127,6 +132,78 @@ results, such as branch names or file names with leading or trailing spaces in their name, or early termination of gfi when it encounters unexpected input. +Date Formats +~~~~~~~~~~~~ +The following date formats are supported. A frontend should select +the format it will use for this import by passing the format name +in the `--date-format=` command line option. + +`raw`:: + This is the Git native format and is `