new_commit ::= 'commit' sp ref_str lf
mark?
- ('author' sp name sp '<' email '>' sp when lf)?
- 'committer' sp name sp '<' email '>' sp when lf
+ ('author' (sp name)? sp '<' email '>' sp when lf)?
+ 'committer' (sp name)? sp '<' email '>' sp when lf
commit_msg
('from' sp committish lf)?
('merge' sp committish lf)*
new_tag ::= 'tag' sp tag_str lf
'from' sp committish lf
- ('tagger' sp name sp '<' email '>' sp when lf)?
+ ('tagger' (sp name)? sp '<' email '>' sp when lf)?
tag_msg;
tag_msg ::= data;
static const char *export_marks_file;
static const char *import_marks_file;
static int import_marks_file_from_stream;
+static int relative_marks_paths;
/* Our last blob */
static struct last_object last_blob = { STRBUF_INIT, 0, 0, 0 };
skip_optional_lf();
}
+static char* make_fast_import_path(const char *path)
+{
+ struct strbuf abs_path = STRBUF_INIT;
+
+ if (!relative_marks_paths || is_absolute_path(path))
+ return xstrdup(path);
+ strbuf_addf(&abs_path, "%s/info/fast-import/%s", get_git_dir(), path);
+ return strbuf_detach(&abs_path, NULL);
+}
+
static void option_import_marks(const char *marks, int from_stream)
{
if (import_marks_file) {
read_marks();
}
- import_marks_file = xstrdup(marks);
+ import_marks_file = make_fast_import_path(marks);
import_marks_file_from_stream = from_stream;
}
static void option_export_marks(const char *marks)
{
- export_marks_file = xstrdup(marks);
+ export_marks_file = make_fast_import_path(marks);
}
static void option_export_pack_edges(const char *edges)
option_import_marks(feature + 13, from_stream);
} else if (!prefixcmp(feature, "export-marks=")) {
option_export_marks(feature + 13);
+ } else if (!prefixcmp(feature, "relative-marks")) {
+ relative_marks_paths = 1;
+ } else if (!prefixcmp(feature, "no-relative-marks")) {
+ relative_marks_paths = 0;
} else if (!prefixcmp(feature, "force")) {
force_update = 1;
} else {