Skip to contentSkip to conversation

What's cooking in git.git (Oct 2016, #09; Mon, 31)

PATCH In review Junio C Hamano 7 participants 30 messages Oct 31, 2016 – Nov 8, 2016 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Here are the topics that have been cooking. Commits prefixed with '-' are only in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'. The ones marked with '.' do not appear in any of the integration branches, but I am still holding onto them.

Git v2.10.2, the second maintenance release for 2.10.x track, has been tagged. On the master front, an early preview v2.11.0-rc0 has been tagged. An updated, slightly slipped from the original, schedule is found at http://tinyurl.com/gitCal and I am hoping that we can conclude this cycle before US Thanksgiving.

You can find the changes described here in the integration branches of the repositories listed at

http://git-blame.blogspot.com/p/git-public-repositories.html

--------------------------------------------------
[Graduated to "master"]

* ak/pre-receive-hook-template-modefix (2016-10-28) 1 commit (merged to 'next' on 2016-10-28 at 86d95836a3)
+ pre-receive.sample: mark it executable

A trivial clean-up to a recently graduated topic.

* ak/sh-setup-dot-source-i18n-fix (2016-10-30) 1 commit (merged to 'next' on 2016-10-31 at 538a72700e)
+ git-sh-setup: be explicit where to dot-source git-sh-i18n from.

Recent update to git-sh-setup (a library of shell functions that are used by our in-tree scripted Porcelain commands) included another shell library git-sh-i18n without specifying where it is, relying on the $PATH. This has been fixed to be more explicit by prefixing $(git --exec-path) output in front.

* aw/numbered-stash (2016-10-26) 1 commit (merged to 'next' on 2016-10-26 at 8d9325fa3a)
+ stash: allow stashes to be referenced by index only

The user always has to say "stash@{$N}" when naming a single element in the default location of the stash, i.e. reflogs in refs/stash. The "git stash" command learned to accept "git stash apply 4" as a short-hand for "git stash apply stash@{4}".

* jk/common-main (2016-10-27) 1 commit
(merged to 'next' on 2016-10-28 at fcdd4f8a26)
+ git-compat-util: move content inside ifdef/endif guards

A trivial clean-up to a recently graduated topic.

* jk/rebase-config-insn-fmt-docfix (2016-10-30) 1 commit (merged to 'next' on 2016-10-31 at d48e20ffa2)
+ doc: fix missing "::" in config list

Documentation fix.

* jt/trailer-with-cruft (2016-10-21) 8 commits (merged to 'next' on 2016-10-27 at b5d1a21811)
+ trailer: support values folded to multiple lines
+ trailer: forbid leading whitespace in trailers
+ trailer: allow non-trailers in trailer block
+ trailer: clarify failure modes in parse_trailer
+ trailer: make args have their own struct
+ trailer: streamline trailer item create and add
+ trailer: use list.h for doubly-linked list
+ trailer: improve const correctness
(this branch is used by jt/use-trailer-api-in-commands.)

Update "interpret-trailers" machinery and teaches it that people in real world write all sorts of crufts in the "trailer" that was originally designed to have the neat-o "Mail-Header: like thing" and nothing else.

* ls/filter-process (2016-10-17) 14 commits
(merged to 'next' on 2016-10-19 at ffd0de042c)
+ contrib/long-running-filter: add long running filter example
+ convert: add filter.<driver>.process option
+ convert: prepare filter.<driver>.process option
+ convert: make apply_filter() adhere to standard Git error handling
+ pkt-line: add functions to read/write flush terminated packet streams
+ pkt-line: add packet_write_gently()
+ pkt-line: add packet_flush_gently()
+ pkt-line: add packet_write_fmt_gently()
+ pkt-line: extract set_packet_header()
+ pkt-line: rename packet_write() to packet_write_fmt()
+ run-command: add clean_on_exit_handler
+ run-command: move check_pipe() from write_or_die to run_command
+ convert: modernize tests
+ convert: quote filter names in error messages

The smudge/clean filter API expect an external process is spawned to filter the contents for each path that has a filter defined. A new type of "process" filter API has been added to allow the first request to run the filter for a path to spawn a single process, and all filtering need is served by this single process for multiple paths, reducing the process creation overhead.

* ls/git-open-cloexec (2016-10-25) 3 commits
(merged to 'next' on 2016-10-26 at f7259cbddb)
+ read-cache: make sure file handles are not inherited by child processes
+ sha1_file: open window into packfiles with O_CLOEXEC
+ sha1_file: rename git_open_noatime() to git_open()
(this branch is used by jc/git-open-cloexec.)

Git generally does not explicitly close file descriptors that were open in the parent process when spawning a child process, but most of the time the child does not want to access them. As Windows does not allow removing or renaming a file that has a file descriptor open, a slow-to-exit child can even break the parent process by holding onto them. Use O_CLOEXEC flag to open files in various codepaths.

* nd/test-helpers (2016-10-27) 1 commit
(merged to 'next' on 2016-10-31 at 9780fe6d90)
+ valgrind: support test helpers

Update to the test framework made in 2.9 timeframe broke running the tests under valgrind, which has been fixed.

* rs/commit-pptr-simplify (2016-10-30) 1 commit
(merged to 'next' on 2016-10-31 at ddeed2e66a)
+ commit: simplify building parents list

Code simplification.

* sc/fmt-merge-msg-doc-markup-fix (2016-10-28) 1 commit (merged to 'next' on 2016-10-31 at 198c259bb2)
+ Documentation/fmt-merge-msg: fix markup in example

Documentation fix.

--------------------------------------------------
[New Topics]

* jc/push-default-explicit (2016-10-28) 1 commit
- push: do not use potentially ambiguous default refspec

A lazy "git push" without refspec did not internally use a fully specified refspec to perform 'current', 'simple', or 'upstream' push, causing unnecessary "ambiguous ref" errors.

Needs updates to the tests.

* jt/use-trailer-api-in-commands (2016-10-28) 4 commits
- sequencer: use trailer's trailer layout
- trailer: have function to describe trailer layout
- trailer: avoid unnecessary splitting on lines
- commit: make ignore_non_trailer take buf/len

Commands that operate on a log message and add lines to the trailer blocks, such as "format-patch -s", "cherry-pick (-x|-s)", and "commit -s", have been taught to use the logic of and share the code with "git interpret-trailer".

--------------------------------------------------
[Stalled]

* hv/submodule-not-yet-pushed-fix (2016-10-10) 3 commits
- batch check whether submodule needs pushing into one call
- serialize collection of refs that contain submodule changes
- serialize collection of changed submodules

The code in "git push" to compute if any commit being pushed in the superproject binds a commit in a submodule that hasn't been pushed out was overly inefficient, making it unusable even for a small project that does not have any submodule but have a reasonable number of refs.

Waiting for review.
cf. <[email protected]>

* sb/push-make-submodule-check-the-default (2016-10-10) 2 commits
- push: change submodule default to check when submodules exist
- submodule add: extend force flag to add existing repos

Turn the default of "push.recurseSubmodules" to "check" when submodules seem to be in use.

Will hold to wait for hv/submodule-not-yet-pushed-fix

* jc/bundle (2016-03-03) 6 commits
- index-pack: --clone-bundle option
- Merge branch 'jc/index-pack' into jc/bundle
- bundle v3: the beginning
- bundle: keep a copy of bundle file name in the in-core bundle header
- bundle: plug resource leak
- bundle doc: 'verify' is not about verifying the bundle

The beginning of "split bundle", which could be one of the ingredients to allow "git clone" traffic off of the core server network to CDN.

While I think it would make it easier for people to experiment and build on if the topic is merged to 'next', I am at the same time a bit reluctant to merge an unproven new topic that introduces a new file format, which we may end up having to support til the end of time. It is likely that to support a "prime clone from CDN", it would need a lot more than just "these are the heads and the pack data is over there", so this may not be sufficient.

Will discard.

* mh/connect (2016-06-06) 10 commits
- connect: [host:port] is legacy for ssh
- connect: move ssh command line preparation to a separate function
- connect: actively reject git:// urls with a user part
- connect: change the --diag-url output to separate user and host
- connect: make parse_connect_url() return the user part of the url as a separate value
- connect: group CONNECT_DIAG_URL handling code
- connect: make parse_connect_url() return separated host and port
- connect: re-derive a host:port string from the separate host and port variables
- connect: call get_host_and_port() earlier
- connect: document why we sometimes call get_port after get_host_and_port

Rewrite Git-URL parsing routine (hopefully) without changing any behaviour.

It has been two months without any support. We may want to discard this.

* kn/ref-filter-branch-list (2016-05-17) 17 commits
- branch: implement '--format' option
- branch: use ref-filter printing APIs
- branch, tag: use porcelain output
- ref-filter: allow porcelain to translate messages in the output
- ref-filter: add :dir and :base options for ref printing atoms
- ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
- ref-filter: introduce symref_atom_parser() and refname_atom_parser()
- ref-filter: introduce refname_atom_parser_internal()
- ref-filter: make "%(symref)" atom work with the ':short' modifier
- ref-filter: add support for %(upstream:track,nobracket)
- ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
- ref-filter: introduce format_ref_array_item()
- ref-filter: move get_head_description() from branch.c
- ref-filter: modify "%(objectname:short)" to take length
- ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
- ref-filter: include reference to 'used_atom' within 'atom_value'
- ref-filter: implement %(if), %(then), and %(else) atoms

The code to list branches in "git branch" has been consolidated with the more generic ref-filter API.

Rerolled.
Needs review.

* ec/annotate-deleted (2015-11-20) 1 commit
- annotate: skip checking working tree if a revision is provided

Usability fix for annotate-specific "<file> <rev>" syntax with deleted files.

Has been waiting for a review for too long without seeing anything.

Will discard.

* dk/gc-more-wo-pack (2016-01-13) 4 commits
- gc: clean garbage .bitmap files from pack dir
- t5304: ensure non-garbage files are not deleted
- t5304: test .bitmap garbage files
- prepare_packed_git(): find more garbage

Follow-on to dk/gc-idx-wo-pack topic, to clean up stale .bitmap and .keep files.

Has been waiting for a reroll for too long. cf. <[email protected]>

Will discard.

* jc/diff-b-m (2015-02-23) 5 commits
. WIPWIP
. WIP: diff-b-m
- diffcore-rename: allow easier debugging
- diffcore-rename.c: add locate_rename_src()
- diffcore-break: allow debugging

"git diff -B -M" produced incorrect patch when the postimage of a completely rewritten file is similar to the preimage of a removed file; such a resulting file must not be expressed as a rename from other place.

The fix in this patch is broken, unfortunately.

Will discard.

--------------------------------------------------
[Cooking]

* nd/rebase-forget (2016-10-28) 1 commit
- rebase: add --forget to cleanup rebase, leave HEAD untouched

"git rebase" learned "--forget" option, which allows a user to remove the metadata left by an earlier "git rebase" that was manually aborted without using "git rebase --abort".

Waiting for a reroll.

* jc/git-open-cloexec (2016-10-31) 3 commits
- sha1_file: stop opening files with O_NOATIME
- git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback
- git_open(): untangle possible NOATIME and CLOEXEC interactions

The codeflow of setting NOATIME and CLOEXEC on file descriptors Git opens has been simplified.

We may want to drop the tip one.

* jk/no-looking-at-dotgit-outside-repo-final (2016-10-26) 1 commit (merged to 'next' on 2016-10-26 at 220e160451)
+ setup_git_env: avoid blind fall-back to ".git"

This is the endgame of the topic to avoid blindly falling back to ".git" when the setup sequence said we are _not_ in Git repository. A corner case that happens to work right now may be broken by a call to die("BUG").

Will cook in 'next'.

* jc/reset-unmerge (2016-10-24) 1 commit
- reset: --unmerge

After "git add" is run prematurely during a conflict resolution, "git diff" can no longer be used as a way to sanity check by looking at the combined diff. "git reset" learned a new "--unmerge" option to recover from this situation.

* jc/merge-base-fp-only (2016-10-19) 8 commits
. merge-base: fp experiment
- merge: allow to use only the fp-only merge bases
- merge-base: limit the output to bases that are on first-parent chain
- merge-base: mark bases that are on first-parent chain
- merge-base: expose get_merge_bases_many_0() a bit more
- merge-base: stop moving commits around in remove_redundant()
- sha1_name: remove ONELINE_SEEN bit
- commit: simplify fastpath of merge-base

An experiment of merge-base that ignores common ancestors that are not on the first parent chain.

* tb/convert-stream-check (2016-10-27) 2 commits
- convert.c: stream and fast search for binary
- read-cache: factor out get_sha1_from_index() helper

End-of-line conversion sometimes needs to see if the current blob in the index has NULs and CRs to base its decision. We used to always get a full statistics over the blob, but in many cases we can return early when we have seen "enough" (e.g. if we see a single NUL, the blob will be handled as binary). The codepaths have been optimized by using streaming interface.

Waiting for review.
The tip seems to do too much in a single commit and may be better split. cf. <[email protected]>
cf. <[email protected]>

* pb/bisect (2016-10-18) 27 commits
- bisect--helper: remove the dequote in bisect_start()
- bisect--helper: retire --bisect-auto-next subcommand
- bisect--helper: retire --bisect-autostart subcommand
- bisect--helper: retire --bisect-write subcommand
- bisect--helper: bisect_replay shell function in C
- bisect--helper: bisect_log shell function in C
- bisect--helper: retire --write-terms subcommand
- bisect--helper: retire --check-expected-revs subcommand
- bisect--helper: bisect_state & bisect_head shell function in C
- bisect--helper: bisect_autostart shell function in C
- bisect--helper: retire --next-all subcommand
- bisect--helper: retire --bisect-clean-state subcommand
- bisect--helper: bisect_next and bisect_auto_next shell function in C
- t6030: no cleanup with bad merge base
- bisect--helper: bisect_start shell function partially in C
- bisect--helper: get_terms & bisect_terms shell function in C
- bisect--helper: bisect_next_check & bisect_voc shell function in C
- bisect--helper: check_and_set_terms shell function in C
- bisect--helper: bisect_write shell function in C
- bisect--helper: is_expected_rev & check_expected_revs shell function in C
- bisect--helper: bisect_reset shell function in C
- wrapper: move is_empty_file() and rename it as is_empty_or_missing_file()
- t6030: explicitly test for bisection cleanup
- bisect--helper: bisect_clean_state shell function in C
- bisect--helper: write_terms shell function in C
- bisect: rewrite check_term_format shell function in C
- bisect--helper: use OPT_CMDMODE instead of OPT_BOOL

Move more parts of "git bisect" to C.

Waiting for review.

* st/verify-tag (2016-10-10) 7 commits
- t/t7004-tag: Add --format specifier tests
- t/t7030-verify-tag: Add --format specifier tests
- builtin/tag: add --format argument for tag -v
- builtin/verify-tag: add --format to verify-tag
- tag: add format specifier to gpg_verify_tag
- ref-filter: add function to print single ref_array_item
- gpg-interface, tag: add GPG_VERIFY_QUIET flag

"git tag" and "git verify-tag" learned to put GPG verification status in their "--format=<placeholders>" output format.

Waiting for a reroll.
cf. <[email protected]>

* sb/attr (2016-10-28) 37 commits
- completion: clone can initialize specific submodules
- clone: add --init-submodule=<pathspec> switch
- submodule update: add --init-default-path switch
- pathspec: allow escaped query values
- pathspec: allow querying for attributes
- pathspec: move prefix check out of the inner loop
- pathspec: move long magic parsing out of prefix_pathspec
- Documentation: fix a typo
- attr: keep attr stack for each check
- SQUASH???
- attr: convert to new threadsafe API
- attr: make git_check_attr_counted static
- attr.c: outline the future plans by heavily commenting
- attr.c: always pass check[] to collect_some_attrs()
- attr.c: introduce empty_attr_check_elems()
- attr.c: correct ugly hack for git_all_attrs()
- attr.c: rename a local variable check
- attr.c: pass struct git_attr_check down the callchain
- attr.c: add push_stack() helper
- attr: support quoting pathname patterns in C style
- attr: expose validity check for attribute names
- attr: add counted string version of git_attr()
- attr: add counted string version of git_check_attr()
- attr: retire git_check_attrs() API
- attr: convert git_check_attrs() callers to use the new API
- attr: convert git_all_attrs() to use "struct git_attr_check"
- attr: (re)introduce git_check_attr() and struct git_attr_check
- attr: rename function and struct related to checking attributes
- attr.c: plug small leak in parse_attr_line()
- attr.c: tighten constness around "git_attr" structure
- attr.c: simplify macroexpand_one()
- attr.c: mark where #if DEBUG ends more clearly
- attr.c: complete a sentence in a comment
- attr.c: explain the lack of attr-name syntax check in parse_attr()
- attr.c: update a stale comment on "struct match_attr"
- attr.c: use strchrnul() to scan for one line
- commit.c: use strchrnul() to scan for one line

The attributes API has been updated so that it can later be optimized using the knowledge of which attributes are queried. Building on top of the updated API, the pathspec machinery learned to select only paths with given attributes set.

Waiting for review.

* va/i18n-perl-scripts (2016-10-20) 14 commits
- i18n: difftool: mark warnings for translation
- i18n: send-email: mark string with interpolation for translation
- i18n: send-email: mark warnings and errors for translation
- i18n: send-email: mark strings for translation
- i18n: add--interactive: mark status words for translation
- i18n: add--interactive: remove %patch_modes entries
- i18n: add--interactive: mark edit_hunk_manually message for translation
- i18n: add--interactive: i18n of help_patch_cmd
- i18n: add--interactive: mark patch prompt for translation
- i18n: add--interactive: mark plural strings
- i18n: clean.c: match string with git-add--interactive.perl
- i18n: add--interactive: mark strings with interpolation for translation
- i18n: add--interactive: mark simple here-documents for translation
- i18n: add--interactive: mark strings for translation

Porcelain scripts written in Perl are getting internationalized.

Waiting for review.
cf. <[email protected]>

* jc/latin-1 (2016-09-26) 2 commits (merged to 'next' on 2016-09-28 at c8673e03c2)
+ utf8: accept "latin-1" as ISO-8859-1
+ utf8: refactor code to decide fallback encoding

Some platforms no longer understand "latin-1" that is still seen in the wild in e-mail headers; replace them with "iso-8859-1" that is more widely known when conversion fails from/to it.

Will hold to see if people scream.

* sg/fix-versioncmp-with-common-suffix (2016-09-08) 5 commits
- versioncmp: cope with common leading parts in versionsort.prereleaseSuffix
- versioncmp: pass full tagnames to swap_prereleases()
- t7004-tag: add version sort tests to show prerelease reordering issues
- t7004-tag: use test_config helper
- t7004-tag: delete unnecessary tags with test_when_finished

The prereleaseSuffix feature of version comparison that is used in "git tag -l" did not correctly when two or more prereleases for the same release were present (e.g. when 2.0, 2.0-beta1, and 2.0-beta2 are there and the code needs to compare 2.0-beta1 and 2.0-beta2).

Waiting for a reroll.
cf. <20160908223727.Horde.jVOOJ278ssZ3qkyjkmyqZD-@webmail.informatik.kit.edu>

* jc/pull-rebase-ff (2016-07-28) 1 commit
- pull: fast-forward "pull --rebase=true"

"git pull --rebase", when there is no new commits on our side since we forked from the upstream, should be able to fast-forward without invoking "git rebase", but it didn't.

Needs a real log message and a few tests.

* jc/merge-drop-old-syntax (2015-04-29) 1 commit (merged to 'next' on 2016-10-11 at 8928c8b9b3)
+ merge: drop 'git merge <message> HEAD <commit>' syntax

Stop supporting "git merge <message> HEAD <commit>" syntax that has been deprecated since October 2007, and issues a deprecation warning message since v2.5.0.

It has been reported that git-gui still uses the deprecated syntax, which needs to be fixed before this final step can proceed. cf. <[email protected]>

Will cook in 'next'.

#1 lore raw
Quoted 12 lines

* tb/convert-stream-check (2016-10-27) 2 commits
- convert.c: stream and fast search for binary
- read-cache: factor out get_sha1_from_index() helper

End-of-line conversion sometimes needs to see if the current blob in the index has NULs and CRs to base its decision. We used to always get a full statistics over the blob, but in many cases we can return early when we have seen "enough" (e.g. if we see a single NUL, the blob will be handled as binary). The codepaths have been optimized by using streaming interface.

Quoted 3 lines

The tip seems to do too much in a single commit and may be better split. cf. <[email protected]>
cf. <[email protected]>

Reviews have been done, thanks everybody.

It looks to be a good "proof of concept".

The current series is far away from being ready, so please kick it out of pu and feel free to discard.

#3 lore raw
In reply to Junio C Hamano

Hi Junio,

Quoted 7 lines · Junio C Hamano

* jc/git-open-cloexec (2016-10-31) 3 commits
- sha1_file: stop opening files with O_NOATIME
- git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback
- git_open(): untangle possible NOATIME and CLOEXEC interactions

The codeflow of setting NOATIME and CLOEXEC on file descriptors Git opens has been simplified.

This branch (in particular, the "use fcntl(2)" one) breaks the build on Windows. Until this breakage is resolved, I won't be able to see (nor report) any test breakages in pu.

Ciao,
Dscho

#2 lore raw
In reply to Torsten Bögershausen
Quoted 9 lines · Torsten Bögershausen
Quoted 4 lines

* tb/convert-stream-check (2016-10-27) 2 commits
- convert.c: stream and fast search for binary
- read-cache: factor out get_sha1_from_index() helper

It looks to be a good "proof of concept".

The current series is far away from being ready, so please kick it out of pu and feel free to discard.

Thanks for a heads-up. Anything in 'pu' won't be of importance until 2.11 final, so please don't worry too much about it.

#4 lore raw
In reply to Johannes Schindelin
Quoted 7 lines · Johannes Schindelin
Quoted 5 lines · Junio C Hamano

* jc/git-open-cloexec (2016-10-31) 3 commits
- sha1_file: stop opening files with O_NOATIME
- git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback
- git_open(): untangle possible NOATIME and CLOEXEC interactions

Quoted 6 lines
Quoted 2 lines

The codeflow of setting NOATIME and CLOEXEC on file descriptors Git opens has been simplified.

This branch (in particular, the "use fcntl(2)" one) breaks the build on Windows. Until this breakage is resolved, I won't be able to see (nor report) any test breakages in pu.

Thanks for a heads-up. Anything in 'pu' won't be of importance until 2.11 final, so please don't worry too much about it. Instead please do make sure the tip of 'master' is OK.

Having said that, an incremental update or replacement to help preparing it for post 2.11 final is appreciated ;-)

FYI, I may be offline for a few days.

#5 lore raw
In reply to Junio C Hamano
Quoted 2 lines

* ls/filter-process (2016-10-17) 14 commits
(merged to 'next' on 2016-10-19 at ffd0de042c)

Some (late, as I recently got a new battery for the Mac OS 10.6 test system) comments:
t0021 failes here:

Can't locate object method "flush" via package "IO::Handle" at /Users/tb/projects/git/git.next/t/t0021/rot13-filter.pl line 90.
fatal: The remote end hung up unexpectedly

perl itself is 5.10 and we use the one shipped with Mac OS. Why that ?
t0021 uses the hard-coded path:
t0021/rot13-filter.pl (around line 345) and the nice macro PERL_PATH from the Makefile is fully ignored.

Commenting out the different "flush" makes the test hang, and I haven't digged further.

#6 lore raw
Quoted 8 lines · Torsten Bögershausen
Quoted 2 lines

* ls/filter-process (2016-10-17) 14 commits
(merged to 'next' on 2016-10-19 at ffd0de042c)

Some (late, as I recently got a new battery for the Mac OS 10.6 test system) comments:
t0021 failes here:

Quoted 5 lines

Can't locate object method "flush" via package "IO::Handle" at /Users/tb/projects/git/git.next/t/t0021/rot13-filter.pl line 90.
fatal: The remote end hung up unexpectedly

perl itself is 5.10 and we use the one shipped with Mac OS.

Wow, haven't seen that bug in a while[1]. The problem is that STDIN is a filehandle object, but older versions of perl do not automatically load IO::Handle to get all of the methods. This was fixed in perl 5.13.

We can work around it with:

use IO::Handle;

at the top of the script. That should work everywhere, as IO::Handle has been part of the core system for ages. But another option would be to just turn on autoflush, with:

  $| = 1;

at the top of the script (though it looks like we flush $debug, too, so we'd probably need to "select $debug; $| = 1" there, too). The "use" command is preferable IMHO.

Quoted 4 lines

Why that ?
t0021 uses the hard-coded path:
t0021/rot13-filter.pl (around line 345) and the nice macro PERL_PATH from the Makefile is fully ignored.

Yeah, we should be using PERL_PATH. Doing so inside the filter config value is probably a pain due to shell quoting issues. But we could use write_script() to get a local copy.

I'll see if I can work up a patch.

-Peff

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261953

#23 lore raw
In reply to Torsten Bögershausen

Am 02.11.2016 um 18:04 schrieb Torsten Bögershausen:

Quoted 12 lines
Quoted 2 lines

* ls/filter-process (2016-10-17) 14 commits
(merged to 'next' on 2016-10-19 at ffd0de042c)

Some (late, as I recently got a new battery for the Mac OS 10.6 test system) comments:
t0021 failes here:

Can't locate object method "flush" via package "IO::Handle" at /Users/tb/projects/git/git.next/t/t0021/rot13-filter.pl line 90.
fatal: The remote end hung up unexpectedly

Quoted 8 lines

perl itself is 5.10 and we use the one shipped with Mac OS. Why that ?
t0021 uses the hard-coded path:
t0021/rot13-filter.pl (around line 345) and the nice macro PERL_PATH from the Makefile is fully ignored.

Commenting out the different "flush" makes the test hang, and I haven't digged further.

https://public-inbox.org/git/[email protected]/

-- Hannes

#25 lore raw
In reply to Torsten Bögershausen
Quoted 8 lines · Torsten Bögershausen
Quoted 2 lines

* ls/filter-process (2016-10-17) 14 commits
(merged to 'next' on 2016-10-19 at ffd0de042c)

Some (late, as I recently got a new battery for the Mac OS 10.6 test system) comments:
t0021 failes here:

Quoted 6 lines

Can't locate object method "flush" via package "IO::Handle" at /Users/tb/projects/git/git.next/t/t0021/rot13-filter.pl line 90.
fatal: The remote end hung up unexpectedly

perl itself is 5.10 and we use the one shipped with Mac OS. Why that ?

Thanks for reporting! It surprises me that flush is not available. I don't have a 10.6 system to tests. Where you able to reproduce the problem on a newer system with an older Perl, too?

@Martin: do you have a clue?

I can't debug the issue right now (only on mobile) but I will look into it on Friday!

Quoted 3 lines

t0021 uses the hard-coded path:
t0021/rot13-filter.pl (around line 345) and the nice macro PERL_PATH from the Makefile is fully t

Can you check the line number? Rot13-filter.pl has only 192 lines. I'll look into the PERL_PATH.

Quoted 1 line

Commenting out the different "flush" makes the test hang, and I haven't digged further.

That would be expected because the pl file writes output to a file which is checked by the calling sh script.

Thanks,
Lars

#7 lore raw

cover t0021 perl portability fixups

In reply to Jeff King

This series should fix the portability problem you saw (in the final patch), and fixes the failure to use PERL_PATH along the way.

[1/4]: t0021: use write_script to create rot13 shell script [2/4]: t0021: put $TEST_ROOT in $PATH
[3/4]: t0021: use $PERL_PATH for rot13-filter.pl [4/4]: t0021: fix filehandle usage on older perl

 t/t0021-conversion.sh   | 30 ++++++++++++++++--------------
 t/t0021/rot13-filter.pl |  2 +-
 2 files changed, 17 insertions(+), 15 deletions(-)
 mode change 100755 => 100644 t/t0021/rot13-filter.pl
#8 lore raw

PATCH 1/4 t0021: use write_script to create rot13 shell script

This avoids us fooling around with $SHELL_PATH and the executable bit ourselves.

---
 t/t0021-conversion.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
t/t0021-conversion.sh +1 -3
index a20b9f58e..dfde22549 100755
@@ -6,13 +6,11 @@ test_description='blob conversion via gitattributes'
 
 TEST_ROOT="$(pwd)"
 
-cat <<EOF >"$TEST_ROOT/rot13.sh"
-#!$SHELL_PATH
+write_script <<\EOF "$TEST_ROOT/rot13.sh"
 tr \
   'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
   'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
 EOF
-chmod +x "$TEST_ROOT/rot13.sh"
 
 generate_random_characters () {
 	LEN=$1
Signature · 1 line
2.11.0.rc0.258.gf434c15
#12 lore raw

PATCH 2/4 t0021: put $TEST_ROOT in $PATH

In reply to Jeff King

We create a rot13.sh script in the trash directory, but need to call it by its full path when we have moved our cwd to another directory. Let's just put $TEST_ROOT in our $PATH so that the script is always found.

This is a minor convenience for rot13.sh, but will be a major one when we switch rot13-filter.pl to a script in the same directory, as it means we will not have to deal with shell quoting inside the filter-process config.

---
 t/t0021-conversion.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
t/t0021-conversion.sh +4 -3
index dfde22549..c1ad20c61 100755
@@ -5,6 +5,7 @@ test_description='blob conversion via gitattributes'
 . ./test-lib.sh
 
 TEST_ROOT="$(pwd)"
+PATH=$TEST_ROOT:$PATH
 
 write_script <<\EOF "$TEST_ROOT/rot13.sh"
 tr \
@@ -64,7 +65,7 @@ test_cmp_exclude_clean () {
 # is equal to the committed content.
 test_cmp_committed_rot13 () {
 	test_cmp "$1" "$2" &&
-	"$TEST_ROOT/rot13.sh" <"$1" >expected &&
+	rot13.sh <"$1" >expected &&
 	git cat-file blob :"$2" >actual &&
 	test_cmp expected actual
 }
@@ -513,7 +514,7 @@ test_expect_success PERL 'required process filter should process multiple packet
 		for FILE in "$TEST_ROOT"/*.file
 		do
 			cp "$FILE" . &&
-			"$TEST_ROOT/rot13.sh" <"$FILE" >"$FILE.rot13"
+			rot13.sh <"$FILE" >"$FILE.rot13"
 		done &&
 
 		echo "*.file filter=protocol" >.gitattributes &&
@@ -616,7 +617,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
 
 		# Smudge failed
 		! test_cmp smudge-write-fail.o smudge-write-fail.r &&
-		"$TEST_ROOT/rot13.sh" <smudge-write-fail.o >expected &&
+		rot13.sh <smudge-write-fail.o >expected &&
 		git cat-file blob :smudge-write-fail.r >actual &&
 		test_cmp expected actual
 	)
Signature · 1 line
2.11.0.rc0.258.gf434c15
#17 lore raw

PATCH 3/4 t0021: use $PERL_PATH for rot13-filter.pl

In reply to Jeff King

The rot13-filter.pl script hardcodes "#!/usr/bin/perl", and does not respect $PERL_PATH at all. That is a problem if the system does not have perl at that path, or if it has a perl that is too old to run a complicated script like the rot13-filter (but PERL_PATH points to a more modern one).

We can fix this by using write_script() to create a new copy of the script with the correct #!-line. In theory we could move the whole script inside t0021-conversion.sh rather than having it as an auxiliary file, but it's long enough that it just makes things harder to read.

As a bonus, we can stop using the full path to the script in the filter-process config we add (because the trash directory is in our PATH). Not only is this shorter, but it sidesteps any shell-quoting issues. The original was broken when $TEST_DIRECTORY contained a space, because it was interpolated in the outer script.

---
 t/t0021-conversion.sh   | 19 +++++++++++--------
 t/t0021/rot13-filter.pl |  1 -
 2 files changed, 11 insertions(+), 9 deletions(-)
 mode change 100755 => 100644 t/t0021/rot13-filter.pl
t/t0021-conversion.sh +11 -8
index c1ad20c61..a8fa52148 100755
@@ -13,6 +13,9 @@ tr \
   'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
 EOF
 
+write_script rot13-filter.pl "$PERL_PATH" \
+	<"$TEST_DIRECTORY"/t0021/rot13-filter.pl
+
 generate_random_characters () {
 	LEN=$1
 	NAME=$2
@@ -341,7 +344,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '
 '
 
 test_expect_success PERL 'required process filter should filter data' '
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
 	test_config_global filter.protocol.required true &&
 	rm -rf repo &&
 	mkdir repo &&
@@ -434,7 +437,7 @@ test_expect_success PERL 'required process filter should filter data' '
 
 test_expect_success PERL 'required process filter takes precedence' '
 	test_config_global filter.protocol.clean false &&
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean" &&
 	test_config_global filter.protocol.required true &&
 	rm -rf repo &&
 	mkdir repo &&
@@ -459,7 +462,7 @@ test_expect_success PERL 'required process filter takes precedence' '
 '
 
 test_expect_success PERL 'required process filter should be used only for "clean" operation only' '
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean" &&
 	rm -rf repo &&
 	mkdir repo &&
 	(
@@ -494,7 +497,7 @@ test_expect_success PERL 'required process filter should be used only for "clean
 '
 
 test_expect_success PERL 'required process filter should process multiple packets' '
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
 	test_config_global filter.protocol.required true &&
 
 	rm -rf repo &&
@@ -554,7 +557,7 @@ test_expect_success PERL 'required process filter should process multiple packet
 '
 
 test_expect_success PERL 'required process filter with clean error should fail' '
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
 	test_config_global filter.protocol.required true &&
 	rm -rf repo &&
 	mkdir repo &&
@@ -573,7 +576,7 @@ test_expect_success PERL 'required process filter with clean error should fail'
 '
 
 test_expect_success PERL 'process filter should restart after unexpected write failure' '
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
 	rm -rf repo &&
 	mkdir repo &&
 	(
@@ -624,7 +627,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
 '
 
 test_expect_success PERL 'process filter should not be restarted if it signals an error' '
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
 	rm -rf repo &&
 	mkdir repo &&
 	(
@@ -663,7 +666,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a
 '
 
 test_expect_success PERL 'process filter abort stops processing of all further files' '
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
 	rm -rf repo &&
 	mkdir repo &&
 	(
t/t0021/rot13-filter.pl +0 -1
old mode 100755
new mode 100644
index ae4c50f5c..e3ea58e1e
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
 #
 # Example implementation for the Git filter protocol version 2
 # See Documentation/gitattributes.txt, section "Filter Protocol"
Signature · 1 line
2.11.0.rc0.258.gf434c15
#20 lore raw

PATCH 4/4 t0021: fix filehandle usage on older perl

In reply to Jeff King

The rot13-filter.pl script calls methods on implicitly defined filehandles (STDOUT, and the result of an open() call). Prior to perl 5.13, these methods are not automatically loaded, and perl will complain with:

Can't locate object method "flush" via package "IO::Handle"

Let's explicitly load IO::File (which inherits from IO::Handle). That's more than we need for just "flush", but matches what perl has done since:

http://perl5.git.perl.org/perl.git/commit/15e6cdd91beb4cefae4b65e855d68cf64766965d

---
I see J6t solved this a week ago using "FileHandle". These days that is basically a compatibility synonym for IO::File. I think both should be available pretty much everywhere, so I went with IO::File for the reasons above. But if that doesn't work for some reason, switching to "use FileHandle" should be OK, too.

I don't have an old enough perl easily available to test it either way.

 t/t0021/rot13-filter.pl | 1 +
 1 file changed, 1 insertion(+)
t/t0021/rot13-filter.pl +1 -0
index e3ea58e1e..4d5697ee5 100644
@@ -21,6 +21,7 @@
 
 use strict;
 use warnings;
+use IO::File;
 
 my $MAX_PACKET_CONTENT_SIZE = 65516;
 my @capabilities            = @ARGV;
Signature · 1 line
2.11.0.rc0.258.gf434c15
#21 lore raw

Re: [PATCH 4/4] t0021: fix filehandle usage on older perl

Quoted 2 lines

+use IO::File;

That did the trick (the J6T version work as well)

Thanks for the fast responses.

#24 lore raw
In reply to Johannes Sixt
Quoted 22 lines · Johannes Sixt

Am 02.11.2016 um 18:04 schrieb Torsten Bögershausen:

Quoted 18 lines
Quoted 2 lines

* ls/filter-process (2016-10-17) 14 commits
(merged to 'next' on 2016-10-19 at ffd0de042c)

Some (late, as I recently got a new battery for the Mac OS 10.6 test system) comments:
t0021 failes here:

Can't locate object method "flush" via package "IO::Handle" at /Users/tb/projects/git/git.next/t/t0021/rot13-filter.pl line 90.
fatal: The remote end hung up unexpectedly

perl itself is 5.10 and we use the one shipped with Mac OS. Why that ?
t0021 uses the hard-coded path:
t0021/rot13-filter.pl (around line 345) and the nice macro PERL_PATH from the Makefile is fully ignored.

Quoted 4 lines
Quoted 2 lines

Commenting out the different "flush" makes the test hang, and I haven't digged further.

https://public-inbox.org/git/[email protected]/

Woooh. I am sorry Hannes - I completely missed that email! Looks like Peff addressed the issue already. His patches look very good but I want to try it on my machine tomorrow.

Thanks,
Lars

#13 lore raw

Re: [PATCH 2/4] t0021: put $TEST_ROOT in $PATH

In reply to Jeff King

Am 02.11.2016 um 19:18 schrieb Jeff King:

Quoted 20 lines

We create a rot13.sh script in the trash directory, but need to call it by its full path when we have moved our cwd to another directory. Let's just put $TEST_ROOT in our $PATH so that the script is always found.

This is a minor convenience for rot13.sh, but will be a major one when we switch rot13-filter.pl to a script in the same directory, as it means we will not have to deal with shell quoting inside the filter-process config.

---
 t/t0021-conversion.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
t/t0021-conversion.sh +0 -0
index dfde22549..c1ad20c61 100755

t/t0021-conversion.sh test_description='blob conversion via gitattributes' · line 8

Quoted 4 lines
t/t0021-conversion.sh +1 -0
@@ -5,6 +5,7 @@ test_description='blob conversion via gitattributes'
 . ./test-lib.sh
 
 TEST_ROOT="$(pwd)"
+PATH=$TEST_ROOT:$PATH

This causes problems on Windows. We need the following squashed in.

---- 8< ----
[PATCH] squash! t0021: put $TEST_ROOT in $PATH

We have to use $PWD instead of $(pwd) because on Windows the latter would add a C: style path to bash's Unix-style $PATH variable, which becomes confused by the colon after the drive letter. ($PWD is a Unix-style path.)

---
 t/t0021-conversion.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/t0021-conversion.sh +1 -1
index 4e4b9a6be3..cff2b7259d 100755
@@ -4,7 +4,7 @@ test_description='blob conversion via gitattributes'
 
 . ./test-lib.sh
 
-TEST_ROOT="$(pwd)"
+TEST_ROOT="$PWD"
 PATH=$TEST_ROOT:$PATH
 
 write_script <<\EOF "$TEST_ROOT/rot13.sh"
Signature · 1 line
2.11.0.rc0.55.gd967357
#14 lore raw

Re: [PATCH 2/4] t0021: put $TEST_ROOT in $PATH

Quoted 5 lines · Johannes Sixt
Quoted 2 lines

TEST_ROOT="$(pwd)"
+PATH=$TEST_ROOT:$PATH

This causes problems on Windows. We need the following squashed in.

Quoted 7 lines

---- 8< ----
[PATCH] squash! t0021: put $TEST_ROOT in $PATH

We have to use $PWD instead of $(pwd) because on Windows the latter would add a C: style path to bash's Unix-style $PATH variable, which becomes confused by the colon after the drive letter. ($PWD is a Unix-style path.)

Thanks. I have to admit I remain confused about which one to use at any given invocation (I would have thought that switching to $PWD causes problems elsewhere in the script, but I guess file redirection is capable of handling either type).

-Peff

#15 lore raw

Re: [PATCH 2/4] t0021: put $TEST_ROOT in $PATH

Am 03.11.2016 um 21:44 schrieb Jeff King:

Quoted 5 lines · Johannes Sixt
Quoted 1 line

We have to use $PWD instead of $(pwd) because on Windows...

Thanks. I have to admit I remain confused about which one to use at any given invocation

No worries. It *is* complex, and I don't expect anyone who is not deep in the business to get this thing right except by mere chance.

Quoted 3 lines

(I would have thought that switching to $PWD causes problems elsewhere in the script, but I guess file redirection is capable of handling either type).

Correct.

-- Hannes

#27 lore raw
In reply to a message not in the archive
Quoted 4 lines · Martin-Louis Bright

I will see if I can find a OSX 10.6 system to test with, and I'll try with perl 5.10.

--Martin

No need to worry too much:

I have tested Peffs patch applied on next OK-
And the integration into pu that came the 2nd Novevember is tested OK as well.

(And please everybody: avoid top-posting here)

#28 lore raw
In reply to Junio C Hamano
Quoted 9 lines

* st/verify-tag (2016-10-10) 7 commits
- t/t7004-tag: Add --format specifier tests
- t/t7030-verify-tag: Add --format specifier tests
- builtin/tag: add --format argument for tag -v
- builtin/verify-tag: add --format to verify-tag
- tag: add format specifier to gpg_verify_tag
- ref-filter: add function to print single ref_array_item
- gpg-interface, tag: add GPG_VERIFY_QUIET flag

Quoted 5 lines

"git tag" and "git verify-tag" learned to put GPG verification status in their "--format=<placeholders>" output format.

Waiting for a reroll.
cf. <[email protected]>

I don't know if this has been reported before:
Some tests needs to be protected by GPG:
+test_expect_success GPG 'verifying a proper tag with --format pass and format accordingly'

test_expect_success GPG 'verifying a forged tag with --format fail and format accordingly'

test_expect_success GPG 'verifying a forged tag with --format fail and format accordingly'

#9 lore raw

Re: [PATCH 1/4] t0021: use write_script to create rot13 shell script

In reply to Jeff King
Quoted 28 lines · Jeff King

This avoids us fooling around with $SHELL_PATH and the executable bit ourselves.

---
t/t0021-conversion.sh | 4 +---

1 file changed, 1 insertion(+), 3 deletions(-)
t/t0021-conversion.sh +0 -0
index a20b9f58e..dfde22549 100755
@@ -6,13 +6,11 @@ test_description='blob conversion via gitattributes'
 

TEST_ROOT="$(pwd)"

t/t0021-conversion.sh +1 -2
-cat <<EOF >"$TEST_ROOT/rot13.sh"
-#!$SHELL_PATH
+write_script <<\EOF "$TEST_ROOT/rot13.sh"

tr \
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
EOF
-chmod +x "$TEST_ROOT/rot13.sh"

Quoted 5 lines
generate_random_characters () {
	LEN=$1
Signature · 1 line
2.11.0.rc0.258.gf434c15

This looks good to me (and it works on my machine). However, I took a look at the "write_script" function and found this, added by Junio in 840c519d:

echo "#!${2-"$SHELL_PATH"}" &&

There is some kind of variable expansion happening with the "2-" but I can't quite figure out what is going on. Plus, I can't find anything about this in the sh docs.

Can anyone help me to understand it?

Thanks,
Lars

#10 lore raw

Re: [PATCH 1/4] t0021: use write_script to create rot13 shell script

Quoted 11 lines · Lars Schneider

This looks good to me (and it works on my machine). However, I took a look at the "write_script" function and found this, added by Junio in 840c519d:

echo "#!${2-"$SHELL_PATH"}" &&

There is some kind of variable expansion happening with the "2-" but I can't quite figure out what is going on. Plus, I can't find anything about this in the sh docs.

Can anyone help me to understand it?

See the section on parameter expansion in "man bash". Basically:

${foo:-bar}

expands to $foo, or "bar" if it is unset or empty. Without the colon:

  ${foo-bar}

expands to $foo, "bar" if it unset (but not if it is empty). I don't think we really care about the distinction here, and either is fine (you would not ever pass an empty argument).

So in this context you may pass in the interpreter:

write_script "$PERL_PATH" <<\EOF
... some perl code ...
EOF

or it defaults to shell, which is what most of the callers want:

write_script <<\EOF
... some shell code ...
EOF

-Peff

#16 lore raw

Re: [PATCH 2/4] t0021: put $TEST_ROOT in $PATH

In reply to Jeff King
Quoted 59 lines · Jeff King

We create a rot13.sh script in the trash directory, but need to call it by its full path when we have moved our cwd to another directory. Let's just put $TEST_ROOT in our $PATH so that the script is always found.

This is a minor convenience for rot13.sh, but will be a major one when we switch rot13-filter.pl to a script in the same directory, as it means we will not have to deal with shell quoting inside the filter-process config.

---
t/t0021-conversion.sh | 7 ++++---

1 file changed, 4 insertions(+), 3 deletions(-)
t/t0021-conversion.sh +0 -0
index dfde22549..c1ad20c61 100755
@@ -5,6 +5,7 @@ test_description='blob conversion via gitattributes'

. ./test-lib.sh

TEST_ROOT="$(pwd)"
+PATH=$TEST_ROOT:$PATH

write_script <<\EOF "$TEST_ROOT/rot13.sh"
tr \

t/t0021-conversion.sh +3 -3
@@ -64,7 +65,7 @@ test_cmp_exclude_clean () {
 # is equal to the committed content.
 test_cmp_committed_rot13 () {
 	test_cmp "$1" "$2" &&
-	"$TEST_ROOT/rot13.sh" <"$1" >expected &&
+	rot13.sh <"$1" >expected &&
 	git cat-file blob :"$2" >actual &&
 	test_cmp expected actual
 }
@@ -513,7 +514,7 @@ test_expect_success PERL 'required process filter should process multiple packet
 		for FILE in "$TEST_ROOT"/*.file
 		do
 			cp "$FILE" . &&
-			"$TEST_ROOT/rot13.sh" <"$FILE" >"$FILE.rot13"
+			rot13.sh <"$FILE" >"$FILE.rot13"
 		done &&
 
 		echo "*.file filter=protocol" >.gitattributes &&
@@ -616,7 +617,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f
 
 		# Smudge failed
 		! test_cmp smudge-write-fail.o smudge-write-fail.r &&
-		"$TEST_ROOT/rot13.sh" <smudge-write-fail.o >expected &&
+		rot13.sh <smudge-write-fail.o >expected &&
 		git cat-file blob :smudge-write-fail.r >actual &&
 		test_cmp expected actual
 	)
Signature · 1 line
2.11.0.rc0.258.gf434c15

Looks good to me and the PWD Windows fix suggested by Hannes [1] works great on macOS.

Thanks,
Lars

[1] http://public-inbox.org/git/[email protected]/

#11 lore raw

Re: [PATCH 1/4] t0021: use write_script to create rot13 shell script

In reply to Jeff King
Quoted 19 lines · Jeff King
Quoted 11 lines · Lars Schneider

This looks good to me (and it works on my machine). However, I took a look at the "write_script" function and found this, added by Junio in 840c519d:

echo "#!${2-"$SHELL_PATH"}" &&

There is some kind of variable expansion happening with the "2-" but I can't quite figure out what is going on. Plus, I can't find anything about this in the sh docs.

Can anyone help me to understand it?

See the section on parameter expansion in "man bash". Basically:

Quoted 7 lines

${foo:-bar}

expands to $foo, or "bar" if it is unset or empty. Without the colon:

${foo-bar}

expands to $foo, "bar" if it unset (but not if it is empty).

Ahh! The missing colon tricked me. For some reason the version without colon is not mentioned in my docs (GNU bash, version 3.2.57) or I overlooked it.

Thanks for taking the time to explain it!

- Lars

#18 lore raw

Re: [PATCH 3/4] t0021: use $PERL_PATH for rot13-filter.pl

In reply to Jeff King
Quoted 128 lines · Jeff King

The rot13-filter.pl script hardcodes "#!/usr/bin/perl", and does not respect $PERL_PATH at all. That is a problem if the system does not have perl at that path, or if it has a perl that is too old to run a complicated script like the rot13-filter (but PERL_PATH points to a more modern one).

We can fix this by using write_script() to create a new copy of the script with the correct #!-line. In theory we could move the whole script inside t0021-conversion.sh rather than having it as an auxiliary file, but it's long enough that it just makes things harder to read.

As a bonus, we can stop using the full path to the script in the filter-process config we add (because the trash directory is in our PATH). Not only is this shorter, but it sidesteps any shell-quoting issues. The original was broken when $TEST_DIRECTORY contained a space, because it was interpolated in the outer script.

---
t/t0021-conversion.sh | 19 +++++++++++--------
t/t0021/rot13-filter.pl | 1 -

2 files changed, 11 insertions(+), 9 deletions(-)

mode change 100755 => 100644 t/t0021/rot13-filter.pl

t/t0021-conversion.sh +0 -0
index c1ad20c61..a8fa52148 100755
@@ -13,6 +13,9 @@ tr \
  'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'

EOF

t/t0021-conversion.sh +3 -0
+write_script rot13-filter.pl "$PERL_PATH" \
+	<"$TEST_DIRECTORY"/t0021/rot13-filter.pl
+
generate_random_characters () {
	LEN=$1
	NAME=$2
t/t0021-conversion.sh +0 -0
@@ -341,7 +344,7 @@ test_expect_success 'diff does not reuse worktree files that need cleaning' '

'

test_expect_success PERL 'required process filter should filter data' '

t/t0021-conversion.sh +1 -1
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
	test_config_global filter.protocol.required true &&
	rm -rf repo &&
	mkdir repo &&
t/t0021-conversion.sh +0 -0
@@ -434,7 +437,7 @@ test_expect_success PERL 'required process filter should filter data' '
 

test_expect_success PERL 'required process filter takes precedence' '

	test_config_global filter.protocol.clean false &&
t/t0021-conversion.sh +1 -1
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean" &&
	test_config_global filter.protocol.required true &&
	rm -rf repo &&
	mkdir repo &&
t/t0021-conversion.sh +0 -0
@@ -459,7 +462,7 @@ test_expect_success PERL 'required process filter takes precedence' '

'

test_expect_success PERL 'required process filter should be used only for "clean" operation only' '

t/t0021-conversion.sh +1 -1
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean" &&
	rm -rf repo &&
	mkdir repo &&
	(
t/t0021-conversion.sh +0 -0
@@ -494,7 +497,7 @@ test_expect_success PERL 'required process filter should be used only for "clean

'

test_expect_success PERL 'required process filter should process multiple packets' '

t/t0021-conversion.sh +1 -1
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
	test_config_global filter.protocol.required true &&

	rm -rf repo &&
t/t0021-conversion.sh +0 -0
@@ -554,7 +557,7 @@ test_expect_success PERL 'required process filter should process multiple packet

'

test_expect_success PERL 'required process filter with clean error should fail' '

t/t0021-conversion.sh +1 -1
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
	test_config_global filter.protocol.required true &&
	rm -rf repo &&
	mkdir repo &&
t/t0021-conversion.sh +0 -0
@@ -573,7 +576,7 @@ test_expect_success PERL 'required process filter with clean error should fail'

'

test_expect_success PERL 'process filter should restart after unexpected write failure' '

t/t0021-conversion.sh +1 -1
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
	rm -rf repo &&
	mkdir repo &&
	(
t/t0021-conversion.sh +0 -0
@@ -624,7 +627,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f

'

test_expect_success PERL 'process filter should not be restarted if it signals an error' '

t/t0021-conversion.sh +1 -1
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
	rm -rf repo &&
	mkdir repo &&
	(
t/t0021-conversion.sh +0 -0
@@ -663,7 +666,7 @@ test_expect_success PERL 'process filter should not be restarted if it signals a

'

test_expect_success PERL 'process filter abort stops processing of all further files' '

t/t0021-conversion.sh +1 -1
-	test_config_global filter.protocol.process "$TEST_DIRECTORY/t0021/rot13-filter.pl clean smudge" &&
+	test_config_global filter.protocol.process "rot13-filter.pl clean smudge" &&
	rm -rf repo &&
	mkdir repo &&
	(
t/t0021/rot13-filter.pl +0 -1
old mode 100755
new mode 100644
index ae4c50f5c..e3ea58e1e
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
 #
 # Example implementation for the Git filter protocol version 2
 # See Documentation/gitattributes.txt, section "Filter Protocol"
Signature · 1 line
2.11.0.rc0.258.gf434c15

Looks good to me!

Minor pedantic nit:
Would it make sense to rename "rot13-filter.pl" to "rot13-filter.pl.template" or something because of the missing shebang?

- Lars

#19 lore raw

Re: [PATCH 3/4] t0021: use $PERL_PATH for rot13-filter.pl

Quoted 3 lines · Lars Schneider

Would it make sense to rename "rot13-filter.pl" to "rot13-filter.pl.template" or something because of the missing shebang?

I think it makes sense to keep it as ".pl". Without the "#!" things like editors will use the extension to guess what type of file it is, for features like syntax highlight and auto-indentation.

I was actually tempted to _keep_ the #! line for that reason, but then the built result ends up with two such lines (which is not wrong, but is confusing if anybody actually looks at it).

-Peff

#22 lore raw

Re: [PATCH 4/4] t0021: fix filehandle usage on older perl

In reply to Jeff King
Quoted 43 lines · Jeff King

The rot13-filter.pl script calls methods on implicitly defined filehandles (STDOUT, and the result of an open() call). Prior to perl 5.13, these methods are not automatically loaded, and perl will complain with:

Can't locate object method "flush" via package "IO::Handle"

Let's explicitly load IO::File (which inherits from IO::Handle). That's more than we need for just "flush", but matches what perl has done since:

http://perl5.git.perl.org/perl.git/commit/15e6cdd91beb4cefae4b65e855d68cf64766965d

---
I see J6t solved this a week ago using "FileHandle". These days that is basically a compatibility synonym for IO::File. I think both should be available pretty much everywhere, so I went with IO::File for the reasons above. But if that doesn't work for some reason, switching to "use FileHandle" should be OK, too.

I don't have an old enough perl easily available to test it either way.

t/t0021/rot13-filter.pl | 1 +

1 file changed, 1 insertion(+)
t/t0021/rot13-filter.pl +1 -0
index e3ea58e1e..4d5697ee5 100644
@@ -21,6 +21,7 @@
 
 use strict;
 use warnings;
+use IO::File;
 
 my $MAX_PACKET_CONTENT_SIZE = 65516;
 my @capabilities            = @ARGV;
Signature · 1 line
2.11.0.rc0.258.gf434c15

Looks good to me (and works flawlessly on newer macOS).

Thanks,
Lars

#29 lore raw
In reply to Junio C Hamano

Hello,

Quoted 20 lines

* kn/ref-filter-branch-list (2016-05-17) 17 commits
- branch: implement '--format' option
- branch: use ref-filter printing APIs
- branch, tag: use porcelain output
- ref-filter: allow porcelain to translate messages in the output
- ref-filter: add :dir and :base options for ref printing atoms
- ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
- ref-filter: introduce symref_atom_parser() and refname_atom_parser()
- ref-filter: introduce refname_atom_parser_internal()
- ref-filter: make "%(symref)" atom work with the ':short' modifier
- ref-filter: add support for %(upstream:track,nobracket)
- ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
- ref-filter: introduce format_ref_array_item()
- ref-filter: move get_head_description() from branch.c
- ref-filter: modify "%(objectname:short)" to take length
- ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
- ref-filter: include reference to 'used_atom' within 'atom_value'
- ref-filter: implement %(if), %(then), and %(else) atoms

Quoted 5 lines

The code to list branches in "git branch" has been consolidated with the more generic ref-filter API.

Rerolled.
Needs review.

Anything I could do to push this forward? It's been a while now.

#31 lore raw
In reply to a message not in the archive

Helo,

Quoted 8 lines · Jacob Keller
Quoted 1 line · Karthik Nayak

Anything I could do to push this forward? It's been a while now.

Hi,

If this just needs more reviewers I can take a look. Do you possibly have a link to the series so I can find it more easily on the mailing list?

Since It's been so long I feel it's better I rerolled it, rebasing on 'master'. So I'll
do that soon.

Signature · 2 lines
Regards,
Karthik Nayak