path: root/templates
AgeCommit message (Collapse)Author
2022-06-07fsmonitor: query watchman with right valid jsonSon Luong Ngoc
In rare circumstances where the current git index does not carry the last_update_token, the fsmonitor v2 hook will be invoked with an empty string which would caused the final rendered json to be invalid. ["query", "/path/to/my/git/repository/", { "since": , "fields": ["name"], "expression": ["not", ["dirname", ".git"]] }] Which will left user with the following error message > git status failed to parse command from stdin: line 2, column 13, position 67: unexpected token near ',' Watchman: command returned no output. Falling back to scanning... Hide the "since" field in json query when "last_update_token" is empty. Co-authored-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Son Luong Ngoc <> Signed-off-by: Junio C Hamano <>
2022-03-03Makefile: add "$(QUIET)" boilerplate to shared.makÆvar Arnfjörð Bjarmason
The $(QUIET) variables we define are largely duplicated between our various Makefiles, let's define them in the new "shared.mak" instead. Since we're not using the environment to pass these around we don't need to export the "QUIET_GEN" and "QUIET_BUILT_IN" variables anymore. The "QUIET_GEN" variable is used in "git-gui/Makefile" and "gitweb/Makefile", but they've got their own definition for those. The "QUIET_BUILT_IN" variable is only used in the top-level "Makefile". We still need to export the "V" variable. Signed-off-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Junio C Hamano <>
2022-03-03Makefiles: add "shared.mak", move ".DELETE_ON_ERROR" to itÆvar Arnfjörð Bjarmason
We have various behavior that's shared across our Makefiles, or that really should be (e.g. via defined templates). Let's create a top-level "shared.mak" to house those sorts of things, and start by adding the ".DELETE_ON_ERROR" flag to it. See my own 7b76d6bf221 (Makefile: add and use the ".DELETE_ON_ERROR" flag, 2021-06-29) and db10fc6c09f (doc: simplify Makefile using .DELETE_ON_ERROR, 2021-05-21) for the addition and use of the ".DELETE_ON_ERROR" flag. I.e. this changes the behavior of existing rules in the altered Makefiles (except "Makefile" & "Documentation/Makefile"). I'm confident that this is safe having read the relevant rules in those Makfiles, and as the GNU make manual notes that it isn't the default behavior is out of an abundance of backwards compatibility caution. From edition 0.75 of its manual, covering GNU make 4.3: [Enabling '.DELETE_ON_ERROR' is] almost always what you want 'make' to do, but it is not historical practice; so for compatibility, you must explicitly request it. This doesn't introduce a bug by e.g. having this ".DELETE_ON_ERROR" flag only apply to this new shared.mak, Makefiles have no such scoping semantics. It does increase the danger that any Makefile without an explicit "The default target of this Makefile is..." snippet to define the default target as "all" could have its default rule changed if our new shared.mak ever defines a "real" rule. In subsequent commits we'll be careful not to do that, and such breakage would be obvious e.g. in the case of "make -C t". We might want to make that less fragile still (e.g. by using ".DEFAULT_GOAL" as noted in the preceding commit), but for now let's simply include "shared.mak" without adding that boilerplate to all the Makefiles that don't have it already. Most of those are already exposed to that potential caveat e.g. due to including "config.mak*". Signed-off-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Junio C Hamano <>
2020-10-16hook: add sample template for push-to-checkoutAdam Spiers
The template is a more-or-less exact translation to shell of the C code for the default behaviour for git's push-to-checkout hook defined in the push_to_deploy() function in builtin/receive-pack.c, to serve as a convenient starting point for modification. It also contains relevant text extracted from the git-config(1) and githooks(5) man pages. Signed-off-by: Adam Spiers <> Signed-off-by: Junio C Hamano <>
2020-09-23hooks--update.sample: use hash-agnostic zero OIDDenton Liu
The update sample hook has the zero OID hardcoded as 40 zeros. However, with the introduction of SHA-256 support, this assumption no longer holds true. Replace the hardcoded $z40 with a call to git hash-object --stdin </dev/null | tr '[0-9a-f]' '0' so the sample hook becomes hash-agnostic. Signed-off-by: Denton Liu <> Signed-off-by: Junio C Hamano <>
2020-09-23hooks--pre-push.sample: use hash-agnostic zero OIDDenton Liu
The pre-push sample hook has the zero OID hardcoded as 40 zeros. However, with the introduction of SHA-256 support, this assumption no longer holds true. Replace the hardcoded $z40 with a call to git hash-object --stdin </dev/null | tr '[0-9a-f]' '0' so the sample hook becomes hash-agnostic. Signed-off-by: Denton Liu <> Signed-off-by: Junio C Hamano <>
2020-09-23hooks--pre-push.sample: modernize scriptDenton Liu
The preferred form for a command substitution is $() over ``. Use this form for the command substitution in the sample hook. The preferred form for conditional tests is to use `test` over []. Replace [] with `test`. Finally, replace all instances of "sha" with "oid". Signed-off-by: Denton Liu <> Signed-off-by: Junio C Hamano <>
2020-02-14Merge branch 'kw/fsmonitor-watchman-racefix'Junio C Hamano
A new version of fsmonitor-watchman hook has been introduced, to avoid races. * kw/fsmonitor-watchman-racefix: fsmonitor: update documentation for hook version and watchman hooks fsmonitor: add fsmonitor hook scripts for version 2 fsmonitor: handle version 2 of the hooks that will use opaque token fsmonitor: change last update timestamp on the index_state to opaque token
2020-01-30Merge branch 'lh/bool-to-type-bool'Junio C Hamano
Replace "git config --bool" calls with "git config --type=bool" in sample templates. * lh/bool-to-type-bool: templates: fix deprecated type option `--bool`
2020-01-23fsmonitor: add fsmonitor hook scripts for version 2Kevin Willford
Version 2 of the fsmonitor hooks is passed the version and an update token and must pass back a last update token to use for subsequent calls to the hook. Signed-off-by: Kevin Willford <> Signed-off-by: Junio C Hamano <>
2020-01-21templates: fix deprecated type option `--bool`Lucius Hu
The `--bool` option to `git-config` is marked as historical, and users are recommended to use `--type=bool` instead. This commit replaces all occurrences of `--bool` in the templates. Also note that, no other deprecated type options are found, including `--int`, `--bool-or-int`, `--path`, or `--expiry-date`. Signed-off-by: Lucius Hu <> Signed-off-by: Junio C Hamano <>
2019-12-01Merge branch 'kw/fsmonitor-watchman-fix'Junio C Hamano
The watchman integration for fsmonitor was racy, which has been corrected to be more conservative. * kw/fsmonitor-watchman-fix: fsmonitor: fix watchman integration
2019-11-06fsmonitor: fix watchman integrationKevin Willford
When running Git commands quickly -- such as in a shell script or the test suite -- the Git commands frequently complete and start again during the same second. The example fsmonitor hooks to integrate with Watchman truncate the nanosecond times to seconds. In principle, this is fine, as Watchman claims to use inclusive comparisons [1]. The result should only be an over-representation of the changed paths since the last Git command. However, Watchman's own documentation claims "Using a timestamp is prone to race conditions in understanding the complete state of the file tree" [2]. All of their documented examples use a "clockspec" that looks like 'c:123:234'. Git should eventually learn how to store this type of string to provide a stronger integration, but that will be a more invasive change. When using GIT_TEST_FSMONITOR="$(pwd)/t7519/fsmonitor-watchman", scripts such as fail due to these race conditions. In fact, running any test script with GIT_TEST_FSMONITOR pointing at t/t7519/fsmonitor-wathcman will cause failures in the test_commit function. The 'git add "$indir$file"' command fails due to not enough time between the creation of '$file' and the 'git add' command. For now, subtract one second from the timestamp we pass to Watchman. This will make our window large enough to avoid these race conditions. Increasing the window causes tests like to pass. When the integration was introduced in def437671 (fsmonitor: add a sample integration script for Watchman, 2018-09-22), the query included an expression that would ignore files created and deleted in that window. The performance reason for this change was to ignore temporary files created by a build between Git commands. However, this causes failures in script scenarios where Git is creating or deleting files quickly. When using GIT_TEST_FSMONITOR as before, fails due to this add-and-delete race condition. By removing the "expression" from the Watchman query, we remove this race condition. It will lead to some performance degradation in the case of users creating and deleting temporary files inside their working directory between Git commands. However, that is a cost we need to pay to be correct. [1] [2] Helped-by: Derrick Stolee <> Signed-off-by: Kevin Willford <> Signed-off-by: Junio C Hamano <>
2019-08-07git-merge: honor pre-merge-commit hookMichael J Gruber
git-merge does not honor the pre-commit hook when doing automatic merge commits, and for compatibility reasons this is going to stay. Introduce a pre-merge-commit hook which is called for an automatic merge commit just like pre-commit is called for a non-automatic merge commit (or any other commit). [js: * renamed hook from "pre-merge" to "pre-merge-commit" * only discard the index if the hook is actually present * expanded githooks documentation entry * clarified that hook should write messages to stderr * squashed test changes from the original series' patch 4/4 * modified tests to follow new pattern from this series' patch 1/4 * added a test case for non-executable merge hooks * added a test case for failed merges * when testing that the merge hook did not run, make sure we actually have a merge to perform (by resetting the "side" branch to its original state). * reworded commit message ] Improved-by: Martin Ågren <> Signed-off-by: Michael J Gruber <> Signed-off-by: Martin Ågren <> Signed-off-by: Josh Steadmon <> Signed-off-by: Junio C Hamano <>
2018-05-02Update shell scripts to compute empty tree object IDbrian m. carlson
Several of our shell scripts hard-code the object ID of the empty tree. To avoid any problems when changing hashes, compute this value on startup of the script. For performance, store the value in a variable and reuse it throughout the life of the script. Signed-off-by: brian m. carlson <> Signed-off-by: Junio C Hamano <>
2017-11-13fsmonitor: simplify determining the git worktree under WindowsBen Peart
Simplify and speed up the process of finding the git worktree when running on Windows by keeping it in perl and avoiding spawning helper processes. Signed-off-by: Ben Peart <> Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
2017-11-10fsmonitor: read from getcwd(), not the PWD environment variableAlex Vandiver
Though the process has chdir'd to the root of the working tree, the PWD environment variable is only guaranteed to be updated accordingly if a shell is involved -- which is not guaranteed to be the case. That is, if `/usr/bin/perl` is a binary, $ENV{PWD} is unchanged from whatever spawned `git` -- if `/usr/bin/perl` is a trivial shell wrapper to the real `perl`, `$ENV{PWD}` will have been updated to the root of the working copy. Update to read from the Cwd module using the `getcwd` syscall, not the PWD environment variable. The Cygwin case is left unchanged, as it necessarily _does_ go through a shell. Signed-off-by: Alex Vandiver <> Signed-off-by: Junio C Hamano <>
2017-10-30fsmonitor: don't bother pretty-printing JSON from watchmanAlex Vandiver
This provides modest performance savings. Benchmarking with the following program, with and without `--no-pretty`, we find savings of 23% (0.316s -> 0.242s) in the git repository, and savings of 8% (5.24s -> 4.86s) on a large repository with 580k files in the working copy. #!/usr/bin/perl use strict; use warnings; use IPC::Open2; use JSON::XS; my $pid = open2(\*CHLD_OUT, \*CHLD_IN, "watchman -j @ARGV") or die "open2() failed: $!\n" . "Falling back to scanning...\n"; my $query = qq|["query", "$ENV{PWD}", {}]|; print CHLD_IN $query; close CHLD_IN; my $response = do {local $/; <CHLD_OUT>}; JSON::XS->new->utf8->decode($response); Signed-off-by: Alex Vandiver <> Signed-off-by: Junio C Hamano <>
2017-10-04fsmonitor: read entirety of watchman outputAlex Vandiver
In Perl, setting $/ sets the string that is used as the "record separator," which sets the boundary that the `<>` construct reads to. Setting `local $/ = 0666;` evaluates the octal, getting 438, and stringifies it. Thus, the later read from `<CHLD_OUT>` stops as soon as it encounters the string "438" in the watchman output, yielding invalid JSON; repositories containing filenames with SHA1 hashes are able to trip this easily. Set `$/` to undefined, thus slurping all output from watchman. Also close STDIN which is provided to watchman, to better guarantee that we cannot deadlock with watchman while both attempting to read. Signed-off-by: Alex Vandiver <> Signed-off-by: Junio C Hamano <>
2017-10-04fsmonitor: MINGW support for watchman integrationBen Peart
Instead of just taking $ENV{'PWD'}, use the same logic that converts PWD to $git_work_tree on MSYS_NT in the watchman integration hook script also on MINGW. Signed-off-by: Ben Peart <> Signed-off-by: Junio C Hamano <>
2017-10-01fsmonitor: add a sample integration script for WatchmanBen Peart
This script integrates the new fsmonitor capabilities of git with the cross platform Watchman file watching service. To use the script: Download and install Watchman from Rename the sample integration hook from fsmonitor-watchman.sample to fsmonitor-watchman. Configure git to use the extension: git config core.fsmonitor .git/hooks/fsmonitor-watchman Optionally turn on the untracked cache for optimal performance. Signed-off-by: Ben Peart <> Signed-off-by: Johannes Schindelin <> Signed-off-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Christian Couder <> Signed-off-by: Junio C Hamano <>
2017-09-10Merge branch 'ma/up-to-date'Junio C Hamano
Message and doc updates. * ma/up-to-date: treewide: correct several "up-to-date" to "up to date" Documentation/user-manual: update outdated example output
2017-08-23Merge branch 'ks/prepare-commit-msg-sample-fix'Junio C Hamano
An "oops" fix to a topic that is already in 'master'. * ks/prepare-commit-msg-sample-fix: hook: use correct logical variable
2017-08-23treewide: correct several "up-to-date" to "up to date"Martin Ågren
Follow the Oxford style, which says to use "up-to-date" before the noun, but "up to date" after it. Don't change plumbing (specifically send-pack.c, but transport.c (git push) also has the same string). This was produced by grepping for "up-to-date" and "up to date". It turned out we only had to edit in one direction, removing the hyphens. Fix a typo in Documentation/git-diff-index.txt while we're there. Reported-by: Jeffrey Manian <> Reported-by: STEVEN WHITE <> Signed-off-by: Martin Ågren <> Signed-off-by: Junio C Hamano <>
2017-08-14hook: use correct logical variableKaartic Sivaraam
Sign-off added should be that of the "committer", not that of the "commit's author"; that is how the rest of Git adds sign-off using sequencer.c::append_signoff(). Use the correct logical variable that identifies the committer. Signed-off-by: Kaartic Sivaraam <> Signed-off-by: Junio C Hamano <>
2017-08-11Merge branch 'ks/prepare-commit-msg-sample'Junio C Hamano
Remove an example that is now obsolete from a sample hook, and improve an old example in it that added a sign-off manually to use the interpret-trailers command. * ks/prepare-commit-msg-sample: hook: add a simple first example hook: add sign-off using "interpret-trailers" hook: name the positional variables hook: cleanup script
2017-07-12hook: add a simple first exampleKaartic Sivaraam
Add a simple example that replaces an outdated example that was removed. This ensures that there's at the least a simple example that illustrates what could be done using the hook just by enabling it. Also, update the documentation. Signed-off-by: Kaartic Sivaraam <> Signed-off-by: Junio C Hamano <>
2017-07-12hook: add sign-off using "interpret-trailers"Kaartic Sivaraam
The sample hook to prepare the commit message before a commit allows users to opt-in to add the sign-off to the commit message. The sign-off is added at a place that isn't consistent with the "-s" option of "git commit". Further, it could go out of view in certain cases. Add the sign-off in a way similar to "-s" option of "git commit" using git's interpret-trailers command. It works well in all cases except when the user invokes "git commit" without any arguments. In that case manually add a new line after the first line to ensure it's consistent with the output of "-s" option. Signed-off-by: Kaartic Sivaraam <> Signed-off-by: Junio C Hamano <>
2017-07-12hook: name the positional variablesKaartic Sivaraam
It's always nice to have named variables instead of positional variables as they communicate their purpose well. Appropriately name the positional variables of the hook to make it easier to see what's going on. Signed-off-by: Kaartic Sivaraam <> Signed-off-by: Junio C Hamano <>
2017-07-12hook: cleanup scriptKaartic Sivaraam
Prepare the 'preare-commit-msg' sample script for upcoming changes. Preparation includes removal of an example that has outlived it's purpose. The example is the one that comments the "Conflicts:" part of a merge commit message. It isn't relevant anymore as it's done by default since 261f315b ("merge & sequencer: turn "Conflicts:" hint into a comment", 2014-08-28). Further update the relevant comments from the sample script and update the documentation. Signed-off-by: Kaartic Sivaraam <> Signed-off-by: Junio C Hamano <>
2017-07-11pre-rebase hook: capture documentation in a <<here documentJonathan Nieder
Without this change, the sample hook does not pass a syntax check (sh -n): $ sh -n hooks--pre-rebase.sample hooks--pre-rebase.sample: line 101: syntax error near unexpected token `(' hooks--pre-rebase.sample: line 101: ` merged into it again (either directly or indirectly).' Signed-off-by: Jonathan Nieder <> Signed-off-by: Stefan Beller <> Signed-off-by: Junio C Hamano <>
2016-10-28pre-receive.sample: mark it executableAnders Kaseorg
For consistency with other hooks, make the sample hook executable. Signed-off-by: Anders Kaseorg <> Signed-off-by: Junio C Hamano <>
2016-07-14push options: {pre,post}-receive hook learns about push optionsStefan Beller
The environment variable GIT_PUSH_OPTION_COUNT is set to the number of push options sent, and GIT_PUSH_OPTION_{0,1,..} is set to the transmitted option. The code is not executed as the push options are set to NULL, nor is the new capability advertised. There was some discussion back and forth how to present these push options to the user as there are some ways to do it: Keep all options in one environment variable ============================================ + easiest way to implement in Git - This would make things hard to parse correctly in the hook. Put the options in files instead, filenames are in GIT_PUSH_OPTION_FILES ====================================== + After a discussion about environment variables and shells, we may not want to put user data into an environment variable (see [1] for example). + We could transmit binaries, i.e. we're not bound to C strings as we are when using environment variables to the user. + Maybe easier to parse than constructing environment variable names GIT_PUSH_OPTION_{0,1,..} yourself - cleanup of the temporary files is hard to do reliably - we have race conditions with multiple clients pushing, hence we'd need to use mkstemp. That's not too bad, but still. Use environment variables, but restrict to key/value pairs ========================================================== (When the user pushes a push option `foo=bar`, we'd GIT_PUSH_OPTION_foo=bar) + very easy to parse for a simple model of push options - it's not sufficient for more elaborate models, e.g. it doesn't allow doubles (e.g. cc=reviewer@email) Present the options in different environment variables ====================================================== (This is implemented) * harder to parse as a user, but we have a sample hook for that. - doesn't allow binary files + allows the same option twice, i.e. is not restrictive about options, except for binary files. + doesn't clutter a remote directory with (possibly stale) temporary files As we first want to focus on getting simple strings to work reliably, we go with the last option for now. If we want to do transmission of binaries later, we can just attach a 'side-channel', e.g. "any push option that contains a '\0' is put into a file instead of the environment variable and we'd have new GIT_PUSH_OPTION_FILES, GIT_PUSH_OPTION_FILENAME_{0,1,..} environment variables". [1] 'Shellshock' Signed-off-by: Stefan Beller <> Signed-off-by: Junio C Hamano <>
2016-02-26Merge branch 'ma/update-hooks-sample-typofix'Junio C Hamano
* ma/update-hooks-sample-typofix: templates/hooks: fix minor typo in the sample update-hook
2016-02-25templates/hooks: fix minor typo in the sample update-hookMartin Amdisen
Signed-off-by: Martin Mosegaard Amdisen <> Signed-off-by: Junio C Hamano <>
2015-05-11Merge branch 'nd/multiple-work-trees'Junio C Hamano
A replacement for contrib/workdir/git-new-workdir that does not rely on symbolic links and make sharing of objects and refs safer by making the borrowee and borrowers aware of each other. * nd/multiple-work-trees: (41 commits) prune --worktrees: fix expire vs worktree existence condition t1501: fix test with split index t2026: fix broken &&-chain t2026 needs procondition SANITY git-checkout.txt: a note about multiple checkout support for submodules checkout: add --ignore-other-wortrees checkout: pass whole struct to parse_branchname_arg instead of individual flags git-common-dir: make "modules/" per-working-directory directory checkout: do not fail if target is an empty directory t2025: add a test to make sure grafts is working from a linked checkout checkout: don't require a work tree when checking out into a new one git_path(): keep "info/sparse-checkout" per work-tree count-objects: report unused files in $GIT_DIR/worktrees/... gc: support prune --worktrees gc: factor out gc.pruneexpire parsing code gc: style change -- no SP before closing parenthesis checkout: clean up half-prepared directories in --to mode checkout: reject if the branch is already checked out elsewhere prune: strategies for linked checkouts checkout: support checking out into a new working directory ...
2014-12-22pre-push.sample: remove unnecessary and misleading IFS=' 'Jim Hill
The sample hook explicitly sets IFS to SP and nothing else so that the "read" used in the per-ref while loop that iterates over "<localref> SP <localsha1> SP <remoteref> SP <remotesha>" records, where we know refs and sha1s will not have SPs, would split them correctly. While this is not wrong per-se, it is not necessary; because we know these fields do not contain HT or LF, either, we can simply leave IFS the default. This will also prevent those who cut and paste from this sample from getting bitten when they write things in the per-ref loop that need splitting with the default $IFS (e.g. use $(git rev-list ...) to produce one-record-per-line output). Signed-off-by: Jim Hill <> Signed-off-by: Junio C Hamano <>
2014-12-01*.sh: avoid hardcoding $GIT_DIR/hooks/...Nguyễn Thái Ngọc Duy
If $GIT_COMMON_DIR is set, it should be $GIT_COMMON_DIR/hooks/, not $GIT_DIR/hooks/. Just let rev-parse --git-path handle it. Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
2014-09-11pre-push.sample: Write error message to stderrW. Trevor King
githooks(5) suggests: Information about why the push is rejected may be sent to the user by writing to standard error. So follow that advice in the sample. Signed-off-by: W. Trevor King <> Signed-off-by: Junio C Hamano <>
2013-09-24sample pre-commit hook: use --bool when retrieving config varJohan Herland
Currently if you set [hooks] allowNonAscii (or allownonascii = 1, or = yes) in your .git/config then the sample pre-commit misinterprets the value as "false" and rejects non-ASCII filenames. Use "git config --bool" to get the usual nicer boolean handling. Signed-off-by: Johan Herland <> Signed-off-by: Jonathan Nieder <>
2013-09-03Merge branch 'maint-1.8.3' into maintJunio C Hamano
* maint-1.8.3: fix shell syntax error in template
2013-08-30fix shell syntax error in templateThorsten Glaser
An if clause must not be empty; add a "colon" command. Signed-off-by: Thorsten Glaser <> Signed-off-by: Junio C Hamano <>
2013-07-15templates: spell ASCII in uppercase in pre-commit hookRichard Hartmann
The name of the encoding is ASCII, not ascii. Signed-off-by: Richard Hartmann <> Signed-off-by: Junio C Hamano <>
2013-07-15templates: Reformat pre-commit hook's messageRichard Hartmann
Now that we're using heredoc, the message can span the full 80 chars. Signed-off-by: Richard Hartmann <> Signed-off-by: Junio C Hamano <>
2013-07-15templates: Use heredoc in pre-commit hookRichard Hartmann
This way, it is easier to see how the text we give the end users would look like, and it will allow us to use (near) full width of the source file. Signed-off-by: Richard Hartmann <> Signed-off-by: Junio C Hamano <>
2013-06-11pre-push.sample: Make the script executableWieland Hoffmann
githooks(5) says that "[...]the .sample files are executable by default" which was not true. Signed-off-by: Wieland Hoffmann <> Signed-off-by: Junio C Hamano <>
2013-02-24templates/hooks--update.sample: use a lowercase "usage:" stringDavid Aguilar
Make the usage string consistent with Git. Reviewed-by: Jonathan Nieder <> Signed-off-by: David Aguilar <> Signed-off-by: Junio C Hamano <>
2013-01-18Add sample pre-push hook scriptAaron Schrab
Create a sample of a script for a pre-push hook. The main purpose is to illustrate how a script may parse the information which is supplied to such a hook. The script may also be useful to some people as-is for avoiding to push commits which are marked as a work in progress. Signed-off-by: Aaron Schrab <> Signed-off-by: Junio C Hamano <>
2011-10-26Merge branch 'maint-1.7.6' into maintJunio C Hamano
* maint-1.7.6: make the sample pre-commit hook script reject names with newlines, too git-read-tree.txt: update sparse checkout examples git-read-tree.txt: correct sparse-checkout and skip-worktree description git-read-tree.txt: language and typography fixes unpack-trees: print "Aborting" to stderr Documentation/git-update-index: refer to 'ls-files' Documentation: basic configuration of notes.rewriteRef
2011-10-26make the sample pre-commit hook script reject names with newlines, tooJim Meyering
The sample pre-commit hook script would fail to reject a file name like "a\nb" because of the way newlines are handled in "$(...)". Adjust the test to count filtered bytes and require there be 0. Also print all diagnostics to standard error, not stdout, so they will actually be seen. Signed-off-by: Jim Meyering <> Signed-off-by: Junio C Hamano <>