Code

Merge branch 'jk/diff'
[git.git] / builtin-add.c
index 096b611b5b0eef1c5a96dcaddc21aa874bdaee29..febb75ed994b5edc51afc60e2d46483fa9e273f2 100644 (file)
@@ -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");