X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-add.c;h=febb75ed994b5edc51afc60e2d46483fa9e273f2;hb=6534141151f7fd4334f62827d9234acf3974ca4d;hp=f548b8007de79d66f7ed3fad0d96bce75c6bbf57;hpb=3fe5dbf57f2512d29cb72c68bdab98957fda7bb3;p=git.git diff --git a/builtin-add.c b/builtin-add.c index f548b8007..febb75ed9 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -70,7 +70,6 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec) base = ""; if (baselen) { char *common = xmalloc(baselen + 1); - common = xmalloc(baselen + 1); memcpy(common, *pathspec, baselen); common[baselen] = 0; path = base = common; @@ -93,9 +92,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) git_config(git_default_config); - newfd = hold_lock_file_for_update(&lock_file, get_index_file()); - if (newfd < 0) - die("unable to create new index file"); + newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1); if (read_cache() < 0) die("index file corrupt"); @@ -117,7 +114,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) verbose = 1; continue; } - die(builtin_add_usage); + usage(builtin_add_usage); } pathspec = get_pathspec(prefix, argv + i);