<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/templates, branch v2.45.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.45.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.45.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2023-12-20T18:14:52Z</updated>
<entry>
<title>Merge branch 'jp/use-diff-index-in-pre-commit-sample'</title>
<updated>2023-12-20T18:14:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-12-20T18:14:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=145336ec1d028b9a6c1c39554972ffe0d497e7bb'/>
<id>urn:sha1:145336ec1d028b9a6c1c39554972ffe0d497e7bb</id>
<content type='text'>
The sample pre-commit hook that tries to catch introduction of new
paths that use potentially non-portable characters did not notice
an existing path getting renamed to such a problematic path, when
rename detection was enabled.

* jp/use-diff-index-in-pre-commit-sample:
  hooks--pre-commit: detect non-ASCII when renaming
</content>
</entry>
<entry>
<title>hooks--pre-commit: detect non-ASCII when renaming</title>
<updated>2023-12-03T02:55:40Z</updated>
<author>
<name>Julian Prein</name>
<email>druckdev@protonmail.com</email>
</author>
<published>2023-11-30T16:13:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d9fd71fa2a82da40a9b58c4ecbc49aed06cb8953'/>
<id>urn:sha1:d9fd71fa2a82da40a9b58c4ecbc49aed06cb8953</id>
<content type='text'>
When diff.renames is turned on, the diff-filter will not return renamed
files (or copied ones with diff.renames=copy) and potential non-ASCII
characters would not be caught by this hook.

Use the plumbing command diff-index instead of the porcelain one to not
be affected by diff.rename.

Signed-off-by: Julian Prein &lt;druckdev@protonmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>send-email: export patch counters in validate environment</title>
<updated>2023-04-14T17:41:15Z</updated>
<author>
<name>Robin Jarry</name>
<email>robin@jarry.cc</email>
</author>
<published>2023-04-14T15:52:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3c8d3adeae8326d3b73fee0b134abd68d55f7c67'/>
<id>urn:sha1:3c8d3adeae8326d3b73fee0b134abd68d55f7c67</id>
<content type='text'>
When sending patch series (with a cover-letter or not)
sendemail-validate is called with every email/patch file independently
from the others. When one of the patches depends on a previous one, it
may not be possible to use this hook in a meaningful way. A hook that
wants to check some property of the whole series needs to know which
patch is the final one.

Expose the current and total number of patches to the hook via the
GIT_SENDEMAIL_PATCH_COUNTER and GIT_SENDEMAIL_PATCH_TOTAL environment
variables so that both incremental and global validation is possible.

Sharing any other state between successive invocations of the validate
hook must be done via external means. For example, by storing it in
a git config sendemail.validateWorktree entry.

Add a sample script with placeholder validations and update tests to
check that the counters are properly exported.

Suggested-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
Signed-off-by: Robin Jarry &lt;robin@jarry.cc&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: query watchman with right valid json</title>
<updated>2022-06-07T17:00:49Z</updated>
<author>
<name>Son Luong Ngoc</name>
<email>sluongng@gmail.com</email>
</author>
<published>2022-06-07T11:14:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=134047b500fd6da079c4aad72c456cd76afe6771'/>
<id>urn:sha1:134047b500fd6da079c4aad72c456cd76afe6771</id>
<content type='text'>
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

  &gt; 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 &lt;avarab@gmail.com&gt;
Signed-off-by: Son Luong Ngoc &lt;sluongng@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Makefile: add "$(QUIET)" boilerplate to shared.mak</title>
<updated>2022-03-03T22:14:55Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-03-03T16:04:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a9fda017f40ee7ef2d41e52581b6064bb69ff7a2'/>
<id>urn:sha1:a9fda017f40ee7ef2d41e52581b6064bb69ff7a2</id>
<content type='text'>
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 &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Makefiles: add "shared.mak", move ".DELETE_ON_ERROR" to it</title>
<updated>2022-03-03T22:14:55Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-03-03T16:04:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8df786d2981f8f4456834798d99b9d92c562d1cd'/>
<id>urn:sha1:8df786d2981f8f4456834798d99b9d92c562d1cd</id>
<content type='text'>
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" &amp; "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 &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hook: add sample template for push-to-checkout</title>
<updated>2020-10-16T15:47:02Z</updated>
<author>
<name>Adam Spiers</name>
<email>git@adamspiers.org</email>
</author>
<published>2020-10-15T22:54:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e632c464d5dbbda72ae370ff6e9cbe31c01b0bb0'/>
<id>urn:sha1:e632c464d5dbbda72ae370ff6e9cbe31c01b0bb0</id>
<content type='text'>
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 &lt;git@adamspiers.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hooks--update.sample: use hash-agnostic zero OID</title>
<updated>2020-09-23T16:31:45Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-09-23T09:38:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d8d3d632f4165955da49032d50279c20cfbde2e5'/>
<id>urn:sha1:d8d3d632f4165955da49032d50279c20cfbde2e5</id>
<content type='text'>
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 &lt;/dev/null | tr '[0-9a-f]' '0'

so the sample hook becomes hash-agnostic.

Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hooks--pre-push.sample: use hash-agnostic zero OID</title>
<updated>2020-09-23T16:31:45Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-09-23T09:38:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8c7e5059506c6840bfbd4dd8d1730784a5689719'/>
<id>urn:sha1:8c7e5059506c6840bfbd4dd8d1730784a5689719</id>
<content type='text'>
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 &lt;/dev/null | tr '[0-9a-f]' '0'

so the sample hook becomes hash-agnostic.

Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hooks--pre-push.sample: modernize script</title>
<updated>2020-09-23T16:31:45Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-09-23T09:38:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6a117da6e523a82115733682f4d3f59755897d5a'/>
<id>urn:sha1:6a117da6e523a82115733682f4d3f59755897d5a</id>
<content type='text'>
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 &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
