Skip to content

Commit 69d61da

Browse files
committed
Merge branch 'maint-1.7.4' into maint-1.7.5
* maint-1.7.4: make the sample pre-commit hook script reject names with newlines, too Reindent closing bracket using tab instead of spaces Documentation/git-update-index: refer to 'ls-files'
2 parents b586744 + ed36a48 commit 69d61da

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Documentation/git-update-index.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ tree files, you have to explicitly tell git about it by dropping
264264
"assume unchanged" bit, either before or after you modify them.
265265

266266
In order to set "assume unchanged" bit, use `--assume-unchanged`
267-
option. To unset, use `--no-assume-unchanged`.
267+
option. To unset, use `--no-assume-unchanged`. To see which files
268+
have the "assume unchanged" bit set, use `git ls-files -v`
269+
(see linkgit:git-ls-files[1]).
268270

269271
The command looks at `core.ignorestat` configuration variable. When
270272
this is true, paths updated with `git update-index paths...` and
@@ -363,7 +365,8 @@ ctime for marking files processed) (see linkgit:git-config[1]).
363365
SEE ALSO
364366
--------
365367
linkgit:git-config[1],
366-
linkgit:git-add[1]
368+
linkgit:git-add[1],
369+
linkgit:git-ls-files[1]
367370

368371
GIT
369372
---

templates/hooks--pre-commit.sample

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ fi
1818
# If you want to allow non-ascii filenames set this variable to true.
1919
allownonascii=$(git config hooks.allownonascii)
2020

21+
# Redirect output to stderr.
22+
exec 1>&2
23+
2124
# Cross platform projects tend to avoid non-ascii filenames; prevent
2225
# them from being added to the repository. We exploit the fact that the
2326
# printable range starts at the space character and ends with tilde.
2427
if [ "$allownonascii" != "true" ] &&
2528
# Note that the use of brackets around a tr range is ok here, (it's
2629
# even required, for portability to Solaris 10's /usr/bin/tr), since
2730
# the square bracket bytes happen to fall in the designated range.
28-
test "$(git diff --cached --name-only --diff-filter=A -z $against |
29-
LC_ALL=C tr -d '[ -~]\0')"
31+
test $(git diff --cached --name-only --diff-filter=A -z $against |
32+
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
3033
then
3134
echo "Error: Attempt to add a non-ascii file name."
3235
echo
@@ -43,4 +46,5 @@ then
4346
exit 1
4447
fi
4548

49+
# If there are whitespace errors, print the offending file names and fail.
4650
exec git diff-index --check --cached $against --

wt-status.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
394394
if (s->ignore_submodule_arg) {
395395
DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
396396
handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
397-
}
397+
}
398398
rev.diffopt.format_callback = wt_status_collect_changed_cb;
399399
rev.diffopt.format_callback_data = s;
400400
init_pathspec(&rev.prune_data, s->pathspec);

0 commit comments

Comments
 (0)