aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-10-26 16:08:14 -0700
committerJunio C Hamano <gitster@pobox.com>2011-10-26 16:08:14 -0700
commit69d61daec7a7915f6a664f32002fd9403e7f2a34 (patch)
tree5a82a51e9938eb7154642a5bfc82f84c9e33f44b
parentb586744a864cf4d6886d6436d559302123b01fae (diff)
parented36a48e6d246f4f60d44b27e8c1e660151cd0b4 (diff)
downloadgit-69d61daec7a7915f6a664f32002fd9403e7f2a34.tar.gz
git-69d61daec7a7915f6a664f32002fd9403e7f2a34.tar.xz
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'
-rw-r--r--Documentation/git-update-index.txt7
-rwxr-xr-xtemplates/hooks--pre-commit.sample8
-rw-r--r--wt-status.c2
3 files changed, 12 insertions, 5 deletions
diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index d3931294d..a3081f4e2 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -264,7 +264,9 @@ tree files, you have to explicitly tell git about it by dropping
"assume unchanged" bit, either before or after you modify them.
In order to set "assume unchanged" bit, use `--assume-unchanged`
-option. To unset, use `--no-assume-unchanged`.
+option. To unset, use `--no-assume-unchanged`. To see which files
+have the "assume unchanged" bit set, use `git ls-files -v`
+(see linkgit:git-ls-files[1]).
The command looks at `core.ignorestat` configuration variable. When
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]).
SEE ALSO
--------
linkgit:git-config[1],
-linkgit:git-add[1]
+linkgit:git-add[1],
+linkgit:git-ls-files[1]
GIT
---
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks--pre-commit.sample
index b187c4bb1..18c482976 100755
--- a/templates/hooks--pre-commit.sample
+++ b/templates/hooks--pre-commit.sample
@@ -18,6 +18,9 @@ fi
# If you want to allow non-ascii filenames set this variable to true.
allownonascii=$(git config hooks.allownonascii)
+# Redirect output to stderr.
+exec 1>&2
+
# Cross platform projects tend to avoid non-ascii filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
@@ -25,8 +28,8 @@ if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
- test "$(git diff --cached --name-only --diff-filter=A -z $against |
- LC_ALL=C tr -d '[ -~]\0')"
+ test $(git diff --cached --name-only --diff-filter=A -z $against |
+ LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
echo "Error: Attempt to add a non-ascii file name."
echo
@@ -43,4 +46,5 @@ then
exit 1
fi
+# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
diff --git a/wt-status.c b/wt-status.c
index 9f4e0ba9c..227622d15 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -394,7 +394,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
if (s->ignore_submodule_arg) {
DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
- }
+ }
rev.diffopt.format_callback = wt_status_collect_changed_cb;
rev.diffopt.format_callback_data = s;
init_pathspec(&rev.prune_data, s->pathspec);