Merge branch 'maint' to sync with 1.6.5.7
* maint: Git 1.6.5.7 worktree: don't segfault with an absolute pathspec without a work tree ignore unknown color configuration help.autocorrect: do not run a command if the command given is junk Illustrate "filter" attribute with an example
This commit is contained in:
commit
a1bb8f45f1
19
Documentation/RelNotes-1.6.5.7.txt
Normal file
19
Documentation/RelNotes-1.6.5.7.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Git v1.6.5.7 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.6.5.6
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* If a user specifies a color for a <slot> (i.e. a class of things to show
|
||||||
|
in a particular color) that is known only by newer versions of git
|
||||||
|
(e.g. "color.diff.func" was recently added for upcoming 1.6.6 release),
|
||||||
|
an older version of git should just ignore them. Instead we diagnosed
|
||||||
|
it as an error.
|
||||||
|
|
||||||
|
* With help.autocorrect set to non-zero value, the logic to guess typoes
|
||||||
|
in the subcommand name misfired and ran a random nonsense command.
|
||||||
|
|
||||||
|
* If a command is run with an absolute path as a pathspec inside a bare
|
||||||
|
repository, e.g. "rev-list HEAD -- /home", the code tried to run
|
||||||
|
strlen() on NULL, which is the result of get_git_work_tree(), and
|
||||||
|
segfaulted.
|
@ -43,9 +43,10 @@ unreleased) version of git, that is available from 'master'
|
|||||||
branch of the `git.git` repository.
|
branch of the `git.git` repository.
|
||||||
Documentation for older releases are available here:
|
Documentation for older releases are available here:
|
||||||
|
|
||||||
* link:v1.6.5.6/git.html[documentation for release 1.6.5.6]
|
* link:v1.6.5.7/git.html[documentation for release 1.6.5.7]
|
||||||
|
|
||||||
* release notes for
|
* release notes for
|
||||||
|
link:RelNotes-1.6.5.7.txt[1.6.5.7],
|
||||||
link:RelNotes-1.6.5.6.txt[1.6.5.6],
|
link:RelNotes-1.6.5.6.txt[1.6.5.6],
|
||||||
link:RelNotes-1.6.5.5.txt[1.6.5.5],
|
link:RelNotes-1.6.5.5.txt[1.6.5.5],
|
||||||
link:RelNotes-1.6.5.4.txt[1.6.5.4],
|
link:RelNotes-1.6.5.4.txt[1.6.5.4],
|
||||||
|
@ -197,6 +197,25 @@ intent is that if someone unsets the filter driver definition,
|
|||||||
or does not have the appropriate filter program, the project
|
or does not have the appropriate filter program, the project
|
||||||
should still be usable.
|
should still be usable.
|
||||||
|
|
||||||
|
For example, in .gitattributes, you would assign the `filter`
|
||||||
|
attribute for paths.
|
||||||
|
|
||||||
|
------------------------
|
||||||
|
*.c filter=indent
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Then you would define a "filter.indent.clean" and "filter.indent.smudge"
|
||||||
|
configuration in your .git/config to specify a pair of commands to
|
||||||
|
modify the contents of C programs when the source files are checked
|
||||||
|
in ("clean" is run) and checked out (no change is made because the
|
||||||
|
command is "cat").
|
||||||
|
|
||||||
|
------------------------
|
||||||
|
[filter "indent"]
|
||||||
|
clean = indent
|
||||||
|
smudge = cat
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
|
||||||
Interaction between checkin/checkout attributes
|
Interaction between checkin/checkout attributes
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -65,7 +65,7 @@ static int parse_branch_color_slot(const char *var, int ofs)
|
|||||||
return BRANCH_COLOR_LOCAL;
|
return BRANCH_COLOR_LOCAL;
|
||||||
if (!strcasecmp(var+ofs, "current"))
|
if (!strcasecmp(var+ofs, "current"))
|
||||||
return BRANCH_COLOR_CURRENT;
|
return BRANCH_COLOR_CURRENT;
|
||||||
die("bad config variable '%s'", var);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int git_branch_config(const char *var, const char *value, void *cb)
|
static int git_branch_config(const char *var, const char *value, void *cb)
|
||||||
@ -76,6 +76,8 @@ static int git_branch_config(const char *var, const char *value, void *cb)
|
|||||||
}
|
}
|
||||||
if (!prefixcmp(var, "color.branch.")) {
|
if (!prefixcmp(var, "color.branch.")) {
|
||||||
int slot = parse_branch_color_slot(var, 13);
|
int slot = parse_branch_color_slot(var, 13);
|
||||||
|
if (slot < 0)
|
||||||
|
return 0;
|
||||||
if (!value)
|
if (!value)
|
||||||
return config_error_nonbool(var);
|
return config_error_nonbool(var);
|
||||||
color_parse(value, var, branch_colors[slot]);
|
color_parse(value, var, branch_colors[slot]);
|
||||||
|
@ -890,7 +890,7 @@ static int parse_status_slot(const char *var, int offset)
|
|||||||
return WT_STATUS_NOBRANCH;
|
return WT_STATUS_NOBRANCH;
|
||||||
if (!strcasecmp(var+offset, "unmerged"))
|
if (!strcasecmp(var+offset, "unmerged"))
|
||||||
return WT_STATUS_UNMERGED;
|
return WT_STATUS_UNMERGED;
|
||||||
die("bad config variable '%s'", var);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int git_status_config(const char *k, const char *v, void *cb)
|
static int git_status_config(const char *k, const char *v, void *cb)
|
||||||
@ -910,6 +910,8 @@ static int git_status_config(const char *k, const char *v, void *cb)
|
|||||||
}
|
}
|
||||||
if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
|
if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
|
||||||
int slot = parse_status_slot(k, 13);
|
int slot = parse_status_slot(k, 13);
|
||||||
|
if (slot < 0)
|
||||||
|
return 0;
|
||||||
if (!v)
|
if (!v)
|
||||||
return config_error_nonbool(k);
|
return config_error_nonbool(k);
|
||||||
color_parse(v, k, s->color_palette[slot]);
|
color_parse(v, k, s->color_palette[slot]);
|
||||||
|
4
diff.c
4
diff.c
@ -63,7 +63,7 @@ static int parse_diff_color_slot(const char *var, int ofs)
|
|||||||
return DIFF_WHITESPACE;
|
return DIFF_WHITESPACE;
|
||||||
if (!strcasecmp(var+ofs, "func"))
|
if (!strcasecmp(var+ofs, "func"))
|
||||||
return DIFF_FUNCINFO;
|
return DIFF_FUNCINFO;
|
||||||
die("bad config variable '%s'", var);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int git_config_rename(const char *var, const char *value)
|
static int git_config_rename(const char *var, const char *value)
|
||||||
@ -122,6 +122,8 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
|
|||||||
|
|
||||||
if (!prefixcmp(var, "diff.color.") || !prefixcmp(var, "color.diff.")) {
|
if (!prefixcmp(var, "diff.color.") || !prefixcmp(var, "color.diff.")) {
|
||||||
int slot = parse_diff_color_slot(var, 11);
|
int slot = parse_diff_color_slot(var, 11);
|
||||||
|
if (slot < 0)
|
||||||
|
return 0;
|
||||||
if (!value)
|
if (!value)
|
||||||
return config_error_nonbool(var);
|
return config_error_nonbool(var);
|
||||||
color_parse(value, var, diff_colors[slot]);
|
color_parse(value, var, diff_colors[slot]);
|
||||||
|
7
help.c
7
help.c
@ -297,6 +297,9 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)
|
|||||||
old->names = NULL;
|
old->names = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* An empirically derived magic number */
|
||||||
|
#define SIMILAR_ENOUGH(x) ((x) < 6)
|
||||||
|
|
||||||
const char *help_unknown_cmd(const char *cmd)
|
const char *help_unknown_cmd(const char *cmd)
|
||||||
{
|
{
|
||||||
int i, n, best_similarity = 0;
|
int i, n, best_similarity = 0;
|
||||||
@ -331,7 +334,7 @@ const char *help_unknown_cmd(const char *cmd)
|
|||||||
n = 1;
|
n = 1;
|
||||||
while (n < main_cmds.cnt && best_similarity == main_cmds.names[n]->len)
|
while (n < main_cmds.cnt && best_similarity == main_cmds.names[n]->len)
|
||||||
++n;
|
++n;
|
||||||
if (autocorrect && n == 1) {
|
if (autocorrect && n == 1 && SIMILAR_ENOUGH(best_similarity)) {
|
||||||
const char *assumed = main_cmds.names[0]->name;
|
const char *assumed = main_cmds.names[0]->name;
|
||||||
main_cmds.names[0] = NULL;
|
main_cmds.names[0] = NULL;
|
||||||
clean_cmdnames(&main_cmds);
|
clean_cmdnames(&main_cmds);
|
||||||
@ -349,7 +352,7 @@ const char *help_unknown_cmd(const char *cmd)
|
|||||||
|
|
||||||
fprintf(stderr, "git: '%s' is not a git-command. See 'git --help'.\n", cmd);
|
fprintf(stderr, "git: '%s' is not a git-command. See 'git --help'.\n", cmd);
|
||||||
|
|
||||||
if (best_similarity < 6) {
|
if (SIMILAR_ENOUGH(best_similarity)) {
|
||||||
fprintf(stderr, "\nDid you mean %s?\n",
|
fprintf(stderr, "\nDid you mean %s?\n",
|
||||||
n < 2 ? "this": "one of these");
|
n < 2 ? "this": "one of these");
|
||||||
|
|
||||||
|
7
setup.c
7
setup.c
@ -18,9 +18,12 @@ const char *prefix_path(const char *prefix, int len, const char *path)
|
|||||||
if (normalize_path_copy(sanitized, sanitized))
|
if (normalize_path_copy(sanitized, sanitized))
|
||||||
goto error_out;
|
goto error_out;
|
||||||
if (is_absolute_path(orig)) {
|
if (is_absolute_path(orig)) {
|
||||||
|
size_t len, total;
|
||||||
const char *work_tree = get_git_work_tree();
|
const char *work_tree = get_git_work_tree();
|
||||||
size_t len = strlen(work_tree);
|
if (!work_tree)
|
||||||
size_t total = strlen(sanitized) + 1;
|
goto error_out;
|
||||||
|
len = strlen(work_tree);
|
||||||
|
total = strlen(sanitized) + 1;
|
||||||
if (strncmp(sanitized, work_tree, len) ||
|
if (strncmp(sanitized, work_tree, len) ||
|
||||||
(sanitized[len] != '\0' && sanitized[len] != '/')) {
|
(sanitized[len] != '\0' && sanitized[len] != '/')) {
|
||||||
error_out:
|
error_out:
|
||||||
|
@ -174,4 +174,19 @@ test_expect_success 'git grep' '
|
|||||||
GIT_DIR=../.. GIT_WORK_TREE=.. git grep -l changed | grep dir/tracked)
|
GIT_DIR=../.. GIT_WORK_TREE=.. git grep -l changed | grep dir/tracked)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'git commit' '
|
||||||
|
(
|
||||||
|
cd repo.git &&
|
||||||
|
GIT_DIR=. GIT_WORK_TREE=work git commit -a -m done
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'absolute pathspec should fail gracefully' '
|
||||||
|
(
|
||||||
|
cd repo.git || exit 1
|
||||||
|
git config --unset core.worktree
|
||||||
|
test_must_fail git log HEAD -- /home
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -66,4 +66,21 @@ test_expect_success 'extra character after attribute' '
|
|||||||
invalid_color "dimX"
|
invalid_color "dimX"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'unknown color slots are ignored (diff)' '
|
||||||
|
git config --unset diff.color.new
|
||||||
|
git config color.diff.nosuchslotwilleverbedefined white &&
|
||||||
|
git diff --color
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'unknown color slots are ignored (branch)' '
|
||||||
|
git config color.branch.nosuchslotwilleverbedefined white &&
|
||||||
|
git branch -a
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'unknown color slots are ignored (status)' '
|
||||||
|
git config color.status.nosuchslotwilleverbedefined white || exit
|
||||||
|
git status
|
||||||
|
case $? in 0|1) : ok ;; *) false ;; esac
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user