From e3163c75156f1b85e8a778cecfacae63c14dcdbb Mon Sep 17 00:00:00 2001 From: Tay Ray Chuan Date: Sat, 10 Apr 2010 10:50:19 +0800 Subject: [PATCH 1/2] fetch/push: fix usage strings - use "" instead of just "options". - use "[ [...]]" to indicate that and are optional, and that cannot be specified without specifying . Note that when called without specifying (eg. "git fetch -f"), it is accurate to say that the "git fetch [] [ ...]" case takes precedence over "git fetch [] ". Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- Documentation/git-fetch.txt | 8 ++++---- Documentation/git-push.txt | 2 +- builtin-fetch.c | 8 ++++---- builtin-push.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt index 948ea26c5a..400fe7f956 100644 --- a/Documentation/git-fetch.txt +++ b/Documentation/git-fetch.txt @@ -8,13 +8,13 @@ git-fetch - Download objects and refs from another repository SYNOPSIS -------- -'git fetch' ... +'git fetch' [] [ [...]] -'git fetch' +'git fetch' [] -'git fetch' --multiple [ | ]... +'git fetch' --multiple [] [ | ]... -'git fetch' --all +'git fetch' --all [] DESCRIPTION diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index 49b6bd9d92..7a4e507c4b 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'git push' [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=] [--repo=] [-f | --force] [-v | --verbose] [-u | --set-upstream] - [ ...] + [ [...]] DESCRIPTION ----------- diff --git a/builtin-fetch.c b/builtin-fetch.c index bbc425b655..007dabf62f 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -13,10 +13,10 @@ #include "sigchain.h" static const char * const builtin_fetch_usage[] = { - "git fetch [options] [ ...]", - "git fetch [options] ", - "git fetch --multiple [options] [ | ]...", - "git fetch --all [options]", + "git fetch [] [ [...]]", + "git fetch [] ", + "git fetch --multiple [] [ | ]...", + "git fetch --all []", NULL }; diff --git a/builtin-push.c b/builtin-push.c index f7bc2b292f..9fc6931247 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -10,7 +10,7 @@ #include "parse-options.h" static const char * const push_usage[] = { - "git push [] [ ...]", + "git push [] [ [...]]", NULL, }; From 54fd955c211db6f4a2c91301f792ec9de86eed31 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Fri, 9 Apr 2010 22:08:35 +0200 Subject: [PATCH 2/2] Let check_preimage() use memset() to initialize "struct checkout" Every code site except check_preimage() uses either memset() or declares a static instance of "struct checkout" to achieve proper initialization. Lets use memset() instead of explicit initialization of all members here too to be on the safe side in case this structure is expanded someday. Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano --- builtin-apply.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/builtin-apply.c b/builtin-apply.c index 7ca90472c1..771c972c55 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -2824,11 +2824,8 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s if (stat_ret < 0) { struct checkout costate; /* checkout */ + memset(&costate, 0, sizeof(costate)); costate.base_dir = ""; - costate.base_dir_len = 0; - costate.force = 0; - costate.quiet = 0; - costate.not_new = 0; costate.refresh_cache = 1; if (checkout_entry(*ce, &costate, NULL) || lstat(old_name, st))