summaryrefslogtreecommitdiff
path: root/builtin-add.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2006-12-04 11:13:39 -0500
committerJunio C Hamano <junkio@cox.net>2006-12-04 16:33:51 -0800
commit366bfcb68f4d98a43faaf17893a1aa0a7a9e2c58 (patch)
tree70d87fdba82ccf99095148a4918a77e019d12891 /builtin-add.c
parentba988a83f0cfdafdcfdc7ed44253840ea83578fb (diff)
downloadgit-366bfcb68f4d98a43faaf17893a1aa0a7a9e2c58.tar.gz
make 'git add' a first class user friendly interface to the index
This brings the power of the index up front using a proper mental model without talking about the index at all. See for example how all the technical discussion has been evacuated from the git-add man page. Any content to be committed must be added together. Whether that content comes from new files or modified files doesn't matter. You just need to "add" it, either with git-add, or by providing git-commit with -a (for already known files only of course). No need for a separate command to distinguish new vs modified files please. That would only screw the mental model everybody should have when using GIT. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-add.c')
-rw-r--r--builtin-add.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin-add.c b/builtin-add.c
index febb75ed99..b3f920676a 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -94,9 +94,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
newfd = hold_lock_file_for_update(&lock_file, get_index_file(), 1);
- if (read_cache() < 0)
- die("index file corrupt");
-
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
@@ -131,6 +128,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
return 0;
}
+ if (read_cache() < 0)
+ die("index file corrupt");
+
for (i = 0; i < dir.nr; i++)
add_file_to_index(dir.entries[i]->name, verbose);