summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 081751c)
raw | patch | inline | side by side (parent: 081751c)
author | Sverre Rabbelier <srabbelier@gmail.com> | |
Fri, 4 Dec 2009 17:07:00 +0000 (18:07 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 5 Dec 2009 20:43:24 +0000 (12:43 -0800) |
After specifying 'feature relative-marks' the paths specified with
'feature import-marks' and 'feature export-marks' are relative to an
internal directory in the current repository.
In git-fast-import this means that the paths are relative to the
'.git/info/fast-import' directory. However, other importers may use a
different location.
Add 'feature non-relative-marks' to disable this behavior, this way
it is possible to, for example, specify the import-marks location as
relative, and the export-marks location as non-relative.
Also add tests to verify this behavior.
Cc: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
'feature import-marks' and 'feature export-marks' are relative to an
internal directory in the current repository.
In git-fast-import this means that the paths are relative to the
'.git/info/fast-import' directory. However, other importers may use a
different location.
Add 'feature non-relative-marks' to disable this behavior, this way
it is possible to, for example, specify the import-marks location as
relative, and the export-marks location as non-relative.
Also add tests to verify this behavior.
Cc: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-fast-import.txt | patch | blob | history | |
fast-import.c | patch | blob | history | |
t/t9300-fast-import.sh | patch | blob | history |
index 752f85c9aca367f39bfeecdb725093254153eb65..1a63835d27a3bf890a3db26c383393348ae45b4d 100644 (file)
set of marks. If a mark is defined to different values,
the last file wins.
+--relative-marks::
+ After specifying --relative-marks= the paths specified
+ with --import-marks= and --export-marks= are relative
+ to an internal directory in the current repository.
+ In git-fast-import this means that the paths are relative
+ to the .git/info/fast-import directory. However, other
+ importers may use a different location.
+
+--no-relative-marks::
+ Negates a previous --relative-marks. Allows for combining
+ relative and non-relative marks by interweaving
+ --(no-)-relative-marks= with the --(import|export)-marks=
+ options.
+
--export-pack-edges=<file>::
After creating a packfile, print a line of data to
<file> listing the filename of the packfile and the last
* date-format
* import-marks
* export-marks
+* relative-marks
+* no-relative-marks
* force
The import-marks behaves differently from when it is specified as
diff --git a/fast-import.c b/fast-import.c
index 4c3406e9f01fbd1e9627d92bd2ef050c99ae5b31..dc670bfd2c18baa7fcd5f175e95a9fbe60933d54 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
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 {
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index ba92775b9d02a76b9b4cc22f8ccdb5be367c36b9..a1b8c2bb93374ba326c00f3f87a52dd550f90b2e 100755 (executable)
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
test_cmp marks.out combined.marks
'
+cat >input <<EOF
+feature relative-marks
+feature import-marks=relative.in
+feature export-marks=relative.out
+EOF
+
+test_expect_success 'R: feature relative-marks should be honoured' '
+ mkdir -p .git/info/fast-import/ &&
+ cp marks.new .git/info/fast-import/relative.in &&
+ git fast-import <input &&
+ test_cmp marks.new .git/info/fast-import/relative.out
+'
+
+cat >input <<EOF
+feature relative-marks
+feature import-marks=relative.in
+feature no-relative-marks
+feature export-marks=non-relative.out
+EOF
+
+test_expect_success 'R: feature no-relative-marks should be honoured' '
+ git fast-import <input &&
+ test_cmp marks.new non-relative.out
+'
+
cat >input << EOF
option git quiet
blob