summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1dacfbc)
raw | patch | inline | side by side (parent: 1dacfbc)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Fri, 22 Oct 2010 06:44:01 +0000 (01:44 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 22 Oct 2010 18:03:56 +0000 (11:03 -0700) |
checkout-index loads the index before parsing options. Erroring out
is counterproductive at that point if the operator is hunting for a
command to recover useful data from the broken repository.
[jn: new commit message, tests]
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
is counterproductive at that point if the operator is hunting for a
command to recover useful data from the broken repository.
[jn: new commit message, tests]
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout-index.c | patch | blob | history | |
t/t2006-checkout-index-basic.sh | [new file with mode: 0755] | patch | blob |
index a7a5ee10f32d52c7555f85f2dcf6c567425488dd..3bf342232b74011e627d3cf6f5bea1a159f5ead9 100644 (file)
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
OPT_END()
};
+ if (argc == 2 && !strcmp(argv[1], "-h"))
+ usage_with_options(builtin_checkout_index_usage,
+ builtin_checkout_index_options);
git_config(git_default_config, NULL);
state.base_dir = "";
prefix_length = prefix ? strlen(prefix) : 0;
diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+test_description='basic checkout-index tests
+'
+
+. ./test-lib.sh
+
+test_expect_success 'checkout-index --gobbledegook' '
+ test_expect_code 129 git checkout-index --gobbledegook 2>err &&
+ grep "[Uu]sage" err
+'
+
+test_expect_success 'checkout-index -h in broken repository' '
+ mkdir broken &&
+ (
+ cd broken &&
+ git init &&
+ >.git/index &&
+ test_expect_code 129 git checkout-index -h >usage 2>&1
+ ) &&
+ grep "[Uu]sage" broken/usage
+'
+
+test_done