diff options
Diffstat (limited to 'fast-import.c')
-rw-r--r-- | fast-import.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/fast-import.c b/fast-import.c index 9fc7093406..84a13756cc 100644 --- a/fast-import.c +++ b/fast-import.c @@ -164,7 +164,6 @@ Format of STDIN stream: #include "refs.h" #include "csum-file.h" #include "quote.h" -#include "exec_cmd.h" #include "dir.h" #define PACK_ID_BITS 16 @@ -300,7 +299,7 @@ static int failure; static FILE *pack_edges; static unsigned int show_stats = 1; static int global_argc; -static char **global_argv; +static const char **global_argv; /* Memory pools */ static size_t mem_pool_alloc = 2*1024*1024 - sizeof(struct mem_pool); @@ -329,6 +328,7 @@ static const char *export_marks_file; static const char *import_marks_file; static int import_marks_file_from_stream; static int import_marks_file_ignore_missing; +static int import_marks_file_done; static int relative_marks_paths; /* Our last blob */ @@ -414,7 +414,7 @@ static void write_crash_report(const char *err) struct recent_command *rc; if (!rpt) { - error("can't write crash report %s: %s", loc, strerror(errno)); + error_errno("can't write crash report %s", loc); free(loc); return; } @@ -1512,7 +1512,7 @@ static int tree_content_set( t = root->tree; for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; - if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) { + if (e->name->str_len == n && !fspathncmp(p, e->name->str_dat, n)) { if (!*slash1) { if (!S_ISDIR(mode) && e->versions[1].mode == mode @@ -1602,7 +1602,7 @@ static int tree_content_remove( t = root->tree; for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; - if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) { + if (e->name->str_len == n && !fspathncmp(p, e->name->str_dat, n)) { if (*slash1 && !S_ISDIR(e->versions[1].mode)) /* * If p names a file in some subdirectory, and a @@ -1669,7 +1669,7 @@ static int tree_content_get( t = root->tree; for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; - if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) { + if (e->name->str_len == n && !fspathncmp(p, e->name->str_dat, n)) { if (!*slash1) goto found_entry; if (!S_ISDIR(e->versions[1].mode)) @@ -1802,12 +1802,12 @@ static void dump_marks(void) static struct lock_file mark_lock; FILE *f; - if (!export_marks_file) + if (!export_marks_file || (import_marks_file && !import_marks_file_done)) return; if (hold_lock_file_for_update(&mark_lock, export_marks_file, 0) < 0) { - failure |= error("Unable to write marks file %s: %s", - export_marks_file, strerror(errno)); + failure |= error_errno("Unable to write marks file %s", + export_marks_file); return; } @@ -1822,8 +1822,8 @@ static void dump_marks(void) dump_marks_helper(f, 0, marks); if (commit_lock_file(&mark_lock)) { - failure |= error("Unable to write file %s: %s", - export_marks_file, strerror(errno)); + failure |= error_errno("Unable to write file %s", + export_marks_file); return; } } @@ -1835,7 +1835,7 @@ static void read_marks(void) if (f) ; else if (import_marks_file_ignore_missing && errno == ENOENT) - return; /* Marks file does not exist */ + goto done; /* Marks file does not exist */ else die_errno("cannot read '%s'", import_marks_file); while (fgets(line, sizeof(line), f)) { @@ -1865,6 +1865,8 @@ static void read_marks(void) insert_mark(mark, e); } fclose(f); +done: + import_marks_file_done = 1; } @@ -3381,14 +3383,10 @@ static void parse_argv(void) read_marks(); } -int main(int argc, char **argv) +int cmd_main(int argc, const char **argv) { unsigned int i; - git_extract_argv0_path(argv[0]); - - git_setup_gettext(); - if (argc == 2 && !strcmp(argv[1], "-h")) usage(fast_import_usage); |