Make pprint_tag void and cleans up call in cmd_cat_file.
[gitweb.git] / builtin-add.c
index 72d2853176f9c6d8b7c678bce64f5f482c2c5345..0cb9c812006ba4826122b57b9732e895b0eed905 100644 (file)
@@ -84,19 +84,16 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec)
 
 static struct lock_file lock_file;
 
-int cmd_add(int argc, const char **argv, char **envp)
+int cmd_add(int argc, const char **argv, const char *prefix)
 {
        int i, newfd;
        int verbose = 0, show_only = 0;
-       const char *prefix = setup_git_directory();
        const char **pathspec;
        struct dir_struct dir;
 
        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");
@@ -118,7 +115,7 @@ int cmd_add(int argc, const char **argv, char **envp)
                        verbose = 1;
                        continue;
                }
-               die(builtin_add_usage);
+               usage(builtin_add_usage);
        }
        pathspec = get_pathspec(prefix, argv + i);