]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fast-import.c
Merge branch 'af/maint-install-no-handlink' into maint
[thirdparty/git.git] / fast-import.c
index caea684338031431dc3177716654a1a289faa9a3..7089e6f9e6c5fa9142f468e54afe7d33a6d2eec7 100644 (file)
@@ -890,7 +890,7 @@ static char *create_index(void)
                SHA1_Update(&ctx, (*c)->sha1, 20);
        }
        sha1write(f, pack_data->sha1, sizeof(pack_data->sha1));
-       sha1close(f, NULL, 1);
+       sha1close(f, NULL, CSUM_FSYNC);
        free(idx);
        SHA1_Final(pack_data->sha1, &ctx);
        return tmpfile;
@@ -1868,6 +1868,7 @@ static void file_change_m(struct branch *b)
        case S_IFREG | 0644:
        case S_IFREG | 0755:
        case S_IFLNK:
+       case S_IFGITLINK:
        case 0644:
        case 0755:
                /* ok */
@@ -1900,7 +1901,20 @@ static void file_change_m(struct branch *b)
                p = uq.buf;
        }
 
-       if (inline_data) {
+       if (S_ISGITLINK(mode)) {
+               if (inline_data)
+                       die("Git links cannot be specified 'inline': %s",
+                               command_buf.buf);
+               else if (oe) {
+                       if (oe->type != OBJ_COMMIT)
+                               die("Not a commit (actually a %s): %s",
+                                       typename(oe->type), command_buf.buf);
+               }
+               /*
+                * Accept the sha1 without checking; it expected to be in
+                * another repository.
+                */
+       } else if (inline_data) {
                static struct strbuf buf = STRBUF_INIT;
 
                if (p != uq.buf) {
@@ -2352,7 +2366,7 @@ static void import_marks(const char *input_file)
        fclose(f);
 }
 
-static int git_pack_config(const char *k, const char *v)
+static int git_pack_config(const char *k, const char *v, void *cb)
 {
        if (!strcmp(k, "pack.depth")) {
                max_depth = git_config_int(k, v);
@@ -2370,18 +2384,18 @@ static int git_pack_config(const char *k, const char *v)
                pack_compression_seen = 1;
                return 0;
        }
-       return git_default_config(k, v);
+       return git_default_config(k, v, cb);
 }
 
 static const char fast_import_usage[] =
-"git-fast-import [--date-format=f] [--max-pack-size=n] [--depth=n] [--active-branches=n] [--export-marks=marks.file]";
+"git fast-import [--date-format=f] [--max-pack-size=n] [--depth=n] [--active-branches=n] [--export-marks=marks.file]";
 
 int main(int argc, const char **argv)
 {
        unsigned int i, show_stats = 1;
 
        setup_git_directory();
-       git_config(git_pack_config);
+       git_config(git_pack_config, NULL);
        if (!pack_compression_seen && core_compression_seen)
                pack_compression_level = core_compression_level;