All of lore.kernel.org
 help / color / mirror / Atom feed
* What's cooking in git.git (Aug 2010, #02; Wed, 11)
@ 2010-08-11 23:35 Junio C Hamano
  2010-08-12  1:41 ` Jonathan Nieder
                   ` (2 more replies)
  0 siblings, 3 replies; 56+ messages in thread
From: Junio C Hamano @ 2010-08-11 23:35 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking.  Commits prefixed with '-' are
only in 'pu' 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.

Has the rate of patch traffic increased markedly for the past few months?
I am feeling perpetually behind these days...

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

* ab/omit-aggregate-test-result-under-tap-harness (2010-08-11) 1 commit
 - test-lib: Don't write test-results when HARNESS_ACTIVE

* ab/test-prereq (2010-08-11) 5 commits
 - test-lib: Multi-prereq support only checked the last prereq
 - tests: A SANITY test prereq for testing if we're root
 - t/README: Document the predefined test prerequisites
 - test-lib: Print missing prerequisites in test output
 - test-lib: Add support for multiple test prerequisites

* ab/test-smoke (2010-08-08) 4 commits
 - t/README: Add SMOKE_{COMMENT,TAGS}= to smoke_report target
 - t/Makefile: Can't include GIT-BUILD-OPTIONS, it's a .sh
 - t/README: Document the Smoke testing
 - tests: Infrastructure for Git smoke testing

Will merge the above three topics to 'next' together with other "test"
topics from the same author shortly.

* by/line-log (2010-08-11) 18 commits
 - line-log: minimum compilation fix
 - Document line history browser
 - Add tests for line history browser
 - Add --full-line-diff option
 - Add --graph prefix before line history output
 - Add parent rewriting to line history browser
 - Make graph_next_line external to other part of git
 - Make rewrite_parents public to other part of git
 - Hook line history into cmd_log, ensuring a topo-ordered walk
 - Print the line log
 - map/take range to the parent of commits
 - Add range clone functions
 - Export three functions from diff.c
 - Parse the -L options
 - Refactor parse_loc
 - Add the basic data structure for line level history
 - parse-options: add two helper functions
 - parse-options: enhance STOP_AT_NON_OPTION

Does not seem to pass the self test for me...

* dg/local-mod-error-messages (2010-08-11) 5 commits
 - t7609: test merge and checkout error messages
 - unpack_trees: group error messages by type
 - merge-recursive: distinguish "removed" and "overwritten" messages
 - merge-recursive: porcelain messages for checkout
 - Turn unpack_trees_options.msgs into an array + enum

Looking good.

* en/rebase-against-rebase-fix (2010-08-06) 2 commits
 - pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
 - t5520-pull: Add testcases showing spurious conflicts from git pull --rebase

* gb/split-cmdline-errmsg (2010-08-07) 1 commit
 - split_cmdline: Allow caller to access error string

* jc/builtin-binsearch (2010-08-05) 2 commits
 . git.c: binary search in the built-in command list
 . git.c: sort the list of built-in command names

* jl/submodule-ignore-diff (2010-08-06) 4 commits
 - Add tests for the diff.ignoreSubmodules config option
 - Add the 'diff.ignoreSubmodules' config setting
 - Submodules: Use "ignore" settings from .gitmodules too for diff and status
 - Submodules: Add the new "ignore" config option for diff and status

Looking good.

* jn/commit-no-change-wo-status (2010-07-24) 9 commits
 . commit: suppress status summary when no changes staged
 . commit --dry-run: give advice on empty amend
 . commit: give empty-commit avoidance code its own function
 . t7508 (status): modernize style
 . commit: split off the piece that writes status
 . commit: split commit -s handling into its own function
 . commit: split off a function to fetch the default log message
 . wt-status: split off a function for printing submodule summary
 . wt-status: split wt_status_print into digestible pieces

* jn/merge-renormalize (2010-08-05) 12 commits
 . merge-recursive --renormalize
 . rerere: never renormalize
 . rerere: migrate to parse-options API
 . t4200 (rerere): modernize style
 . ll-merge: let caller decide whether to renormalize
 . ll-merge: make flag easier to populate
 . Documentation/technical: document ll_merge
 . merge-trees: let caller decide whether to renormalize
 . merge-trees: push choice to renormalize away from low level
 . t6038 (merge.renormalize): check that it can be turned off
 . t6038 (merge.renormalize): try checkout -m and cherry-pick
 . t6038 (merge.renormalize): style nitpicks
 (this branch uses eb/double-convert-before-merge.)

* jn/paginate-fix (2010-08-05) 13 commits
 . merge-file: run setup_git_directory_gently() sooner
 . var: run setup_git_directory_gently() sooner
 . ls-remote: run setup_git_directory_gently() sooner
 . index-pack: run setup_git_directory_gently() sooner
 . Merge branch 'jn/maint-setup-fix' (early part) into HEAD
 . config: run setup_git_directory_gently() sooner
 . bundle: run setup_git_directory_gently() sooner
 . apply: run setup_git_directory_gently() sooner
 . grep: run setup_git_directory_gently() sooner
 . shortlog: run setup_git_directory_gently() sooner
 . git wrapper: allow setup_git_directory_gently() be called earlier
 . setup: remember whether repository was found
 . git wrapper: introduce startup_info struct
 (this branch uses jn/maint-setup-fix.)

I had trouble merging these three topics to 'pu' and ran out of time my
git Wednesday this week.  I think the "no-change-wo-status" one had some
unintended consequences discovered on the list?

* jn/maint-plug-leak (2010-08-09) 3 commits
 - write-tree: Avoid leak when index refers to an invalid object
 - read-tree: stop leaking tree objects
 - core: Stop leaking ondisk_cache_entrys

Will fast-track merging to 'next', 'master' and 'maint' after giving it
another look.

* jn/svn-fe (2010-08-09) 10 commits
 - svn-fe manual: Clarify warning about deltas in dump files
 - Update svn-fe manual
 - SVN dump parser
 - Infrastructure to write revisions in fast-export format
 - Add stream helper library
 - Add string-specific memory pool
 - Add treap implementation
 - Add memory pool library
 - Introduce vcs-svn lib
 - Export parse_date_basic() to convert a date string to timestamp

There was a screw-up on my part---I should have dropped the first one and
branched this off of jn/parse-date-basic (I'll fix it up before merging
this to 'next').

* js/detached-stash (2010-08-10) 9 commits
 - Documentation: git stash branch now tolerates non-stash references.
 - t3903-stash.sh: tests of git stash with stash-like arguments
 - stash: teach git stash show to always tolerate stash-like arguments.
 - stash: teach git stash branch to tolerate stash-like arguments
 - stash: teach git stash drop to fail early if the specified revision is not a stash reference
 - stash: teach git stash pop to fail early if the argument is not a stash ref
 - stash: introduce is_stash_ref and assert_stash_ref functions.
 - stash: extract stash-like check into its own function
 - stash: refactor - create pop_stash function

Haven't looked this new round closely yet.

* mm/rebase-i-exec (2010-08-10) 2 commits
 - test-lib: user-friendly alternatives to test [-d|-f|-e]
 - rebase -i: add exec command to launch a shell command

Looking good.

* so/http-user-agent (2010-08-11) 1 commit
 - Allow HTTP user agent string to be modified.

Looking good.

* sp/fix-smart-http-deadlock-on-error (2010-08-06) 1 commit
  (merged to 'next' on 2010-08-11 at 0a6369e)
 + smart-http: Don't deadlock on server failure

Will fast-track merging to 'master' and 'maint' after giving it another
look.

--------------------------------------------------
[Ejected]

* rr/svn-export (2010-07-29) 9 commits
 . vcs-svn: Remove stray calls to removed functions
 . Add SVN dump parser
 . Add infrastructure to write revisions in fast-export format
 . Add stream helper library
 . Add string-specific memory pool
 . vcs-svn: treap_search should return NULL for missing items
 . Add treap implementation
 . Add memory pool library
 . Introduce vcs-svn lib
 (this branch uses jn/parse-date-basic.)

Replaced with Jonathan's reroll.

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

* zl/mailinfo-recode-patch (2010-06-14) 2 commits
 - add --recode-patch option to git-am
 - add --recode-patch option to git-mailinfo

I recall there was another round of re-roll planned for this one.

* jk/tag-contains (2010-07-05) 4 commits
 - Why is "git tag --contains" so slow?
 - default core.clockskew variable to one day
 - limit "contains" traversals based on commit timestamp
 - tag: speed up --contains calculation

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

* jc/sha1-name-find-fix (2010-08-02) 1 commit
  (merged to 'next' on 2010-08-11 at 51106a5)
 + sha1_name.c: fix parsing of ":/token" syntax

Will merge to 'master' (and perhaps 'maint').

* jn/doc-pull (2010-08-02) 1 commit
  (merged to 'next' on 2010-08-11 at a223479)
 + Documentation: flesh out “git pull” description

Will merge to 'master'.

* jn/maint-gitweb-dynconf (2010-07-30) 1 commit
  (merged to 'next' on 2010-08-11 at a94ce85)
 + gitweb: allow configurations that change with each request

Will merge to 'master'.

* sr/local-config (2010-08-03) 1 commit
 - config: add --local option

Looked Ok.  Will merge to 'next'.

* ab/test-coverage (2010-07-26) 8 commits
 - Makefile: make gcov invocation configurable
 - t/README: Add a note about the dangers of coverage chasing
 - t/README: A new section about test coverage
 - Makefile: Add cover_db_html target
 - Makefile: Add cover_db target
 - Makefile: Split out the untested functions target
 - Makefile: Include subdirectories in "make cover" reports
 - gitignore: Ignore files generated by "make coverage"

* ab/test-no-skip (2010-08-10) 13 commits
 - git-notes: Run partial expensive test everywhere
 - t/t3300-funny-names: change from skip_all=* to prereq skip
 - t/t3902-quoted: change from skip_all=* to prereq skip
 - t/t4016-diff-quote: change from skip_all=* to prereq skip
 - t/t5503-tagfollow: change from skip_all=* to prereq skip
 - t/t7005-editor: change from skip_all=* to prereq skip
 - t/t5705-clone-2gb: change from skip_all=* to prereq skip
 - t/t1304-default-acl: change from skip_all=* to prereq skip
 - t/README: Update "Skipping tests" to align with best practices
 - t/t7800-difftool.sh: Skip with prereq on no PERL
 - t/t5800-remote-helpers.sh: Skip with prereq on python <2.4
 - t/t4004-diff-rename-symlink.sh: use three-arg <prereq>
 - tests: implicitly skip SYMLINKS tests using <prereq>

* bc/use-more-hardlinks-in-install (2010-07-23) 2 commits
  (merged to 'next' on 2010-08-11 at 59dd30e)
 + Makefile: make hard/symbolic links for non-builtins too
 + Makefile: link builtins residing in bin directory to main git binary too

Will merge to 'master'.

* cc/find-commit-subject (2010-07-22) 6 commits
 - blame: use find_commit_subject() instead of custom code
 - merge-recursive: use find_commit_subject() instead of custom code
 - bisect: use find_commit_subject() instead of custom code
 - revert: rename variables related to subject in get_message()
 - revert: refactor code to find commit subject in find_commit_subject()
 - revert: fix off by one read when searching the end of a commit subject

Looked Ok.  Will merge to 'next'.

* gb/shell-ext (2010-07-28) 3 commits
 - Add sample commands for git-shell
 - Add interactive mode to git-shell for user-friendliness
 - Allow creation of arbitrary git-shell commands

* jc/log-grep (2010-07-19) 1 commit
 - git log: add -G<regexp> that greps in the patch text

This is broken, but haven't found any time to revisit it yet.

* jh/clean-exclude (2010-07-20) 2 commits
 - Add test for git clean -e.
 - Add -e/--exclude to git-clean.

Looked Ok.  Will merge to 'next'.

* jh/use-test-must-fail (2010-07-20) 1 commit
 - Convert "! git" to "test_must_fail git"

Looked Ok.  Will merge to 'next'.

* jn/apply-filename-with-sp (2010-07-23) 4 commits
 - apply: Handle traditional patches with space in filename
 - t4135 (apply): use expand instead of pr for portability
 - tests: Test how well "git apply" copes with weird filenames
 - apply: Split quoted filename handling into new function

Looked Ok.  Will merge to 'next'.

* jn/fix-abbrev (2010-07-27) 3 commits
 - examples/commit: use --abbrev for commit summary
 - checkout, commit: remove confusing assignments to rev.abbrev
 - archive: abbreviate substituted commit ids again

Looked Ok.  Will merge to 'next'.

* jn/maint-setup-fix (2010-07-24) 11 commits
 - setup: split off a function to handle ordinary .git directories
 - Revert "rehabilitate 'git index-pack' inside the object store"
 - setup: do not forget working dir from subdir of gitdir
 - t4111 (apply): refresh index before applying patches to it
 - setup: split off get_device_or_die helper
 - setup: split off a function to handle hitting ceiling in repo search
 - setup: split off code to handle stumbling upon a repository
 - setup: split off a function to checks working dir for .git file
 - setup: split off $GIT_DIR-set case from setup_git_directory_gently
 - tests: try git apply from subdir of toplevel
 - t1501 (rev-parse): clarify
 (this branch is used by jn/paginate-fix.)

* jn/rebase-rename-am (2008-11-10) 5 commits
 - rebase: protect against diff.renames configuration
 - t3400 (rebase): whitespace cleanup
 - Teach "apply --index-info" to handle rename patches
 - t4150 (am): futureproof against failing tests
 - t4150 (am): style fix

Will merge to 'next'.

* ml/rebase-x-strategy (2010-07-29) 1 commit
 - rebase: support -X to pass through strategy options

Looked Ok.  Will merge to 'next'.

* mm/shortopt-detached (2010-08-05) 5 commits
 - log: parse separate option for --glob
 - log: parse separate options like git log --grep foo
 - diff: parse separate options --stat-width n, --stat-name-width n
 - diff: split off a function for --stat-* option parsing
 - diff: parse separate options like -S foo

Looked Ok.  Will merge to 'next'.

* nd/fix-sparse-checkout (2010-07-31) 5 commits
 - unpack-trees: mark new entries skip-worktree appropriately
 - unpack-trees: do not check for conflict entries too early
 - unpack-trees: let read-tree -u remove index entries outside sparse area
 - unpack-trees: only clear CE_UPDATE|CE_REMOVE when skip-worktree is always set
 - t1011 (sparse checkout): style nitpicks

Looked Ok.  Will merge to 'next'.

* tr/ab-i18n-fix (2010-07-25) 1 commit
 - tests: locate i18n lib&data correctly under --valgrind
 (this branch uses ab/i18n.)

Looked Ok.  Will merge to 'next'.

* tr/maint-no-unquote-plus (2010-07-24) 1 commit
 - Do not unquote + into ' ' in URLs

* tr/xsize-bits (2010-07-28) 1 commit
  (merged to 'next' on 2010-08-11 at bcc0271)
 + xsize_t: check whether we lose bits

* vs/doc-spell (2010-07-20) 1 commit
 - Documentation: spelling fixes

Looked Ok.  Will merge to 'next'.

* ab/report-corrupt-object-with-type (2010-06-10) 1 commit
 - sha1_file: Show the the type and path to corrupt objects

Looked Ok.  Will merge to 'next'.

* cc/revert (2010-07-21) 5 commits
 - t3508: add check_head_differs_from() helper function and use it
 - revert: improve success message by adding abbreviated commit sha1
 - revert: don't print "Finished one cherry-pick." if commit failed
 - revert: refactor commit code into a new run_git_commit() function
 - revert: report success when using option --strategy

* en/fast-export-fix (2010-07-17) 2 commits
 - fast-export: Add a --full-tree option
 - fast-export: Fix dropping of files with --import-marks and path limiting

* jn/parse-date-basic (2010-07-15) 1 commit
  (merged to 'next' on 2010-08-11 at ca9fef0)
 + Export parse_date_basic() to convert a date string to timestamp
 (this branch is used by rr/svn-export.)

Will merge to 'master'.

* kf/post-receive-sample-hook (2010-07-16) 1 commit
 - post-receive-email: optional message line count limit

I do not particularly like the idea of counting number of lines in a shell
loop but this is an opt-in feature to a contrib/ item so it should be ok.
Will merge to 'next'.

* tr/rfc-reset-doc (2010-07-18) 5 commits
  (merged to 'next' on 2010-08-11 at 8e7c8d1)
 + Documentation/reset: move "undo permanently" example behind "make topic"
 + Documentation/reset: reorder examples to match description
 + Documentation/reset: promote 'examples' one section up
 + Documentation/reset: separate options by mode
 + Documentation/git-reset: reorder modes for soft-mixed-hard progression

Looked fine.  Will merge to 'master'.

* hv/autosquash-config (2010-07-14) 1 commit
 - add configuration variable for --autosquash option of interactive rebase

* jh/graph-next-line (2010-07-13) 2 commits
  (merged to 'next' on 2010-08-11 at 333f9df)
 + Enable custom schemes for column colors in the graph API
 + Make graph_next_line() available in the graph.h API

* ar/string-list-foreach (2010-07-03) 2 commits
  (merged to 'next' on 2010-08-11 at 993dc02)
 + Convert the users of for_each_string_list to for_each_string_list_item macro
 + Add a for_each_string_list_item macro
 (this branch is used by tf/string-list-init.)

* il/rfc-remote-fd-ext (2010-07-31) 4 commits
 - Rewrite bidirectional traffic loop
 - gitignore: Ignore the new /git-remote-{ext,fd} helpers
 - New remote helper: git-remote-ext
 - New remote helper git-remote-fd

* hv/submodule-find-ff-merge (2010-07-07) 3 commits
  (merged to 'next' on 2010-08-11 at 6900d2c)
 + Implement automatic fast-forward merge for submodules
 + setup_revisions(): Allow walking history in a submodule
 + Teach ref iteration module about submodules

* jn/fast-import-subtree (2010-06-30) 1 commit
  (merged to 'next' on 2010-08-11 at 5e19de0)
 + Teach fast-import to import subtrees named by tree id

* sg/rerere-gc-old-still-used (2010-07-13) 2 commits
 - rerere: fix overeager gc
 - mingw_utime(): handle NULL times parameter

* tf/string-list-init (2010-07-04) 1 commit
 - string_list: Add STRING_LIST_INIT macro and make use of it.
 (this branch uses ar/string-list-foreach.)

* en/d-f-conflict-fix (2010-07-27) 7 commits
  (merged to 'next' on 2010-08-03 at 7f78604)
 + t/t6035-merge-dir-to-symlink.sh: Remove TODO on passing test
 + fast-import: Improve robustness when D->F changes provided in wrong order
 + fast-export: Fix output order of D/F changes
 + merge_recursive: Fix renames across paths below D/F conflicts
 + merge-recursive: Fix D/F conflicts
 + Add a rename + D/F conflict testcase
 + Add additional testcases for D/F conflicts

* ab/i18n (2010-07-19) 2 commits
 - tests: rename test to work around GNU gettext bug
 - Add infrastructure for translating Git with gettext
 (this branch is used by tr/ab-i18n-fix.)

* tc/checkout-B (2010-08-10) 4 commits
  (merged to 'next' on 2010-08-11 at 5433b51)
 + builtin/checkout: handle -B from detached HEAD correctly
 + builtin/checkout: learn -B
 + builtin/checkout: reword hint for -b
 + add tests for checkout -b

* eb/double-convert-before-merge (2010-07-02) 3 commits
 - Don't expand CRLFs when normalizing text during merge
 - Try normalizing files to avoid delete/modify conflicts when merging
 - Avoid conflicts when merging branches with mixed normalization
 (this branch is used by jn/merge-renormalize.)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-11 23:35 What's cooking in git.git (Aug 2010, #02; Wed, 11) Junio C Hamano
@ 2010-08-12  1:41 ` Jonathan Nieder
  2010-08-12  2:33   ` Ævar Arnfjörð Bjarmason
  2010-08-12  5:47 ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Elijah Newren
  2010-08-12  9:23 ` Johannes Sixt
  2 siblings, 1 reply; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-12  1:41 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Bo Yang, Ramkumar Ramachandra

Junio C Hamano wrote:

> * by/line-log (2010-08-11) 18 commits

Is there a simple and current “here is how to try this code and what
it will do for you” document?

In my imagination such a document is about three lines, including an
example. :)

> * jn/commit-no-change-wo-status (2010-07-24) 9 commits
>  . commit: suppress status summary when no changes staged
>  . commit --dry-run: give advice on empty amend
...

Could you revert the tip of this one?  What remains is a good
cleanup (+ change in --dry-run output for consistency), I think.

There was no positive feedback about suppressing the status summary.
I am afraid it might be a bad idea; I’d be happy if people have other
ideas for making the output friendlier.

> * jn/merge-renormalize (2010-08-05) 12 commits
...
>  . t4200 (rerere): modernize style
...
>  . t6038 (merge.renormalize): style nitpicks

Should I resend with these two ejected into a separate series?

> * jn/paginate-fix (2010-08-05) 13 commits
...
> I had trouble merging these three topics to 'pu' and ran out of time my
> git Wednesday this week.

I’ll try to find time to investigate and publish conflict-resolution
branches.

> * jn/svn-fe (2010-08-09) 10 commits
...
> There was a screw-up on my part---I should have dropped the first one and
> branched this off of jn/parse-date-basic (I'll fix it up before merging
> this to 'next').

I didn’t notice the existing parse-date-basic branch.  Sorry about
that.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  1:41 ` Jonathan Nieder
@ 2010-08-12  2:33   ` Ævar Arnfjörð Bjarmason
  2010-08-12  3:15     ` jn/commit-no-change-wo-status (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
  0 siblings, 1 reply; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-12  2:33 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, git, Bo Yang, Ramkumar Ramachandra

On Thu, Aug 12, 2010 at 01:41, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Junio C Hamano wrote:
>> * jn/commit-no-change-wo-status (2010-07-24) 9 commits
>>  . commit: suppress status summary when no changes staged
>>  . commit --dry-run: give advice on empty amend
> ...
>
> Could you revert the tip of this one?  What remains is a good
> cleanup (+ change in --dry-run output for consistency), I think.
>
> There was no positive feedback about suppressing the status summary.
> I am afraid it might be a bad idea; I’d be happy if people have other
> ideas for making the output friendlier.

I think it's a little unfriendlier with this patch than without. With
`color.ui = auto' on and `touch meh && git commit' you'll have "meh"
pointed out to you in bright red as the thing you forgot, so you know
what to "git add".

Just saying that you need to "git add" doesn't give you that context.

But maybe the wall of text from "git status" can be a bit confusing to
users, especially in the pathological case. Perhaps one way to solve
that would be to give the message more color:

    $ git commit
A   # On branch master
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
X   #       blahblah
Y   nothing added to commit but untracked files present (use "git add" to track)

X is now red, but Y is the same color as the rest of the
message. Maybe we could give that the "info" color (used in
e.g. test-lib.sh). Then users might read it as Y->X->A instead of
A->X->Y.

But I don't know, the "git commit" output doesn't confuse me so I'm
not in the target audience.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* jn/commit-no-change-wo-status (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12  2:33   ` Ævar Arnfjörð Bjarmason
@ 2010-08-12  3:15     ` Jonathan Nieder
  0 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-12  3:15 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Junio C Hamano, git, Bo Yang, Ramkumar Ramachandra, Thomas Rast,
	Jakub Narebski, Jeff King

Ævar Arnfjörð Bjarmason wrote:

> But I don't know, the "git commit" output doesn't confuse me so I'm
> not in the target audience.

For what it’s worth, I had three scenarios in mind:

Getting started
---------------

One way to learn a program is to just try things.  Some people take
this practice to an extreme and unforunately (1) would expect “git
commit” to do the same thing as “cvs commit” and (2) would not want to
read a manual or a long stream of text when it does not do so.

I hope we can streamline that process somehow, for example by
starting the output with the error message:

 $ git commit
 fatal: no changes added to commit
 hint: use 'git add' and 'git reset' to update what will be committed
 hint: you have 37 untracked files; use 'git status' to list them

24-line terminal
----------------

When I forget to stage changes, the previous output in the terminal’s
scrollback buffer may give a reminder of what those changes were.
The current “git status” output makes that information harder to find.

For the same reason, I basically never use git status without -s.
Before status --short existed, I used diff-files and ls-files -o.
Now I generally use “add -u”, “diff --cached”, and “add/reset -p”.

Need reminder of changes
------------------------

Some people forget where they are and would be confused if “git
commit” just failed without explaining why.  They need an indication
of what just happened and what they need to try to do to fix it up.

For such people, the existing output is fine.  With a successful
series, the new output would also be fine, and running “git checkout”
or “git status” would seem the most natural thing in the world rather
than an imposition.

Hope that helps.
Jonathan

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-11 23:35 What's cooking in git.git (Aug 2010, #02; Wed, 11) Junio C Hamano
  2010-08-12  1:41 ` Jonathan Nieder
@ 2010-08-12  5:47 ` Elijah Newren
  2010-08-12 15:49   ` Junio C Hamano
  2010-08-12  9:23 ` Johannes Sixt
  2 siblings, 1 reply; 56+ messages in thread
From: Elijah Newren @ 2010-08-12  5:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Wed, Aug 11, 2010 at 5:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
> * en/rebase-against-rebase-fix (2010-08-06) 2 commits
>  - pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
>  - t5520-pull: Add testcases showing spurious conflicts from git pull --rebase

It looks like you pulled my original submission, despite the fact that
you commented on v3 of the series.  Granted, everything after v1 was
just commit log wording changes and testsuite fixups, but I'll resend
to make it easy for you to grab the latest.

> * en/fast-export-fix (2010-07-17) 2 commits
>  - fast-export: Add a --full-tree option
>  - fast-export: Fix dropping of files with --import-marks and path limiting
<snip>
> * en/d-f-conflict-fix (2010-07-27) 7 commits
>  (merged to 'next' on 2010-08-03 at 7f78604)
>  + t/t6035-merge-dir-to-symlink.sh: Remove TODO on passing test
>  + fast-import: Improve robustness when D->F changes provided in wrong order
>  + fast-export: Fix output order of D/F changes
>  + merge_recursive: Fix renames across paths below D/F conflicts
>  + merge-recursive: Fix D/F conflicts
>  + Add a rename + D/F conflict testcase
>  + Add additional testcases for D/F conflicts

Out of curiosity, is there anything preventing these two series from
advancing?  I was particularly hoping that the fix (first patch) in
the en/fast-export-fix series would be applied to maint; Sverre seemed
to agree -- http://article.gmane.org/gmane.comp.version-control.git/151046.
 If it's just time, I understand, I was just curious if there was
anything I could or should do to help these series (or the new
en/rebase-against-rebase-fix one) along.

Thanks,
Elijah

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-11 23:35 What's cooking in git.git (Aug 2010, #02; Wed, 11) Junio C Hamano
  2010-08-12  1:41 ` Jonathan Nieder
  2010-08-12  5:47 ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Elijah Newren
@ 2010-08-12  9:23 ` Johannes Sixt
  2010-08-12  9:37   ` Greg Brockman
                     ` (6 more replies)
  2 siblings, 7 replies; 56+ messages in thread
From: Johannes Sixt @ 2010-08-12  9:23 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jonathan Nieder, Greg Brockman, Ilari Liusvaara, Elijah Newren

[Sorry for the Cc spam; I lack the time to conduct individual messages.]

I compiled many topics in pu and ran the test suite on Windows,
particularly those that "look good" and "will merge to next". Here's a report.

Today's next produces this warning:

merge-recursive.c: In function 'process_df_entry':
merge-recursive.c:1246: warning: unused variable 'o_sha'

(line number may be different) because o_sha is only used inside assert().
I don't know how you would like this fixed.

Am 8/12/2010 1:35, schrieb Junio C Hamano:
> * en/rebase-against-rebase-fix (2010-08-06) 2 commits
>  - pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
>  - t5520-pull: Add testcases showing spurious conflicts from git pull --rebase

This should not use "sed -i" in the test suite.

> * jn/svn-fe (2010-08-09) 10 commits
>  - svn-fe manual: Clarify warning about deltas in dump files
>  - Update svn-fe manual
>  - SVN dump parser
>  - Infrastructure to write revisions in fast-export format
>  - Add stream helper library
>  - Add string-specific memory pool
>  - Add treap implementation
>  - Add memory pool library
>  - Introduce vcs-svn lib
>  - Export parse_date_basic() to convert a date string to timestamp
> 
> There was a screw-up on my part---I should have dropped the first one and
> branched this off of jn/parse-date-basic (I'll fix it up before merging
> this to 'next').

This fails to build under MinGW because we don't have strtok_r() and a
whole lot of other things that I didn't even look at. Can we have an
opt-in or opt-out for this?

> * gb/shell-ext (2010-07-28) 3 commits
>  - Add sample commands for git-shell
>  - Add interactive mode to git-shell for user-friendliness
>  - Allow creation of arbitrary git-shell commands

This needs work on Windows because we do not have geteuid(), perhaps just
a compiler flag -Dgeteuid=getuid

> * jn/apply-filename-with-sp (2010-07-23) 4 commits
>  - apply: Handle traditional patches with space in filename
>  - t4135 (apply): use expand instead of pr for portability
>  - tests: Test how well "git apply" copes with weird filenames
>  - apply: Split quoted filename handling into new function
> 
> Looked Ok.  Will merge to 'next'.

The test cases that work with files with tabs must have a prerequisite;
see t3600-rm.sh.

> * il/rfc-remote-fd-ext (2010-07-31) 4 commits
>  - Rewrite bidirectional traffic loop
>  - gitignore: Ignore the new /git-remote-{ext,fd} helpers
>  - New remote helper: git-remote-ext
>  - New remote helper git-remote-fd

We do not have EWOULDBLOCK on Windows. Is it needed or could the
respective write() loop in remote-ext.c not be replaced by write_in_full()?

> * en/d-f-conflict-fix (2010-07-27) 7 commits
>   (merged to 'next' on 2010-08-03 at 7f78604)
>  + t/t6035-merge-dir-to-symlink.sh: Remove TODO on passing test
>  + fast-import: Improve robustness when D->F changes provided in wrong order
>  + fast-export: Fix output order of D/F changes
>  + merge_recursive: Fix renames across paths below D/F conflicts
>  + merge-recursive: Fix D/F conflicts
>  + Add a rename + D/F conflict testcase
>  + Add additional testcases for D/F conflicts

The new tests in t/t3509-cherry-pick-merge-df.sh and t9350-fast-export.sh
need SYMLINKS prerequisite.

-- Hannes

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  9:23 ` Johannes Sixt
@ 2010-08-12  9:37   ` Greg Brockman
  2010-08-12 10:11     ` Ævar Arnfjörð Bjarmason
  2010-08-12 22:08     ` Junio C Hamano
  2010-08-12 10:20   ` Ævar Arnfjörð Bjarmason
                     ` (5 subsequent siblings)
  6 siblings, 2 replies; 56+ messages in thread
From: Greg Brockman @ 2010-08-12  9:37 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Jonathan Nieder, Ilari Liusvaara, Elijah Newren

>> * gb/shell-ext (2010-07-28) 3 commits
>>  - Add sample commands for git-shell
>>  - Add interactive mode to git-shell for user-friendliness
>>  - Allow creation of arbitrary git-shell commands
>
> This needs work on Windows because we do not have geteuid(), perhaps just
> a compiler flag -Dgeteuid=getuid
I had a submitted a revised patch that just uses HOME, see
http://thread.gmane.org/gmane.comp.version-control.git/152050/focus=152135.
 I guess that didn't make it in yet.

Thanks,

Greg

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  9:37   ` Greg Brockman
@ 2010-08-12 10:11     ` Ævar Arnfjörð Bjarmason
  2010-08-12 22:08     ` Junio C Hamano
  1 sibling, 0 replies; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-12 10:11 UTC (permalink / raw)
  To: Greg Brockman
  Cc: Johannes Sixt, Junio C Hamano, git, Jonathan Nieder,
	Ilari Liusvaara, Elijah Newren

On Thu, Aug 12, 2010 at 09:37, Greg Brockman <gdb@mit.edu> wrote:
>>> * gb/shell-ext (2010-07-28) 3 commits
>>>  - Add sample commands for git-shell
>>>  - Add interactive mode to git-shell for user-friendliness
>>>  - Allow creation of arbitrary git-shell commands
>>
>> This needs work on Windows because we do not have geteuid(), perhaps just
>> a compiler flag -Dgeteuid=getuid
> I had a submitted a revised patch that just uses HOME, see
> http://thread.gmane.org/gmane.comp.version-control.git/152050/focus=152135.
>  I guess that didn't make it in yet.

Maybe that should be (untested):

    char* home = expand_user_path("~");

To avoid duplicating the getenv("HOME") code (e.g. if someone wants to
make a getpwuid fallback in the future).

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  9:23 ` Johannes Sixt
  2010-08-12  9:37   ` Greg Brockman
@ 2010-08-12 10:20   ` Ævar Arnfjörð Bjarmason
  2010-08-12 11:35     ` Erik Faye-Lund
  2010-08-12 10:21   ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Ilari Liusvaara
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-12 10:20 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Jonathan Nieder, Greg Brockman,
	Ilari Liusvaara, Elijah Newren

On Thu, Aug 12, 2010 at 09:23, Johannes Sixt <j.sixt@viscovery.net> wrote:
> [Sorry for the Cc spam; I lack the time to conduct individual messages.]
>
> I compiled many topics in pu and ran the test suite on Windows,

A Windows smoker would be useful :)

> Am 8/12/2010 1:35, schrieb Junio C Hamano:
>> * en/rebase-against-rebase-fix (2010-08-06) 2 commits
>>  - pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
>>  - t5520-pull: Add testcases showing spurious conflicts from git pull --rebase
>
> This should not use "sed -i" in the test suite.

Another case for the modify() helper function I guess.

>> * jn/apply-filename-with-sp (2010-07-23) 4 commits
>>  - apply: Handle traditional patches with space in filename
>>  - t4135 (apply): use expand instead of pr for portability
>>  - tests: Test how well "git apply" copes with weird filenames
>>  - apply: Split quoted filename handling into new function
>>
>> Looked Ok.  Will merge to 'next'.
>
> The test cases that work with files with tabs must have a prerequisite;
> see t3600-rm.sh.

Hrm, another test with tabs in filenames. There are already three
setting the TABS_IN_FILENAMES prereq, but I missed this one.

I should probably move those checks into some prereq library, maybe to
test-lib.sh itself.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  9:23 ` Johannes Sixt
  2010-08-12  9:37   ` Greg Brockman
  2010-08-12 10:20   ` Ævar Arnfjörð Bjarmason
@ 2010-08-12 10:21   ` Ilari Liusvaara
  2010-08-12 10:31     ` Johannes Sixt
  2010-08-12 12:43   ` Elijah Newren
                     ` (3 subsequent siblings)
  6 siblings, 1 reply; 56+ messages in thread
From: Ilari Liusvaara @ 2010-08-12 10:21 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Jonathan Nieder, Greg Brockman, Elijah Newren

On Thu, Aug 12, 2010 at 11:23:39AM +0200, Johannes Sixt wrote:

> > * il/rfc-remote-fd-ext (2010-07-31) 4 commits
> >  - Rewrite bidirectional traffic loop
> >  - gitignore: Ignore the new /git-remote-{ext,fd} helpers
> >  - New remote helper: git-remote-ext
> >  - New remote helper git-remote-fd
> 
> We do not have EWOULDBLOCK on Windows. Is it needed or could the
> respective write() loop in remote-ext.c not be replaced by write_in_full()?

No, the writes can't be replaced by write_in_full() without changing what
the code does, because write_in_full() retries short writes, whereas current
code does not retry reads nor writes. And retrying reads/writes in code
juggling with multiple fds is usally no-no.

The EWOULDBLOCK is needed on some systems if fds involved are nonblocking[1]. I
think the easiest way to handle system that has EAGAIN but not EWOULDBLOCK
would be:

#ifndef EWOULDBLOCK
#define EWOULDBLOCK EGAIN
#endif

[1] Some systems return EAGAIN on read/write failed due to blocking (with
EAGAIN == EWOULDBLOCK), others return EWOULDBLOCK.

-Ilari

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 10:21   ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Ilari Liusvaara
@ 2010-08-12 10:31     ` Johannes Sixt
  2010-08-12 15:25       ` Ilari Liusvaara
  0 siblings, 1 reply; 56+ messages in thread
From: Johannes Sixt @ 2010-08-12 10:31 UTC (permalink / raw)
  To: Ilari Liusvaara
  Cc: Junio C Hamano, git, Jonathan Nieder, Greg Brockman, Elijah Newren

Am 8/12/2010 12:21, schrieb Ilari Liusvaara:
> On Thu, Aug 12, 2010 at 11:23:39AM +0200, Johannes Sixt wrote:
> 
>>> * il/rfc-remote-fd-ext (2010-07-31) 4 commits
>>>  - Rewrite bidirectional traffic loop
>>>  - gitignore: Ignore the new /git-remote-{ext,fd} helpers
>>>  - New remote helper: git-remote-ext
>>>  - New remote helper git-remote-fd
>>
>> We do not have EWOULDBLOCK on Windows. Is it needed or could the
>> respective write() loop in remote-ext.c not be replaced by write_in_full()?
> 
> No, the writes can't be replaced by write_in_full() without changing what
> the code does, because write_in_full() retries short writes, whereas current
> code does not retry reads nor writes. And retrying reads/writes in code
> juggling with multiple fds is usally no-no.

builtin/remote-ext.c uses a loop that looks very much like what
write_in_full() does; transport-helper.c's checks for EAGAIN look very
similar to xwrite(). Why can't you reuse these functions?

> The EWOULDBLOCK is needed on some systems if fds involved are nonblocking[1]. I
> think the easiest way to handle system that has EAGAIN but not EWOULDBLOCK
> would be:
> 
> #ifndef EWOULDBLOCK
> #define EWOULDBLOCK EGAIN
> #endif
> 
> [1] Some systems return EAGAIN on read/write failed due to blocking (with
> EAGAIN == EWOULDBLOCK), others return EWOULDBLOCK.

But shouldn't then xwrite() and xread() be extended to check also for
EWOULDBLOCK?

-- Hannes

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 10:20   ` Ævar Arnfjörð Bjarmason
@ 2010-08-12 11:35     ` Erik Faye-Lund
  2010-08-12 16:50       ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 56+ messages in thread
From: Erik Faye-Lund @ 2010-08-12 11:35 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Johannes Sixt, Junio C Hamano, git, Jonathan Nieder,
	Greg Brockman, Ilari Liusvaara, Elijah Newren

On Thu, Aug 12, 2010 at 12:20 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> On Thu, Aug 12, 2010 at 09:23, Johannes Sixt <j.sixt@viscovery.net> wrote:
>> [Sorry for the Cc spam; I lack the time to conduct individual messages.]
>>
>> I compiled many topics in pu and ran the test suite on Windows,
>
> A Windows smoker would be useful :)
>

I guess I could look into setting one up. Where would I look for the
most up-to-date instructions on doing this?

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  9:23 ` Johannes Sixt
                     ` (2 preceding siblings ...)
  2010-08-12 10:21   ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Ilari Liusvaara
@ 2010-08-12 12:43   ` Elijah Newren
  2010-08-12 22:21     ` Junio C Hamano
  2010-08-12 21:58   ` Junio C Hamano
                     ` (2 subsequent siblings)
  6 siblings, 1 reply; 56+ messages in thread
From: Elijah Newren @ 2010-08-12 12:43 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Jonathan Nieder, Greg Brockman, Ilari Liusvaara

On Thu, Aug 12, 2010 at 3:23 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> [Sorry for the Cc spam; I lack the time to conduct individual messages.]
>
> I compiled many topics in pu and ran the test suite on Windows,
> particularly those that "look good" and "will merge to next". Here's a report.
>
> Today's next produces this warning:
>
> merge-recursive.c: In function 'process_df_entry':
> merge-recursive.c:1246: warning: unused variable 'o_sha'
>
> (line number may be different) because o_sha is only used inside assert().
> I don't know how you would like this fixed.

This is caused by en/d-f-conflict-fix.  I could remove the definition
of o_sha and the corresponding assert, or (my preference) just add a
simple null statement:
   (void)o_sha;
What would others prefer?

> Am 8/12/2010 1:35, schrieb Junio C Hamano:
>> * en/rebase-against-rebase-fix (2010-08-06) 2 commits
>>  - pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
>>  - t5520-pull: Add testcases showing spurious conflicts from git pull --rebase
>
> This should not use "sed -i" in the test suite.

Already fixed in v4 sent out last night (and was fixed in v3 that
Junio commented on, but for some reason he merged v1 instead).

>> * en/d-f-conflict-fix (2010-07-27) 7 commits
>>   (merged to 'next' on 2010-08-03 at 7f78604)
>>  + t/t6035-merge-dir-to-symlink.sh: Remove TODO on passing test
>>  + fast-import: Improve robustness when D->F changes provided in wrong order
>>  + fast-export: Fix output order of D/F changes
>>  + merge_recursive: Fix renames across paths below D/F conflicts
>>  + merge-recursive: Fix D/F conflicts
>>  + Add a rename + D/F conflict testcase
>>  + Add additional testcases for D/F conflicts
>
> The new tests in t/t3509-cherry-pick-merge-df.sh and t9350-fast-export.sh
> need SYMLINKS prerequisite.

I'll fix them up.  Sorry for being less familiar with the rules, but
since these are in next, do I resend the series or just the new fixes?

Thanks,
Elijah

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 10:31     ` Johannes Sixt
@ 2010-08-12 15:25       ` Ilari Liusvaara
  0 siblings, 0 replies; 56+ messages in thread
From: Ilari Liusvaara @ 2010-08-12 15:25 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Jonathan Nieder, Greg Brockman, Elijah Newren

On Thu, Aug 12, 2010 at 12:31:33PM +0200, Johannes Sixt wrote:
>
> builtin/remote-ext.c uses a loop that looks very much like what
> write_in_full() does; transport-helper.c's checks for EAGAIN look very
> similar to xwrite(). Why can't you reuse these functions?

Ah, the request sending loop (send_git_request()), not the bidirectional loop
(my bad). Yes, that function can be simplified a lot (patch sent).

> > [1] Some systems return EAGAIN on read/write failed due to blocking (with
> > EAGAIN == EWOULDBLOCK), others return EWOULDBLOCK.
> 
> But shouldn't then xwrite() and xread() be extended to check also for
> EWOULDBLOCK?

Based on what I understand, yes. read() and write() that fails due to blocking
being needed but disabled returns EWOULDBLOCK, which may or may not be the
same as EAGAIN, so the return value in no-blocking case equals EAGAIN only
if EAGAIN == EWOULDBLOCK, which isn't guaranteed.

Have a macro that does the non-fatal error check?

-Ilari

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  5:47 ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Elijah Newren
@ 2010-08-12 15:49   ` Junio C Hamano
  2010-08-12 21:12     ` Elijah Newren
  0 siblings, 1 reply; 56+ messages in thread
From: Junio C Hamano @ 2010-08-12 15:49 UTC (permalink / raw)
  To: Elijah Newren; +Cc: git

Elijah Newren <newren@gmail.com> writes:

> On Wed, Aug 11, 2010 at 5:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>> * en/rebase-against-rebase-fix (2010-08-06) 2 commits
> It looks like you pulled my original submission, despite the fact that
> you commented on v3 of the series.  Granted, everything after v1 was
> just commit log wording changes and testsuite fixups, but I'll resend
> to make it easy for you to grab the latest.

Thanks.

>> * en/fast-export-fix (2010-07-17) 2 commits
>>  - fast-export: Add a --full-tree option
> <snip>
>> * en/d-f-conflict-fix (2010-07-27) 7 commits
>>  (merged to 'next' on 2010-08-03 at 7f78604)
> ...
> Out of curiosity, is there anything preventing these two series from
> advancing?

Nothing other than that we have been in pre-release freeze to 1.7.2 til
late last month, then immediately after the release I got bogged down in
unpacking cardboard boxes, moving between apartments, during which period
I started slowly re-reading pent-up topics and merging ones that looked Ok
to 'next'.  And then I got sick and haven't been productive for the past
few days...

Sorry.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 11:35     ` Erik Faye-Lund
@ 2010-08-12 16:50       ` Ævar Arnfjörð Bjarmason
  2010-08-12 17:34         ` Chris Packham
  0 siblings, 1 reply; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-12 16:50 UTC (permalink / raw)
  To: kusmabite
  Cc: Johannes Sixt, Junio C Hamano, git, Jonathan Nieder,
	Greg Brockman, Ilari Liusvaara, Elijah Newren

On Thu, Aug 12, 2010 at 11:35, Erik Faye-Lund <kusmabite@gmail.com> wrote:
> On Thu, Aug 12, 2010 at 12:20 PM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> On Thu, Aug 12, 2010 at 09:23, Johannes Sixt <j.sixt@viscovery.net> wrote:
>>> [Sorry for the Cc spam; I lack the time to conduct individual messages.]
>>>
>>> I compiled many topics in pu and ran the test suite on Windows,
>>
>> A Windows smoker would be useful :)
>>
>
> I guess I could look into setting one up. Where would I look for the
> most up-to-date instructions on doing this?

The smoke testing section in t/README in pu.

Here's a small script I use to automate my smoke reports:
http://github.com/avar/linode-etc/blob/master/bin/cron/build-and-install-git

But it's crappy and incomplete, we/I still need to write something
easy to set up that does automatic bisecting etc. on errors, tests
multiple branches and all that good stuff.

In the meantime smoking pu daily in cron should do.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 16:50       ` Ævar Arnfjörð Bjarmason
@ 2010-08-12 17:34         ` Chris Packham
  2010-08-12 18:35           ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 56+ messages in thread
From: Chris Packham @ 2010-08-12 17:34 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: kusmabite, Johannes Sixt, Junio C Hamano, git, Jonathan Nieder,
	Greg Brockman, Ilari Liusvaara, Elijah Newren

On 12/08/10 09:50, Ævar Arnfjörð Bjarmason wrote:
> On Thu, Aug 12, 2010 at 11:35, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Thu, Aug 12, 2010 at 12:20 PM, Ævar Arnfjörð Bjarmason
>> <avarab@gmail.com> wrote:
>>> On Thu, Aug 12, 2010 at 09:23, Johannes Sixt <j.sixt@viscovery.net> wrote:
>>>> [Sorry for the Cc spam; I lack the time to conduct individual messages.]
>>>>
>>>> I compiled many topics in pu and ran the test suite on Windows,
>>>
>>> A Windows smoker would be useful :)
>>>
>>
>> I guess I could look into setting one up. Where would I look for the
>> most up-to-date instructions on doing this?
> 
> The smoke testing section in t/README in pu.
> 
> Here's a small script I use to automate my smoke reports:
> http://github.com/avar/linode-etc/blob/master/bin/cron/build-and-install-git
> 
> But it's crappy and incomplete, we/I still need to write something
> easy to set up that does automatic bisecting etc. on errors, tests
> multiple branches and all that good stuff.
> 
> In the meantime smoking pu daily in cron should do.
>

I've got a spare windows box at work I could set something up on it.
I've never used msysgit or MinGW so I might need some instructions/links
on that in addition to the smoker stuff.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 17:34         ` Chris Packham
@ 2010-08-12 18:35           ` Ævar Arnfjörð Bjarmason
  2010-08-12 22:19             ` windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Chris Packham
  0 siblings, 1 reply; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-12 18:35 UTC (permalink / raw)
  To: Chris Packham
  Cc: kusmabite, Johannes Sixt, Junio C Hamano, git, Jonathan Nieder,
	Greg Brockman, Ilari Liusvaara, Elijah Newren

On Thu, Aug 12, 2010 at 17:34, Chris Packham <judge.packham@gmail.com> wrote:

> I've got a spare windows box at work I could set something up on it.
> I've never used msysgit or MinGW so I might need some instructions/links
> on that in addition to the smoker stuff.

I won't be able to help you there, sorry. I know Windows about as well
as IBM z/OS, which is to say not at all :)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 15:49   ` Junio C Hamano
@ 2010-08-12 21:12     ` Elijah Newren
  0 siblings, 0 replies; 56+ messages in thread
From: Elijah Newren @ 2010-08-12 21:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi,

On Thu, Aug 12, 2010 at 9:49 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Elijah Newren <newren@gmail.com> writes:
>> Out of curiosity, is there anything preventing these two series from
>> advancing?
>
> Nothing other than that we have been in pre-release freeze to 1.7.2 til
> late last month, then immediately after the release I got bogged down in
> unpacking cardboard boxes, moving between apartments, during which period
> I started slowly re-reading pent-up topics and merging ones that looked Ok
> to 'next'.  And then I got sick and haven't been productive for the past
> few days...
>
> Sorry.

No worries -- I was just curious if there were any technical issues
that needed resolving.  I hope your recent activity means you're
feeling better.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  9:23 ` Johannes Sixt
                     ` (3 preceding siblings ...)
  2010-08-12 12:43   ` Elijah Newren
@ 2010-08-12 21:58   ` Junio C Hamano
  2010-08-12 22:40   ` jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
  2010-08-13  0:08   ` jn/svn-fe Jonathan Nieder
  6 siblings, 0 replies; 56+ messages in thread
From: Junio C Hamano @ 2010-08-12 21:58 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: git, Jonathan Nieder, Greg Brockman, Ilari Liusvaara, Elijah Newren

Johannes Sixt <j.sixt@viscovery.net> writes:

> I compiled many topics in pu and ran the test suite on Windows,
> particularly those that "look good" and "will merge to next". Here's a report.

Thanks.

>> * jn/apply-filename-with-sp (2010-07-23) 4 commits
>>  - apply: Handle traditional patches with space in filename
>>  - t4135 (apply): use expand instead of pr for portability
>>  - tests: Test how well "git apply" copes with weird filenames
>>  - apply: Split quoted filename handling into new function
>> 
>> Looked Ok.  Will merge to 'next'.
>
> The test cases that work with files with tabs must have a prerequisite;
> see t3600-rm.sh.

Thanks for stopping me.

>> * en/d-f-conflict-fix (2010-07-27) 7 commits
>>   (merged to 'next' on 2010-08-03 at 7f78604)
>>  + t/t6035-merge-dir-to-symlink.sh: Remove TODO on passing test
>>  + fast-import: Improve robustness when D->F changes provided in wrong order
>>  + fast-export: Fix output order of D/F changes
>>  + merge_recursive: Fix renames across paths below D/F conflicts
>>  + merge-recursive: Fix D/F conflicts
>>  + Add a rename + D/F conflict testcase
>>  + Add additional testcases for D/F conflicts
>
> The new tests in t/t3509-cherry-pick-merge-df.sh and t9350-fast-export.sh
> need SYMLINKS prerequisite.

Again, thanks for stopping me.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12  9:37   ` Greg Brockman
  2010-08-12 10:11     ` Ævar Arnfjörð Bjarmason
@ 2010-08-12 22:08     ` Junio C Hamano
  2010-08-12 22:13       ` Greg Brockman
  2010-08-12 22:19       ` Junio C Hamano
  1 sibling, 2 replies; 56+ messages in thread
From: Junio C Hamano @ 2010-08-12 22:08 UTC (permalink / raw)
  To: Greg Brockman
  Cc: Johannes Sixt, git, Jonathan Nieder, Ilari Liusvaara, Elijah Newren

Greg Brockman <gdb@MIT.EDU> writes:

>>> * gb/shell-ext (2010-07-28) 3 commits
>>>  - Add sample commands for git-shell
>>>  - Add interactive mode to git-shell for user-friendliness
>>>  - Allow creation of arbitrary git-shell commands
>>
>> This needs work on Windows because we do not have geteuid(), perhaps just
>> a compiler flag -Dgeteuid=getuid
> I had a submitted a revised patch that just uses HOME, see
> http://thread.gmane.org/gmane.comp.version-control.git/152050/focus=152135.
>  I guess that didn't make it in yet.

No, it didn't; because you said

    Err, actually it would probably be a good idea to
    s/char *home = getenv("HOME");/const char *home = getenv("HOME");/

    Greg

hinting me not to pick it up.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 22:08     ` Junio C Hamano
@ 2010-08-12 22:13       ` Greg Brockman
  2010-08-12 22:19       ` Junio C Hamano
  1 sibling, 0 replies; 56+ messages in thread
From: Greg Brockman @ 2010-08-12 22:13 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Sixt, git, Jonathan Nieder, Ilari Liusvaara, Elijah Newren

My apologies... I'm still trying to figure out my way around the
conventions around here, and hadn't intended that as an indicator to
not pick up the patch.  I'll submit a revised version using
expanduser("~").

Greg



On Thu, Aug 12, 2010 at 6:08 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Greg Brockman <gdb@MIT.EDU> writes:
>
>>>> * gb/shell-ext (2010-07-28) 3 commits
>>>>  - Add sample commands for git-shell
>>>>  - Add interactive mode to git-shell for user-friendliness
>>>>  - Allow creation of arbitrary git-shell commands
>>>
>>> This needs work on Windows because we do not have geteuid(), perhaps just
>>> a compiler flag -Dgeteuid=getuid
>> I had a submitted a revised patch that just uses HOME, see
>> http://thread.gmane.org/gmane.comp.version-control.git/152050/focus=152135.
>>  I guess that didn't make it in yet.
>
> No, it didn't; because you said
>
>    Err, actually it would probably be a good idea to
>    s/char *home = getenv("HOME");/const char *home = getenv("HOME");/
>
>    Greg
>
> hinting me not to pick it up.
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12 18:35           ` Ævar Arnfjörð Bjarmason
@ 2010-08-12 22:19             ` Chris Packham
  2010-08-12 22:29               ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 56+ messages in thread
From: Chris Packham @ 2010-08-12 22:19 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: kusmabite, Johannes Sixt, Junio C Hamano, git, Jonathan Nieder,
	Greg Brockman, Ilari Liusvaara, Elijah Newren

On 12/08/10 11:35, Ævar Arnfjörð Bjarmason wrote:
> On Thu, Aug 12, 2010 at 17:34, Chris Packham <judge.packham@gmail.com> wrote:
> 
>> I've got a spare windows box at work I could set something up on it.
>> I've never used msysgit or MinGW so I might need some instructions/links
>> on that in addition to the smoker stuff.
> 
> I won't be able to help you there, sorry. I know Windows about as well
> as IBM z/OS, which is to say not at all :)

I've got msysgit installed now via the net installer. I checked out
Avar's (Aevar?) branch One problem is that I don't have any of the perl
TAP modules. It's complaining about TAP/Harness/Archive.pm. Any
suggestions for installing additional perl modules under msysgit?

Another problem is that the mingw sh.exe is _really_ slow (the box is an
oldish Dell Latitude). It took a while for the net installer to run and
compile the devel branch but it got there eventually. It's not a huge
issue for me as the box is sitting idle but any suggestions for making
it run a bit smoother are welcome.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 22:08     ` Junio C Hamano
  2010-08-12 22:13       ` Greg Brockman
@ 2010-08-12 22:19       ` Junio C Hamano
  1 sibling, 0 replies; 56+ messages in thread
From: Junio C Hamano @ 2010-08-12 22:19 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Greg Brockman, Johannes Sixt, git, Jonathan Nieder,
	Ilari Liusvaara, Elijah Newren

Junio C Hamano <gitster@pobox.com> writes:

> Greg Brockman <gdb@MIT.EDU> writes:
> ...
>> I had a submitted a revised patch that just uses HOME, see
>> http://thread.gmane.org/gmane.comp.version-control.git/152050/focus=152135.
>>  I guess that didn't make it in yet.
>
> No, it didn't; because you said
>
>     Err, actually it would probably be a good idea to
>     s/char *home = getenv("HOME");/const char *home = getenv("HOME");/
>
>     Greg
>
> hinting me not to pick it up.

Ok, I'll replace 1/3 with 

    http://thread.gmane.org/gmane.comp.version-control.git/152050/focus=152133

and hand-tweak the constness.

Thanks.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)
  2010-08-12 12:43   ` Elijah Newren
@ 2010-08-12 22:21     ` Junio C Hamano
  0 siblings, 0 replies; 56+ messages in thread
From: Junio C Hamano @ 2010-08-12 22:21 UTC (permalink / raw)
  To: Elijah Newren
  Cc: Johannes Sixt, Junio C Hamano, git, Jonathan Nieder,
	Greg Brockman, Ilari Liusvaara

Elijah Newren <newren@gmail.com> writes:

>> The new tests in t/t3509-cherry-pick-merge-df.sh and t9350-fast-export.sh
>> need SYMLINKS prerequisite.
>
> I'll fix them up.  Sorry for being less familiar with the rules, but
> since these are in next, do I resend the series or just the new fixes?

A fix-up patch on top of what is already in 'next' is welcome.  Thanks.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12 22:19             ` windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Chris Packham
@ 2010-08-12 22:29               ` Ævar Arnfjörð Bjarmason
  2010-08-12 22:58                 ` Chris Packham
  0 siblings, 1 reply; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-12 22:29 UTC (permalink / raw)
  To: Chris Packham
  Cc: kusmabite, Johannes Sixt, Junio C Hamano, git, Jonathan Nieder,
	Greg Brockman, Ilari Liusvaara, Elijah Newren

On Thu, Aug 12, 2010 at 22:19, Chris Packham <judge.packham@gmail.com> wrote:
> I checked out Avar's (Aevar?)

Whatever works :)


> branch One problem is that I don't have any of the perl TAP
> modules. It's complaining about TAP/Harness/Archive.pm. Any
> suggestions for installing additional perl modules under msysgit?

I don't know what msysgit does for perl but if you can make it use
strawberry perl's perl + modules that'd be easiest:

    http://strawberryperl.com

It comes with an easy-to use CPAN shell out of the box.

> Another problem is that the mingw sh.exe is _really_ slow (the box is an
> oldish Dell Latitude).

Odd that sh.exe is the slowest bit.

One thing (as the t/README notes) that'll make the tests much faster
is using a ramdisk for the trash directory, but I don't know if
Windows can do that.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12  9:23 ` Johannes Sixt
                     ` (4 preceding siblings ...)
  2010-08-12 21:58   ` Junio C Hamano
@ 2010-08-12 22:40   ` Jonathan Nieder
  2010-08-12 22:46     ` Ævar Arnfjörð Bjarmason
                       ` (2 more replies)
  2010-08-13  0:08   ` jn/svn-fe Jonathan Nieder
  6 siblings, 3 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-12 22:40 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Greg Brockman, Ilari Liusvaara, Elijah Newren

Johannes Sixt wrote:
> Am 8/12/2010 1:35, schrieb Junio C Hamano:

>> * jn/apply-filename-with-sp (2010-07-23) 4 commits
>>  - apply: Handle traditional patches with space in filename
>>  - t4135 (apply): use expand instead of pr for portability
>>  - tests: Test how well "git apply" copes with weird filenames
>>  - apply: Split quoted filename handling into new function
>> 
>> Looked Ok.  Will merge to 'next'.
>
> The test cases that work with files with tabs must have a prerequisite;
> see t3600-rm.sh.

Would this work?

-- 8< --
Subject: t4135 (apply): filenames with tabs are not usable on NTFS

Move the code setting up the FUNNYNAMES prerequisite from
v1.3.0-rc1~67 (workaround fat/ntfs deficiences for t3600-rm.sh,
2006-03-03) to test-lib and use it.

Reported-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t3600-rm.sh                    |   11 +++--------
 t/t4135-apply-weird-filenames.sh |   17 +++++++++--------
 t/test-lib.sh                    |   11 +++++++++++
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index b26cabd..a60b7c9 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -14,15 +14,10 @@ test_expect_success \
      git add -- foo bar baz 'space embedded' -q &&
      git commit -m 'add normal files'"
 
-if touch -- 'tab	embedded' 'newline
-embedded' 2>/dev/null
-then
-	test_set_prereq FUNNYNAMES
-else
-	say 'Your filesystem does not allow tabs in filenames.'
-fi
-
 test_expect_success FUNNYNAMES 'add files with funny names' "
+     >'newline
+embedded' &&
+     >'tab	embedded' &&
      git add -- 'tab	embedded' 'newline
 embedded' &&
      git commit -m 'add files with tabs and newlines'
diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index f4c7e15..5c7165e 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -40,11 +40,12 @@ test_expect_success 'setup: test prerequisites' '
 try_filename() {
 	desc=$1
 	postimage=$2
-	exp1=${3:-success}
-	exp2=${4:-success}
-	exp3=${5:-success}
+	prereq=${3:-}
+	exp1=${4:-success}
+	exp2=${5:-success}
+	exp3=${6:-success}
 
-	test_expect_$exp1 "$desc, git-style file creation patch" "
+	test_expect_$exp1 $prereq "$desc, git-style file creation patch" "
 		reset_preimage &&
 		echo postimage >'$postimage' &&
 		git add -N '$postimage' &&
@@ -57,7 +58,7 @@ try_filename() {
 		test_cmp postimage.saved '$postimage'
 	"
 
-	test_expect_$exp2 UNIDIFF "$desc, traditional patch" "
+	test_expect_$exp2 ${prereq:+$prereq,}UNIDIFF "$desc, traditional patch" "
 		reset_preimage &&
 		echo preimage >'$postimage.orig' &&
 		echo postimage >'$postimage' &&
@@ -70,7 +71,7 @@ try_filename() {
 		test_cmp postimage.saved '$postimage'
 	"
 
-	test_expect_$exp3 FULLDIFF "$desc, traditional file creation patch" "
+	test_expect_$exp3 ${prereq:+$prereq,}FULLDIFF "$desc, traditional file creation patch" "
 		reset_preimage &&
 		reset_subdirs &&
 		echo postimage >b/'$postimage' &&
@@ -86,9 +87,9 @@ try_filename() {
 
 try_filename 'plain'            'postimage.txt'
 try_filename 'with spaces'      'post image.txt'
-try_filename 'with tab'         'post	image.txt'
+try_filename 'with tab'         'post	image.txt' FUNNYNAMES
 try_filename 'with backslash'   'post\image.txt'
-try_filename 'with quote'       '"postimage".txt' success failure success
+try_filename 'with quote'       '"postimage".txt' '' success failure success
 
 test_expect_success FULLDIFF 'whitespace-damaged traditional patch' '
 	reset_preimage &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 938fb24..5ba8723 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -907,6 +907,17 @@ esac
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
 
+# test whether the filesystem supports unusual filenames
+f1='newline
+embedded'
+if
+	>"$f1" 2>/dev/null &&
+	>'tab	embedded' 2>/dev/null
+then
+	test_set_prereq FUNNYNAMES
+fi
+rm -f "$f1" 'tab	embedded'
+
 # test whether the filesystem supports symbolic links
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
 rm -f y
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12 22:40   ` jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
@ 2010-08-12 22:46     ` Ævar Arnfjörð Bjarmason
  2010-08-12 23:17     ` Junio C Hamano
  2010-08-13 21:44     ` Johannes Sixt
  2 siblings, 0 replies; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-12 22:46 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Johannes Sixt, Junio C Hamano, git, Greg Brockman,
	Ilari Liusvaara, Elijah Newren

On Thu, Aug 12, 2010 at 22:40, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Johannes Sixt wrote:
>> Am 8/12/2010 1:35, schrieb Junio C Hamano:
>
>>> * jn/apply-filename-with-sp (2010-07-23) 4 commits
>>>  - apply: Handle traditional patches with space in filename
>>>  - t4135 (apply): use expand instead of pr for portability
>>>  - tests: Test how well "git apply" copes with weird filenames
>>>  - apply: Split quoted filename handling into new function
>>>
>>> Looked Ok.  Will merge to 'next'.
>>
>> The test cases that work with files with tabs must have a prerequisite;
>> see t3600-rm.sh.
>
> Would this work?

This is nice, but incomplete. I just recently added a bunch of
TABS_IN_FILENAMES prereqs to pu, moving that prereq setup to
test-lib.sh + making the rm test use it would be better, we might want
more specific name restrictions than just "funny".

Please also add docs for the new prereq to t/README. There's a new
section for those now too.

Thanks.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12 22:29               ` Ævar Arnfjörð Bjarmason
@ 2010-08-12 22:58                 ` Chris Packham
  2010-08-13  1:01                   ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 56+ messages in thread
From: Chris Packham @ 2010-08-12 22:58 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Johannes Sixt, git, kusmabite

On 12/08/10 15:29, Ævar Arnfjörð Bjarmason wrote:
> On Thu, Aug 12, 2010 at 22:19, Chris Packham <judge.packham@gmail.com> wrote:
>> I checked out Avar's (Aevar?)
> 
> Whatever works :)
> 
> 
>> branch One problem is that I don't have any of the perl TAP
>> modules. It's complaining about TAP/Harness/Archive.pm. Any
>> suggestions for installing additional perl modules under msysgit?
> 
> I don't know what msysgit does for perl but if you can make it use
> strawberry perl's perl + modules that'd be easiest:
> 
>     http://strawberryperl.com

I'll see if I can get it to work. Msys comes with its own perl so maybe
there is another way.

> It comes with an easy-to use CPAN shell out of the box.
> 
>> Another problem is that the mingw sh.exe is _really_ slow (the box is an
>> oldish Dell Latitude).
> 
> Odd that sh.exe is the slowest bit.

I'm probably pointing the finger at sh.exe but it is more that something
else it is doing is slowing things down (probably the fancy PS1 setting).

> One thing (as the t/README notes) that'll make the tests much faster
> is using a ramdisk for the trash directory, but I don't know if
> Windows can do that.

I doubt windows has the capability (heck they've only had 3 file systems
in the last 20 years).

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12 22:40   ` jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
  2010-08-12 22:46     ` Ævar Arnfjörð Bjarmason
@ 2010-08-12 23:17     ` Junio C Hamano
  2010-08-13  0:59       ` Ævar Arnfjörð Bjarmason
  2010-08-13 21:44     ` Johannes Sixt
  2 siblings, 1 reply; 56+ messages in thread
From: Junio C Hamano @ 2010-08-12 23:17 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Johannes Sixt, git, Greg Brockman, Ilari Liusvaara, Elijah Newren

Jonathan Nieder <jrnieder@gmail.com> writes:

> Johannes Sixt wrote:
>> Am 8/12/2010 1:35, schrieb Junio C Hamano:
>
>>> * jn/apply-filename-with-sp (2010-07-23) 4 commits
>>>  - apply: Handle traditional patches with space in filename
>>>  - t4135 (apply): use expand instead of pr for portability
>>>  - tests: Test how well "git apply" copes with weird filenames
>>>  - apply: Split quoted filename handling into new function
>>> 
>>> Looked Ok.  Will merge to 'next'.
>>
>> The test cases that work with files with tabs must have a prerequisite;
>> see t3600-rm.sh.
>
> Would this work?
>
> -- 8< --
> Subject: t4135 (apply): filenames with tabs are not usable on NTFS
>
> Move the code setting up the FUNNYNAMES prerequisite from
> v1.3.0-rc1~67 (workaround fat/ntfs deficiences for t3600-rm.sh,
> 2006-03-03) to test-lib and use it.

Hmm.  FUNNYNAMES is used by only these two but we have nearly 500
individual test scripts in the test suite, and that was the original reason
why we don't have it in test-lib.sh.

I wonder if we can/should lazily check this kind of thing upon the first
use of symbol during a single test session?

 * Create an empty $TEST_DIRECTORY/test-prereq file part of pre-clean
   target of t/Makefile.  This file needs to be removed as part of clean
   target;

 * t/test-lib.sh "."-sources the test-prereq file before doing anything
   else;

 * Instead of using "satisfied" variable as a SP separated list of
   prerequisite tokens, use PREREQ_FOO shell variable (whose value can be
   true, false) to represent FOO prerequisite we have already checked;

 * When checking for prerequite FOO, test_have_prereq checks if PREREQ_FOO
   variable is set.  If not, then it calls a shell function of the same
   name (i.e. PREREQ_FOO) defined in test-lib.sh (the function can exit
   with zero or non-zero just like usual tests to signal if the
   prerequisite is met), sets PREREQ_FOO to an appropriate value, and then
   runs "echo PREREQ_FOO=$PREREQ_FOO >>$TEST_DIRECTORY/test-prereq".
   Then $PREREQ_FOO can be examined to see if prerequisite FOO is
   satisfied.

The file based caching of the above wouldn't work well under "make -j";
without it, we can still have a prerequisite checked only once per a test
script run, which is not worse than the current situation (and it would
even save cycles if a test does not check for a particular prereq,
e.g. SYMLINKS, that is always checked in test-lib).

^ permalink raw reply	[flat|nested] 56+ messages in thread

* jn/svn-fe
  2010-08-12  9:23 ` Johannes Sixt
                     ` (5 preceding siblings ...)
  2010-08-12 22:40   ` jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
@ 2010-08-13  0:08   ` Jonathan Nieder
  2010-08-13 10:18     ` jn/svn-fe Jakub Narebski
  2010-08-13 21:33     ` jn/svn-fe Johannes Sixt
  6 siblings, 2 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-13  0:08 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git, Ramkumar Ramachandra

(pruned Ccs)

Johannes Sixt wrote:
> Am 8/12/2010 1:35, schrieb Junio C Hamano:

>> * jn/svn-fe (2010-08-09) 10 commits
[...]
> This fails to build under MinGW because we don't have strtok_r() and a
> whole lot of other things that I didn't even look at. Can we have an
> opt-in or opt-out for this?

How about something like this instead?

-- 8< --
Subject: vcs-svn: Port to Windows

MSys #define-s dirent away.  Avoid trouble by avoiding that
identifier.

Windows does not have strtok_r (and while does have an identical
strtok_s, but it is not obvious how to use it).  Grab an
implementation from glibc.

The svn-fe test fails in the “svn export” step because of the
lack of symlink support.  With a less ambitious dump, it passes.

Cc: Johannes Sixt <j6t@kdbg.org>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Makefile              |    8 ++
 compat/strtok_r.c     |   61 ++++++++++++++++
 git-compat-util.h     |    5 ++
 t/t9010-svn-fe.sh     |    4 +-
 vcs-svn/fast_export.c |    4 +-
 vcs-svn/repo_tree.c   |  188 ++++++++++++++++++++++++------------------------
 6 files changed, 172 insertions(+), 98 deletions(-)
 create mode 100644 compat/strtok_r.c

diff --git a/Makefile b/Makefile
index c441414..444a0fe 100644
--- a/Makefile
+++ b/Makefile
@@ -68,6 +68,8 @@ all::
 #
 # Define NO_MKSTEMPS if you don't have mkstemps in the C library.
 #
+# Define NO_STRTOK_R if you don't have strtok_r in the C library.
+#
 # Define NO_LIBGEN_H if you don't have libgen.h.
 #
 # Define NEEDS_LIBGEN if your libgen needs -lgen when linking
@@ -1041,6 +1043,7 @@ ifeq ($(uname_S),Windows)
 	NO_UNSETENV = YesPlease
 	NO_STRCASESTR = YesPlease
 	NO_STRLCPY = YesPlease
+	NO_STRTOK_R = YesPlease
 	NO_MEMMEM = YesPlease
 	# NEEDS_LIBICONV = YesPlease
 	NO_ICONV = YesPlease
@@ -1095,6 +1098,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	NO_UNSETENV = YesPlease
 	NO_STRCASESTR = YesPlease
 	NO_STRLCPY = YesPlease
+	NO_STRTOK_R = YesPlease
 	NO_MEMMEM = YesPlease
 	NEEDS_LIBICONV = YesPlease
 	OLD_ICONV = YesPlease
@@ -1325,6 +1329,10 @@ endif
 ifdef NO_STRTOULL
 	COMPAT_CFLAGS += -DNO_STRTOULL
 endif
+ifdef NO_STRTOK_R
+	COMPAT_CFLAGS += -DNO_STRTOK_R
+	COMPAT_OBJS += compat/strtok_r.o
+endif
 ifdef NO_SETENV
 	COMPAT_CFLAGS += -DNO_SETENV
 	COMPAT_OBJS += compat/setenv.o
diff --git a/compat/strtok_r.c b/compat/strtok_r.c
new file mode 100644
index 0000000..7b5d568
--- /dev/null
+++ b/compat/strtok_r.c
@@ -0,0 +1,61 @@
+/* Reentrant string tokenizer.  Generic version.
+   Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "../git-compat-util.h"
+
+/* Parse S into tokens separated by characters in DELIM.
+   If S is NULL, the saved pointer in SAVE_PTR is used as
+   the next starting point.  For example:
+	char s[] = "-abc-=-def";
+	char *sp;
+	x = strtok_r(s, "-", &sp);	// x = "abc", sp = "=-def"
+	x = strtok_r(NULL, "-=", &sp);	// x = "def", sp = NULL
+	x = strtok_r(NULL, "=", &sp);	// x = NULL
+		// s = "abc\0-def\0"
+*/
+char *
+gitstrtok_r (char *s, const char *delim, char **save_ptr)
+{
+  char *token;
+
+  if (s == NULL)
+    s = *save_ptr;
+
+  /* Scan leading delimiters.  */
+  s += strspn (s, delim);
+  if (*s == '\0')
+    {
+      *save_ptr = s;
+      return NULL;
+    }
+
+  /* Find the end of the token.  */
+  token = s;
+  s = strpbrk (token, delim);
+  if (s == NULL)
+    /* This token finishes the string.  */
+    *save_ptr = token + strlen (token);
+  else
+    {
+      /* Terminate the token and make *SAVE_PTR point past it.  */
+      *s = '\0';
+      *save_ptr = s + 1;
+    }
+  return token;
+}
diff --git a/git-compat-util.h b/git-compat-util.h
index 02a73ee..28d6b00 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -312,6 +312,11 @@ extern size_t gitstrlcpy(char *, const char *, size_t);
 extern uintmax_t gitstrtoumax(const char *, char **, int);
 #endif
 
+#ifdef NO_STRTOK_R
+#define strtok_r gitstrtok_r
+extern char *gitstrtok_r(char *s, const char *delim, char **save_ptr);
+#endif
+
 #ifdef NO_HSTRERROR
 #define hstrerror githstrerror
 extern const char *githstrerror(int herror);
diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh
index bf9bbd6..a713dfc 100644
--- a/t/t9010-svn-fe.sh
+++ b/t/t9010-svn-fe.sh
@@ -10,7 +10,7 @@ test_dump() {
 	test_expect_success "$dump" '
 		svnadmin create "$label-svn" &&
 		svnadmin load "$label-svn" < "$TEST_DIRECTORY/$dump" &&
-		svn_cmd export "file://$(pwd)/$label-svn" "$label-svnco" &&
+		svn_cmd export "file://$PWD/$label-svn" "$label-svnco" &&
 		git init "$label-git" &&
 		test-svn-fe "$TEST_DIRECTORY/$dump" >"$label.fe" &&
 		(
@@ -27,6 +27,6 @@ test_dump() {
 	'
 }
 
-test_dump simple t9111/svnsync.dump
+test_dump simple t9135/svn.dump
 
 test_done
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 3a6156f..1f8d8ab 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -48,8 +48,8 @@ void fast_export_commit(uint32_t revision, uint32_t author, char *log,
 		   ~author ? pool_fetch(author) : "nobody",
 		   ~author ? pool_fetch(author) : "nobody",
 		   ~uuid ? pool_fetch(uuid) : "local", timestamp);
-	printf("data %zd\n%s%s\n",
-		   strlen(log) + strlen(gitsvnline), log, gitsvnline);
+	printf("data %d\n%s%s\n",
+		   (int) strlen(log) + strlen(gitsvnline), log, gitsvnline);
 	if (!first_commit_done) {
 		if (revision > 1)
 			printf("from refs/heads/master^0\n");
diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c
index c3d7ee7..194218d 100644
--- a/vcs-svn/repo_tree.c
+++ b/vcs-svn/repo_tree.c
@@ -12,7 +12,7 @@
 
 #include "trp.h"
 
-struct repo_dirent {
+struct repo_dent {
 	uint32_t name_offset;
 	struct trp_node children;
 	uint32_t mode;
@@ -27,18 +27,18 @@ struct repo_commit {
 	uint32_t root_dir_offset;
 };
 
-/* Memory pools for commit, dir and dirent */
+/* Memory pools for commit, dir and dent */
 obj_pool_gen(commit, struct repo_commit, 4096)
 obj_pool_gen(dir, struct repo_dir, 4096)
-obj_pool_gen(dirent, struct repo_dirent, 4096)
+obj_pool_gen(dent, struct repo_dent, 4096)
 
 static uint32_t active_commit;
 static uint32_t mark;
 
-static int repo_dirent_name_cmp(const void *a, const void *b);
+static int repo_dent_name_cmp(const void *a, const void *b);
 
 /* Treap for directory entries */
-trp_gen(static, dirent_, struct repo_dirent, children, dirent, repo_dirent_name_cmp);
+trp_gen(static, dent_, struct repo_dent, children, dent, repo_dent_name_cmp);
 
 uint32_t next_blob_mark(void)
 {
@@ -50,29 +50,29 @@ static struct repo_dir *repo_commit_root_dir(struct repo_commit *commit)
 	return dir_pointer(commit->root_dir_offset);
 }
 
-static struct repo_dirent *repo_first_dirent(struct repo_dir *dir)
+static struct repo_dent *repo_first_dent(struct repo_dir *dir)
 {
-	return dirent_first(&dir->entries);
+	return dent_first(&dir->entries);
 }
 
-static int repo_dirent_name_cmp(const void *a, const void *b)
+static int repo_dent_name_cmp(const void *a, const void *b)
 {
-	const struct repo_dirent *dirent1 = a, *dirent2 = b;
-	uint32_t a_offset = dirent1->name_offset;
-	uint32_t b_offset = dirent2->name_offset;
+	const struct repo_dent *dent1 = a, *dent2 = b;
+	uint32_t a_offset = dent1->name_offset;
+	uint32_t b_offset = dent2->name_offset;
 	return (a_offset > b_offset) - (a_offset < b_offset);
 }
 
-static int repo_dirent_is_dir(struct repo_dirent *dirent)
+static int repo_dent_is_dir(struct repo_dent *dent)
 {
-	return dirent != NULL && dirent->mode == REPO_MODE_DIR;
+	return dent != NULL && dent->mode == REPO_MODE_DIR;
 }
 
-static struct repo_dir *repo_dir_from_dirent(struct repo_dirent *dirent)
+static struct repo_dir *repo_dir_from_dent(struct repo_dent *dent)
 {
-	if (!repo_dirent_is_dir(dirent))
+	if (!repo_dent_is_dir(dent))
 		return NULL;
-	return dir_pointer(dirent->content_offset);
+	return dir_pointer(dent->content_offset);
 }
 
 static struct repo_dir *repo_clone_dir(struct repo_dir *orig_dir)
@@ -87,31 +87,31 @@ static struct repo_dir *repo_clone_dir(struct repo_dir *orig_dir)
 	return dir_pointer(new_o);
 }
 
-static struct repo_dirent *repo_read_dirent(uint32_t revision, uint32_t *path)
+static struct repo_dent *repo_read_dent(uint32_t revision, uint32_t *path)
 {
 	uint32_t name = 0;
-	struct repo_dirent *key = dirent_pointer(dirent_alloc(1));
+	struct repo_dent *key = dent_pointer(dent_alloc(1));
 	struct repo_dir *dir = NULL;
-	struct repo_dirent *dirent = NULL;
+	struct repo_dent *dent = NULL;
 	dir = repo_commit_root_dir(commit_pointer(revision));
 	while (~(name = *path++)) {
 		key->name_offset = name;
-		dirent = dirent_search(&dir->entries, key);
-		if (dirent == NULL || !repo_dirent_is_dir(dirent))
+		dent = dent_search(&dir->entries, key);
+		if (dent == NULL || !repo_dent_is_dir(dent))
 			break;
-		dir = repo_dir_from_dirent(dirent);
+		dir = repo_dir_from_dent(dent);
 	}
-	dirent_free(1);
-	return dirent;
+	dent_free(1);
+	return dent;
 }
 
-static void repo_write_dirent(uint32_t *path, uint32_t mode,
+static void repo_write_dent(uint32_t *path, uint32_t mode,
 			      uint32_t content_offset, uint32_t del)
 {
 	uint32_t name, revision, dir_o = ~0, parent_dir_o = ~0;
 	struct repo_dir *dir;
-	struct repo_dirent *key;
-	struct repo_dirent *dirent = NULL;
+	struct repo_dent *key;
+	struct repo_dent *dent = NULL;
 	revision = active_commit;
 	dir = repo_commit_root_dir(commit_pointer(revision));
 	dir = repo_clone_dir(dir);
@@ -119,127 +119,127 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode,
 	while (~(name = *path++)) {
 		parent_dir_o = dir_offset(dir);
 
-		key = dirent_pointer(dirent_alloc(1));
+		key = dent_pointer(dent_alloc(1));
 		key->name_offset = name;
 
-		dirent = dirent_search(&dir->entries, key);
-		if (dirent == NULL)
-			dirent = key;
+		dent = dent_search(&dir->entries, key);
+		if (dent == NULL)
+			dent = key;
 		else
-			dirent_free(1);
+			dent_free(1);
 
-		if (dirent == key) {
-			dirent->mode = REPO_MODE_DIR;
-			dirent->content_offset = 0;
-			dirent_insert(&dir->entries, dirent);
+		if (dent == key) {
+			dent->mode = REPO_MODE_DIR;
+			dent->content_offset = 0;
+			dent_insert(&dir->entries, dent);
 		}
 
-		if (dirent_offset(dirent) < dirent_pool.committed) {
-			dir_o = repo_dirent_is_dir(dirent) ?
-					dirent->content_offset : ~0;
-			dirent_remove(&dir->entries, dirent);
-			dirent = dirent_pointer(dirent_alloc(1));
-			dirent->name_offset = name;
-			dirent->mode = REPO_MODE_DIR;
-			dirent->content_offset = dir_o;
-			dirent_insert(&dir->entries, dirent);
+		if (dent_offset(dent) < dent_pool.committed) {
+			dir_o = repo_dent_is_dir(dent) ?
+					dent->content_offset : ~0;
+			dent_remove(&dir->entries, dent);
+			dent = dent_pointer(dent_alloc(1));
+			dent->name_offset = name;
+			dent->mode = REPO_MODE_DIR;
+			dent->content_offset = dir_o;
+			dent_insert(&dir->entries, dent);
 		}
 
-		dir = repo_dir_from_dirent(dirent);
+		dir = repo_dir_from_dent(dent);
 		dir = repo_clone_dir(dir);
-		dirent->content_offset = dir_offset(dir);
+		dent->content_offset = dir_offset(dir);
 	}
-	if (dirent == NULL)
+	if (dent == NULL)
 		return;
-	dirent->mode = mode;
-	dirent->content_offset = content_offset;
+	dent->mode = mode;
+	dent->content_offset = content_offset;
 	if (del && ~parent_dir_o)
-		dirent_remove(&dir_pointer(parent_dir_o)->entries, dirent);
+		dent_remove(&dir_pointer(parent_dir_o)->entries, dent);
 }
 
 uint32_t repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst)
 {
 	uint32_t mode = 0, content_offset = 0;
-	struct repo_dirent *src_dirent;
-	src_dirent = repo_read_dirent(revision, src);
-	if (src_dirent != NULL) {
-		mode = src_dirent->mode;
-		content_offset = src_dirent->content_offset;
-		repo_write_dirent(dst, mode, content_offset, 0);
+	struct repo_dent *src_dent;
+	src_dent = repo_read_dent(revision, src);
+	if (src_dent != NULL) {
+		mode = src_dent->mode;
+		content_offset = src_dent->content_offset;
+		repo_write_dent(dst, mode, content_offset, 0);
 	}
 	return mode;
 }
 
 void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark)
 {
-	repo_write_dirent(path, mode, blob_mark, 0);
+	repo_write_dent(path, mode, blob_mark, 0);
 }
 
 uint32_t repo_replace(uint32_t *path, uint32_t blob_mark)
 {
 	uint32_t mode = 0;
-	struct repo_dirent *src_dirent;
-	src_dirent = repo_read_dirent(active_commit, path);
-	if (src_dirent != NULL) {
-		mode = src_dirent->mode;
-		repo_write_dirent(path, mode, blob_mark, 0);
+	struct repo_dent *src_dent;
+	src_dent = repo_read_dent(active_commit, path);
+	if (src_dent != NULL) {
+		mode = src_dent->mode;
+		repo_write_dent(path, mode, blob_mark, 0);
 	}
 	return mode;
 }
 
 void repo_modify(uint32_t *path, uint32_t mode, uint32_t blob_mark)
 {
-	struct repo_dirent *src_dirent;
-	src_dirent = repo_read_dirent(active_commit, path);
-	if (src_dirent != NULL && blob_mark == 0)
-		blob_mark = src_dirent->content_offset;
-	repo_write_dirent(path, mode, blob_mark, 0);
+	struct repo_dent *src_dent;
+	src_dent = repo_read_dent(active_commit, path);
+	if (src_dent != NULL && blob_mark == 0)
+		blob_mark = src_dent->content_offset;
+	repo_write_dent(path, mode, blob_mark, 0);
 }
 
 void repo_delete(uint32_t *path)
 {
-	repo_write_dirent(path, 0, 0, 1);
+	repo_write_dent(path, 0, 0, 1);
 }
 
 static void repo_git_add_r(uint32_t depth, uint32_t *path, struct repo_dir *dir);
 
-static void repo_git_add(uint32_t depth, uint32_t *path, struct repo_dirent *dirent)
+static void repo_git_add(uint32_t depth, uint32_t *path, struct repo_dent *dent)
 {
-	if (repo_dirent_is_dir(dirent))
-		repo_git_add_r(depth, path, repo_dir_from_dirent(dirent));
+	if (repo_dent_is_dir(dent))
+		repo_git_add_r(depth, path, repo_dir_from_dent(dent));
 	else
 		fast_export_modify(depth, path,
-				   dirent->mode, dirent->content_offset);
+				   dent->mode, dent->content_offset);
 }
 
 static void repo_git_add_r(uint32_t depth, uint32_t *path, struct repo_dir *dir)
 {
-	struct repo_dirent *de = repo_first_dirent(dir);
+	struct repo_dent *de = repo_first_dent(dir);
 	while (de) {
 		path[depth] = de->name_offset;
 		repo_git_add(depth + 1, path, de);
-		de = dirent_next(&dir->entries, de);
+		de = dent_next(&dir->entries, de);
 	}
 }
 
 static void repo_diff_r(uint32_t depth, uint32_t *path, struct repo_dir *dir1,
 			struct repo_dir *dir2)
 {
-	struct repo_dirent *de1, *de2;
-	de1 = repo_first_dirent(dir1);
-	de2 = repo_first_dirent(dir2);
+	struct repo_dent *de1, *de2;
+	de1 = repo_first_dent(dir1);
+	de2 = repo_first_dent(dir2);
 
 	while (de1 && de2) {
 		if (de1->name_offset < de2->name_offset) {
 			path[depth] = de1->name_offset;
 			fast_export_delete(depth + 1, path);
-			de1 = dirent_next(&dir1->entries, de1);
+			de1 = dent_next(&dir1->entries, de1);
 			continue;
 		}
 		if (de1->name_offset > de2->name_offset) {
 			path[depth] = de2->name_offset;
 			repo_git_add(depth + 1, path, de2);
-			de2 = dirent_next(&dir2->entries, de2);
+			de2 = dent_next(&dir2->entries, de2);
 			continue;
 		}
 		path[depth] = de1->name_offset;
@@ -247,28 +247,28 @@ static void repo_diff_r(uint32_t depth, uint32_t *path, struct repo_dir *dir1,
 		if (de1->mode == de2->mode &&
 		    de1->content_offset == de2->content_offset) {
 			; /* No change. */
-		} else if (repo_dirent_is_dir(de1) && repo_dirent_is_dir(de2)) {
+		} else if (repo_dent_is_dir(de1) && repo_dent_is_dir(de2)) {
 			repo_diff_r(depth + 1, path,
-				    repo_dir_from_dirent(de1),
-				    repo_dir_from_dirent(de2));
-		} else if (!repo_dirent_is_dir(de1) && !repo_dirent_is_dir(de2)) {
+				    repo_dir_from_dent(de1),
+				    repo_dir_from_dent(de2));
+		} else if (!repo_dent_is_dir(de1) && !repo_dent_is_dir(de2)) {
 			repo_git_add(depth + 1, path, de2);
 		} else {
 			fast_export_delete(depth + 1, path);
 			repo_git_add(depth + 1, path, de2);
 		}
-		de1 = dirent_next(&dir1->entries, de1);
-		de2 = dirent_next(&dir2->entries, de2);
+		de1 = dent_next(&dir1->entries, de1);
+		de2 = dent_next(&dir2->entries, de2);
 	}
 	while (de1) {
 		path[depth] = de1->name_offset;
 		fast_export_delete(depth + 1, path);
-		de1 = dirent_next(&dir1->entries, de1);
+		de1 = dent_next(&dir1->entries, de1);
 	}
 	while (de2) {
 		path[depth] = de2->name_offset;
 		repo_git_add(depth + 1, path, de2);
-		de2 = dirent_next(&dir2->entries, de2);
+		de2 = dent_next(&dir2->entries, de2);
 	}
 }
 
@@ -286,7 +286,7 @@ void repo_commit(uint32_t revision, uint32_t author, char *log, uint32_t uuid,
 		 uint32_t url, unsigned long timestamp)
 {
 	fast_export_commit(revision, author, log, uuid, url, timestamp);
-	dirent_commit();
+	dent_commit();
 	dir_commit();
 	active_commit = commit_alloc(1);
 	commit_pointer(active_commit)->root_dir_offset =
@@ -297,10 +297,10 @@ static void mark_init(void)
 {
 	uint32_t i;
 	mark = 0;
-	for (i = 0; i < dirent_pool.size; i++)
-		if (!repo_dirent_is_dir(dirent_pointer(i)) &&
-		    dirent_pointer(i)->content_offset > mark)
-			mark = dirent_pointer(i)->content_offset;
+	for (i = 0; i < dent_pool.size; i++)
+		if (!repo_dent_is_dir(dent_pointer(i)) &&
+		    dent_pointer(i)->content_offset > mark)
+			mark = dent_pointer(i)->content_offset;
 	mark++;
 }
 
@@ -325,5 +325,5 @@ void repo_reset(void)
 	pool_reset();
 	commit_reset();
 	dir_reset();
-	dirent_reset();
+	dent_reset();
 }
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12 23:17     ` Junio C Hamano
@ 2010-08-13  0:59       ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-13  0:59 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Jonathan Nieder, Johannes Sixt, git, Greg Brockman,
	Ilari Liusvaara, Elijah Newren

On Thu, Aug 12, 2010 at 23:17, Junio C Hamano <gitster@pobox.com> wrote:

> The file based caching of the above wouldn't work well under "make -j";
> without it, we can still have a prerequisite checked only once per a test
> script run, which is not worse than the current situation (and it would
> even save cycles if a test does not check for a particular prereq,
> e.g. SYMLINKS, that is always checked in test-lib).

I think that's being a little too clever for such a small part of the
test suite, better to just stick specialized checks like these into
e.g. lib-check-fs.sh, which those tests can then source.

Or just leave it as-is, trying to create a few files is a negligible
part of the test execution time, most of the tests are doing a lot
mork work than just trying to create a symlink or a file with a funny
name.

Anyway, a simpler implementation of lazy-loading would be to have
e.g. t/lib-prereq/FUNNYNAMES.sh. test_have_prereq could then just
do:

    lazy="$TEST_DIRECTORY/lib-prereq/$prereq.sh"
    test -f $lazy && . $lazy # TODO: Don't load this if we've done it already
    case $satisfied in ...

Or something like that, that'd eliminate the need for file creation,
since prereq labels would map directly to filenames, and there could
be an internal "${prereq}_FOO" variable checking if it was loaded
already.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12 22:58                 ` Chris Packham
@ 2010-08-13  1:01                   ` Ævar Arnfjörð Bjarmason
  2010-08-14  0:42                     ` Chris Packham
  0 siblings, 1 reply; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-13  1:01 UTC (permalink / raw)
  To: Chris Packham; +Cc: Johannes Sixt, git, kusmabite

On Thu, Aug 12, 2010 at 22:58, Chris Packham <judge.packham@gmail.com> wrote:
> On 12/08/10 15:29, Ævar Arnfjörð Bjarmason wrote:
>> On Thu, Aug 12, 2010 at 22:19, Chris Packham <judge.packham@gmail.com> wrote:
>>> I checked out Avar's (Aevar?)
>>
>> Whatever works :)
>>
>>
>>> branch One problem is that I don't have any of the perl TAP
>>> modules. It's complaining about TAP/Harness/Archive.pm. Any
>>> suggestions for installing additional perl modules under msysgit?
>>
>> I don't know what msysgit does for perl but if you can make it use
>> strawberry perl's perl + modules that'd be easiest:
>>
>>     http://strawberryperl.com
>
> I'll see if I can get it to work. Msys comes with its own perl so maybe
> there is another way.

If it comes with its own perl it should also have a cpan shell:

    perl -MCPAN -e 'install TAP::Harness::Archive'

That should be easier than installing strawberry in addition to the
mingw perl.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: jn/svn-fe
  2010-08-13  0:08   ` jn/svn-fe Jonathan Nieder
@ 2010-08-13 10:18     ` Jakub Narebski
  2010-08-13 21:33     ` jn/svn-fe Johannes Sixt
  1 sibling, 0 replies; 56+ messages in thread
From: Jakub Narebski @ 2010-08-13 10:18 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Johannes Sixt, Junio C Hamano, git, Ramkumar Ramachandra

Jonathan Nieder <jrnieder@gmail.com> writes:

> How about something like this instead?
> 
> -- 8< --
> Subject: vcs-svn: Port to Windows
> 
> MSys #define-s dirent away.  Avoid trouble by avoiding that
> identifier.
> 
> Windows does not have strtok_r (and while does have an identical
> strtok_s, but it is not obvious how to use it).  Grab an
> implementation from glibc.
> 
> The svn-fe test fails in the “svn export” step because of the
> lack of symlink support.  With a less ambitious dump, it passes.
> 
> Cc: Johannes Sixt <j6t@kdbg.org>
> Cc: Ramkumar Ramachandra <artagnon@gmail.com>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
>  Makefile              |    8 ++
>  compat/strtok_r.c     |   61 ++++++++++++++++
>  git-compat-util.h     |    5 ++
>  t/t9010-svn-fe.sh     |    4 +-
>  vcs-svn/fast_export.c |    4 +-
>  vcs-svn/repo_tree.c   |  188 ++++++++++++++++++++++++------------------------
>  6 files changed, 172 insertions(+), 98 deletions(-)
>  create mode 100644 compat/strtok_r.c
> 
> diff --git a/Makefile b/Makefile
> index c441414..444a0fe 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -68,6 +68,8 @@ all::
>  #
>  # Define NO_MKSTEMPS if you don't have mkstemps in the C library.
>  #
> +# Define NO_STRTOK_R if you don't have strtok_r in the C library.
> +#
>  # Define NO_LIBGEN_H if you don't have libgen.h.
>  #
>  # Define NEEDS_LIBGEN if your libgen needs -lgen when linking

You are missing autodetection by autoconf, i.e. changes to
config.mak.in and to configure.ac

  #
  # Define NO_STRTOK_R if you don't have strtok_r in the C library.
  GIT_CHECK_FUNC(strtok_r,
  [NO_STRTOK_R=],
  [NO_STRTOK_R=YesPlease])
  AC_SUBST(NO_STRTOK_R)

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: jn/svn-fe
  2010-08-13  0:08   ` jn/svn-fe Jonathan Nieder
  2010-08-13 10:18     ` jn/svn-fe Jakub Narebski
@ 2010-08-13 21:33     ` Johannes Sixt
  2010-08-13 23:47       ` [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows Jonathan Nieder
  1 sibling, 1 reply; 56+ messages in thread
From: Johannes Sixt @ 2010-08-13 21:33 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Johannes Sixt, Junio C Hamano, git, Ramkumar Ramachandra

Am 13.08.2010 02:08, schrieb Jonathan Nieder:
> (pruned Ccs)
>
> Johannes Sixt wrote:
>> Am 8/12/2010 1:35, schrieb Junio C Hamano:
>
>>> * jn/svn-fe (2010-08-09) 10 commits
> [...]
>> This fails to build under MinGW because we don't have strtok_r() and a
>> whole lot of other things that I didn't even look at. Can we have an
>> opt-in or opt-out for this?
>
> How about something like this instead?
>
> -- 8<  --
> Subject: vcs-svn: Port to Windows
>
> MSys #define-s dirent away.  Avoid trouble by avoiding that
> identifier.
>
> Windows does not have strtok_r (and while does have an identical
> strtok_s, but it is not obvious how to use it).  Grab an
> implementation from glibc.
>
> The svn-fe test fails in the “svn export” step because of the
> lack of symlink support.  With a less ambitious dump, it passes.
>
> Cc: Johannes Sixt<j6t@kdbg.org>
> Cc: Ramkumar Ramachandra<artagnon@gmail.com>
> Signed-off-by: Jonathan Nieder<jrnieder@gmail.com>

Thanks, it compiles with this patch and passes the test suite.

Acked-by: Johannes Sixt<j6t@kdbg.org>

The license, LGPL 2.1 or later is OK, I assume?

-- Hannes

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-12 22:40   ` jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
  2010-08-12 22:46     ` Ævar Arnfjörð Bjarmason
  2010-08-12 23:17     ` Junio C Hamano
@ 2010-08-13 21:44     ` Johannes Sixt
  2010-08-14  2:27       ` Jonathan Nieder
  2 siblings, 1 reply; 56+ messages in thread
From: Johannes Sixt @ 2010-08-13 21:44 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Johannes Sixt, Junio C Hamano, git, Greg Brockman,
	Ilari Liusvaara, Elijah Newren

Am 13.08.2010 00:40, schrieb Jonathan Nieder:
> Johannes Sixt wrote:
>> Am 8/12/2010 1:35, schrieb Junio C Hamano:
>
>>> * jn/apply-filename-with-sp (2010-07-23) 4 commits
>>>   - apply: Handle traditional patches with space in filename
>>>   - t4135 (apply): use expand instead of pr for portability
>>>   - tests: Test how well "git apply" copes with weird filenames
>>>   - apply: Split quoted filename handling into new function
>>>
>>> Looked Ok.  Will merge to 'next'.
>>
>> The test cases that work with files with tabs must have a prerequisite;
>> see t3600-rm.sh.
>
> Would this work?
>
> -- 8<  --
> Subject: t4135 (apply): filenames with tabs are not usable on NTFS
>
> Move the code setting up the FUNNYNAMES prerequisite from
> v1.3.0-rc1~67 (workaround fat/ntfs deficiences for t3600-rm.sh,
> 2006-03-03) to test-lib and use it.
>
> Reported-by: Johannes Sixt<j6t@kdbg.org>
> Signed-off-by: Jonathan Nieder<jrnieder@gmail.com>

No, it needs this squashed in (warning, whitespace damaged), except that 
the prerequisite EXPAND is nowhere defined - it is only a hint for you(?) 
that we need something else there because we don't have expand on Windows.

I don't know why the test with quotes fails. It must be a bug in MSYS 
bash, because the file system does not have any problems with quotes in 
file names.

diff --git a/t/t4135-apply-weird-filenames.sh 
b/t/t4135-apply-weird-filenames.sh
index 5c7165e..6730a30 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -88,10 +88,10 @@ try_filename() {
  try_filename 'plain'            'postimage.txt'
  try_filename 'with spaces'      'post image.txt'
  try_filename 'with tab'         'post	image.txt' FUNNYNAMES
-try_filename 'with backslash'   'post\image.txt'
-try_filename 'with quote'       '"postimage".txt' '' success failure success
+try_filename 'with backslash'   'post\image.txt' BSLASHPSPEC
+try_filename 'with quote'       '"postimage".txt' FUNNYNAMES success 
failure success

-test_expect_success FULLDIFF 'whitespace-damaged traditional patch' '
+test_expect_success EXPAND,FULLDIFF 'whitespace-damaged traditional patch' '
  	reset_preimage &&
  	reset_subdirs &&
  	echo postimage >b/postimage.txt &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 1e5640b..d50e787 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -963,8 +963,8 @@ test -z "$NO_GETTEXT" && test_set_prereq GETTEXT
  f1='newline
  embedded'
  if
-	>"$f1" 2>/dev/null &&
-	>'tab	embedded' 2>/dev/null
+	{ >"$f1"; } 2>/dev/null &&
+	{ >'tab	embedded'; } 2>/dev/null
  then
  	test_set_prereq FUNNYNAMES
  fi

Without the braces in this check the error message is still printed. I 
didn't test whether just writing 2>/dev/null first would suppress it as well.

BTW, I would prefer to keep the test in t3600 and t4135, that it doesn't 
happen for every other test script unnecessarily.

-- Hannes

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows
  2010-08-13 21:33     ` jn/svn-fe Johannes Sixt
@ 2010-08-13 23:47       ` Jonathan Nieder
  2010-08-13 23:59         ` [PATCH 1/5] compat: add strtok_r() Jonathan Nieder
                           ` (4 more replies)
  0 siblings, 5 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-13 23:47 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Ramkumar Ramachandra, David Barr, Jakub Narebski

Johannes Sixt wrote:
> Am 13.08.2010 02:08, schrieb Jonathan Nieder:

>> Subject: vcs-svn: Port to Windows
>>
>> MSys #define-s dirent away.  Avoid trouble by avoiding that
>> identifier.
>>
>> Windows does not have strtok_r (and while does have an identical
>> strtok_s, but it is not obvious how to use it).  Grab an
>> implementation from glibc.
>>
>> The svn-fe test fails in the “svn export” step because of the
>> lack of symlink support.  With a less ambitious dump, it passes.
>>
>> Cc: Johannes Sixt <j6t@kdbg.org>
>> Cc: Ramkumar Ramachandra <artagnon@gmail.com>
>> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
>
> Thanks, it compiles with this patch and passes the test suite.
>
> Acked-by: Johannes Sixt <j6t@kdbg.org>
>
> The license, LGPL 2.1 or later is OK, I assume?

xdiff uses it, so I think that should be fine.  If not, it shouldn’t
be hard to rewrite based on the man page; I only took the glibc
version because it was easy to do.

Here’s a split-up patch.  Patch 1 adds an autoconf test (thanks,
Jakub!).  Patch 2 is a little (though not much) shorter than the blind
search-and-replace I sent before.  This uses uint32_t instead of int
in patch 3 because the vcs-svn lib uses 32-bit lengths elsewhere.

Not tested on Windows but it is not so different from v1 which was.

Thanks again for the help.

Jonathan Nieder (5):
  compat: add strtok_r()
  vcs-svn: Rename dirent pool to build on Windows
  vcs-svn: Avoid %z in format string
  t9010 (svn-fe): use Unix-style path in URI
  t9010 (svn-fe): avoid symlinks in test

 Makefile              |    8 +++
 compat/strtok_r.c     |   61 ++++++++++++++++++++
 config.mak.in         |    1 +
 configure.ac          |    6 ++
 git-compat-util.h     |    5 ++
 t/t9010-svn-fe.sh     |    4 +-
 vcs-svn/fast_export.c |    5 +-
 vcs-svn/repo_tree.c   |  146 ++++++++++++++++++++++++------------------------
 8 files changed, 159 insertions(+), 77 deletions(-)
 create mode 100644 compat/strtok_r.c

-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 1/5] compat: add strtok_r()
  2010-08-13 23:47       ` [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows Jonathan Nieder
@ 2010-08-13 23:59         ` Jonathan Nieder
  2010-08-14  0:01         ` [PATCH 2/5] vcs-svn: Rename dirent pool to build on Windows Jonathan Nieder
                           ` (3 subsequent siblings)
  4 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-13 23:59 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Ramkumar Ramachandra, David Barr, Jakub Narebski

Windows does not have strtok_r (and while it does have an identical
strtok_s, but it is not obvious how to use it).  Grab an
implementation from glibc.

The svn-fe tool uses strtok_r to parse paths.

Acked-by: Johannes Sixt <j6t@kdbg.org>
Helped-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
I have carried over Hannes’s ack; hopefully that is okay.

 Makefile          |    8 +++++++
 compat/strtok_r.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 config.mak.in     |    1 +
 configure.ac      |    6 +++++
 git-compat-util.h |    5 ++++
 5 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 compat/strtok_r.c

diff --git a/Makefile b/Makefile
index 9643b89..ec46ec4 100644
--- a/Makefile
+++ b/Makefile
@@ -68,6 +68,8 @@ all::
 #
 # Define NO_MKSTEMPS if you don't have mkstemps in the C library.
 #
+# Define NO_STRTOK_R if you don't have strtok_r in the C library.
+#
 # Define NO_LIBGEN_H if you don't have libgen.h.
 #
 # Define NEEDS_LIBGEN if your libgen needs -lgen when linking
@@ -1041,6 +1043,7 @@ ifeq ($(uname_S),Windows)
 	NO_UNSETENV = YesPlease
 	NO_STRCASESTR = YesPlease
 	NO_STRLCPY = YesPlease
+	NO_STRTOK_R = YesPlease
 	NO_MEMMEM = YesPlease
 	# NEEDS_LIBICONV = YesPlease
 	NO_ICONV = YesPlease
@@ -1095,6 +1098,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	NO_UNSETENV = YesPlease
 	NO_STRCASESTR = YesPlease
 	NO_STRLCPY = YesPlease
+	NO_STRTOK_R = YesPlease
 	NO_MEMMEM = YesPlease
 	NEEDS_LIBICONV = YesPlease
 	OLD_ICONV = YesPlease
@@ -1325,6 +1329,10 @@ endif
 ifdef NO_STRTOULL
 	COMPAT_CFLAGS += -DNO_STRTOULL
 endif
+ifdef NO_STRTOK_R
+	COMPAT_CFLAGS += -DNO_STRTOK_R
+	COMPAT_OBJS += compat/strtok_r.o
+endif
 ifdef NO_SETENV
 	COMPAT_CFLAGS += -DNO_SETENV
 	COMPAT_OBJS += compat/setenv.o
diff --git a/compat/strtok_r.c b/compat/strtok_r.c
new file mode 100644
index 0000000..7b5d568
--- /dev/null
+++ b/compat/strtok_r.c
@@ -0,0 +1,61 @@
+/* Reentrant string tokenizer.  Generic version.
+   Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "../git-compat-util.h"
+
+/* Parse S into tokens separated by characters in DELIM.
+   If S is NULL, the saved pointer in SAVE_PTR is used as
+   the next starting point.  For example:
+	char s[] = "-abc-=-def";
+	char *sp;
+	x = strtok_r(s, "-", &sp);	// x = "abc", sp = "=-def"
+	x = strtok_r(NULL, "-=", &sp);	// x = "def", sp = NULL
+	x = strtok_r(NULL, "=", &sp);	// x = NULL
+		// s = "abc\0-def\0"
+*/
+char *
+gitstrtok_r (char *s, const char *delim, char **save_ptr)
+{
+  char *token;
+
+  if (s == NULL)
+    s = *save_ptr;
+
+  /* Scan leading delimiters.  */
+  s += strspn (s, delim);
+  if (*s == '\0')
+    {
+      *save_ptr = s;
+      return NULL;
+    }
+
+  /* Find the end of the token.  */
+  token = s;
+  s = strpbrk (token, delim);
+  if (s == NULL)
+    /* This token finishes the string.  */
+    *save_ptr = token + strlen (token);
+  else
+    {
+      /* Terminate the token and make *SAVE_PTR point past it.  */
+      *s = '\0';
+      *save_ptr = s + 1;
+    }
+  return token;
+}
diff --git a/config.mak.in b/config.mak.in
index b4e65c3..4ffd774 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -46,6 +46,7 @@ NO_IPV6=@NO_IPV6@
 NO_C99_FORMAT=@NO_C99_FORMAT@
 NO_HSTRERROR=@NO_HSTRERROR@
 NO_STRCASESTR=@NO_STRCASESTR@
+NO_STRTOK_R=@NO_STRTOK_R@
 NO_MEMMEM=@NO_MEMMEM@
 NO_STRLCPY=@NO_STRLCPY@
 NO_UINTMAX_T=@NO_UINTMAX_T@
diff --git a/configure.ac b/configure.ac
index 5601e8b..708e7b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -783,6 +783,12 @@ GIT_CHECK_FUNC(strcasestr,
 [NO_STRCASESTR=YesPlease])
 AC_SUBST(NO_STRCASESTR)
 #
+# Define NO_STRTOK_R if you don't have strtok_r
+GIT_CHECK_FUNC(strtok_r,
+[NO_STRTOK_R=],
+[NO_STRTOK_R=YesPlease])
+AC_SUBST(NO_STRTOK_R)
+#
 # Define NO_MEMMEM if you don't have memmem.
 GIT_CHECK_FUNC(memmem,
 [NO_MEMMEM=],
diff --git a/git-compat-util.h b/git-compat-util.h
index 02a73ee..28d6b00 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -312,6 +312,11 @@ extern size_t gitstrlcpy(char *, const char *, size_t);
 extern uintmax_t gitstrtoumax(const char *, char **, int);
 #endif
 
+#ifdef NO_STRTOK_R
+#define strtok_r gitstrtok_r
+extern char *gitstrtok_r(char *s, const char *delim, char **save_ptr);
+#endif
+
 #ifdef NO_HSTRERROR
 #define hstrerror githstrerror
 extern const char *githstrerror(int herror);
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 2/5] vcs-svn: Rename dirent pool to build on Windows
  2010-08-13 23:47       ` [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows Jonathan Nieder
  2010-08-13 23:59         ` [PATCH 1/5] compat: add strtok_r() Jonathan Nieder
@ 2010-08-14  0:01         ` Jonathan Nieder
  2010-08-14  0:03         ` [PATCH 3/5] vcs-svn: Avoid %z in format string Jonathan Nieder
                           ` (2 subsequent siblings)
  4 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-14  0:01 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Ramkumar Ramachandra, David Barr, Jakub Narebski

dirent is #define’d to mingw_dirent in compat/mingw.h, with the
result that

 obj_pool_gen(dirent, struct repo_dirent, 4096)

creates functions with names like mingw_dirent_alloc and
references to dirent_alloc go unresolved.  Rename the functions
to dent_* to avoid this problem.

Reported-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 vcs-svn/repo_tree.c |  146 +++++++++++++++++++++++++-------------------------
 1 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c
index c3d7ee7..e94d91d 100644
--- a/vcs-svn/repo_tree.c
+++ b/vcs-svn/repo_tree.c
@@ -30,7 +30,7 @@ struct repo_commit {
 /* Memory pools for commit, dir and dirent */
 obj_pool_gen(commit, struct repo_commit, 4096)
 obj_pool_gen(dir, struct repo_dir, 4096)
-obj_pool_gen(dirent, struct repo_dirent, 4096)
+obj_pool_gen(dent, struct repo_dirent, 4096)
 
 static uint32_t active_commit;
 static uint32_t mark;
@@ -38,7 +38,7 @@ static uint32_t mark;
 static int repo_dirent_name_cmp(const void *a, const void *b);
 
 /* Treap for directory entries */
-trp_gen(static, dirent_, struct repo_dirent, children, dirent, repo_dirent_name_cmp);
+trp_gen(static, dent_, struct repo_dirent, children, dent, repo_dirent_name_cmp);
 
 uint32_t next_blob_mark(void)
 {
@@ -52,27 +52,27 @@ static struct repo_dir *repo_commit_root_dir(struct repo_commit *commit)
 
 static struct repo_dirent *repo_first_dirent(struct repo_dir *dir)
 {
-	return dirent_first(&dir->entries);
+	return dent_first(&dir->entries);
 }
 
 static int repo_dirent_name_cmp(const void *a, const void *b)
 {
-	const struct repo_dirent *dirent1 = a, *dirent2 = b;
-	uint32_t a_offset = dirent1->name_offset;
-	uint32_t b_offset = dirent2->name_offset;
+	const struct repo_dirent *dent1 = a, *dent2 = b;
+	uint32_t a_offset = dent1->name_offset;
+	uint32_t b_offset = dent2->name_offset;
 	return (a_offset > b_offset) - (a_offset < b_offset);
 }
 
-static int repo_dirent_is_dir(struct repo_dirent *dirent)
+static int repo_dirent_is_dir(struct repo_dirent *dent)
 {
-	return dirent != NULL && dirent->mode == REPO_MODE_DIR;
+	return dent != NULL && dent->mode == REPO_MODE_DIR;
 }
 
-static struct repo_dir *repo_dir_from_dirent(struct repo_dirent *dirent)
+static struct repo_dir *repo_dir_from_dirent(struct repo_dirent *dent)
 {
-	if (!repo_dirent_is_dir(dirent))
+	if (!repo_dirent_is_dir(dent))
 		return NULL;
-	return dir_pointer(dirent->content_offset);
+	return dir_pointer(dent->content_offset);
 }
 
 static struct repo_dir *repo_clone_dir(struct repo_dir *orig_dir)
@@ -90,19 +90,19 @@ static struct repo_dir *repo_clone_dir(struct repo_dir *orig_dir)
 static struct repo_dirent *repo_read_dirent(uint32_t revision, uint32_t *path)
 {
 	uint32_t name = 0;
-	struct repo_dirent *key = dirent_pointer(dirent_alloc(1));
+	struct repo_dirent *key = dent_pointer(dent_alloc(1));
 	struct repo_dir *dir = NULL;
-	struct repo_dirent *dirent = NULL;
+	struct repo_dirent *dent = NULL;
 	dir = repo_commit_root_dir(commit_pointer(revision));
 	while (~(name = *path++)) {
 		key->name_offset = name;
-		dirent = dirent_search(&dir->entries, key);
-		if (dirent == NULL || !repo_dirent_is_dir(dirent))
+		dent = dent_search(&dir->entries, key);
+		if (dent == NULL || !repo_dirent_is_dir(dent))
 			break;
-		dir = repo_dir_from_dirent(dirent);
+		dir = repo_dir_from_dirent(dent);
 	}
-	dirent_free(1);
-	return dirent;
+	dent_free(1);
+	return dent;
 }
 
 static void repo_write_dirent(uint32_t *path, uint32_t mode,
@@ -111,7 +111,7 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode,
 	uint32_t name, revision, dir_o = ~0, parent_dir_o = ~0;
 	struct repo_dir *dir;
 	struct repo_dirent *key;
-	struct repo_dirent *dirent = NULL;
+	struct repo_dirent *dent = NULL;
 	revision = active_commit;
 	dir = repo_commit_root_dir(commit_pointer(revision));
 	dir = repo_clone_dir(dir);
@@ -119,52 +119,52 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode,
 	while (~(name = *path++)) {
 		parent_dir_o = dir_offset(dir);
 
-		key = dirent_pointer(dirent_alloc(1));
+		key = dent_pointer(dent_alloc(1));
 		key->name_offset = name;
 
-		dirent = dirent_search(&dir->entries, key);
-		if (dirent == NULL)
-			dirent = key;
+		dent = dent_search(&dir->entries, key);
+		if (dent == NULL)
+			dent = key;
 		else
-			dirent_free(1);
+			dent_free(1);
 
-		if (dirent == key) {
-			dirent->mode = REPO_MODE_DIR;
-			dirent->content_offset = 0;
-			dirent_insert(&dir->entries, dirent);
+		if (dent == key) {
+			dent->mode = REPO_MODE_DIR;
+			dent->content_offset = 0;
+			dent_insert(&dir->entries, dent);
 		}
 
-		if (dirent_offset(dirent) < dirent_pool.committed) {
-			dir_o = repo_dirent_is_dir(dirent) ?
-					dirent->content_offset : ~0;
-			dirent_remove(&dir->entries, dirent);
-			dirent = dirent_pointer(dirent_alloc(1));
-			dirent->name_offset = name;
-			dirent->mode = REPO_MODE_DIR;
-			dirent->content_offset = dir_o;
-			dirent_insert(&dir->entries, dirent);
+		if (dent_offset(dent) < dent_pool.committed) {
+			dir_o = repo_dirent_is_dir(dent) ?
+					dent->content_offset : ~0;
+			dent_remove(&dir->entries, dent);
+			dent = dent_pointer(dent_alloc(1));
+			dent->name_offset = name;
+			dent->mode = REPO_MODE_DIR;
+			dent->content_offset = dir_o;
+			dent_insert(&dir->entries, dent);
 		}
 
-		dir = repo_dir_from_dirent(dirent);
+		dir = repo_dir_from_dirent(dent);
 		dir = repo_clone_dir(dir);
-		dirent->content_offset = dir_offset(dir);
+		dent->content_offset = dir_offset(dir);
 	}
-	if (dirent == NULL)
+	if (dent == NULL)
 		return;
-	dirent->mode = mode;
-	dirent->content_offset = content_offset;
+	dent->mode = mode;
+	dent->content_offset = content_offset;
 	if (del && ~parent_dir_o)
-		dirent_remove(&dir_pointer(parent_dir_o)->entries, dirent);
+		dent_remove(&dir_pointer(parent_dir_o)->entries, dent);
 }
 
 uint32_t repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst)
 {
 	uint32_t mode = 0, content_offset = 0;
-	struct repo_dirent *src_dirent;
-	src_dirent = repo_read_dirent(revision, src);
-	if (src_dirent != NULL) {
-		mode = src_dirent->mode;
-		content_offset = src_dirent->content_offset;
+	struct repo_dirent *src_dent;
+	src_dent = repo_read_dirent(revision, src);
+	if (src_dent != NULL) {
+		mode = src_dent->mode;
+		content_offset = src_dent->content_offset;
 		repo_write_dirent(dst, mode, content_offset, 0);
 	}
 	return mode;
@@ -178,10 +178,10 @@ void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark)
 uint32_t repo_replace(uint32_t *path, uint32_t blob_mark)
 {
 	uint32_t mode = 0;
-	struct repo_dirent *src_dirent;
-	src_dirent = repo_read_dirent(active_commit, path);
-	if (src_dirent != NULL) {
-		mode = src_dirent->mode;
+	struct repo_dirent *src_dent;
+	src_dent = repo_read_dirent(active_commit, path);
+	if (src_dent != NULL) {
+		mode = src_dent->mode;
 		repo_write_dirent(path, mode, blob_mark, 0);
 	}
 	return mode;
@@ -189,10 +189,10 @@ uint32_t repo_replace(uint32_t *path, uint32_t blob_mark)
 
 void repo_modify(uint32_t *path, uint32_t mode, uint32_t blob_mark)
 {
-	struct repo_dirent *src_dirent;
-	src_dirent = repo_read_dirent(active_commit, path);
-	if (src_dirent != NULL && blob_mark == 0)
-		blob_mark = src_dirent->content_offset;
+	struct repo_dirent *src_dent;
+	src_dent = repo_read_dirent(active_commit, path);
+	if (src_dent != NULL && blob_mark == 0)
+		blob_mark = src_dent->content_offset;
 	repo_write_dirent(path, mode, blob_mark, 0);
 }
 
@@ -203,13 +203,13 @@ void repo_delete(uint32_t *path)
 
 static void repo_git_add_r(uint32_t depth, uint32_t *path, struct repo_dir *dir);
 
-static void repo_git_add(uint32_t depth, uint32_t *path, struct repo_dirent *dirent)
+static void repo_git_add(uint32_t depth, uint32_t *path, struct repo_dirent *dent)
 {
-	if (repo_dirent_is_dir(dirent))
-		repo_git_add_r(depth, path, repo_dir_from_dirent(dirent));
+	if (repo_dirent_is_dir(dent))
+		repo_git_add_r(depth, path, repo_dir_from_dirent(dent));
 	else
 		fast_export_modify(depth, path,
-				   dirent->mode, dirent->content_offset);
+				   dent->mode, dent->content_offset);
 }
 
 static void repo_git_add_r(uint32_t depth, uint32_t *path, struct repo_dir *dir)
@@ -218,7 +218,7 @@ static void repo_git_add_r(uint32_t depth, uint32_t *path, struct repo_dir *dir)
 	while (de) {
 		path[depth] = de->name_offset;
 		repo_git_add(depth + 1, path, de);
-		de = dirent_next(&dir->entries, de);
+		de = dent_next(&dir->entries, de);
 	}
 }
 
@@ -233,13 +233,13 @@ static void repo_diff_r(uint32_t depth, uint32_t *path, struct repo_dir *dir1,
 		if (de1->name_offset < de2->name_offset) {
 			path[depth] = de1->name_offset;
 			fast_export_delete(depth + 1, path);
-			de1 = dirent_next(&dir1->entries, de1);
+			de1 = dent_next(&dir1->entries, de1);
 			continue;
 		}
 		if (de1->name_offset > de2->name_offset) {
 			path[depth] = de2->name_offset;
 			repo_git_add(depth + 1, path, de2);
-			de2 = dirent_next(&dir2->entries, de2);
+			de2 = dent_next(&dir2->entries, de2);
 			continue;
 		}
 		path[depth] = de1->name_offset;
@@ -257,18 +257,18 @@ static void repo_diff_r(uint32_t depth, uint32_t *path, struct repo_dir *dir1,
 			fast_export_delete(depth + 1, path);
 			repo_git_add(depth + 1, path, de2);
 		}
-		de1 = dirent_next(&dir1->entries, de1);
-		de2 = dirent_next(&dir2->entries, de2);
+		de1 = dent_next(&dir1->entries, de1);
+		de2 = dent_next(&dir2->entries, de2);
 	}
 	while (de1) {
 		path[depth] = de1->name_offset;
 		fast_export_delete(depth + 1, path);
-		de1 = dirent_next(&dir1->entries, de1);
+		de1 = dent_next(&dir1->entries, de1);
 	}
 	while (de2) {
 		path[depth] = de2->name_offset;
 		repo_git_add(depth + 1, path, de2);
-		de2 = dirent_next(&dir2->entries, de2);
+		de2 = dent_next(&dir2->entries, de2);
 	}
 }
 
@@ -286,7 +286,7 @@ void repo_commit(uint32_t revision, uint32_t author, char *log, uint32_t uuid,
 		 uint32_t url, unsigned long timestamp)
 {
 	fast_export_commit(revision, author, log, uuid, url, timestamp);
-	dirent_commit();
+	dent_commit();
 	dir_commit();
 	active_commit = commit_alloc(1);
 	commit_pointer(active_commit)->root_dir_offset =
@@ -297,10 +297,10 @@ static void mark_init(void)
 {
 	uint32_t i;
 	mark = 0;
-	for (i = 0; i < dirent_pool.size; i++)
-		if (!repo_dirent_is_dir(dirent_pointer(i)) &&
-		    dirent_pointer(i)->content_offset > mark)
-			mark = dirent_pointer(i)->content_offset;
+	for (i = 0; i < dent_pool.size; i++)
+		if (!repo_dirent_is_dir(dent_pointer(i)) &&
+		    dent_pointer(i)->content_offset > mark)
+			mark = dent_pointer(i)->content_offset;
 	mark++;
 }
 
@@ -325,5 +325,5 @@ void repo_reset(void)
 	pool_reset();
 	commit_reset();
 	dir_reset();
-	dirent_reset();
+	dent_reset();
 }
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 3/5] vcs-svn: Avoid %z in format string
  2010-08-13 23:47       ` [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows Jonathan Nieder
  2010-08-13 23:59         ` [PATCH 1/5] compat: add strtok_r() Jonathan Nieder
  2010-08-14  0:01         ` [PATCH 2/5] vcs-svn: Rename dirent pool to build on Windows Jonathan Nieder
@ 2010-08-14  0:03         ` Jonathan Nieder
  2010-08-14  0:04         ` [PATCH 4/5] t9010 (svn-fe): use Unix-style path in URI Jonathan Nieder
  2010-08-14  0:06         ` [PATCH 5/5] t9010 (svn-fe): avoid symlinks in test Jonathan Nieder
  4 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-14  0:03 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Ramkumar Ramachandra, David Barr, Jakub Narebski

In the spirit of v1.6.4-rc0~124 (MinGW: Fix compiler warning in
merge-recursive, 2009-05-23), use a 32-bit integer instead; the
dump file parser does not support any better, anyway.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 vcs-svn/fast_export.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 3a6156f..256a052 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -48,8 +48,9 @@ void fast_export_commit(uint32_t revision, uint32_t author, char *log,
 		   ~author ? pool_fetch(author) : "nobody",
 		   ~author ? pool_fetch(author) : "nobody",
 		   ~uuid ? pool_fetch(uuid) : "local", timestamp);
-	printf("data %zd\n%s%s\n",
-		   strlen(log) + strlen(gitsvnline), log, gitsvnline);
+	printf("data %"PRIu32"\n%s%s\n",
+		   (uint32_t) (strlen(log) + strlen(gitsvnline)),
+		   log, gitsvnline);
 	if (!first_commit_done) {
 		if (revision > 1)
 			printf("from refs/heads/master^0\n");
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4/5] t9010 (svn-fe): use Unix-style path in URI
  2010-08-13 23:47       ` [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows Jonathan Nieder
                           ` (2 preceding siblings ...)
  2010-08-14  0:03         ` [PATCH 3/5] vcs-svn: Avoid %z in format string Jonathan Nieder
@ 2010-08-14  0:04         ` Jonathan Nieder
  2010-08-14  0:06         ` [PATCH 5/5] t9010 (svn-fe): avoid symlinks in test Jonathan Nieder
  4 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-14  0:04 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Ramkumar Ramachandra, David Barr, Jakub Narebski

Ever since v1.6.3-rc0~101^2~14 (Tests on Windows: $(pwd) must return
Windows-style paths, 2009-03-13), there is a subtle difference between
$(pwd) and $PWD in tests: the former returns Windows-style paths as
might be output by git and the latter Unix-style paths which msys
programs tend to prefer.

In file:// URIs, Unix-style paths are needed.  Before: “svn export”
declares it cannot find

 file://c:/apps/git/git/t/trash directory/simple-svco

After: “svn export” successfully finds

 file:///c/apps/git/git/...

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t9010-svn-fe.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh
index bf9bbd6..dd8e78e 100644
--- a/t/t9010-svn-fe.sh
+++ b/t/t9010-svn-fe.sh
@@ -10,7 +10,7 @@ test_dump() {
 	test_expect_success "$dump" '
 		svnadmin create "$label-svn" &&
 		svnadmin load "$label-svn" < "$TEST_DIRECTORY/$dump" &&
-		svn_cmd export "file://$(pwd)/$label-svn" "$label-svnco" &&
+		svn_cmd export "file://$PWD/$label-svn" "$label-svnco" &&
 		git init "$label-git" &&
 		test-svn-fe "$TEST_DIRECTORY/$dump" >"$label.fe" &&
 		(
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 5/5] t9010 (svn-fe): avoid symlinks in test
  2010-08-13 23:47       ` [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows Jonathan Nieder
                           ` (3 preceding siblings ...)
  2010-08-14  0:04         ` [PATCH 4/5] t9010 (svn-fe): use Unix-style path in URI Jonathan Nieder
@ 2010-08-14  0:06         ` Jonathan Nieder
  4 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-14  0:06 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Ramkumar Ramachandra, David Barr, Jakub Narebski

The svn-fe test fails on Windows in the “svn export” step because of
the lack of symlink support.  With a less ambitious dump, it passes.

Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t9010-svn-fe.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh
index dd8e78e..a713dfc 100644
--- a/t/t9010-svn-fe.sh
+++ b/t/t9010-svn-fe.sh
@@ -27,6 +27,6 @@ test_dump() {
 	'
 }
 
-test_dump simple t9111/svnsync.dump
+test_dump simple t9135/svn.dump
 
 test_done
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-13  1:01                   ` Ævar Arnfjörð Bjarmason
@ 2010-08-14  0:42                     ` Chris Packham
  2010-08-14  0:46                       ` Ævar Arnfjörð Bjarmason
  2010-08-15  0:54                       ` Tay Ray Chuan
  0 siblings, 2 replies; 56+ messages in thread
From: Chris Packham @ 2010-08-14  0:42 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Johannes Sixt, git, kusmabite

On 12/08/10 18:01, Ævar Arnfjörð Bjarmason wrote:
> If it comes with its own perl it should also have a cpan shell:
> 
>     perl -MCPAN -e 'install TAP::Harness::Archive'
> 
> That should be easier than installing strawberry in addition to the
> mingw perl.

OK this is me officially giving up on windows (or at least this
particular windows box).

I couldn't install any perl modules with the environment provided by
msysgit, I couldn't make msys play nice with strawberry perl. In
desperation I tried cygwin and again I failed to get any perl modules
installed (although it did get further than msys).

I think a major part of the problem is the way the box was setup by the
IT department at work. It has its home drive set to a network share
which both cygwin and msys pick up on. This seems to cause problems for
the CPAN module when it tries to download and build stuff there.

I'd like to be able to help, but I lack the windows knowledge to change
any of the setup that was made by the IT team. If I get my hands on
another windows box with a more standard install I'll give it another
try. For now, I'm admitting defeat.

-C

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-14  0:42                     ` Chris Packham
@ 2010-08-14  0:46                       ` Ævar Arnfjörð Bjarmason
  2010-08-15  0:54                       ` Tay Ray Chuan
  1 sibling, 0 replies; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-14  0:46 UTC (permalink / raw)
  To: Chris Packham; +Cc: Johannes Sixt, git, kusmabite

On Sat, Aug 14, 2010 at 00:42, Chris Packham <judge.packham@gmail.com> wrote:
> On 12/08/10 18:01, Ævar Arnfjörð Bjarmason wrote:
>> If it comes with its own perl it should also have a cpan shell:
>>
>>     perl -MCPAN -e 'install TAP::Harness::Archive'
>>
>> That should be easier than installing strawberry in addition to the
>> mingw perl.
>
> OK this is me officially giving up on windows (or at least this
> particular windows box).
>
> I couldn't install any perl modules with the environment provided by
> msysgit, I couldn't make msys play nice with strawberry perl. In
> desperation I tried cygwin and again I failed to get any perl modules
> installed (although it did get further than msys).
>
> I think a major part of the problem is the way the box was setup by the
> IT department at work. It has its home drive set to a network share
> which both cygwin and msys pick up on. This seems to cause problems for
> the CPAN module when it tries to download and build stuff there.
>
> I'd like to be able to help, but I lack the windows knowledge to change
> any of the setup that was made by the IT team. If I get my hands on
> another windows box with a more standard install I'll give it another
> try. For now, I'm admitting defeat.

Thanks for trying. But since you have perl (but not any modules) I
might try to just produce some self-contained script that smokers can
drop in that has the needed Perl parts.

Can you try this though:

    curl -L http://cpanmin.us | perl --self-upgrade -s

That should install cpanminus, then try to install the archive module.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-13 21:44     ` Johannes Sixt
@ 2010-08-14  2:27       ` Jonathan Nieder
  2010-08-14 18:37         ` Johannes Sixt
  0 siblings, 1 reply; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-14  2:27 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Greg Brockman, Ilari Liusvaara, Elijah Newren

Johannes Sixt wrote:
> Am 13.08.2010 00:40, schrieb Jonathan Nieder:

>> Would this work?
>>
>> -- 8<  --
>> Subject: t4135 (apply): filenames with tabs are not usable on NTFS
[...]
> No, it needs this squashed in

Ah, makes sense.  Here’s another rough patch.  Patch is against
jn/apply-filename-with-sp + ab/test.  Not signed off because I am not
sure about the licensing of expand.sed (and I would rather see some
other fix instead).

-- 8< --
Subject: t4135 (apply): tweaks for Windows

Filenames with tabs are not usable on NTFS, so mimic the code setting
up the FUNNYNAMES prerequisite from v1.3.0-rc1~67 (workaround fat/ntfs
deficiences for t3600-rm.sh, 2006-03-03) and use it.  The code is not
shared in test-lib.sh to avoid wasting time on that check while
running other tests.

Backslashes is the path separator on Windows, so it cannot be used
in filenames (see v1.6.3-rc0~93^2~6, t3700: Skip a test with
backslashes in pathspec, 2009-03-13).

Filenames starting with a quotation mark do not behave well in msys
(see v1.7.0-rc0~94^2, t4030, t4031: work around bogus MSYS bash path
conversion, 2010-01-01), so skip those tests on Windows.

“expand” is not available in msysgit.  Use a sed script by Greg Ubben
to replace it.

Reported-by: Johannes Sixt <j6t@kdbg.org>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Not-signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t4135-apply-weird-filenames.sh |   70 ++++++++++++++++++++++++++++++++------
 1 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index f4c7e15..08f8fe2 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -10,7 +10,7 @@ test_expect_success 'setup: empty commit' '
 	git tag preimage
 '
 
-test_expect_success 'setup: clean-up functions' '
+test_expect_success 'setup: helper functions' '
 	reset_preimage() {
 		git checkout -f preimage^0 &&
 		git read-tree -u --reset HEAD &&
@@ -20,6 +20,44 @@ test_expect_success 'setup: clean-up functions' '
 	reset_subdirs() {
 		rm -fr a b &&
 		mkdir a b
+	} &&
+
+	cat <<-\EOF >expand.sed &&
+	#! /bin/sed -f
+	#  @(#)14apr89/31aug01 expand.sed by Greg Ubben
+
+	/	/!b
+
+	# Change the text before a tab to
+	#   text<MARKER>text<TAB><8 blanks><TAB>
+	#
+	s/\([^	]*\)	/\1Q&        	/g
+
+	# Reduce the text between the marker and the tab to less
+	# than eight characters.  We have to put in 8-(length MOD 8)
+	# blanks, and this effectively does the modulo operation.
+	:a
+		s/Q[^	]\{8\}/Q/g
+	ta
+
+	# The buffer is now:
+	#   text<MARKER><(length MOD 8) characters><TAB><expansion><extra blanks><TAB>
+	#                -----------------------------------------
+	# Notice that the expansion is 8-(length MOD 8), so the
+	# underlined part is exactly nine characters.  That is how
+	# we discard the extra blanks and the tabs.
+	#
+	s/\(Q.\{9\}\) *	/\1/g
+
+	# We have now:
+	#         text<MARKER><(length MOD 8) characters><TAB><expansion>
+	#
+	# so we discard everything between the marker and the tab
+	#
+	s/Q[^	]*	//g
+	EOF
+	expand_tabs() {
+		sed -f "$TRASH_DIRECTORY/expand.sed" "$@"
 	}
 '
 
@@ -34,17 +72,25 @@ test_expect_success 'setup: test prerequisites' '
 	if diff -pruN 1 2
 	then
 		test_set_prereq FULLDIFF
+	fi &&
+
+	test_when_finished "rm -f \"tab	embedded.txt\"" &&
+	test_when_finished "rm -f '\''\"quoteembedded\".txt'\''" &&
+	if touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
+	then
+		test_set_prereq FUNNYNAMES
 	fi
 '
 
 try_filename() {
 	desc=$1
 	postimage=$2
-	exp1=${3:-success}
-	exp2=${4:-success}
-	exp3=${5:-success}
+	prereq=${3:-}
+	exp1=${4:-success}
+	exp2=${5:-success}
+	exp3=${6:-success}
 
-	test_expect_$exp1 "$desc, git-style file creation patch" "
+	test_expect_$exp1 $prereq "$desc, git-style file creation patch" "
 		reset_preimage &&
 		echo postimage >'$postimage' &&
 		git add -N '$postimage' &&
@@ -57,7 +103,8 @@ try_filename() {
 		test_cmp postimage.saved '$postimage'
 	"
 
-	test_expect_$exp2 UNIDIFF "$desc, traditional patch" "
+	test_expect_$exp2 ${prereq:+$prereq,}UNIDIFF \
+						"$desc, traditional patch" "
 		reset_preimage &&
 		echo preimage >'$postimage.orig' &&
 		echo postimage >'$postimage' &&
@@ -70,7 +117,8 @@ try_filename() {
 		test_cmp postimage.saved '$postimage'
 	"
 
-	test_expect_$exp3 FULLDIFF "$desc, traditional file creation patch" "
+	test_expect_$exp3 ${prereq:+$prereq,}FULLDIFF \
+				"$desc, traditional file creation patch" "
 		reset_preimage &&
 		reset_subdirs &&
 		echo postimage >b/'$postimage' &&
@@ -86,16 +134,16 @@ try_filename() {
 
 try_filename 'plain'            'postimage.txt'
 try_filename 'with spaces'      'post image.txt'
-try_filename 'with tab'         'post	image.txt'
-try_filename 'with backslash'   'post\image.txt'
-try_filename 'with quote'       '"postimage".txt' success failure success
+try_filename 'with tab'         'post	image.txt' FUNNYNAMES
+try_filename 'with backslash'   'post\image.txt' BSLASHPSPEC
+try_filename 'with quote'       '"postimage".txt' FUNNYNAMES success failure success
 
 test_expect_success FULLDIFF 'whitespace-damaged traditional patch' '
 	reset_preimage &&
 	reset_subdirs &&
 	echo postimage >b/postimage.txt &&
 	! diff -pruN a b >diff-plain.txt &&
-	expand diff-plain.txt >damaged.diff &&
+	expand_tabs diff-plain.txt >damaged.diff &&
 
 	mv postimage.txt postimage.saved &&
 	git apply -v damaged.diff &&
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-14  2:27       ` Jonathan Nieder
@ 2010-08-14 18:37         ` Johannes Sixt
  2010-08-15  0:05           ` Jonathan Nieder
  2010-08-19  1:45           ` [PATCH v2 0/3] apply: handle traditional patches with space in filename Jonathan Nieder
  0 siblings, 2 replies; 56+ messages in thread
From: Johannes Sixt @ 2010-08-14 18:37 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Junio C Hamano, git, Greg Brockman, Ilari Liusvaara, Elijah Newren

On Samstag, 14. August 2010, Jonathan Nieder wrote:
> @@ -20,6 +20,44 @@ test_expect_success 'setup: clean-up functions' '
>  	reset_subdirs() {
>  		rm -fr a b &&
>  		mkdir a b
> +	} &&
> +
> +	cat <<-\EOF >expand.sed &&
...

Why not just write an explicit test vector? The result of expand will be 
constant, no?

-- Hannes

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-14 18:37         ` Johannes Sixt
@ 2010-08-15  0:05           ` Jonathan Nieder
  2010-08-19  1:45           ` [PATCH v2 0/3] apply: handle traditional patches with space in filename Jonathan Nieder
  1 sibling, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-15  0:05 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Greg Brockman, Ilari Liusvaara, Elijah Newren

Johannes Sixt wrote:
> On Samstag, 14. August 2010, Jonathan Nieder wrote:

>> @@ -20,6 +20,44 @@ test_expect_success 'setup: clean-up functions' '
>>  	reset_subdirs() {
>>  		rm -fr a b &&
>>  		mkdir a b
>> +	} &&
>> +
>> +	cat <<-\EOF >expand.sed &&
> ...
> 
> Why not just write an explicit test vector? The result of expand will be 
> constant, no?

Yes, you’re right.  That’s the best way to go (especially since future
versions of GNU diff might handle special characters differently).

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-14  0:42                     ` Chris Packham
  2010-08-14  0:46                       ` Ævar Arnfjörð Bjarmason
@ 2010-08-15  0:54                       ` Tay Ray Chuan
  2010-08-15  1:08                         ` Ævar Arnfjörð Bjarmason
  1 sibling, 1 reply; 56+ messages in thread
From: Tay Ray Chuan @ 2010-08-15  0:54 UTC (permalink / raw)
  To: Chris Packham
  Cc: Ævar Arnfjörð Bjarmason, Johannes Sixt, git, kusmabite

Hi,

On Sat, Aug 14, 2010 at 8:42 AM, Chris Packham <judge.packham@gmail.com> wrote:
> I couldn't install any perl modules with the environment provided by
> msysgit, I couldn't make msys play nice with strawberry perl. In
> desperation I tried cygwin
> [snip]

I've tried it out on cygwin, check out report #30:

  http://smoke.git.nix.is/app/projects/report_details/30

A lot of stuff was skipped though - python, http.

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-15  0:54                       ` Tay Ray Chuan
@ 2010-08-15  1:08                         ` Ævar Arnfjörð Bjarmason
  2010-08-15 17:39                           ` Tay Ray Chuan
  0 siblings, 1 reply; 56+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-15  1:08 UTC (permalink / raw)
  To: Tay Ray Chuan; +Cc: Chris Packham, Johannes Sixt, git, kusmabite

On Sun, Aug 15, 2010 at 00:54, Tay Ray Chuan <rctay89@gmail.com> wrote:
> Hi,
>
> On Sat, Aug 14, 2010 at 8:42 AM, Chris Packham <judge.packham@gmail.com> wrote:
>> I couldn't install any perl modules with the environment provided by
>> msysgit, I couldn't make msys play nice with strawberry perl. In
>> desperation I tried cygwin
>> [snip]
>
> I've tried it out on cygwin, check out report #30:
>
>  http://smoke.git.nix.is/app/projects/report_details/30
>
> A lot of stuff was skipped though - python, http.

Thanks, there's a bunch of failures though. Do those usually fail on
your Cygwin setup? I haven't looked at them in any detail.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11))
  2010-08-15  1:08                         ` Ævar Arnfjörð Bjarmason
@ 2010-08-15 17:39                           ` Tay Ray Chuan
  0 siblings, 0 replies; 56+ messages in thread
From: Tay Ray Chuan @ 2010-08-15 17:39 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Chris Packham, Johannes Sixt, git, kusmabite

On Sun, Aug 15, 2010 at 9:08 AM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> Thanks, there's a bunch of failures though. Do those usually fail on
> your Cygwin setup? I haven't looked at them in any detail.

Sorry, can't tell you much, as this is absolutely the first time I'm
running *all* the tests. Usually, I only run those that are likely to
be affected by the parts I hack.

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH v2 0/3] apply: handle traditional patches with space in filename
  2010-08-14 18:37         ` Johannes Sixt
  2010-08-15  0:05           ` Jonathan Nieder
@ 2010-08-19  1:45           ` Jonathan Nieder
  2010-08-19  1:46             ` [PATCH 1/3] apply: split quoted filename handling into new function Jonathan Nieder
                               ` (3 more replies)
  1 sibling, 4 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-19  1:45 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Sixt, git, Greg Brockman, Ilari Liusvaara,
	Elijah Newren, Andreas Schwab

Johannes Sixt wrote:

> Why not just write an explicit test vector? The result of expand will be 
> constant, no?

Sorry for the long delay.  Here's a re-roll, meant to replace
jn/apply-filename-with-sp from pu.

Patch 1 fixes an edge case for git apply -p when traditional patches
have quotation marks in file names (so: an edge case of an edge).
But that is only a side-effect; the main purpose is to rearrange
code to prepare for patch 3.  Except for the commit message, it is
unchanged from the version in pu.

Patch 2 contains the funny-filenames tests.  Testing on Windows would
be welcome.  The test vectors are included in the patch to avoid a
source of non-determinism (for example, GNU diff could stop emiting
traditional patches some day).  The script used to generate them is
provided to make the test easy to change.

Patch 3 is basically as before, except that find_name_traditional()
calls find_name_common() directly now instead of redundantly checking
again for quotes at the beginning of filenames.  As before, the
purpose is to handle patches to files with whitespace in their
names, by trying to use the timestamp instead of arbitrary whitespace
as a name terminator (falling back to the old method if that fails).

Thanks for your help so far.  The code would be much worse without it.

Jonathan Nieder (3):
  apply: split quoted filename handling into new function
  tests: exercise "git apply" with weird filenames
  apply: handle traditional patches with space in filename

 builtin/apply.c                  |  251 ++++++++++++++++++++++++++++++++------
 t/t4120-apply-popt.sh            |   35 +++++-
 t/t4135-apply-weird-filenames.sh |   75 +++++++++++
 t/t4135/.gitignore               |    3 +
 t/t4135/add-plain.diff           |    5 +
 t/t4135/add-with backslash.diff  |    5 +
 t/t4135/add-with quote.diff      |    5 +
 t/t4135/add-with spaces.diff     |    5 +
 t/t4135/add-with tab.diff        |    5 +
 t/t4135/damaged.diff             |    5 +
 t/t4135/diff-plain.diff          |    5 +
 t/t4135/diff-with backslash.diff |    5 +
 t/t4135/diff-with quote.diff     |    5 +
 t/t4135/diff-with spaces.diff    |    5 +
 t/t4135/diff-with tab.diff       |    5 +
 t/t4135/git-plain.diff           |    7 +
 t/t4135/git-with backslash.diff  |    7 +
 t/t4135/git-with quote.diff      |    7 +
 t/t4135/git-with spaces.diff     |    7 +
 t/t4135/git-with tab.diff        |    7 +
 t/t4135/make-patches             |   45 +++++++
 21 files changed, 457 insertions(+), 42 deletions(-)
 create mode 100755 t/t4135-apply-weird-filenames.sh
 create mode 100644 t/t4135/.gitignore
 create mode 100644 t/t4135/add-plain.diff
 create mode 100644 t/t4135/add-with backslash.diff
 create mode 100644 t/t4135/add-with quote.diff
 create mode 100644 t/t4135/add-with spaces.diff
 create mode 100644 t/t4135/add-with tab.diff
 create mode 100644 t/t4135/damaged.diff
 create mode 100644 t/t4135/diff-plain.diff
 create mode 100644 t/t4135/diff-with backslash.diff
 create mode 100644 t/t4135/diff-with quote.diff
 create mode 100644 t/t4135/diff-with spaces.diff
 create mode 100644 t/t4135/diff-with tab.diff
 create mode 100644 t/t4135/git-plain.diff
 create mode 100644 t/t4135/git-with backslash.diff
 create mode 100644 t/t4135/git-with quote.diff
 create mode 100644 t/t4135/git-with spaces.diff
 create mode 100644 t/t4135/git-with tab.diff
 create mode 100755 t/t4135/make-patches

-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 1/3] apply: split quoted filename handling into new function
  2010-08-19  1:45           ` [PATCH v2 0/3] apply: handle traditional patches with space in filename Jonathan Nieder
@ 2010-08-19  1:46             ` Jonathan Nieder
  2010-08-19  1:48             ` [PATCH 2/3] tests: exercise "git apply" with weird filenames Jonathan Nieder
                               ` (2 subsequent siblings)
  3 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-19  1:46 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Sixt, git, Greg Brockman, Ilari Liusvaara,
	Elijah Newren, Andreas Schwab

The new find_name_gnu() function handles new-style '--- "a/foo"'
patch header lines, leaving find_name() itself a bit less
daunting.

Functional change: do not clobber the p-value when there are not
enough path components in a quoted file name to honor it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 builtin/apply.c       |   70 +++++++++++++++++++++++++++---------------------
 t/t4120-apply-popt.sh |   35 ++++++++++++++++++++++--
 2 files changed, 71 insertions(+), 34 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 12ef9ea..efc109e 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -416,44 +416,52 @@ static char *squash_slash(char *name)
 	return name;
 }
 
+static char *find_name_gnu(const char *line, char *def, int p_value)
+{
+	struct strbuf name = STRBUF_INIT;
+	char *cp;
+
+	/*
+	 * Proposed "new-style" GNU patch/diff format; see
+	 * http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2
+	 */
+	if (unquote_c_style(&name, line, NULL)) {
+		strbuf_release(&name);
+		return NULL;
+	}
+
+	for (cp = name.buf; p_value; p_value--) {
+		cp = strchr(cp, '/');
+		if (!cp) {
+			strbuf_release(&name);
+			return NULL;
+		}
+		cp++;
+	}
+
+	/* name can later be freed, so we need
+	 * to memmove, not just return cp
+	 */
+	strbuf_remove(&name, 0, cp - name.buf);
+	free(def);
+	if (root)
+		strbuf_insert(&name, 0, root, root_len);
+	return squash_slash(strbuf_detach(&name, NULL));
+}
+
 static char *find_name(const char *line, char *def, int p_value, int terminate)
 {
 	int len;
 	const char *start = NULL;
 
+	if (*line == '"') {
+		char *name = find_name_gnu(line, def, p_value);
+		if (name)
+			return name;
+	}
+
 	if (p_value == 0)
 		start = line;
-
-	if (*line == '"') {
-		struct strbuf name = STRBUF_INIT;
-
-		/*
-		 * Proposed "new-style" GNU patch/diff format; see
-		 * http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2
-		 */
-		if (!unquote_c_style(&name, line, NULL)) {
-			char *cp;
-
-			for (cp = name.buf; p_value; p_value--) {
-				cp = strchr(cp, '/');
-				if (!cp)
-					break;
-				cp++;
-			}
-			if (cp) {
-				/* name can later be freed, so we need
-				 * to memmove, not just return cp
-				 */
-				strbuf_remove(&name, 0, cp - name.buf);
-				free(def);
-				if (root)
-					strbuf_insert(&name, 0, root, root_len);
-				return squash_slash(strbuf_detach(&name, NULL));
-			}
-		}
-		strbuf_release(&name);
-	}
-
 	for (;;) {
 		char c = *line;
 
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
index b463b4f..2b2d00b 100755
--- a/t/t4120-apply-popt.sh
+++ b/t/t4120-apply-popt.sh
@@ -10,21 +10,50 @@ test_description='git apply -p handling.'
 test_expect_success setup '
 	mkdir sub &&
 	echo A >sub/file1 &&
-	cp sub/file1 file1 &&
+	cp sub/file1 file1.saved &&
 	git add sub/file1 &&
 	echo B >sub/file1 &&
 	git diff >patch.file &&
-	rm sub/file1 &&
-	rmdir sub
+	git checkout -- sub/file1 &&
+	git mv sub süb &&
+	echo B >süb/file1 &&
+	git diff >patch.escaped &&
+	grep "[\]" patch.escaped &&
+	rm süb/file1 &&
+	rmdir süb
 '
 
 test_expect_success 'apply git diff with -p2' '
+	cp file1.saved file1 &&
 	git apply -p2 patch.file
 '
 
 test_expect_success 'apply with too large -p' '
+	cp file1.saved file1 &&
 	test_must_fail git apply --stat -p3 patch.file 2>err &&
 	grep "removing 3 leading" err
 '
 
+test_expect_success 'apply (-p2) traditional diff with funny filenames' '
+	cat >patch.quotes <<-\EOF &&
+	diff -u "a/"sub/file1 "b/"sub/file1
+	--- "a/"sub/file1
+	+++ "b/"sub/file1
+	@@ -1 +1 @@
+	-A
+	+B
+	EOF
+	echo B >expected &&
+
+	cp file1.saved file1 &&
+	git apply -p2 patch.quotes &&
+	test_cmp expected file1
+'
+
+test_expect_success 'apply with too large -p and fancy filename' '
+	cp file1.saved file1 &&
+	test_must_fail git apply --stat -p3 patch.escaped 2>err &&
+	grep "removing 3 leading" err
+'
+
 test_done
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 2/3] tests: exercise "git apply" with weird filenames
  2010-08-19  1:45           ` [PATCH v2 0/3] apply: handle traditional patches with space in filename Jonathan Nieder
  2010-08-19  1:46             ` [PATCH 1/3] apply: split quoted filename handling into new function Jonathan Nieder
@ 2010-08-19  1:48             ` Jonathan Nieder
  2010-08-19  1:50             ` [PATCH 3/3] apply: handle traditional patches with space in filename Jonathan Nieder
  2010-08-19 19:56             ` [PATCH v2 0/3] " Johannes Sixt
  3 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-19  1:48 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Sixt, git, Greg Brockman, Ilari Liusvaara,
	Elijah Newren, Andreas Schwab

Check that "git apply" can cope with strange filenames, particularly
filenames with spaces.

Not all platforms have a sane enough diff -u and expand to
reliably create the such patches and maybe future versions of GNU
diff will handle funny characters differently, so this uses
pre-generated patches.  The script used to generate them is in
t/t4135/make-patches.

Filenames with tabs are not usable on NTFS; use something like the
FUNNYNAMES prerequisite from v1.3.0-rc1~67 (2006-03-03) to skip the
relevant tests when appropriate.  The detection is not shared in
test-lib.sh to avoid wasting time while running other test scripts.

Backslash is the path separator on Windows, so do not used it in
file names there (v1.6.3-rc0~93^2~6, 2009-03-13).

Finally, filenames starting with a quotation mark do not behave well
in msys (see v1.7.0-rc0~94^2, t4030, t4031: work around bogus MSYS
bash path conversion, 2010-01-01), so skip those tests on Windows,
too.

Helped-by: Andreas Schwab <schwab@linux-m68k.org>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t4135-apply-weird-filenames.sh |   75 ++++++++++++++++++++++++++++++++++++++
 t/t4135/.gitignore               |    3 ++
 t/t4135/add-plain.diff           |    5 +++
 t/t4135/add-with backslash.diff  |    5 +++
 t/t4135/add-with quote.diff      |    5 +++
 t/t4135/add-with spaces.diff     |    5 +++
 t/t4135/add-with tab.diff        |    5 +++
 t/t4135/damaged.diff             |    5 +++
 t/t4135/diff-plain.diff          |    5 +++
 t/t4135/diff-with backslash.diff |    5 +++
 t/t4135/diff-with quote.diff     |    5 +++
 t/t4135/diff-with spaces.diff    |    5 +++
 t/t4135/diff-with tab.diff       |    5 +++
 t/t4135/git-plain.diff           |    7 ++++
 t/t4135/git-with backslash.diff  |    7 ++++
 t/t4135/git-with quote.diff      |    7 ++++
 t/t4135/git-with spaces.diff     |    7 ++++
 t/t4135/git-with tab.diff        |    7 ++++
 t/t4135/make-patches             |   45 +++++++++++++++++++++++
 19 files changed, 213 insertions(+), 0 deletions(-)
 create mode 100755 t/t4135-apply-weird-filenames.sh
 create mode 100644 t/t4135/.gitignore
 create mode 100644 t/t4135/add-plain.diff
 create mode 100644 t/t4135/add-with backslash.diff
 create mode 100644 t/t4135/add-with quote.diff
 create mode 100644 t/t4135/add-with spaces.diff
 create mode 100644 t/t4135/add-with tab.diff
 create mode 100644 t/t4135/damaged.diff
 create mode 100644 t/t4135/diff-plain.diff
 create mode 100644 t/t4135/diff-with backslash.diff
 create mode 100644 t/t4135/diff-with quote.diff
 create mode 100644 t/t4135/diff-with spaces.diff
 create mode 100644 t/t4135/diff-with tab.diff
 create mode 100644 t/t4135/git-plain.diff
 create mode 100644 t/t4135/git-with backslash.diff
 create mode 100644 t/t4135/git-with quote.diff
 create mode 100644 t/t4135/git-with spaces.diff
 create mode 100644 t/t4135/git-with tab.diff
 create mode 100755 t/t4135/make-patches

diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
new file mode 100755
index 0000000..9373f64
--- /dev/null
+++ b/t/t4135-apply-weird-filenames.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+test_description='git apply with weird postimage filenames'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	vector=$TEST_DIRECTORY/t4135 &&
+
+	test_tick &&
+	git commit --allow-empty -m preimage &&
+	git tag preimage &&
+
+	reset_preimage() {
+		git checkout -f preimage^0 &&
+		git read-tree -u --reset HEAD &&
+		git update-index --refresh
+	} &&
+
+	test_when_finished "rm -f \"tab	embedded.txt\"" &&
+	test_when_finished "rm -f '\''\"quoteembedded\".txt'\''" &&
+	if touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
+	then
+		test_set_prereq FUNNYNAMES
+	fi
+'
+
+try_filename() {
+	desc=$1
+	postimage=$2
+	prereq=${3:-}
+	exp1=${4:-success}
+	exp2=${5:-success}
+	exp3=${6:-success}
+
+	test_expect_$exp1 $prereq "$desc, git-style file creation patch" "
+		echo postimage >expected &&
+		reset_preimage &&
+		rm -f '$postimage' &&
+		git apply -v \"\$vector\"/'git-$desc.diff' &&
+		test_cmp expected '$postimage'
+	"
+
+	test_expect_$exp2 $prereq "$desc, traditional patch" "
+		echo postimage >expected &&
+		reset_preimage &&
+		echo preimage >'$postimage' &&
+		git apply -v \"\$vector\"/'diff-$desc.diff' &&
+		test_cmp expected '$postimage'
+	"
+
+	test_expect_$exp3 $prereq "$desc, traditional file creation patch" "
+		echo postimage >expected &&
+		reset_preimage &&
+		rm -f '$postimage' &&
+		git apply -v \"\$vector\"/'add-$desc.diff' &&
+		test_cmp expected '$postimage'
+	"
+}
+
+try_filename 'plain'            'postimage.txt'
+try_filename 'with spaces'      'post image.txt' '' success failure failure
+try_filename 'with tab'         'post	image.txt' FUNNYNAMES success failure failure
+try_filename 'with backslash'   'post\image.txt' BSLASHPSPEC
+try_filename 'with quote'       '"postimage".txt' FUNNYNAMES success failure success
+
+test_expect_success 'whitespace-damaged traditional patch' '
+	echo postimage >expected &&
+	reset_preimage &&
+	rm -f postimage.txt &&
+	git apply -v "$vector/damaged.diff" &&
+	test_cmp expected postimage.txt
+'
+
+test_done
diff --git a/t/t4135/.gitignore b/t/t4135/.gitignore
new file mode 100644
index 0000000..3e58e65
--- /dev/null
+++ b/t/t4135/.gitignore
@@ -0,0 +1,3 @@
+/file-creation/
+/trad-creation/
+/trad-modification/
diff --git a/t/t4135/add-plain.diff b/t/t4135/add-plain.diff
new file mode 100644
index 0000000..cf5970a
--- /dev/null
+++ b/t/t4135/add-plain.diff
@@ -0,0 +1,5 @@
+diff -pruN a/postimage.txt b/postimage.txt
+--- a/postimage.txt	1969-12-31 18:00:00.000000000 -0600
++++ b/postimage.txt	2010-08-18 20:13:31.484002255 -0500
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/add-with backslash.diff b/t/t4135/add-with backslash.diff
new file mode 100644
index 0000000..c6861e1
--- /dev/null
+++ b/t/t4135/add-with backslash.diff	
@@ -0,0 +1,5 @@
+diff -pruN a/post\image.txt b/post\image.txt
+--- a/post\image.txt	1969-12-31 18:00:00.000000000 -0600
++++ b/post\image.txt	2010-08-18 20:13:31.692002255 -0500
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/add-with quote.diff b/t/t4135/add-with quote.diff
new file mode 100644
index 0000000..866de78
--- /dev/null
+++ b/t/t4135/add-with quote.diff	
@@ -0,0 +1,5 @@
+diff -pruN a/"postimage".txt b/"postimage".txt
+--- a/"postimage".txt	1969-12-31 18:00:00.000000000 -0600
++++ b/"postimage".txt	2010-08-18 20:13:31.756002255 -0500
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/add-with spaces.diff b/t/t4135/add-with spaces.diff
new file mode 100644
index 0000000..a9a1212
--- /dev/null
+++ b/t/t4135/add-with spaces.diff	
@@ -0,0 +1,5 @@
+diff -pruN a/post image.txt b/post image.txt
+--- a/post image.txt	1969-12-31 18:00:00.000000000 -0600
++++ b/post image.txt	2010-08-18 20:13:31.556002255 -0500
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/add-with tab.diff b/t/t4135/add-with tab.diff
new file mode 100644
index 0000000..bb67cb7
--- /dev/null
+++ b/t/t4135/add-with tab.diff	
@@ -0,0 +1,5 @@
+diff -pruN a/post	image.txt b/post	image.txt
+--- a/post	image.txt	1969-12-31 18:00:00.000000000 -0600
++++ b/post	image.txt	2010-08-18 20:13:31.628002255 -0500
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/damaged.diff b/t/t4135/damaged.diff
new file mode 100644
index 0000000..68f7ede
--- /dev/null
+++ b/t/t4135/damaged.diff
@@ -0,0 +1,5 @@
+diff -pruN a/postimage.txt b/postimage.txt
+--- a/postimage.txt     1969-12-31 18:00:00.000000000 -0600
++++ b/postimage.txt     2010-08-18 20:13:31.484002255 -0500
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/diff-plain.diff b/t/t4135/diff-plain.diff
new file mode 100644
index 0000000..acedcfa
--- /dev/null
+++ b/t/t4135/diff-plain.diff
@@ -0,0 +1,5 @@
+--- postimage.txt.orig	2010-08-18 20:13:31.432002255 -0500
++++ postimage.txt	2010-08-18 20:13:31.432002255 -0500
+@@ -1 +1 @@
+-preimage
++postimage
diff --git a/t/t4135/diff-with backslash.diff b/t/t4135/diff-with backslash.diff
new file mode 100644
index 0000000..9068a61
--- /dev/null
+++ b/t/t4135/diff-with backslash.diff	
@@ -0,0 +1,5 @@
+--- post\image.txt.orig	2010-08-18 20:13:31.680002255 -0500
++++ post\image.txt	2010-08-18 20:13:31.680002255 -0500
+@@ -1 +1 @@
+-preimage
++postimage
diff --git a/t/t4135/diff-with quote.diff b/t/t4135/diff-with quote.diff
new file mode 100644
index 0000000..c8e8cc1
--- /dev/null
+++ b/t/t4135/diff-with quote.diff	
@@ -0,0 +1,5 @@
+--- "postimage".txt.orig	2010-08-18 20:13:31.744002255 -0500
++++ "postimage".txt	2010-08-18 20:13:31.744002255 -0500
+@@ -1 +1 @@
+-preimage
++postimage
diff --git a/t/t4135/diff-with spaces.diff b/t/t4135/diff-with spaces.diff
new file mode 100644
index 0000000..3512056
--- /dev/null
+++ b/t/t4135/diff-with spaces.diff	
@@ -0,0 +1,5 @@
+--- post image.txt.orig	2010-08-18 20:13:31.544002255 -0500
++++ post image.txt	2010-08-18 20:13:31.544002255 -0500
+@@ -1 +1 @@
+-preimage
++postimage
diff --git a/t/t4135/diff-with tab.diff b/t/t4135/diff-with tab.diff
new file mode 100644
index 0000000..4e6d9b2
--- /dev/null
+++ b/t/t4135/diff-with tab.diff	
@@ -0,0 +1,5 @@
+--- post	image.txt.orig	2010-08-18 20:13:31.616002255 -0500
++++ post	image.txt	2010-08-18 20:13:31.616002255 -0500
+@@ -1 +1 @@
+-preimage
++postimage
diff --git a/t/t4135/git-plain.diff b/t/t4135/git-plain.diff
new file mode 100644
index 0000000..db47d1a
--- /dev/null
+++ b/t/t4135/git-plain.diff
@@ -0,0 +1,7 @@
+diff --git a/postimage.txt b/postimage.txt
+new file mode 100644
+index 0000000..eff0c54
+--- /dev/null
++++ b/postimage.txt
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/git-with backslash.diff b/t/t4135/git-with backslash.diff
new file mode 100644
index 0000000..0e84a10
--- /dev/null
+++ b/t/t4135/git-with backslash.diff	
@@ -0,0 +1,7 @@
+diff --git "a/post\\image.txt" "b/post\\image.txt"
+new file mode 100644
+index 0000000..eff0c54
+--- /dev/null
++++ "b/post\\image.txt"
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/git-with quote.diff b/t/t4135/git-with quote.diff
new file mode 100644
index 0000000..bdbea8a
--- /dev/null
+++ b/t/t4135/git-with quote.diff	
@@ -0,0 +1,7 @@
+diff --git "a/\"postimage\".txt" "b/\"postimage\".txt"
+new file mode 100644
+index 0000000..eff0c54
+--- /dev/null
++++ "b/\"postimage\".txt"
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/git-with spaces.diff b/t/t4135/git-with spaces.diff
new file mode 100644
index 0000000..baaa810
--- /dev/null
+++ b/t/t4135/git-with spaces.diff	
@@ -0,0 +1,7 @@
+diff --git a/post image.txt b/post image.txt
+new file mode 100644
+index 0000000..eff0c54
+--- /dev/null
++++ b/post image.txt	
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/git-with tab.diff b/t/t4135/git-with tab.diff
new file mode 100644
index 0000000..cca3c92
--- /dev/null
+++ b/t/t4135/git-with tab.diff	
@@ -0,0 +1,7 @@
+diff --git "a/post\timage.txt" "b/post\timage.txt"
+new file mode 100644
+index 0000000..eff0c54
+--- /dev/null
++++ "b/post\timage.txt"
+@@ -0,0 +1 @@
++postimage
diff --git a/t/t4135/make-patches b/t/t4135/make-patches
new file mode 100755
index 0000000..f5f45dd
--- /dev/null
+++ b/t/t4135/make-patches
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+do_filename() {
+	desc=$1
+	postimage=$2
+
+	rm -fr file-creation &&
+	git init file-creation &&
+	(
+		cd file-creation &&
+		git commit --allow-empty -m init &&
+		echo postimage >"$postimage" &&
+		git add -N "$postimage" &&
+		git diff HEAD >"../git-$desc.diff"
+	) &&
+
+	rm -fr trad-modification &&
+	mkdir trad-modification &&
+	(
+		cd trad-modification &&
+		echo preimage >"$postimage.orig" &&
+		echo postimage >"$postimage" &&
+		! diff -u "$postimage.orig" "$postimage" >"../diff-$desc.diff"
+	) &&
+
+	rm -fr trad-creation &&
+	mkdir trad-creation &&
+	(
+		cd trad-creation &&
+		mkdir a b &&
+		echo postimage >"b/$postimage" &&
+		! diff -pruN a b >"../add-$desc.diff"
+	)
+}
+
+do_filename plain postimage.txt &&
+do_filename 'with spaces' 'post image.txt' &&
+do_filename 'with tab' 'post	image.txt' &&
+do_filename 'with backslash' 'post\image.txt' &&
+do_filename 'with quote' '"postimage".txt' &&
+expand add-plain.diff >damaged.diff ||
+{
+	echo >&2 Failed. &&
+	exit 1
+}
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 3/3] apply: handle traditional patches with space in filename
  2010-08-19  1:45           ` [PATCH v2 0/3] apply: handle traditional patches with space in filename Jonathan Nieder
  2010-08-19  1:46             ` [PATCH 1/3] apply: split quoted filename handling into new function Jonathan Nieder
  2010-08-19  1:48             ` [PATCH 2/3] tests: exercise "git apply" with weird filenames Jonathan Nieder
@ 2010-08-19  1:50             ` Jonathan Nieder
  2010-08-19 19:56             ` [PATCH v2 0/3] " Johannes Sixt
  3 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-19  1:50 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Johannes Sixt, git, Greg Brockman, Ilari Liusvaara,
	Elijah Newren, Andreas Schwab

To discover filenames from the --- and +++ lines in a traditional
unified diff, currently "git apply" scans forward for a whitespace
character on each line and stops there.  It can't use the whole line
because "diff -u" likes to include timestamps, like so:

 --- foo	2000-07-12 16:56:50.020000414 -0500
 +++ bar	2010-07-12 16:56:50.020000414 -0500

The whitespace-seeking heuristic works great, even when the tab
has been converted to spaces by some email + copy-and-paste
related corruption.

Except for one problem: if the filename itself contains whitespace,
the inferred filename will be too short.

When Giuseppe ran into this problem, it was for a file creation
patch (for debian/licenses/LICENSE.global BSD-style Chromium).
So one can't use the list of files present in the index to deduce an
appropriate filename (not to mention that way lies madness; see
v0.99~402, 2005-05-31).

Instead, look for a timestamp and use that if present to mark the end
of the filename.  If no timestamp is present, the old heuristic is
used, with one exception: the space character \040 is not considered
terminating whitespace any more unless it is followed by a timestamp.

Reported-by: Giuseppe Iuculano <iuculano@debian.org>
Acked-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Thanks for the helpful advice and patience at my use of it.

 builtin/apply.c                  |  193 +++++++++++++++++++++++++++++++++++---
 t/t4135-apply-weird-filenames.sh |    4 +-
 2 files changed, 181 insertions(+), 16 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index efc109e..bd2fcb3 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -449,23 +449,157 @@ static char *find_name_gnu(const char *line, char *def, int p_value)
 	return squash_slash(strbuf_detach(&name, NULL));
 }
 
-static char *find_name(const char *line, char *def, int p_value, int terminate)
+static size_t tz_len(const char *line, size_t len)
+{
+	const char *tz, *p;
+
+	if (len < strlen(" +0500") || line[len-strlen(" +0500")] != ' ')
+		return 0;
+	tz = line + len - strlen(" +0500");
+
+	if (tz[1] != '+' && tz[1] != '-')
+		return 0;
+
+	for (p = tz + 2; p != line + len; p++)
+		if (!isdigit(*p))
+			return 0;
+
+	return line + len - tz;
+}
+
+static size_t date_len(const char *line, size_t len)
+{
+	const char *date, *p;
+
+	if (len < strlen("72-02-05") || line[len-strlen("-05")] != '-')
+		return 0;
+	p = date = line + len - strlen("72-02-05");
+
+	if (!isdigit(*p++) || !isdigit(*p++) || *p++ != '-' ||
+	    !isdigit(*p++) || !isdigit(*p++) || *p++ != '-' ||
+	    !isdigit(*p++) || !isdigit(*p++))	/* Not a date. */
+		return 0;
+
+	if (date - line >= strlen("19") &&
+	    isdigit(date[-1]) && isdigit(date[-2]))	/* 4-digit year */
+		date -= strlen("19");
+
+	return line + len - date;
+}
+
+static size_t short_time_len(const char *line, size_t len)
+{
+	const char *time, *p;
+
+	if (len < strlen(" 07:01:32") || line[len-strlen(":32")] != ':')
+		return 0;
+	p = time = line + len - strlen(" 07:01:32");
+
+	/* Permit 1-digit hours? */
+	if (*p++ != ' ' ||
+	    !isdigit(*p++) || !isdigit(*p++) || *p++ != ':' ||
+	    !isdigit(*p++) || !isdigit(*p++) || *p++ != ':' ||
+	    !isdigit(*p++) || !isdigit(*p++))	/* Not a time. */
+		return 0;
+
+	return line + len - time;
+}
+
+static size_t fractional_time_len(const char *line, size_t len)
+{
+	const char *p;
+	size_t n;
+
+	/* Expected format: 19:41:17.620000023 */
+	if (!len || !isdigit(line[len - 1]))
+		return 0;
+	p = line + len - 1;
+
+	/* Fractional seconds. */
+	while (p > line && isdigit(*p))
+		p--;
+	if (*p != '.')
+		return 0;
+
+	/* Hours, minutes, and whole seconds. */
+	n = short_time_len(line, p - line);
+	if (!n)
+		return 0;
+
+	return line + len - p + n;
+}
+
+static size_t trailing_spaces_len(const char *line, size_t len)
+{
+	const char *p;
+
+	/* Expected format: ' ' x (1 or more)  */
+	if (!len || line[len - 1] != ' ')
+		return 0;
+
+	p = line + len;
+	while (p != line) {
+		p--;
+		if (*p != ' ')
+			return line + len - (p + 1);
+	}
+
+	/* All spaces! */
+	return len;
+}
+
+static size_t diff_timestamp_len(const char *line, size_t len)
+{
+	const char *end = line + len;
+	size_t n;
+
+	/*
+	 * Posix: 2010-07-05 19:41:17
+	 * GNU: 2010-07-05 19:41:17.620000023 -0500
+	 */
+
+	if (!isdigit(end[-1]))
+		return 0;
+
+	n = tz_len(line, end - line);
+	end -= n;
+
+	n = short_time_len(line, end - line);
+	if (!n)
+		n = fractional_time_len(line, end - line);
+	end -= n;
+
+	n = date_len(line, end - line);
+	if (!n)	/* No date.  Too bad. */
+		return 0;
+	end -= n;
+
+	if (end == line)	/* No space before date. */
+		return 0;
+	if (end[-1] == '\t') {	/* Success! */
+		end--;
+		return line + len - end;
+	}
+	if (end[-1] != ' ')	/* No space before date. */
+		return 0;
+
+	/* Whitespace damage. */
+	end -= trailing_spaces_len(line, end - line);
+	return line + len - end;
+}
+
+static char *find_name_common(const char *line, char *def, int p_value,
+				const char *end, int terminate)
 {
 	int len;
 	const char *start = NULL;
 
-	if (*line == '"') {
-		char *name = find_name_gnu(line, def, p_value);
-		if (name)
-			return name;
-	}
-
 	if (p_value == 0)
 		start = line;
-	for (;;) {
+	while (line != end) {
 		char c = *line;
 
-		if (isspace(c)) {
+		if (!end && isspace(c)) {
 			if (c == '\n')
 				break;
 			if (name_terminate(start, line-start, c, terminate))
@@ -505,6 +639,37 @@ static char *find_name(const char *line, char *def, int p_value, int terminate)
 	return squash_slash(xmemdupz(start, len));
 }
 
+static char *find_name(const char *line, char *def, int p_value, int terminate)
+{
+	if (*line == '"') {
+		char *name = find_name_gnu(line, def, p_value);
+		if (name)
+			return name;
+	}
+
+	return find_name_common(line, def, p_value, NULL, terminate);
+}
+
+static char *find_name_traditional(const char *line, char *def, int p_value)
+{
+	size_t len = strlen(line);
+	size_t date_len;
+
+	if (*line == '"') {
+		char *name = find_name_gnu(line, def, p_value);
+		if (name)
+			return name;
+	}
+
+	len = strchrnul(line, '\n') - line;
+	date_len = diff_timestamp_len(line, len);
+	if (!date_len)
+		return find_name_common(line, def, p_value, NULL, TERM_TAB);
+	len -= date_len;
+
+	return find_name_common(line, def, p_value, line + len, 0);
+}
+
 static int count_slashes(const char *cp)
 {
 	int cnt = 0;
@@ -527,7 +692,7 @@ static int guess_p_value(const char *nameline)
 
 	if (is_dev_null(nameline))
 		return -1;
-	name = find_name(nameline, NULL, 0, TERM_SPACE | TERM_TAB);
+	name = find_name_traditional(nameline, NULL, 0);
 	if (!name)
 		return -1;
 	cp = strchr(name, '/');
@@ -646,16 +811,16 @@ static void parse_traditional_patch(const char *first, const char *second, struc
 	if (is_dev_null(first)) {
 		patch->is_new = 1;
 		patch->is_delete = 0;
-		name = find_name(second, NULL, p_value, TERM_SPACE | TERM_TAB);
+		name = find_name_traditional(second, NULL, p_value);
 		patch->new_name = name;
 	} else if (is_dev_null(second)) {
 		patch->is_new = 0;
 		patch->is_delete = 1;
-		name = find_name(first, NULL, p_value, TERM_SPACE | TERM_TAB);
+		name = find_name_traditional(first, NULL, p_value);
 		patch->old_name = name;
 	} else {
-		name = find_name(first, NULL, p_value, TERM_SPACE | TERM_TAB);
-		name = find_name(second, name, p_value, TERM_SPACE | TERM_TAB);
+		name = find_name_traditional(first, NULL, p_value);
+		name = find_name_traditional(second, name, p_value);
 		if (has_epoch_timestamp(first)) {
 			patch->is_new = 1;
 			patch->is_delete = 0;
diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index 9373f64..1e5aad5 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -59,8 +59,8 @@ try_filename() {
 }
 
 try_filename 'plain'            'postimage.txt'
-try_filename 'with spaces'      'post image.txt' '' success failure failure
-try_filename 'with tab'         'post	image.txt' FUNNYNAMES success failure failure
+try_filename 'with spaces'      'post image.txt'
+try_filename 'with tab'         'post	image.txt' FUNNYNAMES
 try_filename 'with backslash'   'post\image.txt' BSLASHPSPEC
 try_filename 'with quote'       '"postimage".txt' FUNNYNAMES success failure success
 
-- 
1.7.2.1.544.ga752d.dirty

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [PATCH v2 0/3] apply: handle traditional patches with space in filename
  2010-08-19  1:45           ` [PATCH v2 0/3] apply: handle traditional patches with space in filename Jonathan Nieder
                               ` (2 preceding siblings ...)
  2010-08-19  1:50             ` [PATCH 3/3] apply: handle traditional patches with space in filename Jonathan Nieder
@ 2010-08-19 19:56             ` Johannes Sixt
  2010-08-20  6:26               ` Jonathan Nieder
  3 siblings, 1 reply; 56+ messages in thread
From: Johannes Sixt @ 2010-08-19 19:56 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Junio C Hamano, git, Greg Brockman, Ilari Liusvaara,
	Elijah Newren, Andreas Schwab

On Donnerstag, 19. August 2010, Jonathan Nieder wrote:
> Patch 2 contains the funny-filenames tests.  Testing on Windows would
> be welcome.

The series passes the test suite on Windows.

-- Hannes

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH v2 0/3] apply: handle traditional patches with space in filename
  2010-08-19 19:56             ` [PATCH v2 0/3] " Johannes Sixt
@ 2010-08-20  6:26               ` Jonathan Nieder
  0 siblings, 0 replies; 56+ messages in thread
From: Jonathan Nieder @ 2010-08-20  6:26 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Junio C Hamano, git, Greg Brockman, Ilari Liusvaara,
	Elijah Newren, Andreas Schwab

Johannes Sixt wrote:

> The series passes the test suite on Windows.

That was fast.  Thanks for checking.

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2010-08-20  6:28 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-11 23:35 What's cooking in git.git (Aug 2010, #02; Wed, 11) Junio C Hamano
2010-08-12  1:41 ` Jonathan Nieder
2010-08-12  2:33   ` Ævar Arnfjörð Bjarmason
2010-08-12  3:15     ` jn/commit-no-change-wo-status (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
2010-08-12  5:47 ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Elijah Newren
2010-08-12 15:49   ` Junio C Hamano
2010-08-12 21:12     ` Elijah Newren
2010-08-12  9:23 ` Johannes Sixt
2010-08-12  9:37   ` Greg Brockman
2010-08-12 10:11     ` Ævar Arnfjörð Bjarmason
2010-08-12 22:08     ` Junio C Hamano
2010-08-12 22:13       ` Greg Brockman
2010-08-12 22:19       ` Junio C Hamano
2010-08-12 10:20   ` Ævar Arnfjörð Bjarmason
2010-08-12 11:35     ` Erik Faye-Lund
2010-08-12 16:50       ` Ævar Arnfjörð Bjarmason
2010-08-12 17:34         ` Chris Packham
2010-08-12 18:35           ` Ævar Arnfjörð Bjarmason
2010-08-12 22:19             ` windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Chris Packham
2010-08-12 22:29               ` Ævar Arnfjörð Bjarmason
2010-08-12 22:58                 ` Chris Packham
2010-08-13  1:01                   ` Ævar Arnfjörð Bjarmason
2010-08-14  0:42                     ` Chris Packham
2010-08-14  0:46                       ` Ævar Arnfjörð Bjarmason
2010-08-15  0:54                       ` Tay Ray Chuan
2010-08-15  1:08                         ` Ævar Arnfjörð Bjarmason
2010-08-15 17:39                           ` Tay Ray Chuan
2010-08-12 10:21   ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Ilari Liusvaara
2010-08-12 10:31     ` Johannes Sixt
2010-08-12 15:25       ` Ilari Liusvaara
2010-08-12 12:43   ` Elijah Newren
2010-08-12 22:21     ` Junio C Hamano
2010-08-12 21:58   ` Junio C Hamano
2010-08-12 22:40   ` jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
2010-08-12 22:46     ` Ævar Arnfjörð Bjarmason
2010-08-12 23:17     ` Junio C Hamano
2010-08-13  0:59       ` Ævar Arnfjörð Bjarmason
2010-08-13 21:44     ` Johannes Sixt
2010-08-14  2:27       ` Jonathan Nieder
2010-08-14 18:37         ` Johannes Sixt
2010-08-15  0:05           ` Jonathan Nieder
2010-08-19  1:45           ` [PATCH v2 0/3] apply: handle traditional patches with space in filename Jonathan Nieder
2010-08-19  1:46             ` [PATCH 1/3] apply: split quoted filename handling into new function Jonathan Nieder
2010-08-19  1:48             ` [PATCH 2/3] tests: exercise "git apply" with weird filenames Jonathan Nieder
2010-08-19  1:50             ` [PATCH 3/3] apply: handle traditional patches with space in filename Jonathan Nieder
2010-08-19 19:56             ` [PATCH v2 0/3] " Johannes Sixt
2010-08-20  6:26               ` Jonathan Nieder
2010-08-13  0:08   ` jn/svn-fe Jonathan Nieder
2010-08-13 10:18     ` jn/svn-fe Jakub Narebski
2010-08-13 21:33     ` jn/svn-fe Johannes Sixt
2010-08-13 23:47       ` [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows Jonathan Nieder
2010-08-13 23:59         ` [PATCH 1/5] compat: add strtok_r() Jonathan Nieder
2010-08-14  0:01         ` [PATCH 2/5] vcs-svn: Rename dirent pool to build on Windows Jonathan Nieder
2010-08-14  0:03         ` [PATCH 3/5] vcs-svn: Avoid %z in format string Jonathan Nieder
2010-08-14  0:04         ` [PATCH 4/5] t9010 (svn-fe): use Unix-style path in URI Jonathan Nieder
2010-08-14  0:06         ` [PATCH 5/5] t9010 (svn-fe): avoid symlinks in test Jonathan Nieder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.