summaryrefslogtreecommitdiff
path: root/update-index.c
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2006-03-02 17:21:33 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-03-03 07:07:42 (GMT)
commita41c175d6f3e903844131b6dc39da986248c7585 (patch)
tree2827c48cfea527828bb12396386424329c4ce9bb /update-index.c
parentc7569b1e0009e0187ce9f87f23699eaa8576b6ee (diff)
downloadgit-a41c175d6f3e903844131b6dc39da986248c7585.zip
git-a41c175d6f3e903844131b6dc39da986248c7585.tar.gz
git-a41c175d6f3e903844131b6dc39da986248c7585.tar.bz2
Prevent --index-info from ignoring -z.
If git-update-index --index-info -z is used only the first record given to the process will actually be updated as the -z option is ignored until after all index records have been read and processed. This meant that multiple null terminated records were seen as a single record which was lacking a trailing LF, however since the first record ended in a null the C string handling functions ignored the trailing garbage. So --index-info should be required to be the last command line option, much as --stdin is required to be the last command line option. Because --index-info implies --stdin this isn't an issue as the user shouldn't be passing --stdin when also passing --index-info. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'update-index.c')
-rw-r--r--update-index.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/update-index.c b/update-index.c
index ce1db38..797245a 100644
--- a/update-index.c
+++ b/update-index.c
@@ -577,9 +577,11 @@ int main(int argc, const char **argv)
break;
}
if (!strcmp(path, "--index-info")) {
+ if (i != argc - 1)
+ die("--index-info must be at the end");
allow_add = allow_replace = allow_remove = 1;
read_index_info(line_termination);
- continue;
+ break;
}
if (!strcmp(path, "--ignore-missing")) {
not_new = 1;