From dc91e1b2cbb74797ad60a39d571553f9cd3419f6 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Wed, 1 Dec 2010 16:51:25 +0200 Subject: [PATCH 1/4] git-commit.txt: (synopsis): move -i and -o before "--" All options, including -i and -o, must come before "--" which is the end of options marker. Reported-by: Joey Hess Signed-off-by: Jari Aalto Signed-off-by: Junio C Hamano --- Documentation/git-commit.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt index 42fb1f57b2..ec7b577b85 100644 --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@ -11,8 +11,8 @@ SYNOPSIS 'git commit' [-a | --interactive] [-s] [-v] [-u] [--amend] [--dry-run] [(-c | -C) ] [-F | -m ] [--reset-author] [--allow-empty] [--allow-empty-message] [--no-verify] [-e] [--author=] - [--date=] [--cleanup=] [--status | --no-status] [--] - [[-i | -o ]...] + [--date=] [--cleanup=] [--status | --no-status] + [-i | -o] [--] [...] DESCRIPTION ----------- From bd40d252ec1ed2716ac9e6bbeab48b3b40bd0d58 Mon Sep 17 00:00:00 2001 From: knittl Date: Wed, 1 Dec 2010 14:17:00 +0100 Subject: [PATCH 2/4] bash: Match lightweight tags in prompt The bash prompt would display a commit's object name when having checked out a lightweight tag. Provide `--tags` to `git describe` in the completion script, so it will display lightweight tag names, as it already does for annotated tags. Signed-off-by: Daniel Knittl-Frank Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 67569901e7..82e6609689 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -255,7 +255,7 @@ __git_ps1 () (describe) git describe HEAD ;; (* | default) - git describe --exact-match HEAD ;; + git describe --tags --exact-match HEAD ;; esac 2>/dev/null)" || b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." || From df5d43be1f721b0ede37097b815463ceb43b0449 Mon Sep 17 00:00:00 2001 From: Ralf Thielow Date: Wed, 1 Dec 2010 20:15:59 +0100 Subject: [PATCH 3/4] commit.c: Remove backward goto in read_craft_line() Bad graft data is noticed in several places in read_graft_line(), and in each case we go back to the first site of detection. It in general is a better style to have an exception handling out of line from the main codepath and make error codepath jump forward. Signed-off-by: Ralf Thielow Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- commit.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/commit.c b/commit.c index 0094ec1c92..2d9265d9fe 100644 --- a/commit.c +++ b/commit.c @@ -137,12 +137,8 @@ struct commit_graft *read_graft_line(char *buf, int len) buf[--len] = '\0'; if (buf[0] == '#' || buf[0] == '\0') return NULL; - if ((len + 1) % 41) { - bad_graft_data: - error("bad graft data: %s", buf); - free(graft); - return NULL; - } + if ((len + 1) % 41) + goto bad_graft_data; i = (len + 1) / 41 - 1; graft = xmalloc(sizeof(*graft) + 20 * i); graft->nr_parent = i; @@ -155,6 +151,11 @@ struct commit_graft *read_graft_line(char *buf, int len) goto bad_graft_data; } return graft; + +bad_graft_data: + error("bad graft data: %s", buf); + free(graft); + return NULL; } static int read_graft_file(const char *graft_file) From 6b3020a241e2c0a1eaa6b74a10a796603bb90975 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Wed, 1 Dec 2010 12:36:15 -0600 Subject: [PATCH 4/4] add: introduce add.ignoreerrors synonym for add.ignore-errors The "[add] ignore-errors" tweakable introduced by v1.5.6-rc0~30^2 (Add a config option to ignore errors for git-add, 2008-05-12) does not follow the usual convention for naming values in the git configuration file. What convention? Glad you asked. The section name indicates the affected subsystem. The subsection name, if any, indicates which of an unbound set of things to set the value for. The variable name describes the effect of tweaking this knob. The section and variable names can be broken into words using bumpyCaps in documentation as a hint to the reader. These word breaks are not significant at the level of code, since the section and variable names are not case sensitive. The name "add.ignore-errors" includes a dash, meaning a naive configuration file like [add] ignoreErrors does not have any effect. Avoid such confusion by renaming to the more consistent add.ignoreErrors, but keep the old version for backwards compatibility. Signed-off-by: Jonathan Nieder Acked-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/config.txt | 6 +++++- builtin-add.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 8adb55c801..ce9c2509b6 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -534,9 +534,13 @@ core.sparseCheckout:: linkgit:git-read-tree[1] for more information. add.ignore-errors:: +add.ignoreErrors:: Tells 'git add' to continue adding files when some files cannot be added due to indexing errors. Equivalent to the '--ignore-errors' - option of linkgit:git-add[1]. + option of linkgit:git-add[1]. Older versions of git accept only + `add.ignore-errors`, which does not follow the usual naming + convention for configuration variables. Newer versions of git + honor `add.ignoreErrors` as well. alias.*:: Command aliases for the linkgit:git[1] command wrapper - e.g. diff --git a/builtin-add.c b/builtin-add.c index 87d2980313..51eeabad86 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -328,7 +328,8 @@ static struct option builtin_add_options[] = { static int add_config(const char *var, const char *value, void *cb) { - if (!strcasecmp(var, "add.ignore-errors")) { + if (!strcasecmp(var, "add.ignoreerrors") || + !strcasecmp(var, "add.ignore-errors")) { ignore_add_errors = git_config_bool(var, value); return 0; }