THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

Git 2.23-rc2

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4fA2sf7nIh/HeOzvsLXohpav5ssFAl1NqkwACgkQsLXohpav
 5ssjXQ//VsqRnuVu947TP0x/3vJzAuLSsTW1qE4kJUNQbRCRz64ejSiKiVlfDtpb
 yk4rWbdnVVVCZwCUCNp421SAKWVWuFvEDhqd6JMe69DF1MqOwdn7gVleRiVa59Sv
 2aVMzCO0FcRwUxuSkHogExJp94z2kyzL6EdAVYyalU8InR54cBML+in+gqtWToXE
 7gGzAyu6g2Dv7/Wx2laohm05xppvbgsnrGqZvMhoYR1rl5pf9LlERvS/CjNl4FBc
 mFqhJYgYjjvWfVPmv7WSce1JxlGd/AdDK0eMl6rnorHwSfDbeNsmvDT5a62YioQ7
 9eC2/2woRom5T56NuEwobMYhpEG7ttlZDHEDg0YULSW7gbaNJdEoYJ78T0p7yQL3
 HIljlg2H+l/I2wxeiMDg50oLCIWptT8d0E9TkEX89UkLq8Lc0XQeA7oxIM8HpjQy
 n/Zx7sfDE4DVd7mFZb9UmzvHpzwXKl1NEy9a2/Mb7gRIUwO1DEHL8ATjar+j3AbO
 uh3vOShC4u1Ya1vUOY7wRbmxfxIGIRiqRHtEmx60j1GCSDQMl71fTyO/QnAi71KH
 CNzBRWauiyuJqwXQfzhZzXKLBDjfufoPudVHlWm0UC5oY3MXuLv9jUH6JAoaRP1U
 46gauPfLinOeB0XQ4Uo3xbHJ6j2e91BLt2TzyQMMz0n6upGM9QE=
 =hE45
 -----END PGP SIGNATURE-----

Merge tag 'v2.23.0-rc2' of git://git.kernel.org/pub/scm/git/git

Git 2.23-rc2

* tag 'v2.23.0-rc2' of git://git.kernel.org/pub/scm/git/git: (63 commits)
  Git 2.23-rc2
  t0000: reword comments for "local" test
  t: decrease nesting in test_oid_to_path
  sha1-file: release strbuf after use
  test-dir-iterator: use path argument directly
  dir-iterator: release strbuf after use
  commit-graph: release strbufs after use
  l10n: reformat some localized strings for v2.23.0
  merge-recursive: avoid directory rename detection in recursive case
  commit-graph: fix bug around octopus merges
  restore: fix typo in docs
  doc: typo: s/can not/cannot/ and s/is does/does/
  Git 2.23-rc1
  log: really flip the --mailmap default
  RelNotes/2.23.0: fix a few typos and other minor issues
  RelNotes/2.21.1: typofix
  log: flip the --mailmap default unconditionally
  config: work around bug with includeif:onbranch and early config
  A few more last-minute fixes
  repack: simplify handling of auto-bitmaps and .keep files
  ...
tags/v2.23.0
Jiang Xin 6 months ago
parent
commit
d6d5cbfe87
59 changed files with 1041 additions and 396 deletions
  1. +6
    -2
      .gitignore
  2. +1
    -1
      Documentation/RelNotes/2.22.1.txt
  3. +13
    -75
      Documentation/RelNotes/2.23.0.txt
  4. +1
    -1
      Documentation/config/log.txt
  5. +1
    -1
      Documentation/config/transfer.txt
  6. +1
    -1
      Documentation/git-cvsserver.txt
  7. +2
    -2
      Documentation/git-fetch.txt
  8. +5
    -0
      Documentation/git-fsck.txt
  9. +1
    -1
      Documentation/git-pull.txt
  10. +1
    -1
      Documentation/git-restore.txt
  11. +1
    -1
      Documentation/glossary-content.txt
  12. +1
    -1
      Documentation/technical/api-ref-iteration.txt
  13. +1
    -1
      GIT-VERSION-GEN
  14. +1
    -1
      Makefile
  15. +1
    -1
      builtin/checkout.c
  16. +11
    -4
      builtin/fetch.c
  17. +2
    -19
      builtin/log.c
  18. +16
    -5
      builtin/pack-objects.c
  19. +7
    -17
      builtin/repack.c
  20. +0
    -1
      builtin/verify-commit.c
  21. +0
    -1
      builtin/verify-tag.c
  22. +8
    -6
      commit-graph.c
  23. +23
    -0
      compat/vcbuild/README
  24. +2
    -1
      config.c
  25. +76
    -0
      config.mak.uname
  26. +1
    -1
      contrib/buildsystems/Generators.pm
  27. +36
    -83
      contrib/buildsystems/Generators/Vcproj.pm
  28. +388
    -0
      contrib/buildsystems/Generators/Vcxproj.pm
  29. +45
    -10
      contrib/buildsystems/engine.pl
  30. +0
    -3
      git.c
  31. +2
    -1
      merge-recursive.c
  32. +3
    -1
      refs/files-backend.c
  33. +1
    -0
      sha1-file.c
  34. +11
    -4
      t/helper/test-dir-iterator.c
  35. +6
    -8
      t/t0000-basic.sh
  36. +36
    -22
      t/t0011-hashmap.sh
  37. +19
    -11
      t/t0016-oidmap.sh
  38. +4
    -2
      t/t0027-auto-crlf.sh
  39. +2
    -2
      t/t0066-dir-iterator.sh
  40. +2
    -2
      t/t0090-cache-tree.sh
  41. +32
    -26
      t/t1007-hash-object.sh
  42. +5
    -0
      t/t1309-early-config.sh
  43. +8
    -8
      t/t1410-reflog.sh
  44. +25
    -16
      t/t1450-fsck.sh
  45. +34
    -17
      t/t1700-split-index.sh
  46. +4
    -2
      t/t2203-add-intent.sh
  47. +33
    -0
      t/t4203-mailmap.sh
  48. +11
    -5
      t/t5000-tar-tree.sh
  49. +0
    -0
      t/t5000/huge-object
  50. +3
    -1
      t/t5324-split-commit-graph.sh
  51. +16
    -15
      t/t6030-bisect-porcelain.sh
  52. +111
    -0
      t/t6043-merge-rename-directories.sh
  53. +0
    -2
      t/t7006-pager.sh
  54. +14
    -1
      t/t7700-repack.sh
  55. +7
    -0
      t/test-lib-functions.sh
  56. +0
    -1
      wt-status.h
  57. +0
    -2
      xdiff/xhistogram.c
  58. +0
    -2
      xdiff/xpatience.c
  59. +0
    -4
      xdiff/xutils.c

+ 6
- 2
.gitignore View File

@@ -231,6 +231,10 @@
*.ipdb
*.dll
.vs/
/Debug/
/Release/
*.manifest
Debug/
Release/
/UpgradeLog*.htm
/git.VC.VC.opendb
/git.VC.db
*.dSYM

+ 1
- 1
Documentation/RelNotes/2.22.1.txt View File

@@ -94,7 +94,7 @@ Fixes since v2.22

* The configuration variable rebase.rescheduleFailedExec should be
effective only while running an interactive rebase and should not
affect anything when running an non-interactive one, which was not
affect anything when running a non-interactive one, which was not
the case. This has been corrected.

* "git submodule foreach" did not protect command line options passed


+ 13
- 75
Documentation/RelNotes/2.23.0.txt View File

@@ -10,6 +10,9 @@ Backward compatibility note
prerequisite patches in an unstable way, which has been updated to
compute in a way that is compatible with "git patch-id --stable".

* The "git log" command by default behaves as if the --mailmap option
was given.


UI, Workflows & Features

@@ -52,7 +55,7 @@ UI, Workflows & Features

* "git fetch" and "git pull" reports when a fetch results in
non-fast-forward updates to let the user notice unusual situation.
The commands learned "--no-shown-forced-updates" option to disable
The commands learned "--no-show-forced-updates" option to disable
this safety feature.

* Two new commands "git switch" and "git restore" are introduced to
@@ -68,7 +71,7 @@ UI, Workflows & Features
* The conditional inclusion mechanism learned to base the choice on
the branch the HEAD currently is on.

* "git rev-list --objects" learned with "--no-object-names" option to
* "git rev-list --objects" learned the "--no-object-names" option to
squelch the path to the object that is used as a grouping hint for
pack-objects.

@@ -91,11 +94,6 @@ UI, Workflows & Features
commit-graph files now, which allows the commit-graph files to be
updated incrementally.

* The "git log" command learns to issue a warning when log.mailmap
configuration is not set and --[no-]mailmap option is not used, to
prepare users for future versions of Git that uses the mailmap by
default.

* "git range-diff" output has been tweaked for easier identification
of which part of what file the patch shown is about.

@@ -106,7 +104,7 @@ Performance, Internal Implementation, Development Support etc.
no longer be used.

* Developer support to emulate unsatisfied prerequisites in tests to
ensure that the remainer of the tests still succeeds when tests
ensure that the remainder of the tests still succeeds when tests
with prerequisites are skipped.

* "git update-server-info" learned not to rewrite the file with the
@@ -121,7 +119,7 @@ Performance, Internal Implementation, Development Support etc.
* Prepare use of reachability index in topological walker that works
on a range (A..B).

* A new tutorial targetting specifically aspiring git-core
* A new tutorial targeting specifically aspiring git-core
developers has been added.

* Auto-detect how to tell HP-UX aCC where to use dynamically linked
@@ -163,7 +161,6 @@ Performance, Internal Implementation, Development Support etc.
* We have been trying out a few language features outside c89; the
coding guidelines document did not talk about them and instead had
a blanket ban against them.
(merge cc0c42975a jc/post-c89-rules-doc later to maint).

* A test helper has been introduced to optimize preparation of test
repositories with many simple commits, and a handful of test
@@ -177,16 +174,13 @@ Fixes since v2.22
ought to be relative to the directory "git init" gets invoked in,
but it instead was made relative to the repository, which has been
corrected.
(merge e1df7fe43f nd/init-relative-template-fix later to maint).

* "git worktree add" used to fail when another worktree connected to
the same repository was corrupt, which has been corrected.
(merge 105df73e71 nd/corrupt-worktrees later to maint).

* The ownership rule for the file descriptor to fast-import remote
backend was mixed up, leading to unrelated file descriptor getting
backend was mixed up, leading to an unrelated file descriptor getting
closed, which has been fixed.
(merge 3203566a71 mh/import-transport-fd-fix later to maint).

* A "merge -c" instruction during "git rebase --rebase-merges" should
give the user a chance to edit the log message, even when there is
@@ -195,82 +189,65 @@ Fixes since v2.22
corrected.

* Code cleanup and futureproof.
(merge 31f5256c82 ds/object-info-for-prefetch-fix later to maint).

* More parameter validation.
(merge de99eb0c24 es/grep-require-name-when-needed later to maint).

* "git update-server-info" used to leave stale packfiles in its
output, which has been corrected.
(merge e941c48d49 ew/server-info-remove-crufts later to maint).

* The server side support for "git fetch" used to show incorrect
value for the HEAD symbolic ref when the namespace feature is in
use, which has been corrected.
(merge 533e088250 jk/HEAD-symref-in-xfer-namespaces later to maint).

* "git am -i --resolved" segfaulted after trying to see a commit as
if it were a tree, which has been corrected.
(merge 7663e438c5 jk/am-i-resolved-fix later to maint).

* "git bundle verify" needs to see if prerequisite objects exist in
the receiving repository, but the command did not check if we are
in a repository upfront, which has been corrected.
(merge 3bbbe467f2 js/bundle-verify-require-object-store later to maint).

* "git merge --squash" is designed to update the working tree and the
index without creating the commit, and this cannot be countermanded
by adding the "--commit" option; the command now refuses to work
when both options are given.
(merge 1d14d0c994 vv/merge-squash-with-explicit-commit later to maint).

* The data collected by fsmonitor was not properly written back to
the on-disk index file, breaking t7519 tests occasionally, which
has been corrected.
(merge b5a8169752 js/fsmonitor-unflake later to maint).

* Update to Unicode 12.1 width table.
(merge 5817f9caa3 bb/unicode-12.1-reiwa later to maint).

* The command line to invoke a "git cat-file" command from inside
"git p4" was not properly quoted to protect a caret and running a
broken command on Windows, which has been corrected.
(merge c3f2358de3 mm/p4-unshelve-windows-fix later to maint).

* "git request-pull" learned to warn when the ref we ask them to pull
from in the local repository and in the published repository are
different.
(merge 0454220d66 pb/request-pull-verify-remote-ref later to maint).

* When creating a partial clone, the object filtering criteria is
recorded for the origin of the clone, but this incorrectly used a
hardcoded name "origin" to name that remote; it has been corrected
to honor the "--origin <name>" option.
(merge 1c4a9f9114 xl/record-partial-clone-origin later to maint).

* "git fetch" into a lazy clone forgot to fetch base objects that are
necessary to complete delta in a thin packfile, which has been
corrected.
(merge 810e19322d jt/partial-clone-missing-ref-delta-base later to maint).

* The filter_data used in the list-objects-filter (which manages a
lazily sparse clone repository) did not use the dynamic array API
correctly---'nr' is supposed to point at one past the last element
of the array in use. This has been corrected.
(merge 7140600e2e md/list-objects-filter-memfix later to maint).

* The description about slashes in gitignore patterns (used to
indicate things like "anchored to this level only" and "only
matches directories") has been revamped.
(merge 1a58bad014 an/ignore-doc-update later to maint).

* The URL decoding code has been updated to avoid going past the end
of the string while parsing %-<hex>-<hex> sequence.
(merge d37dc239a4 md/url-parse-harden later to maint).

* The list of for-each like macros used by clang-format has been
updated.
(merge fc7e03aace mo/clang-format-for-each-update later to maint).

* "git branch --list" learned to show branches that are checked out
in other worktrees connected to the same repository prefixed with
@@ -280,48 +257,38 @@ Fixes since v2.22

* Code restructuring during 2.20 period broke fetching tags via
"import" based transports.
(merge f80d922355 fc/fetch-with-import-fix later to maint).

* The commit-graph file is now part of the "files that the runtime
may keep open file descriptors on, all of which would need to be
closed when done with the object store", and the file descriptor to
an existing commit-graph file now is closed before "gc" finalizes a
new instance to replace it.
(merge 2d511cfc0b ds/close-object-store later to maint).

* "git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.
(merge 2bd69b9024 pw/add-p-recount later to maint).

* Code clean-up to avoid signed integer wraparounds during binary search.
(merge 568a05c5ec rs/avoid-overflow-in-midpoint-computation later to maint).

* "git interpret-trailers" always treated '#' as the comment
character, regardless of core.commentChar setting, which has been
corrected.
(merge 29c83fc23f jk/trailers-use-config later to maint).

* "git stash show 23" used to work, but no more after getting
rewritten in C; this regression has been corrected.
(merge 63b50c8ffe tg/stash-ref-by-index-fix later to maint).

* "git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.
(merge d559f502c5 pw/rebase-abort-clean-rewritten later to maint).

* An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.
(merge 69702523af nd/completion-no-cache-failure later to maint).

* The code to parse scaled numbers out of configuration files has
been made more robust and also easier to follow.
(merge 39c575c969 rs/config-unit-parsing later to maint).

* The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.
(merge bdbdf42f8a jk/delta-islands-progress-fix later to maint).

* Protocol capabilities that go over wire should never be translated,
but it was incorrectly marked for translation, which has been
@@ -330,23 +297,19 @@ Fixes since v2.22

* Use "Erase in Line" CSI sequence that is already used in the editor
support to clear cruft in the progress output.
(merge 5b12e3123b sg/rebase-progress later to maint).

* "git submodule foreach" did not protect command line options passed
to the command to be run in each submodule correctly, when the
"--recursive" option was in use.
(merge 30db18b148 ms/submodule-foreach-fix later to maint).

* The configuration variable rebase.rescheduleFailedExec should be
effective only while running an interactive rebase and should not
affect anything when running an non-interactive one, which was not
affect anything when running a non-interactive one, which was not
the case. This has been corrected.
(merge 906b63942a js/rebase-reschedule-applies-only-to-interactive later to maint).

* The "git clone" documentation refers to command line options in its
description in the short form; they have been replaced with long
forms to make them more recognisable.
(merge bfc8c84ed5 qn/clone-doc-use-long-form later to maint).

* Generation of pack bitmaps are now disabled when .keep files exist,
as these are mutually exclusive features.
@@ -355,56 +318,31 @@ Fixes since v2.22
* "git rm" to resolve a conflicted path leaked an internal message
"needs merge" before actually removing the path, which was
confusing. This has been corrected.
(merge b2b1f615ce jc/denoise-rm-to-resolve later to maint).

* "git stash --keep-index" did not work correctly on paths that have
been removed, which has been fixed.
(merge b932f6a5e8 tg/stash-keep-index-with-removed-paths later to maint).

* Window 7 update ;-)
(merge eb7c786314 js/mingw-spawn-with-spaces-in-path later to maint).

* A codepath that reads from GPG for signed object verification read
past the end of allocated buffer, which has been fixed.
(merge 64c45dc72e sr/gpg-interface-stop-at-the-end later to maint).

* "git clean" silently skipped a path when it cannot lstat() it; now
it gives a warning.
(merge b09364c47a js/clean-report-too-long-a-path later to maint).

* "git push --atomic" that goes over the transport-helper (namely,
the smart http transport) failed to prevent refs to be pushed when
it can locally tell that one of the ref update will fail without
having to consult the other end, which has been corrected.
(merge 2581ea3d31 es/local-atomic-push-failure-with-http later to maint).

* The internal diff machinery can be made to read out of bounds while
looking for --funcion-context line in a corner case, which has been
looking for --function-context line in a corner case, which has been
corrected.
(merge b777f3fd61 jk/xdiff-clamp-funcname-context-index later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge f547101b26 es/git-debugger-doc later to maint).
(merge 7877ac3d7b js/bisect-helper-check-get-oid-return-value later to maint).
(merge 0108f47eb3 sw/git-p4-unshelve-branched-files later to maint).
(merge 9df8f734fd cm/send-email-document-req-modules later to maint).
(merge afc3bf6eb1 ab/hash-object-doc later to maint).
(merge 1fde99cfc7 po/doc-branch later to maint).
(merge 459842e1c2 dl/config-alias-doc later to maint).
(merge 5d137fc2c7 cb/fsmonitor-intfix later to maint).
(merge 921d49be86 rs/copy-array later to maint).
(merge cc8d872e69 js/t3404-typofix later to maint).
(merge 729a9b558b cb/mkstemps-uint-type-fix later to maint).
(merge 9dae4fe79f js/gcc-8-and-9 later to maint).
(merge ed33bd8f30 js/t0001-case-insensitive later to maint).
(merge dfa880e336 jw/gitweb-sample-update later to maint).
(merge e532a90a9f sg/t5551-fetch-smart-error-is-translated later to maint).
(merge 8d45ad8c29 jt/t5551-test-chunked later to maint).
(merge 1a64e07d23 sg/git-C-empty-doc later to maint).
(merge 37a2e35395 sg/ci-brew-gcc-workaround later to maint).
(merge 24df0d49c4 js/trace2-signo-typofix later to maint).
(merge fbec05c210 cc/test-oidmap later to maint).
(merge 7926cee904 di/readme-markup-fix later to maint).
(merge 02638d1e11 vn/xmmap-gently later to maint).
(merge f7bf24d4dd rm/gpg-program-doc-fix later to maint).
(merge 3aef54e8b8 js/unmap-before-ext-diff later to maint).
(merge 7a06fb038c jk/no-system-includes-in-dot-c later to maint).
(merge 81ed2b405c cb/xdiff-no-system-includes-in-dot-c later to maint).
(merge d61e6ce1dd sg/fsck-config-in-doc later to maint).

+ 1
- 1
Documentation/config/log.txt View File

@@ -41,4 +41,4 @@ log.showSignature::
log.mailmap::
If true, makes linkgit:git-log[1], linkgit:git-show[1], and
linkgit:git-whatchanged[1] assume `--use-mailmap`, otherwise
assume `--no-use-mailmap`. False by default.
assume `--no-use-mailmap`. True by default.

+ 1
- 1
Documentation/config/transfer.txt View File

@@ -17,7 +17,7 @@ linkgit:git-receive-pack[1]. On the fetch side, malformed objects will
instead be left unreferenced in the repository.
+
Due to the non-quarantine nature of the `fetch.fsckObjects`
implementation it can not be relied upon to leave the object store
implementation it cannot be relied upon to leave the object store
clean like `receive.fsckObjects` can.
+
As objects are unpacked they're written to the object store, so there


+ 1
- 1
Documentation/git-cvsserver.txt View File

@@ -232,7 +232,7 @@ write so it might not be enough to grant the users using
'git-cvsserver' write access to the database file without granting
them write access to the directory, too.

The database can not be reliably regenerated in a
The database cannot be reliably regenerated in a
consistent form after the branch it is tracking has changed.
Example: For merged branches, 'git-cvsserver' only tracks
one branch of development, and after a 'git merge' an


+ 2
- 2
Documentation/git-fetch.txt View File

@@ -262,7 +262,7 @@ This updates (or creates, as necessary) branches `pu` and `tmp` in
the local repository by fetching from the branches (respectively)
`pu` and `maint` from the remote repository.
+
The `pu` branch will be updated even if it is does not fast-forward,
The `pu` branch will be updated even if it does not fast-forward,
because it is prefixed with a plus sign; `tmp` will not be.

* Peek at a remote's branch, without configuring the remote in your local
@@ -285,7 +285,7 @@ BUGS
----
Using --recurse-submodules can only fetch new commits in already checked
out submodules right now. When e.g. upstream added a new submodule in the
just fetched commits of the superproject the submodule itself can not be
just fetched commits of the superproject the submodule itself cannot be
fetched, making it impossible to check out that submodule later without
having to do a fetch again. This is expected to be fixed in a future Git
version.


+ 5
- 0
Documentation/git-fsck.txt View File

@@ -104,6 +104,11 @@ care about this output and want to speed it up further.
progress status even if the standard error stream is not
directed to a terminal.

CONFIGURATION
-------------

include::config/fsck.txt[]

DISCUSSION
----------



+ 1
- 1
Documentation/git-pull.txt View File

@@ -249,7 +249,7 @@ BUGS
----
Using --recurse-submodules can only fetch new commits in already checked
out submodules right now. When e.g. upstream added a new submodule in the
just fetched commits of the superproject the submodule itself can not be
just fetched commits of the superproject the submodule itself cannot be
fetched, making it impossible to check out that submodule later without
having to do a fetch again. This is expected to be fixed in a future Git
version.


+ 1
- 1
Documentation/git-restore.txt View File

@@ -39,7 +39,7 @@ OPTIONS
commit, branch or tag associated with it.
+
If not specified, the default restore source for the working tree is
the index, and the default restore source for the index index is
the index, and the default restore source for the index is
`HEAD`. When both `--staged` and `--worktree` are specified,
`--source` must also be specified.



+ 1
- 1
Documentation/glossary-content.txt View File

@@ -255,7 +255,7 @@ This commit is referred to as a "merge commit", or sometimes just a
[[def_object]]object::
The unit of storage in Git. It is uniquely identified by the
<<def_SHA1,SHA-1>> of its contents. Consequently, an
object can not be changed.
object cannot be changed.

[[def_object_database]]object database::
Stores a set of "objects", and an individual <<def_object,object>> is


+ 1
- 1
Documentation/technical/api-ref-iteration.txt View File

@@ -54,7 +54,7 @@ this:
do not do this you will get an error for each ref that it does not point
to a valid object.

Note: As a side-effect of this you can not safely assume that all
Note: As a side-effect of this you cannot safely assume that all
objects you lookup are available in superproject. All submodule objects
will be available the same way as the superprojects objects.



+ 1
- 1
GIT-VERSION-GEN View File

@@ -1,7 +1,7 @@
#!/bin/sh

GVF=GIT-VERSION-FILE
DEF_VER=v2.23.0-rc0
DEF_VER=v2.23.0-rc2

LF='
'


+ 1
- 1
Makefile View File

@@ -2720,7 +2720,7 @@ bin-wrappers/%: wrap-for-bin.sh
@mkdir -p bin-wrappers
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%$(X),$(@F))$(patsubst git%,$(X),$(filter $(@F),$(BINDIR_PROGRAMS_NEED_X)))|' < $< > $@ && \
chmod +x $@

# GNU make supports exporting all variables by "export" without parameters.


+ 1
- 1
builtin/checkout.c View File

@@ -1769,7 +1769,7 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
struct option *options;
struct option restore_options[] = {
OPT_STRING('s', "source", &opts.from_treeish, "<tree-ish>",
N_("where the checkout from")),
N_("which tree-ish to checkout from")),
OPT_BOOL('S', "staged", &opts.checkout_index,
N_("restore the index")),
OPT_BOOL('W', "worktree", &opts.checkout_worktree,


+ 11
- 4
builtin/fetch.c View File

@@ -850,6 +850,15 @@ static int iterate_ref_map(void *cb_data, struct object_id *oid)
return 0;
}

static const char warn_show_forced_updates[] =
N_("Fetch normally indicates which branches had a forced update,\n"
"but that check has been disabled. To re-enable, use '--show-forced-updates'\n"
"flag or run 'git config fetch.showForcedUpdates true'.");
static const char warn_time_show_forced_updates[] =
N_("It took %.2f seconds to check forced updates. You can use\n"
"'--no-show-forced-updates' or run 'git config fetch.showForcedUpdates false'\n"
" to avoid this check.\n");

static int store_updated_refs(const char *raw_url, const char *remote_name,
int connectivity_checked, struct ref *ref_map)
{
@@ -1005,12 +1014,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,

if (advice_fetch_show_forced_updates) {
if (!fetch_show_forced_updates) {
warning(_("Fetch normally indicates which branches had a forced update, but that check has been disabled."));
warning(_("To re-enable, use '--show-forced-updates' flag or run 'git config fetch.showForcedUpdates true'."));
warning(_(warn_show_forced_updates));
} else if (forced_updates_ms > FORCED_UPDATES_DELAY_WARNING_IN_MS) {
warning(_("It took %.2f seconds to check forced updates. You can use '--no-show-forced-updates'\n"),
warning(_(warn_time_show_forced_updates),
forced_updates_ms / 1000.0);
warning(_("or run 'git config fetch.showForcedUpdates false' to avoid this check.\n"));
}
}



+ 2
- 19
builtin/log.c View File

@@ -47,7 +47,7 @@ static int default_follow;
static int default_show_signature;
static int decoration_style;
static int decoration_given;
static int use_mailmap_config = -1;
static int use_mailmap_config = 1;
static const char *fmt_patch_subject_prefix = "PATCH";
static const char *fmt_pretty;

@@ -156,21 +156,11 @@ static void cmd_log_init_defaults(struct rev_info *rev)
parse_date_format(default_date_mode, &rev->date_mode);
}

static char warn_unspecified_mailmap_msg[] =
N_("log.mailmap is not set; its implicit value will change in an\n"
"upcoming release. To squelch this message and preserve current\n"
"behaviour, set the log.mailmap configuration value to false.\n"
"\n"
"To squelch this message and adopt the new behaviour now, set the\n"
"log.mailmap configuration value to true.\n"
"\n"
"See 'git help config' and search for 'log.mailmap' for further information.");

static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
struct rev_info *rev, struct setup_revision_opt *opt)
{
struct userformat_want w;
int quiet = 0, source = 0, mailmap = 0;
int quiet = 0, source = 0, mailmap;
static struct line_opt_callback_data line_cb = {NULL, NULL, STRING_LIST_INIT_DUP};
static struct string_list decorate_refs_exclude = STRING_LIST_INIT_NODUP;
static struct string_list decorate_refs_include = STRING_LIST_INIT_NODUP;
@@ -214,13 +204,6 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
memset(&w, 0, sizeof(w));
userformat_find_requirements(NULL, &w);

if (mailmap < 0) {
if (session_is_interactive() && !rev->pretty_given)
warning("%s\n", _(warn_unspecified_mailmap_msg));

mailmap = 0;
}

if (!rev->show_notes_given && (!rev->pretty_given || w.notes))
rev->show_notes = 1;
if (rev->show_notes)


+ 16
- 5
builtin/pack-objects.c View File

@@ -96,7 +96,11 @@ static off_t reuse_packfile_offset;

static int use_bitmap_index_default = 1;
static int use_bitmap_index = -1;
static int write_bitmap_index;
static enum {
WRITE_BITMAP_FALSE = 0,
WRITE_BITMAP_QUIET,
WRITE_BITMAP_TRUE,
} write_bitmap_index;
static uint16_t write_bitmap_options = BITMAP_OPT_HASH_CACHE;

static int exclude_promisor_objects;
@@ -892,7 +896,8 @@ static void write_pack_file(void)
nr_written, oid.hash, offset);
close(fd);
if (write_bitmap_index) {
warning(_(no_split_warning));
if (write_bitmap_index != WRITE_BITMAP_QUIET)
warning(_(no_split_warning));
write_bitmap_index = 0;
}
}
@@ -1176,7 +1181,8 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
if (!want_object_in_pack(oid, exclude, &found_pack, &found_offset)) {
/* The pack is missing an object, so it will not have closure */
if (write_bitmap_index) {
warning(_(no_closure_warning));
if (write_bitmap_index != WRITE_BITMAP_QUIET)
warning(_(no_closure_warning));
write_bitmap_index = 0;
}
return 0;
@@ -3313,8 +3319,13 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
N_("do not hide commits by grafts"), 0),
OPT_BOOL(0, "use-bitmap-index", &use_bitmap_index,
N_("use a bitmap index if available to speed up counting objects")),
OPT_BOOL(0, "write-bitmap-index", &write_bitmap_index,
N_("write a bitmap index together with the pack index")),
OPT_SET_INT(0, "write-bitmap-index", &write_bitmap_index,
N_("write a bitmap index together with the pack index"),
WRITE_BITMAP_TRUE),
OPT_SET_INT_F(0, "write-bitmap-index-quiet",
&write_bitmap_index,
N_("write a bitmap index if possible"),
WRITE_BITMAP_QUIET, PARSE_OPT_HIDDEN),
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
{ OPTION_CALLBACK, 0, "missing", NULL, N_("action"),
N_("handling for missing objects"), PARSE_OPT_NONEG,


+ 7
- 17
builtin/repack.c View File

@@ -89,17 +89,6 @@ static void remove_pack_on_signal(int signo)
raise(signo);
}

static int has_pack_keep_file(void)
{
struct packed_git *p;

for (p = get_all_packs(the_repository); p; p = p->next) {
if (p->pack_keep)
return 1;
}
return 0;
}

/*
* Adds all packs hex strings to the fname list, which do not
* have a corresponding .keep file. These packs are not to
@@ -345,13 +334,12 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
die(_("--keep-unreachable and -A are incompatible"));

if (write_bitmaps < 0) {
write_bitmaps = (pack_everything & ALL_INTO_ONE) &&
is_bare_repository() &&
keep_pack_list.nr == 0 &&
!has_pack_keep_file();
if (!(pack_everything & ALL_INTO_ONE) ||
!is_bare_repository())
write_bitmaps = 0;
}
if (pack_kept_objects < 0)
pack_kept_objects = write_bitmaps;
pack_kept_objects = write_bitmaps > 0;

if (write_bitmaps && !(pack_everything & ALL_INTO_ONE))
die(_(incremental_bitmap_conflict_error));
@@ -375,8 +363,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
argv_array_push(&cmd.args, "--indexed-objects");
if (repository_format_partial_clone)
argv_array_push(&cmd.args, "--exclude-promisor-objects");
if (write_bitmaps)
if (write_bitmaps > 0)
argv_array_push(&cmd.args, "--write-bitmap-index");
else if (write_bitmaps < 0)
argv_array_push(&cmd.args, "--write-bitmap-index-quiet");
if (use_delta_islands)
argv_array_push(&cmd.args, "--delta-islands");



+ 0
- 1
builtin/verify-commit.c View File

@@ -12,7 +12,6 @@
#include "repository.h"
#include "commit.h"
#include "run-command.h"
#include <signal.h>
#include "parse-options.h"
#include "gpg-interface.h"



+ 0
- 1
builtin/verify-tag.c View File

@@ -10,7 +10,6 @@
#include "builtin.h"
#include "tag.h"
#include "run-command.h"
#include <signal.h>
#include "parse-options.h"
#include "gpg-interface.h"
#include "ref-filter.h"


+ 8
- 6
commit-graph.c View File

@@ -434,6 +434,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, const

free(oids);
fclose(fp);
strbuf_release(&line);

return graph_chain;
}
@@ -1186,7 +1187,7 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
}

stop_progress(&ctx->progress);
strbuf_reset(&progress_title);
strbuf_release(&progress_title);
strbuf_release(&packname);

return 0;
@@ -1636,7 +1637,7 @@ static void sort_and_scan_merged_commits(struct write_commit_graph_context *ctx)
num_parents++;

if (num_parents > 2)
ctx->num_extra_edges += num_parents - 2;
ctx->num_extra_edges += num_parents - 1;
}
}

@@ -1713,10 +1714,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
strbuf_addstr(&path, "/info/commit-graphs");
dir = opendir(path.buf);

if (!dir) {
strbuf_release(&path);
return;
}
if (!dir)
goto out;

strbuf_addch(&path, '/');
dirnamelen = path.len;
@@ -1745,6 +1744,9 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
if (!found)
unlink(path.buf);
}

out:
strbuf_release(&path);
}

int write_commit_graph(const char *obj_dir,


+ 23
- 0
compat/vcbuild/README View File

@@ -37,6 +37,29 @@ The Steps to Build Git with VS2015 or VS2017 from the command line.

================================================================

Alternatively, run `make vcxproj` and then load the generated `git.sln` in
Visual Studio. The initial build will install the vcpkg system and build the
dependencies automatically. This will take a while.

Instead of generating the `git.sln` file yourself (which requires a full Git
for Windows SDK), you may want to consider fetching the `vs/master` branch of
https://github.com/git-for-windows/git instead (which is updated automatically
via CI running `make vcxproj`). The `vs/master` branch does not require a Git
for Windows to build, but you can run the test scripts in a regular Git Bash.

Note that `make vcxproj` will automatically add and commit the generated `.sln`
and `.vcxproj` files to the repo. This is necessary to allow building a
fully-testable Git in Visual Studio, where a regular Git Bash can be used to
run the test scripts (as opposed to a full Git for Windows SDK): a number of
build targets, such as Git commands implemented as Unix shell scripts (where
`@@SHELL_PATH@@` and other placeholders are interpolated) require a full-blown
Git for Windows SDK (which is about 10x the size of a regular Git for Windows
installation).

If your plan is to open a Pull Request with Git for Windows, it is a good idea
to drop this commit before submitting.

================================================================
The Steps of Build Git with VS2008

1. You need the build environment, which contains the Git dependencies


+ 2
- 1
config.c View File

@@ -275,7 +275,8 @@ static int include_by_branch(const char *cond, size_t cond_len)
int flags;
int ret;
struct strbuf pattern = STRBUF_INIT;
const char *refname = resolve_ref_unsafe("HEAD", 0, NULL, &flags);
const char *refname = !the_repository || !the_repository->gitdir ?
NULL : resolve_ref_unsafe("HEAD", 0, NULL, &flags);
const char *shortname;

if (!refname || !(flags & REF_ISSYMREF) ||


+ 76
- 0
config.mak.uname View File

@@ -25,10 +25,12 @@ include compat/vcbuild/MSVC-DEFS-GEN
# See if vcpkg and the vcpkg-build versions of the third-party
# libraries that we use are installed. We include the result
# to get $(vcpkg_*) variables defined for the Makefile.
ifeq (,$(SKIP_VCPKG))
compat/vcbuild/VCPKG-DEFS: compat/vcbuild/vcpkg_install.bat
@"$<"
include compat/vcbuild/VCPKG-DEFS
endif
endif

# We choose to avoid "if .. else if .. else .. endif endif"
# because maintaining the nesting to match is a pain. If
@@ -689,3 +691,77 @@ ifeq ($(uname_S),QNX)
NO_STRCASESTR = YesPlease
NO_STRLCPY = YesPlease
endif

vcxproj:
# Require clean work tree
git update-index -q --refresh && \
git diff-files --quiet && \
git diff-index --cached --quiet HEAD --

# Make .vcxproj files and add them
unset QUIET_GEN QUIET_BUILT_IN; \
perl contrib/buildsystems/generate -g Vcxproj
git add -f git.sln {*,*/lib,t/helper/*}/*.vcxproj

# Generate the LinkOrCopyBuiltins.targets file
(echo '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">' && \
echo ' <Target Name="CopyBuiltins_AfterBuild" AfterTargets="AfterBuild">' && \
for name in $(BUILT_INS);\
do \
echo ' <Copy SourceFiles="$$(OutDir)\git.exe" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
done && \
for name in $(REMOTE_CURL_ALIASES); \
do \
echo ' <Copy SourceFiles="$$(OutDir)\'"$(REMOTE_CURL_PRIMARY)"'" DestinationFiles="$$(OutDir)\'"$$name"'" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />'; \
done && \
echo ' </Target>' && \
echo '</Project>') >git/LinkOrCopyBuiltins.targets
git add -f git/LinkOrCopyBuiltins.targets

# Add command-list.h
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 command-list.h
git add -f command-list.h

# Add scripts
rm -f perl/perl.mak
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 \
$(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
# Strip out the sane tool path, needed only for building
sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
git add -f $(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)

# Add Perl module
$(MAKE) $(LIB_PERL_GEN)
git add -f perl/build

# Add bin-wrappers, for testing
rm -rf bin-wrappers/
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 $(test_bindir_programs)
# Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
# path of the repository is not hard-coded (GIT_EXEC_PATH will be set
# by test-lib.sh according to the current setup)
sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
\1="$$(cygpath -u "$$\1")"/' \
-e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
# Ensure that test-* helpers find the .dll files copied to top-level
sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
# We do not want to force hard-linking builtins
sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
bin-wrappers/git-{receive-pack,upload-archive}
git add -f $(test_bindir_programs)
# remote-ext is a builtin, but invoked as if it were external
sed 's|receive-pack|remote-ext|g' \
<bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
git add -f bin-wrappers/git-remote-ext

# Add templates
$(MAKE) -C templates
git add -f templates/boilerplates.made templates/blt/

# Add build options
$(MAKE) MSVC=1 SKIP_VCPKG=1 prefix=/mingw64 GIT-BUILD-OPTIONS
git add -f GIT-BUILD-OPTIONS

# Commit the whole shebang
git commit -m "Generate Visual Studio solution" \
-m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"

+ 1
- 1
contrib/buildsystems/Generators.pm View File

@@ -17,7 +17,7 @@ BEGIN {
$me = dirname($me);
if (opendir(D,"$me/Generators")) {
foreach my $gen (readdir(D)) {
next if ($gen =~ /^\.\.?$/);
next unless ($gen =~ /\.pm$/);
require "${me}/Generators/$gen";
$gen =~ s,\.pm,,;
push(@AVAILABLE, $gen);


+ 36
- 83
contrib/buildsystems/Generators/Vcproj.pm View File

@@ -3,6 +3,7 @@ require Exporter;

use strict;
use vars qw($VERSION);
use Digest::SHA qw(sha256_hex);

our $VERSION = '1.00';
our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
@@ -12,59 +13,12 @@ BEGIN {
push @EXPORT_OK, qw(generate);
}

my $guid_index = 0;
my @GUIDS = (
"{E07B9989-2BF7-4F21-8918-BE22BA467AC3}",
"{278FFB51-0296-4A44-A81A-22B87B7C3592}",
"{7346A2C4-F0FD-444F-9EBE-1AF23B2B5650}",
"{67F421AC-EB34-4D49-820B-3196807B423F}",
"{385DCFE1-CC8C-4211-A451-80FCFC31CA51}",
"{97CC46C5-D2CC-4D26-B634-E75792B79916}",
"{C7CE21FE-6EF8-4012-A5C7-A22BCEDFBA11}",
"{51575134-3FDF-42D1-BABD-3FB12669C6C9}",
"{0AE195E4-9823-4B87-8E6F-20C5614AF2FF}",
"{4B918255-67CA-43BB-A46C-26704B666E6B}",
"{18CCFEEF-C8EE-4CC1-A265-26F95C9F4649}",
"{5D5D90FA-01B7-4973-AFE5-CA88C53AC197}",
"{1F054320-036D-49E1-B384-FB5DF0BC8AC0}",
"{7CED65EE-F2D9-4171-825B-C7D561FE5786}",
"{8D341679-0F07-4664-9A56-3BA0DE88B9BC}",
"{C189FEDC-2957-4BD7-9FA4-7622241EA145}",
"{66844203-1B9F-4C53-9274-164FFF95B847}",
"{E4FEA145-DECC-440D-AEEA-598CF381FD43}",
"{73300A8E-C8AC-41B0-B555-4F596B681BA7}",
"{873FDEB1-D01D-40BF-A1BF-8BBC58EC0F51}",
"{7922C8BE-76C5-4AC6-8BF7-885C0F93B782}",
"{E245D370-308B-4A49-BFC1-1E527827975F}",
"{F6FA957B-66FC-4ED7-B260-E59BBE4FE813}",
"{E6055070-0198-431A-BC49-8DB6CEE770AE}",
"{54159234-C3EB-43DA-906B-CE5DA5C74654}",
"{594CFC35-0B60-46F6-B8EF-9983ACC1187D}",
"{D93FCAB7-1F01-48D2-B832-F761B83231A5}",
"{DBA5E6AC-E7BE-42D3-8703-4E787141526E}",
"{6171953F-DD26-44C7-A3BE-CC45F86FC11F}",
"{9E19DDBE-F5E4-4A26-A2FE-0616E04879B8}",
"{AE81A615-99E3-4885-9CE0-D9CAA193E867}",
"{FBF4067E-1855-4F6C-8BCD-4D62E801A04D}",
"{17007948-6593-4AEB-8106-F7884B4F2C19}",
"{199D4C8D-8639-4DA6-82EF-08668C35DEE0}",
"{E085E50E-C140-4CF3-BE4B-094B14F0DDD6}",
"{00785268-A9CC-4E40-AC29-BAC0019159CE}",
"{4C06F56A-DCDB-46A6-B67C-02339935CF12}",
"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}",
"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}",
"{9392EB58-D7BA-410B-B1F0-B2FAA6BC89A7}",
"{2ACAB2D5-E0CE-4027-BCA0-D78B2D7A6C66}",
"{86E216C3-43CE-481A-BCB2-BE5E62850635}",
"{FB631291-7923-4B91-9A57-7B18FDBB7A42}",
"{0A176EC9-E934-45B8-B87F-16C7F4C80039}",
"{DF55CA80-46E8-4C53-B65B-4990A23DD444}",
"{3A0F9895-55D2-4710-BE5E-AD7498B5BF44}",
"{294BDC5A-F448-48B6-8110-DD0A81820F8C}",
"{4B9F66E9-FAC9-47AB-B1EF-C16756FBFD06}",
"{72EA49C6-2806-48BD-B81B-D4905102E19C}",
"{5728EB7E-8929-486C-8CD5-3238D060E768}"
);
sub generate_guid ($) {
my $hex = sha256_hex($_[0]);
$hex =~ s/^(.{8})(.{4})(.{4})(.{4})(.{12}).*/{$1-$2-$3-$4-$5}/;
$hex =~ tr/a-z/A-Z/;
return $hex;
}

sub generate {
my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
@@ -92,9 +46,8 @@ sub createLibProject {
$target =~ s/\//_/g;
$target =~ s/\.a//;

my $uuid = $GUIDS[$guid_index];
my $uuid = generate_guid($libname);
$$build_structure{"LIBS_${target}_GUID"} = $uuid;
$guid_index += 1;

my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"LIBS_${libname}_SOURCES"}}));
my @sources;
@@ -106,6 +59,8 @@ sub createLibProject {
my $includes= join(";", sort(map("&quot;$rel_dir\\$_&quot;", @{$$build_structure{"LIBS_${libname}_INCLUDES"}})));
my $cflags = join(" ", sort(@{$$build_structure{"LIBS_${libname}_CFLAGS"}}));
$cflags =~ s/\"/&quot;/g;
$cflags =~ s/</&lt;/g;
$cflags =~ s/>/&gt;/g;

my $cflags_debug = $cflags;
$cflags_debug =~ s/-MT/-MTd/;
@@ -127,6 +82,8 @@ sub createLibProject {

$defines =~ s/-D//g;
$defines =~ s/\"/\\&quot;/g;
$defines =~ s/</&lt;/g;
$defines =~ s/>/&gt;/g;
$defines =~ s/\'//g;
$includes =~ s/-I//g;
mkdir "$target" || die "Could not create the directory $target for lib project!\n";
@@ -162,9 +119,6 @@ sub createLibProject {
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
@@ -228,9 +182,6 @@ sub createLibProject {
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
@@ -311,9 +262,8 @@ sub createAppProject {
$target =~ s/\//_/g;
$target =~ s/\.exe//;

my $uuid = $GUIDS[$guid_index];
my $uuid = generate_guid($appname);
$$build_structure{"APPS_${target}_GUID"} = $uuid;
$guid_index += 1;

my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"APPS_${appname}_SOURCES"}}));
my @sources;
@@ -325,6 +275,8 @@ sub createAppProject {
my $includes= join(";", sort(map("&quot;$rel_dir\\$_&quot;", @{$$build_structure{"APPS_${appname}_INCLUDES"}})));
my $cflags = join(" ", sort(@{$$build_structure{"APPS_${appname}_CFLAGS"}}));
$cflags =~ s/\"/&quot;/g;
$cflags =~ s/</&lt;/g;
$cflags =~ s/>/&gt;/g;

my $cflags_debug = $cflags;
$cflags_debug =~ s/-MT/-MTd/;
@@ -351,6 +303,8 @@ sub createAppProject {

$defines =~ s/-D//g;
$defines =~ s/\"/\\&quot;/g;
$defines =~ s/</&lt;/g;
$defines =~ s/>/&gt;/g;
$defines =~ s/\'//g;
$defines =~ s/\\\\/\\/g;
$includes =~ s/-I//g;
@@ -387,9 +341,6 @@ sub createAppProject {
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
@@ -458,9 +409,6 @@ sub createAppProject {
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
@@ -561,20 +509,18 @@ sub createGlueProject {
foreach (@apps) {
$_ =~ s/\//_/g;
$_ =~ s/\.exe//;
push(@tmp, $_);
if ($_ eq "git" ) {
unshift(@tmp, $_);
} else {
push(@tmp, $_);
}
}
@apps = @tmp;

open F, ">git.sln" || die "Could not open git.sln for writing!\n";
binmode F, ":crlf";
print F "$SLN_HEAD";
foreach (@libs) {
my $libname = $_;
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
print F "$SLN_PRE";
print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
print F "$SLN_POST";
}

my $uuid_libgit = $build_structure{"LIBS_libgit_GUID"};
my $uuid_xdiff_lib = $build_structure{"LIBS_xdiff_lib_GUID"};
foreach (@apps) {
@@ -588,6 +534,13 @@ sub createGlueProject {
print F " EndProjectSection";
print F "$SLN_POST";
}
foreach (@libs) {
my $libname = $_;
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
print F "$SLN_PRE";
print F "\"${libname}\", \"${libname}\\${libname}.vcproj\", \"${uuid}\"";
print F "$SLN_POST";
}

print F << "EOM";
Global
@@ -599,17 +552,17 @@ EOM
print F << "EOM";
GlobalSection(ProjectConfigurationPlatforms) = postSolution
EOM
foreach (@libs) {
my $libname = $_;
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
foreach (@apps) {
my $appname = $_;
my $uuid = $build_structure{"APPS_${appname}_GUID"};
print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";
print F "\t\t${uuid}.Release|Win32.Build.0 = Release|Win32\n";
}
foreach (@apps) {
my $appname = $_;
my $uuid = $build_structure{"APPS_${appname}_GUID"};
foreach (@libs) {
my $libname = $_;
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
print F "\t\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\n";
print F "\t\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\n";
print F "\t\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\n";


+ 388
- 0
contrib/buildsystems/Generators/Vcxproj.pm View File

@@ -0,0 +1,388 @@
package Generators::Vcxproj;
require Exporter;

use strict;
use vars qw($VERSION);
use Digest::SHA qw(sha256_hex);

our $VERSION = '1.00';
our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
@ISA = qw(Exporter);

BEGIN {
push @EXPORT_OK, qw(generate);
}

sub generate_guid ($) {
my $hex = sha256_hex($_[0]);
$hex =~ s/^(.{8})(.{4})(.{4})(.{4})(.{12}).*/{$1-$2-$3-$4-$5}/;
$hex =~ tr/a-z/A-Z/;
return $hex;
}

sub generate {
my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
my @libs = @{$build_structure{"LIBS"}};
foreach (@libs) {
createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 1);
}

my @apps = @{$build_structure{"APPS"}};
foreach (@apps) {
createProject($_, $git_dir, $out_dir, $rel_dir, \%build_structure, 0);
}

createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);
return 0;
}

sub createProject {
my ($name, $git_dir, $out_dir, $rel_dir, $build_structure, $static_library) = @_;
my $label = $static_library ? "lib" : "app";
my $prefix = $static_library ? "LIBS_" : "APPS_";
my $config_type = $static_library ? "StaticLibrary" : "Application";
print "Generate $name vcxproj $label project\n";
my $cdup = $name;
$cdup =~ s/[^\/]+/../g;
$cdup =~ s/\//\\/g;
$rel_dir = $rel_dir eq "." ? $cdup : "$cdup\\$rel_dir";
$rel_dir =~ s/\//\\/g;

my $target = $name;
if ($static_library) {
$target =~ s/\.a//;
} else {
$target =~ s/\.exe//;
}

my $uuid = generate_guid($name);
$$build_structure{"$prefix${target}_GUID"} = $uuid;
my $vcxproj = $target;
$vcxproj =~ s/(.*\/)?(.*)/$&\/$2.vcxproj/;
$vcxproj =~ s/([^\/]*)(\/lib)\/(lib.vcxproj)/$1$2\/$1_$3/;
$$build_structure{"$prefix${target}_VCXPROJ"} = $vcxproj;

my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"$prefix${name}_SOURCES"}}));
my @sources;
foreach (@srcs) {
$_ =~ s/\//\\/g;
push(@sources, $_);
}
my $defines = join(";", sort(@{$$build_structure{"$prefix${name}_DEFINES"}}));
my $includes= join(";", sort(map { s/^-I//; s/\//\\/g; File::Spec->file_name_is_absolute($_) ? $_ : "$rel_dir\\$_" } @{$$build_structure{"$prefix${name}_INCLUDES"}}));
my $cflags = join(" ", sort(map { s/^-[GLMOWZ].*//; s/.* .*/"$&"/; $_; } @{$$build_structure{"$prefix${name}_CFLAGS"}}));
$cflags =~ s/</&lt;/g;
$cflags =~ s/>/&gt;/g;

my $libs_release = "\n ";
my $libs_debug = "\n ";
if (!$static_library) {
$libs_release = join(";", sort(grep /^(?!libgit\.lib|xdiff\/lib\.lib|vcs-svn\/lib\.lib)/, @{$$build_structure{"$prefix${name}_LIBS"}}));
$libs_debug = $libs_release;
$libs_debug =~ s/zlib\.lib/zlibd\.lib/;
}

$defines =~ s/-D//g;
$defines =~ s/</&lt;/g;
$defines =~ s/>/&gt;/g;
$defines =~ s/\'//g;

die "Could not create the directory $target for $label project!\n" unless (-d "$target" || mkdir "$target");

open F, ">$vcxproj" or die "Could not open $vcxproj for writing!\n";
binmode F, ":crlf :utf8";
print F chr(0xFEFF);
print F << "EOM";
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>$uuid</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<VCPKGArch Condition="'\$(Platform)'=='Win32'">x86-windows</VCPKGArch>
<VCPKGArch Condition="'\$(Platform)'!='Win32'">x64-windows</VCPKGArch>
<VCPKGArchDirectory>$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)</VCPKGArchDirectory>
<VCPKGBinDirectory Condition="'\(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\bin</VCPKGBinDirectory>
<VCPKGLibDirectory Condition="'\(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\lib</VCPKGLibDirectory>
<VCPKGBinDirectory Condition="'\(Configuration)'!='Debug'">\$(VCPKGArchDirectory)\\bin</VCPKGBinDirectory>
<VCPKGLibDirectory Condition="'\(Configuration)'!='Debug'">\$(VCPKGArchDirectory)\\lib</VCPKGLibDirectory>
<VCPKGIncludeDirectory>\$(VCPKGArchDirectory)\\include</VCPKGIncludeDirectory>
<VCPKGLibs Condition="'\(Configuration)'=='Debug'">$libs_debug</VCPKGLibs>
<VCPKGLibs Condition="'\(Configuration)'!='Debug'">$libs_release</VCPKGLibs>
</PropertyGroup>
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'\$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'\$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup>
<ConfigurationType>$config_type</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<!-- <CharacterSet>UTF-8</CharacterSet> -->
<OutDir>..\\</OutDir>
<!-- <IntDir>\$(ProjectDir)\$(Configuration)\\</IntDir> -->
</PropertyGroup>
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<GenerateManifest>false</GenerateManifest>
<EnableManagedIncrementalBuild>true</EnableManagedIncrementalBuild>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>$cflags %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$cdup;$cdup\\compat;$cdup\\compat\\regex;$cdup\\compat\\win32;$cdup\\compat\\poll;$cdup\\compat\\vcbuild\\include;\$(VCPKGIncludeDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnableParallelCodeGeneration />
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PrecompiledHeader />
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<SuppressStartupBanner>true</SuppressStartupBanner>
</Lib>
<Link>
<AdditionalLibraryDirectories>\$(VCPKGLibDirectory);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>\$(VCPKGLibs);\$(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>invalidcontinue.obj %(AdditionalOptions)</AdditionalOptions>
<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>
<ManifestFile>$cdup\\compat\\win32\\git.manifest</ManifestFile>
<SubSystem>Console</SubSystem>
</Link>
EOM
if ($target eq 'libgit') {
print F << "EOM";
<PreBuildEvent Condition="!Exists('$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)\\include\\openssl\\ssl.h')">
<Message>Initialize VCPKG</Message>
<Command>del "$cdup\\compat\\vcbuild\\vcpkg"</Command>
<Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat"</Command>
</PreBuildEvent>
EOM
}
print F << "EOM";
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'\$(Platform)'=='Win32'">
<Link>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'\$(Configuration)'=='Debug'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'\$(Configuration)'=='Release'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;$defines;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
EOM
foreach(@sources) {
print F << "EOM";
<ClCompile Include="$_" />
EOM
}
print F << "EOM";
</ItemGroup>
EOM
if (!$static_library || $target =~ 'vcs-svn' || $target =~ 'xdiff') {
my $uuid_libgit = $$build_structure{"LIBS_libgit_GUID"};
my $uuid_xdiff_lib = $$build_structure{"LIBS_xdiff/lib_GUID"};

print F << "EOM";
<ItemGroup>
<ProjectReference Include="$cdup\\libgit\\libgit.vcxproj">
<Project>$uuid_libgit</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
EOM
if (!($name =~ 'xdiff')) {
print F << "EOM";
<ProjectReference Include="$cdup\\xdiff\\lib\\xdiff_lib.vcxproj">
<Project>$uuid_xdiff_lib</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
EOM
}
if ($name =~ /(test-(line-buffer|svn-fe)|^git-remote-testsvn)\.exe$/) {
my $uuid_vcs_svn_lib = $$build_structure{"LIBS_vcs-svn/lib_GUID"};
print F << "EOM";
<ProjectReference Include="$cdup\\vcs-svn\\lib\\vcs-svn_lib.vcxproj">
<Project>$uuid_vcs_svn_lib</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
EOM
}
print F << "EOM";
</ItemGroup>
EOM
}
print F << "EOM";
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" />
EOM
if (!$static_library) {
print F << "EOM";
<Target Name="${target}_AfterBuild" AfterTargets="AfterBuild">
<ItemGroup>
<DLLsAndPDBs Include="\$(VCPKGBinDirectory)\\*.dll;\$(VCPKGBinDirectory)\\*.pdb" />
</ItemGroup>
<Copy SourceFiles="@(DLLsAndPDBs)" DestinationFolder="\$(OutDir)" SkipUnchangedFiles="true" UseHardlinksIfPossible="true" />
<MakeDir Directories="..\\templates\\blt\\branches" />
</Target>
EOM
}
if ($target eq 'git') {
print F " <Import Project=\"LinkOrCopyBuiltins.targets\" />\n";
}
print F << "EOM";
</Project>
EOM
close F;
}

sub createGlueProject {
my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
print "Generate solutions file\n";
$rel_dir = "..\\$rel_dir";
$rel_dir =~ s/\//\\/g;
my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 11.00\n# Visual Studio 2010\n";
my $SLN_PRE = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
my $SLN_POST = "\nEndProject\n";

my @libs = @{$build_structure{"LIBS"}};
my @tmp;
foreach (@libs) {
$_ =~ s/\.a//;
push(@tmp, $_);
}
@libs = @tmp;

my @apps = @{$build_structure{"APPS"}};
@tmp = ();
foreach (@apps) {
$_ =~ s/\.exe//;
if ($_ eq "git" ) {
unshift(@tmp, $_);
} else {
push(@tmp, $_);
}
}
@apps = @tmp;

open F, ">git.sln" || die "Could not open git.sln for writing!\n";
binmode F, ":crlf :utf8";
print F chr(0xFEFF);
print F "$SLN_HEAD";

foreach (@apps) {
my $appname = $_;
my $uuid = $build_structure{"APPS_${appname}_GUID"};
print F "$SLN_PRE";
my $vcxproj = $build_structure{"APPS_${appname}_VCXPROJ"};
$vcxproj =~ s/\//\\/g;
$appname =~ s/.*\///;
print F "\"${appname}\", \"${vcxproj}\", \"${uuid}\"";
print F "$SLN_POST";
}
foreach (@libs) {
my $libname = $_;
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
print F "$SLN_PRE";
my $vcxproj = $build_structure{"LIBS_${libname}_VCXPROJ"};
$vcxproj =~ s/\//\\/g;
$libname =~ s/\//_/g;
print F "\"${libname}\", \"${vcxproj}\", \"${uuid}\"";
print F "$SLN_POST";
}

print F << "EOM";
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
EOM
print F << "EOM";
GlobalSection(ProjectConfigurationPlatforms) = postSolution
EOM
foreach (@apps) {
my $appname = $_;
my $uuid = $build_structure{"APPS_${appname}_GUID"};
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
}
foreach (@libs) {
my $libname = $_;
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
print F "\t\t${uuid}.Release|x86.Build.0 = Release|Win32\n";
}

print F << "EOM";
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
EOM
close F;
}

1;

+ 45
- 10
contrib/buildsystems/engine.pl View File

@@ -12,6 +12,7 @@ use File::Basename;
use File::Spec;
use Cwd;
use Generators;
use Text::ParseWords;

my (%build_structure, %compile_options, @makedry);
my $out_dir = getcwd();
@@ -31,6 +32,7 @@ generate usage:
-g <GENERATOR> --gen <GENERATOR> Specify the buildsystem generator (default: $gen)
Available: $genlist
-o <PATH> --out <PATH> Specify output directory generation (default: .)
--make-out <PATH> Write the output of GNU Make into a file
-i <FILE> --in <FILE> Specify input file, instead of running GNU Make
-h,-? --help This help
EOM
@@ -38,6 +40,7 @@ EOM
}

# Parse command-line options
my $make_out;
while (@ARGV) {
my $arg = shift @ARGV;
if ("$arg" eq "-h" || "$arg" eq "--help" || "$arg" eq "-?") {
@@ -45,6 +48,8 @@ while (@ARGV) {
exit(0);
} elsif("$arg" eq "--out" || "$arg" eq "-o") {
$out_dir = shift @ARGV;
} elsif("$arg" eq "--make-out") {
$make_out = shift @ARGV;
} elsif("$arg" eq "--gen" || "$arg" eq "-g") {
$gen = shift @ARGV;
} elsif("$arg" eq "--in" || "$arg" eq "-i") {
@@ -52,6 +57,8 @@ while (@ARGV) {
open(F, "<$infile") || die "Couldn't open file $infile";
@makedry = <F>;
close(F);
} else {
die "Unknown option: " . $arg;
}
}

@@ -72,7 +79,19 @@ Running GNU Make to figure out build structure...
EOM

# Pipe a make --dry-run into a variable, if not already loaded from file
@makedry = `cd $git_dir && make -n MSVC=1 V=1 2>/dev/null` if !@makedry;
# Capture the make dry stderr to file for review (will be empty for a release build).

my $ErrsFile = "msvc-build-makedryerrors.txt";
@makedry = `make -C $git_dir -n MSVC=1 SKIP_VCPKG=1 V=1 2>$ErrsFile`
if !@makedry;
# test for an empty Errors file and remove it
unlink $ErrsFile if -f -z $ErrsFile;

if (defined $make_out) {
open OUT, ">" . $make_out;
print OUT @makedry;
close OUT;
}

# Parse the make output into usable info
parseMakeOutput();
@@ -140,6 +159,12 @@ sub parseMakeOutput
next;
}

if ($text =~ /^(mkdir|msgfmt) /) {
# options to the Portable Object translations
# the line "mkdir ... && msgfmt ..." contains no linker options
next;
}

if($text =~ / -c /) {
# compilation
handleCompileLine($text, $line);
@@ -231,7 +256,7 @@ sub removeDuplicates
sub handleCompileLine
{
my ($line, $lineno) = @_;
my @parts = split(' ', $line);
my @parts = shellwords($line);
my $sourcefile;
shift(@parts); # ignore cmd
while (my $part = shift @parts) {
@@ -265,7 +290,7 @@ sub handleLibLine
my (@objfiles, @lflags, $libout, $part);
# kill cmd and rm 'prefix'
$line =~ s/^rm -f .* && .* rcs //;
my @parts = split(' ', $line);
my @parts = shellwords($line);
while ($part = shift @parts) {
if ($part =~ /^-/) {
push(@lflags, $part);
@@ -282,7 +307,7 @@ sub handleLibLine
# exit(1);
foreach (@objfiles) {
my $sourcefile = $_;
$sourcefile =~ s/\.o/.c/;
$sourcefile =~ s/\.o$/.c/;
push(@sources, $sourcefile);
push(@cflags, @{$compile_options{"${sourcefile}_CFLAGS"}});
push(@defines, @{$compile_options{"${sourcefile}_DEFINES"}});
@@ -306,7 +331,7 @@ sub handleLinkLine
{
my ($line, $lineno) = @_;
my (@objfiles, @lflags, @libs, $appout, $part);
my @parts = split(' ', $line);
my @parts = shellwords($line);
shift(@parts); # ignore cmd
while ($part = shift @parts) {
if ($part =~ /^-IGNORE/) {
@@ -317,26 +342,36 @@ sub handleLinkLine
$appout = shift @parts;
} elsif ("$part" eq "-lz") {
push(@libs, "zlib.lib");
} elsif ("$part" eq "-lcrypto") {
} elsif ("$part" eq "-lcrypto") {
push(@libs, "libeay32.lib");
} elsif ("$part" eq "-lssl") {
push(@libs, "ssleay32.lib");
} elsif ($part =~ /^-/) {
} elsif ("$part" eq "-lcurl") {
push(@libs, "libcurl.lib");
} elsif ("$part" eq "-lexpat") {
push(@libs, "expat.lib");
} elsif ("$part" eq "-liconv") {
push(@libs, "libiconv.lib");
} elsif ($part =~ /^[-\/]/) {
push(@lflags, $part);
} elsif ($part =~ /\.(a|lib)$/) {
$part =~ s/\.a$/.lib/;
push(@libs, $part);
} elsif ($part =~ /\.(o|obj)$/) {
} elsif ($part eq 'invalidcontinue.obj') {
# ignore - known to MSVC
} elsif ($part =~ /\.o$/) {
push(@objfiles, $part);
} elsif ($part =~ /\.obj$/) {
# do nothing, 'make' should not be producing .obj, only .o files
} else {
die "Unhandled lib option @ line $lineno: $part";
die "Unhandled link option @ line $lineno: $part";
}
}
# print "AppOut: '$appout'\nLFlags: @lflags\nLibs : @libs\nOfiles: @objfiles\n";
# exit(1);
foreach (@objfiles) {
my $sourcefile = $_;
$sourcefile =~ s/\.o/.c/;
$sourcefile =~ s/\.o$/.c/;
push(@sources, $sourcefile);
push(@cflags, @{$compile_options{"${sourcefile}_CFLAGS"}});
push(@defines, @{$compile_options{"${sourcefile}_DEFINES"}});


+ 0
- 3
git.c View File

@@ -739,8 +739,6 @@ static int run_argv(int *argcp, const char ***argv)
*/
if (!done_alias)
handle_builtin(*argcp, *argv);

#if 0 // TODO In GFW, need to amend a7924b655e940b06cb547c235d6bed9767929673 to include trace2_ and _tr2 lines.
else if (get_builtin(**argv)) {
struct argv_array args = ARGV_ARRAY_INIT;
int i;
@@ -775,7 +773,6 @@ static int run_argv(int *argcp, const char ***argv)
exit(i);
die("could not execute builtin %s", **argv);
}
#endif // a7924b655e940b06cb547c235d6bed9767929673

/* .. then try the external ones */
execv_dashed_external(*argv);


+ 2
- 1
merge-recursive.c View File

@@ -2863,7 +2863,8 @@ static int detect_and_process_renames(struct merge_options *opt,
head_pairs = get_diffpairs(opt, common, head);
merge_pairs = get_diffpairs(opt, common, merge);

if (opt->detect_directory_renames) {
if ((opt->detect_directory_renames == 2) ||
(opt->detect_directory_renames == 1 && !opt->call_depth)) {
dir_re_head = get_directory_renames(head_pairs);
dir_re_merge = get_directory_renames(merge_pairs);



+ 3
- 1
refs/files-backend.c View File

@@ -2151,8 +2151,10 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
strbuf_addf(&sb, "%s/logs", gitdir);

diter = dir_iterator_begin(sb.buf, 0);
if(!diter)
if (!diter) {
strbuf_release(&sb);
return empty_ref_iterator_begin();
}

iter = xcalloc(1, sizeof(*iter));
ref_iterator = &iter->base;


+ 1
- 0
sha1-file.c View File

@@ -799,6 +799,7 @@ static void read_alternate_refs(const char *path,

fclose(fh);
finish_command(&cmd);
strbuf_release(&line);
}

struct alternate_refs_data {


+ 11
- 4
t/helper/test-dir-iterator.c View File

@@ -4,13 +4,21 @@
#include "iterator.h"
#include "dir-iterator.h"

static const char *error_name(int error_number)
{
switch (error_number) {
case ENOENT: return "ENOENT";
case ENOTDIR: return "ENOTDIR";
default: return "ESOMETHINGELSE";
}
}

/*
* usage:
* tool-test dir-iterator [--follow-symlinks] [--pedantic] directory_path
*/
int cmd__dir_iterator(int argc, const char **argv)
{
struct strbuf path = STRBUF_INIT;
struct dir_iterator *diter;
unsigned int flags = 0;
int iter_status;
@@ -27,11 +35,10 @@ int cmd__dir_iterator(int argc, const char **argv)
if (!*argv || argc != 1)
die("dir-iterator needs exactly one non-option argument");

strbuf_add(&path, *argv, strlen(*argv));
diter = dir_iterator_begin(path.buf, flags);
diter = dir_iterator_begin(*argv, flags);

if (!diter) {
printf("dir_iterator_begin failure: %d\n", errno);
printf("dir_iterator_begin failure: %s\n", error_name(errno));
exit(EXIT_FAILURE);
}



+ 6
- 8
t/t0000-basic.sh View File

@@ -25,16 +25,14 @@ try_local_x () {
echo "$x"
}

# This test is an experiment to check whether any Git users are using
# Shells that don't support the "local" keyword. "local" is not
# Check whether the shell supports the "local" keyword. "local" is not
# POSIX-standard, but it is very widely supported by POSIX-compliant
# shells, and if it doesn't cause problems for people, we would like
# to be able to use it in Git code.
# shells, and we rely on it within Git's test framework.
#
# For now, this is the only test that requires "local". If your shell
# fails this test, you can ignore the failure, but please report the
# problem to the Git mailing list <git@vger.kernel.org>, as it might
# convince us to continue avoiding the use of "local".
# If your shell fails this test, the results of other tests may be
# unreliable. You may wish to report the problem to the Git mailing
# list <git@vger.kernel.org>, as it could cause us to reconsider
# relying on "local".
test_expect_success 'verify that the running shell supports "local"' '
x="notlocal" &&
echo "local" >expected1 &&


+ 36
- 22
t/t0011-hashmap.sh View File

@@ -170,31 +170,45 @@ NULL
'

test_expect_success 'iterate' '

test_hashmap "put key1 value1
put key2 value2
put fooBarFrotz value3
iterate" "NULL
NULL
NULL
key2 value2
key1 value1
fooBarFrotz value3"

test-tool hashmap >actual.raw <<-\EOF &&
put key1 value1
put key2 value2
put fooBarFrotz value3
iterate
EOF

cat >expect <<-\EOF &&
NULL
NULL
NULL
fooBarFrotz value3
key1 value1
key2 value2
EOF

sort <actual.raw >actual &&
test_cmp expect actual
'

test_expect_success 'iterate (case insensitive)' '

test_hashmap "put key1 value1
put key2 value2
put fooBarFrotz value3
iterate" "NULL
NULL
NULL
fooBarFrotz value3
key2 value2
key1 value1" ignorecase

test-tool hashmap ignorecase >actual.raw <<-\EOF &&
put key1 value1
put key2 value2
put fooBarFrotz value3
iterate
EOF

cat >expect <<-\EOF &&
NULL
NULL
NULL
fooBarFrotz value3
key1 value1
key2 value2
EOF

sort <actual.raw >actual &&
test_cmp expect actual
'

test_expect_success 'grow / shrink' '


+ 19
- 11
t/t0016-oidmap.sh View File

@@ -86,17 +86,25 @@ NULL"
'

test_expect_success 'iterate' '

test_oidmap "put one 1
put two 2
put three 3
iterate" "NULL
NULL
NULL
$(git rev-parse two) 2
$(git rev-parse one) 1
$(git rev-parse three) 3"

test-tool oidmap >actual.raw <<-\EOF &&
put one 1
put two 2
put three 3
iterate
EOF

# sort "expect" too so we do not rely on the order of particular oids
sort >expect <<-EOF &&
NULL
NULL