Merge branch 'nd/config-doc-camelCase'
authorJunio C Hamano <gitster@pobox.com>
Mon, 23 Mar 2015 18:28:12 +0000 (11:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Mar 2015 18:28:12 +0000 (11:28 -0700)
Documentation updates.

* nd/config-doc-camelCase:
*config.txt: stick to camelCase naming convention

60 files changed:
Documentation/RelNotes/2.3.3.txt [new file with mode: 0644]
Documentation/RelNotes/2.4.0.txt [new file with mode: 0644]
Documentation/config.txt
Documentation/git-commit.txt
Documentation/git-imap-send.txt
Documentation/git.txt
GIT-VERSION-GEN
Makefile
RelNotes [changed from file to symlink]
archive-zip.c
builtin/branch.c
builtin/help.c
builtin/index-pack.c
builtin/pack-objects.c
builtin/tag.c
bulk-checkin.c
bundle.c
config.mak.uname
configure.ac
connect.c
contrib/completion/git-completion.bash
daemon.c
diff.c
fast-import.c
git-compat-util.h
git-instaweb.sh
git-rebase--interactive.sh
git.c
http-push.c
imap-send.c
log-tree.c
remote-curl.c
run-command.c
sequencer.c
sha1_file.c
sha1_name.c
t/lib-httpd.sh
t/lib-httpd/apache.conf
t/t0056-git-C.sh
t/t3203-branch-output.sh
t/t3404-rebase-interactive.sh
t/t3511-cherry-pick-x.sh
t/t4013/diff.log_--decorate_--all
t/t4207-log-decoration-colors.sh
t/t5003-archive-zip.sh
t/t5528-push-default.sh
t/t5541-http-push-smart.sh
t/t5551-http-fetch-smart.sh
t/t7004-tag.sh
t/t7508-status.sh
t/t7510-signed-commit.sh
t/t9902-completion.sh
t/test-lib.sh
thread-utils.c
transport.c
upload-pack.c
versioncmp.c
wt-status.c
wt-status.h
zlib.c
diff --git a/Documentation/RelNotes/2.3.3.txt b/Documentation/RelNotes/2.3.3.txt
new file mode 100644 (file)
index 0000000..5ef1264
--- /dev/null
@@ -0,0 +1,39 @@
+Git v2.3.3 Release Notes
+========================
+
+Fixes since v2.3.2
+------------------
+
+ * A corrupt input to "git diff -M" used cause us to segfault.
+
+ * The borrowed code in kwset API did not follow our usual convention
+   to use "unsigned char" to store values that range from 0-255.
+
+ * Description given by "grep -h" for its --exclude-standard option
+   was phrased poorly.
+
+ * Documentaton for "git remote add" mentioned "--tags" and
+   "--no-tags" and it was not clear that fetch from the remote in
+   the future will use the default behaviour when neither is given
+   to override it.
+
+ * "git diff --shortstat --dirstat=changes" showed a dirstat based on
+   lines that was never asked by the end user in addition to the
+   dirstat that the user asked for.
+
+ * The interaction between "git submodule update" and the
+   submodule.*.update configuration was not clearly documented.
+
+ * "git apply" was not very careful about reading from, removing,
+   updating and creating paths outside the working tree (under
+   --index/--cached) or the current directory (when used as a
+   replacement for GNU patch).
+
+ * "git daemon" looked up the hostname even when "%CH" and "%IP"
+   interpolations are not requested, which was unnecessary.
+
+ * The "interpolated-path" option of "git daemon" inserted any string
+   client declared on the "host=" capability request without checking.
+   Sanitize and limit %H and %CH to a saner and a valid DNS name.
+
+Also contains typofixes, documentation updates and trivial code clean-ups.
diff --git a/Documentation/RelNotes/2.4.0.txt b/Documentation/RelNotes/2.4.0.txt
new file mode 100644 (file)
index 0000000..ca149da
--- /dev/null
@@ -0,0 +1,383 @@
+Git 2.4 Release Notes
+=====================
+
+Backward compatibility warning(s)
+---------------------------------
+
+Output from "git log --decorate" (and "%d" format specifier used in
+the userformat "--format=<string>" parameter "git log" family of
+command takes) used to list "HEAD" just like other tips of branch
+names, separated with a comma in between.  E.g.
+
+    $ git log --decorate -1 master
+    commit bdb0f6788fa5e3cacc4315e9ff318a27b2676ff4 (HEAD, master)
+    ...
+
+This release updates the output slightly when HEAD refers to the tip
+of a branch whose name is also shown in the output.  The above is
+shown as:
+
+    $ git log --decorate -1 master
+    commit bdb0f6788fa5e3cacc4315e9ff318a27b2676ff4 (HEAD -> master)
+    ...
+
+
+
+
+Updates since v2.3
+------------------
+
+Ports
+
+ * Our default I/O size (8 MiB) for large files was too large for some
+   platforms with smaller SSIZE_MAX, leading to read(2)/write(2)
+   failures.
+
+ * We did not check the curl library version before using
+   CURLOPT_PROXYAUTH feature that may not exist.
+
+ * We now detect number of CPUs on older BSD-derived systems.
+
+ * Portability fixes and workarounds for shell scripts have been added
+   to help BSD-derived systems.
+
+
+UI, Workflows & Features
+
+ * The command usage info strings given by "git cmd -h" and in
+   documentation have been tweaked for consistency.
+
+ * The "sync" subcommand of "git p4" now allows users to exclude
+   subdirectories like its "clone" subcommand does.
+
+ * "git log --invert-grep --grep=WIP" will show only commits that do
+   not have the string "WIP" in their messages.
+
+ * "git push" has been taught a "--atomic" option that makes push to
+   update more than one ref an "all-or-none" affair.
+
+ * Extending the "push to deploy" added in 2.3, the behaviour of "git
+   push" when updating the branch that is checked out can now be
+   tweaked by push-to-checkout hook.
+
+ * Using environment variable LANGUAGE and friends on the client side,
+   HTTP-based transports now send Accept-Language when making requests.
+
+ * "git send-email" used to accept a mistaken "y" (or "yes") as an
+   answer to "What encoding do you want to use [UTF-8]? " without
+   questioning.  Now it asks for confirmation when the answer looks
+   too short to be a valid encoding name.
+
+ * When "git apply --whitespace=fix" fixed whitespace errors in the
+   common context lines, the command reports that it did so.
+
+ * "git status" now allows the "-v" to be given twice to show the
+   differences that are left in the working tree not to be committed.
+
+ * "git cherry-pick" used to clean-up the log message even when it is
+   merely replaying an existing commit.  It now replays the message
+   verbatim unless you are editing the message of resulting commits.
+
+ * "git archive" can now be told to set the 'text' attribute in the
+   resulting zip archive.
+
+ * Output from "git log --decorate" mentions HEAD when it points at a
+   tip of an branch differently from a detached HEAD.
+
+   This is a potentially backward-incompatible change.
+
+ * "git branch" on a detached HEAD always said "(detached from xyz)",
+   even when "git status" would report "detached at xyz".  The HEAD is
+   actually at xyz and haven't been moved since it was detached in
+   such a case, but the user cannot read what the current value of
+   HEAD is when "detached from" is used.
+   (merge 4b06318 mg/detached-head-report later to maint).
+
+ * "git -C '' subcmd" refused to work in the current directory, unlike
+   "cd ''" which silently behaves as a no-op.
+   (merge 6a536e2 kn/git-cd-to-empty later to maint).
+
+ * The versionsort.prerelease configuration variable can be used to
+   specify that v1.0-pre1 comes before v1.0.
+
+
+Performance, Internal Implementation, Development Support etc.
+
+ * Implementation of N_() macro has been updated slightly to help us
+   detect mistakes.
+
+ * Implementation of "reflog expire" has been restructured to fit the
+   reflogs better with the recently updated ref API.
+
+ * The transport-helper did not give transport options such as
+   verbosity, progress, cloning, etc. to import and export based
+   helpers, like it did for fetch and push based helpers, robbing them
+   the chance to honor the wish of the end-users better.
+
+ * The tests that wanted to see that file becomes unreadable after
+   running "chmod a-r file", and the tests that wanted to make sure it
+   is not run as root, we used "can we write into the / directory?" as
+   a cheap substitute, but on some platforms that is not a good
+   heuristics.  The tests and their prerequisites have been updated to
+   check what they really require.
+   (merge f400e51 jk/sanity later to maint).
+
+ * Various issues around "reflog expire", e.g. using --updateref when
+   expiring a reflog for a symbolic reference, have been corrected
+   and/or made saner.
+
+ * The strbuf API was explained between the API documentation and in
+   the header file.  Move missing bits to strbuf.h so that programmers
+   can check only one place for all necessary information.
+
+ * The error handling functions and conventions are now documented in
+   the API manual.
+
+ * Optimize attribute look-up, mostly useful in "git grep" on a
+   project that does not use many attributes, by avoiding it when we
+   (should) know that the attributes are not defined in the first
+   place.
+
+ * Typofix in comments.
+   (merge ef2956a ak/git-pm-typofix later to maint).
+
+ * Code clean-up.
+   (merge 0b868f0 sb/hex-object-name-is-at-most-41-bytes-long later to maint).
+   (merge 5d30851 dp/remove-duplicated-header-inclusion later to maint).
+
+ * Simplify the ref transaction API around how "the ref should be
+   pointing at this object" is specified.
+
+ * Code in "git daemon" to parse out and hold hostnames used in
+   request interpolation has been simplified.
+
+
+Also contains various documentation updates and code clean-ups.
+
+
+Fixes since v2.3
+----------------
+
+Unless otherwise noted, all the fixes since v2.3 in the maintenance
+track are contained in this release (see the maintenance releases'
+notes for details).
+
+ * "git blame HEAD -- missing" failed to correctly say "HEAD" when it
+   tried to say "No such path 'missing' in HEAD".
+   (merge a46442f jk/blame-commit-label later to maint).
+
+ * "git rerere" (invoked internally from many mergy operations) did
+   not correctly signal errors when told to update the working tree
+   files and failed to do so for whatever reason.
+   (merge 89ea903 jn/rerere-fail-on-auto-update-failure later to maint).
+
+ * Setting diff.submodule to 'log' made "git format-patch" produce
+   broken patches.
+   (merge 339de50 dk/format-patch-ignore-diff-submodule later to maint).
+
+ * After attempting and failing a password-less authentication
+   (e.g. kerberos), libcURL refuses to fall back to password based
+   Basic authentication without a bit of help/encouragement.
+   (merge 4dbe664 bc/http-fallback-to-password-after-krb-fails later to maint).
+
+ * The "git push" documentation made the "--repo=<there>" option
+   easily misunderstood.
+   (merge 57b92a7 mg/push-repo-option-doc later to maint).
+
+ * Code to read branch name from various files in .git/ directory
+   would have misbehaved if the code to write them left an empty file.
+   (merge 66ec904 jk/status-read-branch-name-fix later to maint).
+
+ * A misspelled conditional that is always true has been fixed.
+   (merge 94ee8e2 jk/remote-curl-an-array-in-struct-cannot-be-null later to maint).
+
+ * The documentation incorrectly said that C(opy) and R(ename) are the
+   only ones that can be followed by the score number in the output in
+   the --raw format.
+   (merge ac1c2d9 jc/diff-format-doc later to maint).
+
+ * A broken pack .idx file in the receiving repository prevented the
+   dumb http transport from fetching a good copy of it from the other
+   side.
+   (merge 8b9c2dd jk/dumb-http-idx-fetch-fix later to maint).
+
+ * The error message from "git commit", when a non-existing author
+   name was given as value to the "--author=" parameter, has been
+   reworded to avoid misunderstanding.
+   (merge 1044b1f mg/commit-author-no-match-malformed-message later to maint).
+
+ * "git log --help" used to show rev-list options that are irrelevant
+   to the "log" command.
+   (merge 3cab02d jc/doc-log-rev-list-options later to maint).
+
+ * "git apply --whitespace=fix" used to under-allocate the memory when
+   the fix resulted in a longer text than the original patch.
+   (merge 407a792 jc/apply-ws-fix-expands later to maint).
+
+ * The interactive "show a list and let the user choose from it"
+   interface "add -i" used showed and prompted to the user even when
+   the candidate list was empty, against which the only "choice" the
+   user could have made was to choose nothing.
+   (merge a9c4641 ak/add-i-empty-candidates later to maint).
+
+ * The insn sheet "git rebase -i" creates did not fully honor
+   core.abbrev settings.
+   (merge edb72d5 ks/rebase-i-abbrev later to maint).
+
+ * "git fetch" over a remote-helper that cannot respond to "list"
+   command could not fetch from a symbolic reference e.g. HEAD.
+   (merge 33cae54 mh/deref-symref-over-helper-transport later to maint).
+
+ * "git push --signed" gave an incorrectly worded error message when
+   the other side did not support the capability.
+   (merge 45917f0 jc/push-cert later to maint).
+
+ * We didn't format an integer that wouldn't fit in "int" but in
+   "uintmax_t" correctly.
+   (merge d306f3d jk/decimal-width-for-uintmax later to maint).
+
+ * Reading configuration from a blob object, when it ends with a lone
+   CR, use to confuse the configuration parser.
+   (merge 1d0655c jk/config-no-ungetc-eof later to maint).
+
+ * The pack bitmap support did not build with older versions of GCC.
+   (merge bd4e882 jk/pack-bitmap later to maint).
+
+ * The documentation wasn't clear that "remote.<nick>.pushURL" and
+   "remote.<nick>.URL" are there to name the same repository accessed
+   via different transports, not two separate repositories.
+   (merge 697f652 jc/remote-set-url-doc later to maint).
+
+ * Older GnuPG implementations may not correctly import the keyring
+   material we prepare for the tests to use.
+   (merge 1f985d6 ch/new-gpg-drops-rfc-1991 later to maint).
+
+ * The credential helper for Windows (in contrib/) used to mishandle
+   a user name with an at-sign in it.
+   (merge 13d261e av/wincred-with-at-in-username-fix later to maint).
+
+ * Longstanding configuration variable naming rules has been added to
+   the documentation.
+   (merge 35840a3 jc/conf-var-doc later to maint).
+
+ * An earlier workaround to squelch unhelpful deprecation warnings
+   from the complier on Mac OSX unnecessarily set minimum required
+   version of the OS, which the user might want to raise (or lower)
+   for other reasons.
+   (merge 88c03eb es/squelch-openssl-warnings-on-macosx later to maint).
+
+ * Certain older vintages of cURL give irregular output from
+   "curl-config --vernum", which confused our build system.
+   (merge 3af6792 tc/curl-vernum-output-broken-in-7.11 later to maint).
+
+ * In v2.2.0, we broke "git prune" that runs in a repository that
+   borrows from an alternate object store.
+   (merge b0a4264 jk/prune-mtime later to maint).
+
+ * "git submodule add" failed to squash "path/to/././submodule" to
+   "path/to/submodule".
+   (merge 8196e72 ps/submodule-sanitize-path-upon-add later to maint).
+
+ * "git merge-file" did not work correctly in a subdirectory.
+   (merge 204a8ff ab/merge-file-prefix later to maint).
+
+ * "git blame" died, trying to free an uninitialized piece of memory.
+   (merge e600592 es/blame-commit-info-fix later to maint).
+
+ * "git fast-import" used to crash when it could not close and
+   conclude the resulting packfile cleanly.
+   (merge 5e915f3 jk/fast-import-die-nicely-fix later to maint).
+
+ * "update-index --refresh" used to leak when an entry cannot be
+   refreshed for whatever reason.
+   (merge bc1c2ca sb/plug-leak-in-make-cache-entry later to maint).
+
+ * The "interpolated-path" option of "git daemon" inserted any string
+   client declared on the "host=" capability request without checking.
+   Sanitize and limit %H and %CH to a saner and a valid DNS name.
+   (merge b485373 jk/daemon-interpolate later to maint).
+
+ * "git daemon" looked up the hostname even when "%CH" and "%IP"
+   interpolations are not requested, which was unnecessary.
+   (merge dc8edc8 rs/daemon-interpolate later to maint).
+
+ * Even though we officially haven't dropped Perl 5.8 support, the
+   Getopt::Long package that came with it does not support "--no-"
+   prefix to negate a boolean option; manually add support to help
+   people with older Getopt::Long package.
+   (merge f471494 km/send-email-getopt-long-workarounds later to maint).
+
+ * "git apply" was not very careful about reading from, removing,
+   updating and creating paths outside the working tree (under
+   --index/--cached) or the current directory (when used as a
+   replacement for GNU patch).
+   (merge e0d201b jc/apply-beyond-symlink later to maint).
+
+ * A breakage to git-svn around v2.2 era that triggers premature
+   closing of FileHandle has been corrected.
+   (merge e426311 ew/svn-maint-fixes later to maint).
+
+ * We did not parse username followed by literal IPv6 address in SSH
+   transport URLs, e.g. ssh://user@[2001:db8::1]:22/repo.git
+   correctly.
+   (merge 3f55cca tb/connect-ipv6-parse-fix later to maint).
+
+ * The configuration variable 'mailinfo.scissors' was hard to
+   discover in the documentation.
+   (merge afb5de7 mm/am-c-doc later to maint).
+
+ * The interaction between "git submodule update" and the
+   submodule.*.update configuration was not clearly documented.
+   (merge 5c31acf ms/submodule-update-config-doc later to maint).
+
+ * "git diff --shortstat --dirstat=changes" showed a dirstat based on
+   lines that was never asked by the end user in addition to the
+   dirstat that the user asked for.
+   (merge ab27389 mk/diff-shortstat-dirstat-fix later to maint).
+
+ * "git remote add" mentioned "--tags" and "--no-tags" and was not
+   clear that fetch from the remote in the future will use the default
+   behaviour when neither is given to override it.
+   (merge aaba0ab mg/doc-remote-tags-or-not later to maint).
+
+ * Description given by "grep -h" for its --exclude-standard option
+   was phrased poorly.
+   (merge 77fdb8a nd/grep-exclude-standard-help-fix later to maint).
+
+ * "git rebase -i" recently started to include the number of
+   commits in the insn sheet to be processed, but on a platform
+   that prepends leading whitespaces to "wc -l" output, the numbers
+   are shown with extra whitespaces that aren't necessary.
+   (merge 2185d3b es/rebase-i-count-todo later to maint).
+
+ * The borrowed code in kwset API did not follow our usual convention
+   to use "unsigned char" to store values that range from 0-255.
+   (merge 189c860 bw/kwset-use-unsigned later to maint).
+
+ * A corrupt input to "git diff -M" used to cause it to segfault.
+   (merge 4d6be03 jk/diffcore-rename-duplicate later to maint).
+
+ * Certain builds of GPG triggered false breakages in a test.
+   (merge 3f88c1b mg/verify-commit later to maint).
+
+ * "git imap-send" learned to optionally talk with an IMAP server via
+   libcURL; because there is no other option when Git is built with
+   NO_OPENSSL option, use that codepath by default under such
+   configuration.
+   (merge dcd01ea km/imap-send-libcurl-options later to maint).
+
+ * "git log --decorate" did not reset colors correctly around the
+   branch names.
+   (merge 5ee8758 jc/decorate-leaky-separator-color later to maint).
+
+ * Code cleanups and documentaiton updates.
+   (merge 2ce63e9 rs/simple-cleanups later to maint).
+   (merge 33baa69 rj/no-xopen-source-for-cygwin later to maint).
+   (merge 817d03e jc/diff-test-updates later to maint).
+   (merge eb32c66 ak/t5516-typofix later to maint).
+   (merge bcd57cb mr/doc-clean-f-f later to maint).
+   (merge 0d6accc mg/doc-status-color-slot later to maint).
+   (merge 53e53c7 sg/completion-remote later to maint).
+   (merge 8fa7975 ak/git-done-help-cleanup later to maint).
+   (merge 9a6f128 rs/deflate-init-cleanup later to maint).
+   (merge 6f75d45 rs/use-isxdigit later to maint).
index d4ca0465639440ab35cd1045bc2655e5ccd6aabd..e119d06d2b1855faf6d4dcbef9e1a1a3f61a3e04 100644 (file)
@@ -14,7 +14,8 @@ the fully qualified variable name of the variable itself is the last
 dot-separated segment and the section name is everything before the last
 dot. The variable names are case-insensitive, allow only alphanumeric
 characters and `-`, and must start with an alphabetic character.  Some
-variables may appear multiple times.
+variables may appear multiple times; we say then that the variable is
+multivalued.
 
 Syntax
 ~~~~~~
@@ -25,7 +26,7 @@ blank lines are ignored.
 
 The file consists of sections and variables.  A section begins with
 the name of the section in square brackets and continues until the next
-section begins.  Section names are not case sensitive.  Only alphanumeric
+section begins.  Section names are case-insensitive.  Only alphanumeric
 characters, `-` and `.` are allowed in section names.  Each variable
 must belong to some section, which means that there must be a section
 header before the first setting of a variable.
@@ -40,8 +41,8 @@ in the section header, like in the example below:
 --------
 
 Subsection names are case sensitive and can contain any characters except
-newline (doublequote `"` and backslash have to be escaped as `\"` and `\\`,
-respectively).  Section headers cannot span multiple
+newline (doublequote `"` and backslash can be included by escaping them
+as `\"` and `\\`, respectively).  Section headers cannot span multiple
 lines.  Variables may belong directly to a section or to a given subsection.
 You can have `[section]` if you have `[section "subsection"]`, but you
 don't need to.
@@ -53,38 +54,27 @@ restrictions as section names.
 
 All the other lines (and the remainder of the line after the section
 header) are recognized as setting variables, in the form
-'name = value'.  If there is no equal sign on the line, the entire line
-is taken as 'name' and the variable is recognized as boolean "true".
+'name = value' (or just 'name', which is a short-hand to say that
+the variable is the boolean "true").
 The variable names are case-insensitive, allow only alphanumeric characters
-and `-`, and must start with an alphabetic character.  There can be more
-than one value for a given variable; we say then that the variable is
-multivalued.
+and `-`, and must start with an alphabetic character.
 
-Leading and trailing whitespace in a variable value is discarded.
-Internal whitespace within a variable value is retained verbatim.
+A line that defines a value can be continued to the next line by
+ending it with a `\`; the backquote and the end-of-line are
+stripped.  Leading whitespaces after 'name =', the remainder of the
+line after the first comment character '#' or ';', and trailing
+whitespaces of the line are discarded unless they are enclosed in
+double quotes.  Internal whitespaces within the value are retained
+verbatim.
 
-The values following the equals sign in variable assign are all either
-a string, an integer, or a boolean.  Boolean values may be given as yes/no,
-1/0, true/false or on/off.  Case is not significant in boolean values, when
-converting value to the canonical form using '--bool' type specifier;
-'git config' will ensure that the output is "true" or "false".
-
-String values may be entirely or partially enclosed in double quotes.
-You need to enclose variable values in double quotes if you want to
-preserve leading or trailing whitespace, or if the variable value contains
-comment characters (i.e. it contains '#' or ';').
-Double quote `"` and backslash `\` characters in variable values must
-be escaped: use `\"` for `"` and `\\` for `\`.
+Inside double quotes, double quote `"` and backslash `\` characters
+must be escaped: use `\"` for `"` and `\\` for `\`.
 
 The following escape sequences (beside `\"` and `\\`) are recognized:
 `\n` for newline character (NL), `\t` for horizontal tabulation (HT, TAB)
 and `\b` for backspace (BS).  Other char escape sequences (including octal
 escape sequences) are invalid.
 
-Variable values ending in a `\` are continued on the next line in the
-customary UNIX fashion.
-
-Some variables may require a special value format.
 
 Includes
 ~~~~~~~~
@@ -126,6 +116,60 @@ Example
                path = foo ; expand "foo" relative to the current file
                path = ~/foo ; expand "foo" in your $HOME directory
 
+
+Values
+~~~~~~
+
+Values of many variables are treated as a simple string, but there
+are variables that take values of specific types and there are rules
+as to how to spell them.
+
+boolean::
+
+       When a variable is said to take a boolean value, many
+       synonyms are accepted for 'true' and 'false'; these are all
+       case-insensitive.
+
+       true;; Boolean true can be spelled as `yes`, `on`, `true`,
+               or `1`.  Also, a variable defined without `= <value>`
+               is taken as true.
+
+       false;; Boolean false can be spelled as `no`, `off`,
+               `false`, or `0`.
++
+When converting value to the canonical form using '--bool' type
+specifier; 'git config' will ensure that the output is "true" or
+"false" (spelled in lowercase).
+
+integer::
+       The value for many variables that specify various sizes can
+       be suffixed with `k`, `M`,... to mean "scale the number by
+       1024", "by 1024x1024", etc.
+
+color::
+       The value for a variables that takes a color is a list of
+       colors (at most two) and attributes (at most one), separated
+       by spaces.  The colors accepted are `normal`, `black`,
+       `red`, `green`, `yellow`, `blue`, `magenta`, `cyan` and
+       `white`; the attributes are `bold`, `dim`, `ul`, `blink` and
+       `reverse`.  The first color given is the foreground; the
+       second is the background.  The position of the attribute, if
+       any, doesn't matter. Attributes may be turned off specifically
+       by prefixing them with `no` (e.g., `noreverse`, `noul`, etc).
++
+Colors (foreground and background) may also be given as numbers between
+0 and 255; these use ANSI 256-color mode (but note that not all
+terminals may support this).  If your terminal supports it, you may also
+specify 24-bit RGB values as hex, like `#ff0ab3`.
++
+The attributes are meant to be reset at the beginning of each item
+in the colored output, so setting color.decorate.branch to `black`
+will paint that branch name in a plain `black`, even if the previous
+thing on the same output line (e.g. opening parenthesis before the
+list of branch names in `log --decorate` output) is set to be
+painted with `bold` or some other attribute.
+
+
 Variables
 ~~~~~~~~~
 
@@ -846,20 +890,6 @@ color.branch.<slot>::
        `remote` (a remote-tracking branch in refs/remotes/),
        `upstream` (upstream tracking branch), `plain` (other
        refs).
-+
-The value for these configuration variables is a list of colors (at most
-two) and attributes (at most one), separated by spaces.  The colors
-accepted are `normal`, `black`, `red`, `green`, `yellow`, `blue`,
-`magenta`, `cyan` and `white`; the attributes are `bold`, `dim`, `ul`,
-`blink` and `reverse`.  The first color given is the foreground; the
-second is the background.  The position of the attribute, if any,
-doesn't matter. Attributes may be turned off specifically by prefixing
-them with `no` (e.g., `noreverse`, `noul`, etc).
-+
-Colors (foreground and background) may also be given as numbers between
-0 and 255; these use ANSI 256-color mode (but note that not all
-terminals may support this).  If your terminal supports it, you may also
-specify 24-bit RGB values as hex, like `#ff0ab3`.
 
 color.diff::
        Whether to use ANSI escape sequences to add color to patches.
@@ -879,8 +909,7 @@ color.diff.<slot>::
        of `plain` (context text), `meta` (metainformation), `frag`
        (hunk header), 'func' (function in hunk header), `old` (removed lines),
        `new` (added lines), `commit` (commit headers), or `whitespace`
-       (highlighting whitespace errors). The values of these variables may be
-       specified as in color.branch.<slot>.
+       (highlighting whitespace errors).
 
 color.decorate.<slot>::
        Use customized color for 'git log --decorate' output.  `<slot>` is one
@@ -917,8 +946,6 @@ color.grep.<slot>::
        separators between fields on a line (`:`, `-`, and `=`)
        and between hunks (`--`)
 --
-+
-The values of these variables may be specified as in color.branch.<slot>.
 
 color.interactive::
        When set to `always`, always use colors for interactive prompts
@@ -931,8 +958,7 @@ color.interactive.<slot>::
        Use customized color for 'git add --interactive' and 'git clean
        --interactive' output. `<slot>` may be `prompt`, `header`, `help`
        or `error`, for four distinct types of normal output from
-       interactive commands.  The values of these variables may be
-       specified as in color.branch.<slot>.
+       interactive commands.
 
 color.pager::
        A boolean to enable/disable colored output when the pager is in
@@ -956,10 +982,10 @@ color.status.<slot>::
        `added` or `updated` (files which are added but not committed),
        `changed` (files which are changed but not added in the index),
        `untracked` (files which are not tracked by Git),
-       `branch` (the current branch), or
+       `branch` (the current branch),
        `nobranch` (the color the 'no branch' warning is shown in, defaulting
-       to red). The values of these variables may be specified as in
-       color.branch.<slot>.
+       to red), or
+       `unmerged` (files which have unmerged changes).
 
 color.ui::
        This variable determines the default value for variables such
@@ -2558,6 +2584,18 @@ user.signingKey::
        This option is passed unchanged to gpg's --local-user parameter,
        so you may specify a key using any method that gpg supports.
 
+versionsort.prereleaseSuffix::
+       When version sort is used in linkgit:git-tag[1], prerelease
+       tags (e.g. "1.0-rc1") may appear after the main release
+       "1.0". By specifying the suffix "-rc" in this variable,
+       "1.0-rc1" will appear before "1.0".
++
+This variable can be specified multiple times, once per suffix. The
+order of suffixes in the config file determines the sorting order
+(e.g. if "-pre" appears before "-rc" in the config file then 1.0-preXX
+is sorted before 1.0-rcXX). The sorting order between different
+suffixes is undefined if they are in multiple config files.
+
 web.browser::
        Specify a web browser that may be used by some commands.
        Currently only linkgit:git-instaweb[1] and linkgit:git-help[1]
index b75a122d2eb41aaf849f4486af836df006f941a5..617e29b38b337a40d8aede609d9d979c1b3aac02 100644 (file)
@@ -284,6 +284,10 @@ configuration variable documented in linkgit:git-config[1].
        would be committed at the bottom of the commit message
        template.  Note that this diff output doesn't have its
        lines prefixed with '#'.
++
+If specified twice, show in addition the unified diff between
+what would be committed and the worktree files, i.e. the unstaged
+changes to tracked files.
 
 -q::
 --quiet::
index 77aacf130936435970a945e4d687d01c12b1a0f9..5d1e4c80cd5d479a43c39ffb12b66a7302e754e7 100644 (file)
@@ -44,7 +44,8 @@ OPTIONS
 
 --no-curl::
        Talk to the IMAP server using git's own IMAP routines instead of
-       using libcurl.
+       using libcurl.  Ignored if Git was built with the NO_OPENSSL option
+       set.
 
 
 CONFIGURATION
index 4269907109e75c031dcbb56ed7ba054f87bf1ec9..c0022920c0c644bba2ff9059ccbeb175d55aec30 100644 (file)
@@ -43,9 +43,10 @@ unreleased) version of Git, that is available from the 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
-* link:v2.3.2/git.html[documentation for release 2.3.2]
+* link:v2.3.3/git.html[documentation for release 2.3.3]
 
 * release notes for
+  link:RelNotes/2.3.3.txt[2.3.3],
   link:RelNotes/2.3.2.txt[2.3.2],
   link:RelNotes/2.3.1.txt[2.3.1],
   link:RelNotes/2.3.0.txt[2.3].
index 50078659fcec88359310e9db691ed6b2ae9ade0e..734fa9b4347ac1f65ad35ada88098404d92fcb25 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.3.2
+DEF_VER=v2.3.3.GIT
 
 LF='
 '
index 44f1dd10ff508c03d10704f497c32868762243ce..5f3987fe3bd945fb5a84c9f45a8de7da5581f79a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -357,6 +357,8 @@ all::
 # and define it to "no" if you need to remove the parentheses () around the
 # constant.  The default is "auto", which means to use parentheses if your
 # compiler is detected to support it.
+#
+# Define HAVE_BSD_SYSCTL if your platform has a BSD-compatible sysctl function.
 
 GIT-VERSION-FILE: FORCE
        @$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1431,6 +1433,10 @@ ifdef HAVE_CLOCK_MONOTONIC
        BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
 endif
 
+ifdef HAVE_BSD_SYSCTL
+       BASIC_CFLAGS += -DHAVE_BSD_SYSCTL
+endif
+
 ifeq ($(TCLTK_PATH),)
 NO_TCLTK = NoThanks
 endif
deleted file mode 100644 (file)
index 1662a7beba42190b8e0c6e314fc90587b6c79ff2..0000000000000000000000000000000000000000
--- a/RelNotes
+++ /dev/null
@@ -1,299 +0,0 @@
-Git ???? Release Notes
-======================
-
-Updates since v2.3
-------------------
-
-Ports
-
- * Our default I/O size (8 MiB) for large files was too large for some
-   platforms with smaller SSIZE_MAX, leading to read(2)/write(2)
-   failures.
-
- * We did not check the curl library version before using
-   CURLOPT_PROXYAUTH feature that may not exist.
-
-
-UI, Workflows & Features
-
- * The command usage info strings given by "git cmd -h" and in
-   documentation have been tweaked for consistency.
-
- * The "sync" subcommand of "git p4" now allows users to exclude
-   subdirectories like its "clone" subcommand does.
-
- * "git log --invert-grep --grep=WIP" will show only commits that do
-   not have the string "WIP" in their messages.
-
- * "git push" has been taught a "--atomic" option that makes push to
-   update more than one ref an "all-or-none" affair.
-
- * Extending the "push to deploy" added in 2.3, the behaviour of "git
-   push" when updating the branch that is checked out can now be
-   tweaked by push-to-checkout hook.
-
- * Using environment variable LANGUAGE and friends on the client side,
-   HTTP-based transports now send Accept-Language when making requests.
-
- * "git send-email" used to accept a mistaken "y" (or "yes") as an
-   answer to "What encoding do you want to use [UTF-8]? " without
-   questioning.  Now it asks for confirmation when the answer looks
-   too short to be a valid encoding name.
-
- * When "git apply --whitespace=fix" fixed whitespace errors in the
-   common context lines, the command reports that it did so.
-
-
-Performance, Internal Implementation, Development Support etc.
-
- * Implementation of N_() macro has been updated slightly to help us
-   detect mistakes.
-
- * Implementation of "reflog expire" has been restructured to fit the
-   reflogs better with the recently updated ref API.
-
- * The transport-helper did not give transport options such as
-   verbosity, progress, cloning, etc. to import and export based
-   helpers, like it did for fetch and push based helpers, robbing them
-   the chance to honor the wish of the end-users better.
-
- * The tests that wanted to see that file becomes unreadable after
-   running "chmod a-r file", and the tests that wanted to make sure it
-   is not run as root, we used "can we write into the / directory?" as
-   a cheap substitute, but on some platforms that is not a good
-   heuristics.  The tests and their prerequisites have been updated to
-   check what they really require.
-   (merge f400e51 jk/sanity later to maint).
-
- * Various issues around "reflog expire", e.g. using --updateref when
-   expiring a reflog for a symbolic reference, have been corrected
-   and/or made saner.
-
- * The strbuf API was explained between the API documentation and in
-   the header file.  Move missing bits to strbuf.h so that programmers
-   can check only one place for all necessary information.
-
- * The error handling functions and conventions are now documented in
-   the API manual.
-
- * Optimize attribute look-up, mostly useful in "git grep" on a
-   project that does not use many attributes, by avoiding it when we
-   (should) know that the attributes are not defined in the first
-   place.
-
- * Typofix in comments.
-   (merge ef2956a ak/git-pm-typofix later to maint).
-
- * Code clean-up.
-   (merge 0b868f0 sb/hex-object-name-is-at-most-41-bytes-long later to maint).
-   (merge 5d30851 dp/remove-duplicated-header-inclusion later to maint).
-
- * Simplify the ref transaction API around how "the ref should be
-   pointing at this object" is specified.
-
-
-Also contains various documentation updates and code clean-ups.
-
-
-Fixes since v2.3
-----------------
-
-Unless otherwise noted, all the fixes since v2.3 in the maintenance
-track are contained in this release (see the maintenance releases'
-notes for details).
-
- * "git blame HEAD -- missing" failed to correctly say "HEAD" when it
-   tried to say "No such path 'missing' in HEAD".
-   (merge a46442f jk/blame-commit-label later to maint).
-
- * "git rerere" (invoked internally from many mergy operations) did
-   not correctly signal errors when told to update the working tree
-   files and failed to do so for whatever reason.
-   (merge 89ea903 jn/rerere-fail-on-auto-update-failure later to maint).
-
- * Setting diff.submodule to 'log' made "git format-patch" produce
-   broken patches.
-   (merge 339de50 dk/format-patch-ignore-diff-submodule later to maint).
-
- * After attempting and failing a password-less authentication
-   (e.g. kerberos), libcURL refuses to fall back to password based
-   Basic authentication without a bit of help/encouragement.
-   (merge 4dbe664 bc/http-fallback-to-password-after-krb-fails later to maint).
-
- * The "git push" documentation made the "--repo=<there>" option
-   easily misunderstood.
-   (merge 57b92a7 mg/push-repo-option-doc later to maint).
-
- * Code to read branch name from various files in .git/ directory
-   would have misbehaved if the code to write them left an empty file.
-   (merge 66ec904 jk/status-read-branch-name-fix later to maint).
-
- * A misspelled conditional that is always true has been fixed.
-   (merge 94ee8e2 jk/remote-curl-an-array-in-struct-cannot-be-null later to maint).
-
- * The documentation incorrectly said that C(opy) and R(ename) are the
-   only ones that can be followed by the score number in the output in
-   the --raw format.
-   (merge ac1c2d9 jc/diff-format-doc later to maint).
-
- * A broken pack .idx file in the receiving repository prevented the
-   dumb http transport from fetching a good copy of it from the other
-   side.
-   (merge 8b9c2dd jk/dumb-http-idx-fetch-fix later to maint).
-
- * The error message from "git commit", when a non-existing author
-   name was given as value to the "--author=" parameter, has been
-   reworded to avoid misunderstanding.
-   (merge 1044b1f mg/commit-author-no-match-malformed-message later to maint).
-
- * "git log --help" used to show rev-list options that are irrelevant
-   to the "log" command.
-   (merge 3cab02d jc/doc-log-rev-list-options later to maint).
-
- * "git apply --whitespace=fix" used to under-allocate the memory when
-   the fix resulted in a longer text than the original patch.
-   (merge 407a792 jc/apply-ws-fix-expands later to maint).
-
- * The interactive "show a list and let the user choose from it"
-   interface "add -i" used showed and prompted to the user even when
-   the candidate list was empty, against which the only "choice" the
-   user could have made was to choose nothing.
-   (merge a9c4641 ak/add-i-empty-candidates later to maint).
-
- * The insn sheet "git rebase -i" creates did not fully honor
-   core.abbrev settings.
-   (merge edb72d5 ks/rebase-i-abbrev later to maint).
-
- * "git fetch" over a remote-helper that cannot respond to "list"
-   command could not fetch from a symbolic reference e.g. HEAD.
-   (merge 33cae54 mh/deref-symref-over-helper-transport later to maint).
-
- * "git push --signed" gave an incorrectly worded error message when
-   the other side did not support the capability.
-   (merge 45917f0 jc/push-cert later to maint).
-
- * We didn't format an integer that wouldn't fit in "int" but in
-   "uintmax_t" correctly.
-   (merge d306f3d jk/decimal-width-for-uintmax later to maint).
-
- * Reading configuration from a blob object, when it ends with a lone
-   CR, use to confuse the configuration parser.
-   (merge 1d0655c jk/config-no-ungetc-eof later to maint).
-
- * The pack bitmap support did not build with older versions of GCC.
-   (merge bd4e882 jk/pack-bitmap later to maint).
-
- * The documentation wasn't clear that "remote.<nick>.pushURL" and
-   "remote.<nick>.URL" are there to name the same repository accessed
-   via different transports, not two separate repositories.
-   (merge 697f652 jc/remote-set-url-doc later to maint).
-
- * Older GnuPG implementations may not correctly import the keyring
-   material we prepare for the tests to use.
-   (merge 1f985d6 ch/new-gpg-drops-rfc-1991 later to maint).
-
- * The credential helper for Windows (in contrib/) used to mishandle
-   a user name with an at-sign in it.
-   (merge 13d261e av/wincred-with-at-in-username-fix later to maint).
-
- * Longstanding configuration variable naming rules has been added to
-   the documentation.
-   (merge 35840a3 jc/conf-var-doc later to maint).
-
- * An earlier workaround to squelch unhelpful deprecation warnings
-   from the complier on Mac OSX unnecessarily set minimum required
-   version of the OS, which the user might want to raise (or lower)
-   for other reasons.
-   (merge 88c03eb es/squelch-openssl-warnings-on-macosx later to maint).
-
- * Certain older vintages of cURL give irregular output from
-   "curl-config --vernum", which confused our build system.
-   (merge 3af6792 tc/curl-vernum-output-broken-in-7.11 later to maint).
-
- * In v2.2.0, we broke "git prune" that runs in a repository that
-   borrows from an alternate object store.
-   (merge b0a4264 jk/prune-mtime later to maint).
-
- * "git submodule add" failed to squash "path/to/././submodule" to
-   "path/to/submodule".
-   (merge 8196e72 ps/submodule-sanitize-path-upon-add later to maint).
-
- * "git merge-file" did not work correctly in a subdirectory.
-   (merge 204a8ff ab/merge-file-prefix later to maint).
-
- * "git blame" died, trying to free an uninitialized piece of memory.
-   (merge e600592 es/blame-commit-info-fix later to maint).
-
- * "git fast-import" used to crash when it could not close and
-   conclude the resulting packfile cleanly.
-   (merge 5e915f3 jk/fast-import-die-nicely-fix later to maint).
-
- * "update-index --refresh" used to leak when an entry cannot be
-   refreshed for whatever reason.
-   (merge bc1c2ca sb/plug-leak-in-make-cache-entry later to maint).
-
- * The "interpolated-path" option of "git daemon" inserted any string
-   client declared on the "host=" capability request without checking.
-   Sanitize and limit %H and %CH to a saner and a valid DNS name.
-   (merge b485373 jk/daemon-interpolate later to maint).
-
- * "git daemon" looked up the hostname even when "%CH" and "%IP"
-   interpolations are not requested, which was unnecessary.
-   (merge dc8edc8 rs/daemon-interpolate later to maint).
-
- * Even though we officially haven't dropped Perl 5.8 support, the
-   Getopt::Long package that came with it does not support "--no-"
-   prefix to negate a boolean option; manually add support to help
-   people with older Getopt::Long package.
-   (merge f471494 km/send-email-getopt-long-workarounds later to maint).
-
- * "git apply" was not very careful about reading from, removing,
-   updating and creating paths outside the working tree (under
-   --index/--cached) or the current directory (when used as a
-   replacement for GNU patch).
-   (merge e0d201b jc/apply-beyond-symlink later to maint).
-
- * A breakage to git-svn around v2.2 era that triggers premature
-   closing of FileHandle has been corrected.
-   (merge e426311 ew/svn-maint-fixes later to maint).
-
- * We did not parse username followed by literal IPv6 address in SSH
-   transport URLs, e.g. ssh://user@[2001:db8::1]:22/repo.git
-   correctly.
-   (merge 3f55cca tb/connect-ipv6-parse-fix later to maint).
-
- * The configuration variable 'mailinfo.scissors' was hard to
-   discover in the documentation.
-   (merge afb5de7 mm/am-c-doc later to maint).
-
- * The interaction between "git submodule update" and the
-   submodule.*.update configuration was not clearly documented.
-   (merge 5c31acf ms/submodule-update-config-doc later to maint).
-
- * "git diff --shortstat --dirstat=changes" showed a dirstat based on
-   lines that was never asked by the end user in addition to the
-   dirstat that the user asked for.
-   (merge ab27389 mk/diff-shortstat-dirstat-fix later to maint).
-
- * "git remote add" mentioned "--tags" and "--no-tags" and was not
-   clear that fetch from the remote in the future will use the default
-   behaviour when neither is given to override it.
-   (merge aaba0ab mg/doc-remote-tags-or-not later to maint).
-
- * Description given by "grep -h" for its --exclude-standard option
-   was phrased poorly.
-   (merge 77fdb8a nd/grep-exclude-standard-help-fix later to maint).
-
- * The borrowed code in kwset API did not follow our usual convention
-   to use "unsigned char" to store values that range from 0-255.
-   (merge 189c860 bw/kwset-use-unsigned later to maint).
-
- * A corrupt input to "git diff -M" used to cause it to segfault.
-   (merge 4d6be03 jk/diffcore-rename-duplicate later to maint).
-
- * Code cleanups and documentaiton updates.
-   (merge 2ce63e9 rs/simple-cleanups later to maint).
-   (merge 33baa69 rj/no-xopen-source-for-cygwin later to maint).
-   (merge 817d03e jc/diff-test-updates later to maint).
-   (merge eb32c66 ak/t5516-typofix later to maint).
-   (merge bcd57cb mr/doc-clean-f-f later to maint).
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..1addbec92533510e6e368c607deb36e504bbc438
--- /dev/null
+++ b/RelNotes
@@ -0,0 +1 @@
+Documentation/RelNotes/2.4.0.txt
\ No newline at end of file
index 4bde019bce632703d4e336d6404693487cdbcdfb..ffb3535e93dca2135724d998657b80c2bc4d6f20 100644 (file)
@@ -5,6 +5,8 @@
 #include "archive.h"
 #include "streaming.h"
 #include "utf8.h"
+#include "userdiff.h"
+#include "xdiff-interface.h"
 
 static int zip_date;
 static int zip_time;
@@ -120,7 +122,6 @@ static void *zlib_deflate_raw(void *data, unsigned long size,
        void *buffer;
        int result;
 
-       memset(&stream, 0, sizeof(stream));
        git_deflate_init_raw(&stream, compression_level);
        maxsize = git_deflate_bound(&stream, size);
        buffer = xmalloc(maxsize);
@@ -189,6 +190,16 @@ static int has_only_ascii(const char *s)
        }
 }
 
+static int entry_is_binary(const char *path, const void *buffer, size_t size)
+{
+       struct userdiff_driver *driver = userdiff_find_by_path(path);
+       if (!driver)
+               driver = userdiff_find_by_name("default");
+       if (driver->binary != -1)
+               return driver->binary;
+       return buffer_is_binary(buffer, size);
+}
+
 #define STREAM_BUFFER_SIZE (1024 * 16)
 
 static int write_zip_entry(struct archiver_args *args,
@@ -210,6 +221,8 @@ static int write_zip_entry(struct archiver_args *args,
        struct git_istream *stream = NULL;
        unsigned long flags = 0;
        unsigned long size;
+       int is_binary = -1;
+       const char *path_without_prefix = path + args->baselen;
 
        crc = crc32(0, NULL, 0);
 
@@ -256,6 +269,8 @@ static int write_zip_entry(struct archiver_args *args,
                                return error("cannot read %s",
                                             sha1_to_hex(sha1));
                        crc = crc32(crc, buffer, size);
+                       is_binary = entry_is_binary(path_without_prefix,
+                                                   buffer, size);
                        out = buffer;
                }
                compressed_size = (method == 0) ? size : 0;
@@ -300,7 +315,6 @@ static int write_zip_entry(struct archiver_args *args,
        copy_le16(dirent.extra_length, ZIP_EXTRA_MTIME_SIZE);
        copy_le16(dirent.comment_length, 0);
        copy_le16(dirent.disk, 0);
-       copy_le16(dirent.attr1, 0);
        copy_le32(dirent.attr2, attr2);
        copy_le32(dirent.offset, zip_offset);
 
@@ -328,6 +342,9 @@ static int write_zip_entry(struct archiver_args *args,
                        if (readlen <= 0)
                                break;
                        crc = crc32(crc, buf, readlen);
+                       if (is_binary == -1)
+                               is_binary = entry_is_binary(path_without_prefix,
+                                                           buf, readlen);
                        write_or_die(1, buf, readlen);
                }
                close_istream(stream);
@@ -349,7 +366,6 @@ static int write_zip_entry(struct archiver_args *args,
                size_t out_len;
                unsigned char compressed[STREAM_BUFFER_SIZE * 2];
 
-               memset(&zstream, 0, sizeof(zstream));
                git_deflate_init_raw(&zstream, args->compression_level);
 
                compressed_size = 0;
@@ -361,6 +377,9 @@ static int write_zip_entry(struct archiver_args *args,
                        if (readlen <= 0)
                                break;
                        crc = crc32(crc, buf, readlen);
+                       if (is_binary == -1)
+                               is_binary = entry_is_binary(path_without_prefix,
+                                                           buf, readlen);
 
                        zstream.next_in = buf;
                        zstream.avail_in = readlen;
@@ -405,6 +424,8 @@ static int write_zip_entry(struct archiver_args *args,
        free(deflated);
        free(buffer);
 
+       copy_le16(dirent.attr1, !is_binary);
+
        memcpy(zip_dir + zip_dir_offset, &dirent, ZIP_DIR_HEADER_SIZE);
        zip_dir_offset += ZIP_DIR_HEADER_SIZE;
        memcpy(zip_dir + zip_dir_offset, path, pathlen);
index 6a25957e9f9daff6ab127f8feb91d9349075741e..1d150378e91cd47c4cd555bfc858ec0b7ea9d604 100644 (file)
@@ -589,9 +589,16 @@ static char *get_head_description(void)
        else if (state.bisect_in_progress)
                strbuf_addf(&desc, _("(no branch, bisect started on %s)"),
                            state.branch);
-       else if (state.detached_from)
-               strbuf_addf(&desc, _("(detached from %s)"),
-                           state.detached_from);
+       else if (state.detached_from) {
+               /* TRANSLATORS: make sure these match _("HEAD detached at ")
+                  and _("HEAD detached from ") in wt-status.c */
+               if (state.detached_at)
+                       strbuf_addf(&desc, _("(HEAD detached at %s)"),
+                               state.detached_from);
+               else
+                       strbuf_addf(&desc, _("(HEAD detached from %s)"),
+                               state.detached_from);
+       }
        else
                strbuf_addstr(&desc, _("(no branch)"));
        free(state.branch);
index 6133fe496b00e30a33d03c2d49b22a6ff81f9c77..3422e7307998b9da91f85512084aeae515022a60 100644 (file)
@@ -171,7 +171,7 @@ static void exec_man_cmd(const char *cmd, const char *page)
 {
        struct strbuf shell_cmd = STRBUF_INIT;
        strbuf_addf(&shell_cmd, "%s %s", cmd, page);
-       execl("/bin/sh", "sh", "-c", shell_cmd.buf, (char *)NULL);
+       execl(SHELL_PATH, SHELL_PATH, "-c", shell_cmd.buf, (char *)NULL);
        warning(_("failed to exec '%s': %s"), cmd, strerror(errno));
 }
 
@@ -456,7 +456,7 @@ static void list_common_guides_help(void)
 int cmd_help(int argc, const char **argv, const char *prefix)
 {
        int nongit;
-       const char *alias;
+       char *alias;
        enum help_format parsed_help_format;
 
        argc = parse_options(argc, argv, prefix, builtin_help_options,
@@ -499,6 +499,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
        alias = alias_lookup(argv[0]);
        if (alias && !is_git_command(argv[0])) {
                printf_ln(_("`git %s' is aliased to `%s'"), argv[0], alias);
+               free(alias);
                return 0;
        }
 
index 46321176719808dd53a38675dd0d9c558ae336dd..cf654df09b3734063f415b2b735f3062706f75a0 100644 (file)
@@ -1204,7 +1204,6 @@ static int write_compressed(struct sha1file *f, void *in, unsigned int size)
        int status;
        unsigned char outbuf[4096];
 
-       memset(&stream, 0, sizeof(stream));
        git_deflate_init(&stream, zlib_compression_level);
        stream.next_in = in;
        stream.avail_in = size;
index d8165878e1d466e49719038b1badc524d5627270..c3a75166bd10918d21d3df19832880c4373dc8d7 100644 (file)
@@ -125,7 +125,6 @@ static unsigned long do_compress(void **pptr, unsigned long size)
        void *in, *out;
        unsigned long maxsize;
 
-       memset(&stream, 0, sizeof(stream));
        git_deflate_init(&stream, pack_compression_level);
        maxsize = git_deflate_bound(&stream, size);
 
@@ -153,7 +152,6 @@ static unsigned long write_large_blob_data(struct git_istream *st, struct sha1fi
        unsigned char obuf[1024 * 16];
        unsigned long olen = 0;
 
-       memset(&stream, 0, sizeof(stream));
        git_deflate_init(&stream, pack_compression_level);
 
        for (;;) {
index 4194b9a711d88e6d3575cd8896b1a81de74b087f..6f07ac6b93c3e36a1bc69d43e6e12ca3367b4c34 100644 (file)
@@ -605,13 +605,13 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                OPT_STRING('u', "local-user", &keyid, N_("key-id"),
                                        N_("use another key to sign the tag")),
                OPT__FORCE(&force, N_("replace the tag if exists")),
+
+               OPT_GROUP(N_("Tag listing options")),
                OPT_COLUMN(0, "column", &colopts, N_("show tag list in columns")),
                {
                        OPTION_CALLBACK, 0, "sort", &tag_sort, N_("type"), N_("sort tags"),
                        PARSE_OPT_NONEG, parse_opt_sort
                },
-
-               OPT_GROUP(N_("Tag listing options")),
                {
                        OPTION_CALLBACK, 0, "contains", &with_commit, N_("commit"),
                        N_("print only tags that contain the commit"),
index 0c4b8a7cad085fa1c7760e6290f21213830eda3d..8d157eba455f15a00cc7bf9b970f1862167ee1bb 100644 (file)
@@ -105,7 +105,6 @@ static int stream_to_pack(struct bulk_checkin_state *state,
        int write_object = (flags & HASH_WRITE_OBJECT);
        off_t offset = 0;
 
-       memset(&s, 0, sizeof(s));
        git_deflate_init(&s, pack_compression_level);
 
        hdrlen = encode_in_pack_object_header(type, size, obuf);
index 2e2dbd50efbf2eca2b36f6dd7ceeb68bbecc90ba..f732c920aadd7515d56f7d344f771fb9d362f042 100644 (file)
--- a/bundle.c
+++ b/bundle.c
@@ -334,7 +334,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                if (e->item->flags & UNINTERESTING)
                        continue;
                if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1)
-                       continue;
+                       goto skip_write_ref;
                if (read_ref_full(e->name, RESOLVE_REF_READING, sha1, &flag))
                        flag = 0;
                display_ref = (flag & REF_ISSYMREF) ? e->name : ref;
@@ -342,7 +342,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                if (e->item->type == OBJ_TAG &&
                                !is_tag_in_date_range(e->item, revs)) {
                        e->item->flags |= UNINTERESTING;
-                       continue;
+                       goto skip_write_ref;
                }
 
                /*
@@ -357,8 +357,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                if (!(e->item->flags & SHOWN) && e->item->type == OBJ_COMMIT) {
                        warning(_("ref '%s' is excluded by the rev-list options"),
                                e->name);
-                       free(ref);
-                       continue;
+                       goto skip_write_ref;
                }
                /*
                 * If you run "git bundle create bndl v1.0..v2.0", the
@@ -388,8 +387,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                                obj->flags |= SHOWN;
                                add_pending_object(revs, obj, e->name);
                        }
-                       free(ref);
-                       continue;
+                       goto skip_write_ref;
                }
 
                ref_count++;
@@ -397,6 +395,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
                write_or_die(bundle_fd, " ", 1);
                write_or_die(bundle_fd, display_ref, strlen(display_ref));
                write_or_die(bundle_fd, "\n", 1);
+ skip_write_ref:
                free(ref);
        }
 
index b64b63c34c315561110c5d9f3e334ebd633d095b..f4e77cb9e5099cd3de723ad98894c92d516f176e 100644 (file)
@@ -107,6 +107,7 @@ ifeq ($(uname_S),Darwin)
        COMPAT_OBJS += compat/precompose_utf8.o
        BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
        BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
+       HAVE_BSD_SYSCTL = YesPlease
 endif
 ifeq ($(uname_S),SunOS)
        NEEDS_SOCKET = YesPlease
@@ -199,6 +200,7 @@ ifeq ($(uname_S),FreeBSD)
        PYTHON_PATH = /usr/local/bin/python
        HAVE_PATHS_H = YesPlease
        GMTIME_UNRELIABLE_ERRORS = UnfortunatelyYes
+       HAVE_BSD_SYSCTL = YesPlease
 endif
 ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
@@ -208,6 +210,7 @@ ifeq ($(uname_S),OpenBSD)
        BASIC_CFLAGS += -I/usr/local/include
        BASIC_LDFLAGS += -L/usr/local/lib
        HAVE_PATHS_H = YesPlease
+       HAVE_BSD_SYSCTL = YesPlease
 endif
 ifeq ($(uname_S),MirBSD)
        NO_STRCASESTR = YesPlease
@@ -215,6 +218,7 @@ ifeq ($(uname_S),MirBSD)
        USE_ST_TIMESPEC = YesPlease
        NEEDS_LIBICONV = YesPlease
        HAVE_PATHS_H = YesPlease
+       HAVE_BSD_SYSCTL = YesPlease
 endif
 ifeq ($(uname_S),NetBSD)
        ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
@@ -225,6 +229,7 @@ ifeq ($(uname_S),NetBSD)
        USE_ST_TIMESPEC = YesPlease
        NO_MKSTEMPS = YesPlease
        HAVE_PATHS_H = YesPlease
+       HAVE_BSD_SYSCTL = YesPlease
 endif
 ifeq ($(uname_S),AIX)
        DEFAULT_PAGER = more
index 55e5a9b3e6c39f15d9d4cf419a72ee963713b662..bbdde85c3dcca460dd0aebee6415ccce184885dc 100644 (file)
@@ -1046,6 +1046,29 @@ GIT_CONF_SUBST([NO_INITGROUPS])
 #
 # Define NO_ICONV if your libc does not properly support iconv.
 
+AC_DEFUN([BSD_SYSCTL_SRC], [
+AC_LANG_PROGRAM([[
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+]],[[
+int val, mib[2];
+size_t len;
+mib[0] = CTL_HW;
+mib[1] = 1;
+len = sizeof(val);
+return sysctl(mib, 2, &val, &len, NULL, 0) ? 1 : 0;
+]])])
+
+#
+# Define HAVE_BSD_SYSCTL=YesPlease if a BSD-compatible sysctl function is available.
+AC_MSG_CHECKING([for BSD sysctl])
+AC_COMPILE_IFELSE([BSD_SYSCTL_SRC],
+       [AC_MSG_RESULT([yes])
+       HAVE_BSD_SYSCTL=YesPlease],
+       [AC_MSG_RESULT([no])
+       HAVE_BSD_SYSCTL=])
+GIT_CONF_SUBST([HAVE_BSD_SYSCTL])
 
 ## Other checks.
 # Define USE_PIC if you need the main git objects to be built with -fPIC
index ce0e1214234244236a407e9f3004e619d26c54a8..6090211fe9fad7fb3a2392e399976bc3ea528a4e 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -739,6 +739,7 @@ struct child_process *git_connect(int fd[2], const char *url,
 
                                free(hostandport);
                                free(path);
+                               free(conn);
                                return NULL;
                        } else {
                                ssh = getenv("GIT_SSH_COMMAND");
index c21190d7510c173482b7784f9e8c4bf0b56cb1e1..731c28998f4d2ec6a2339b40a8380c97394b220e 100644 (file)
@@ -411,12 +411,9 @@ __git_refs_remotes ()
 
 __git_remotes ()
 {
-       local i IFS=$'\n' d="$(__gitdir)"
+       local d="$(__gitdir)"
        test -d "$d/remotes" && ls -1 "$d/remotes"
-       for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do
-               i="${i#remote.}"
-               echo "${i/.url*/}"
-       done
+       git --git-dir="$d" remote
 }
 
 __git_list_merge_strategies ()
@@ -2014,6 +2011,7 @@ _git_config ()
                color.status.changed
                color.status.header
                color.status.nobranch
+               color.status.unmerged
                color.status.untracked
                color.status.updated
                color.ui
index c3edd960ec5bf686b66fa55dcfea712e455fe772..9ee21877cd952a7aa47c793d877174d858488794 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -43,9 +43,6 @@ static const char *base_path;
 static const char *interpolated_path;
 static int base_path_relaxed;
 
-/* Flag indicating client sent extra args. */
-static int saw_extended_args;
-
 /* If defined, ~user notation is allowed and the string is inserted
  * after ~user/.  E.g. a request to git://host/~alice/frotz would
  * go to /home/alice/pub_git/frotz with --user-path=pub_git.
@@ -56,25 +53,27 @@ static const char *user_path;
 static unsigned int timeout;
 static unsigned int init_timeout;
 
-static char *hostname;
-static char *canon_hostname;
-static char *ip_address;
-static char *tcp_port;
-
-static int hostname_lookup_done;
+struct hostinfo {
+       struct strbuf hostname;
+       struct strbuf canon_hostname;
+       struct strbuf ip_address;
+       struct strbuf tcp_port;
+       unsigned int hostname_lookup_done:1;
+       unsigned int saw_extended_args:1;
+};
 
-static void lookup_hostname(void);
+static void lookup_hostname(struct hostinfo *hi);
 
-static const char *get_canon_hostname(void)
+static const char *get_canon_hostname(struct hostinfo *hi)
 {
-       lookup_hostname();
-       return canon_hostname;
+       lookup_hostname(hi);
+       return hi->canon_hostname.buf;
 }
 
-static const char *get_ip_address(void)
+static const char *get_ip_address(struct hostinfo *hi)
 {
-       lookup_hostname();
-       return ip_address;
+       lookup_hostname(hi);
+       return hi->ip_address.buf;
 }
 
 static void logreport(int priority, const char *err, va_list params)
@@ -122,38 +121,34 @@ static void NORETURN daemon_die(const char *err, va_list params)
        exit(1);
 }
 
-static void strbuf_addstr_or_null(struct strbuf *sb, const char *s)
-{
-       if (s)
-               strbuf_addstr(sb, s);
-}
-
 struct expand_path_context {
        const char *directory;
+       struct hostinfo *hostinfo;
 };
 
 static size_t expand_path(struct strbuf *sb, const char *placeholder, void *ctx)
 {
        struct expand_path_context *context = ctx;
+       struct hostinfo *hi = context->hostinfo;
 
        switch (placeholder[0]) {
        case 'H':
-               strbuf_addstr_or_null(sb, hostname);
+               strbuf_addbuf(sb, &hi->hostname);
                return 1;
        case 'C':
                if (placeholder[1] == 'H') {
-                       strbuf_addstr_or_null(sb, get_canon_hostname());
+                       strbuf_addstr(sb, get_canon_hostname(hi));
                        return 2;
                }
                break;
        case 'I':
                if (placeholder[1] == 'P') {
-                       strbuf_addstr_or_null(sb, get_ip_address());
+                       strbuf_addstr(sb, get_ip_address(hi));
                        return 2;
                }
                break;
        case 'P':
-               strbuf_addstr_or_null(sb, tcp_port);
+               strbuf_addbuf(sb, &hi->tcp_port);
                return 1;
        case 'D':
                strbuf_addstr(sb, context->directory);
@@ -162,7 +157,7 @@ static size_t expand_path(struct strbuf *sb, const char *placeholder, void *ctx)
        return 0;
 }
 
-static const char *path_ok(const char *directory)
+static const char *path_ok(const char *directory, struct hostinfo *hi)
 {
        static char rpath[PATH_MAX];
        static char interp_path[PATH_MAX];
@@ -198,11 +193,12 @@ static const char *path_ok(const char *directory)
                        dir = rpath;
                }
        }
-       else if (interpolated_path && saw_extended_args) {
+       else if (interpolated_path && hi->saw_extended_args) {
                struct strbuf expanded_path = STRBUF_INIT;
                struct expand_path_context context;
 
                context.directory = directory;
+               context.hostinfo = hi;
 
                if (*dir != '/') {
                        /* Allow only absolute */
@@ -292,7 +288,8 @@ static int daemon_error(const char *dir, const char *msg)
 
 static const char *access_hook;
 
-static int run_access_hook(struct daemon_service *service, const char *dir, const char *path)
+static int run_access_hook(struct daemon_service *service, const char *dir,
+                          const char *path, struct hostinfo *hi)
 {
        struct child_process child = CHILD_PROCESS_INIT;
        struct strbuf buf = STRBUF_INIT;
@@ -301,16 +298,14 @@ static int run_access_hook(struct daemon_service *service, const char *dir, cons
        char *eol;
        int seen_errors = 0;
 
-#define STRARG(x) ((x) ? (x) : "")
        *arg++ = access_hook;
        *arg++ = service->name;
        *arg++ = path;
-       *arg++ = STRARG(hostname);
-       *arg++ = STRARG(get_canon_hostname());
-       *arg++ = STRARG(get_ip_address());
-       *arg++ = STRARG(tcp_port);
+       *arg++ = hi->hostname.buf;
+       *arg++ = get_canon_hostname(hi);
+       *arg++ = get_ip_address(hi);
+       *arg++ = hi->tcp_port.buf;
        *arg = NULL;
-#undef STRARG
 
        child.use_shell = 1;
        child.argv = argv;
@@ -354,7 +349,8 @@ static int run_access_hook(struct daemon_service *service, const char *dir, cons
        return -1;
 }
 
-static int run_service(const char *dir, struct daemon_service *service)
+static int run_service(const char *dir, struct daemon_service *service,
+                      struct hostinfo *hi)
 {
        const char *path;
        int enabled = service->enabled;
@@ -368,7 +364,7 @@ static int run_service(const char *dir, struct daemon_service *service)
                return daemon_error(dir, "service not enabled");
        }
 
-       if (!(path = path_ok(dir)))
+       if (!(path = path_ok(dir, hi)))
                return daemon_error(dir, "no such repository");
 
        /*
@@ -404,7 +400,7 @@ static int run_service(const char *dir, struct daemon_service *service)
         * Optionally, a hook can choose to deny access to the
         * repository depending on the phase of the moon.
         */
-       if (access_hook && run_access_hook(service, dir, path))
+       if (access_hook && run_access_hook(service, dir, path, hi))
                return -1;
 
        /*
@@ -542,7 +538,7 @@ static void parse_host_and_port(char *hostport, char **host,
  * trailing and leading dots, which means that the client cannot escape
  * our base path via ".." traversal.
  */
-static void sanitize_client_strbuf(struct strbuf *out, const char *in)
+static void sanitize_client(struct strbuf *out, const char *in)
 {
        for (; *in; in++) {
                if (*in == '/')
@@ -556,36 +552,27 @@ static void sanitize_client_strbuf(struct strbuf *out, const char *in)
                strbuf_setlen(out, out->len - 1);
 }
 
-static char *sanitize_client(const char *in)
-{
-       struct strbuf out = STRBUF_INIT;
-       sanitize_client_strbuf(&out, in);
-       return strbuf_detach(&out, NULL);
-}
-
 /*
  * Like sanitize_client, but we also perform any canonicalization
  * to make life easier on the admin.
  */
-static char *canonicalize_client(const char *in)
+static void canonicalize_client(struct strbuf *out, const char *in)
 {
-       struct strbuf out = STRBUF_INIT;
-       sanitize_client_strbuf(&out, in);
-       strbuf_tolower(&out);
-       return strbuf_detach(&out, NULL);
+       sanitize_client(out, in);
+       strbuf_tolower(out);
 }
 
 /*
  * Read the host as supplied by the client connection.
  */
-static void parse_host_arg(char *extra_args, int buflen)
+static void parse_host_arg(struct hostinfo *hi, char *extra_args, int buflen)
 {
        char *val;
        int vallen;
        char *end = extra_args + buflen;
 
        if (extra_args < end && *extra_args) {
-               saw_extended_args = 1;
+               hi->saw_extended_args = 1;
                if (strncasecmp("host=", extra_args, 5) == 0) {
                        val = extra_args + 5;
                        vallen = strlen(val) + 1;
@@ -594,13 +581,10 @@ static void parse_host_arg(char *extra_args, int buflen)
                                char *host;
                                char *port;
                                parse_host_and_port(val, &host, &port);
-                               if (port) {
-                                       free(tcp_port);
-                                       tcp_port = sanitize_client(port);
-                               }
-                               free(hostname);
-                               hostname = canonicalize_client(host);
-                               hostname_lookup_done = 0;
+                               if (port)
+                                       sanitize_client(&hi->tcp_port, port);
+                               canonicalize_client(&hi->hostname, host);
+                               hi->hostname_lookup_done = 0;
                        }
 
                        /* On to the next one */
@@ -614,9 +598,9 @@ static void parse_host_arg(char *extra_args, int buflen)
 /*
  * Locate canonical hostname and its IP address.
  */
-static void lookup_hostname(void)
+static void lookup_hostname(struct hostinfo *hi)
 {
-       if (!hostname_lookup_done && hostname) {
+       if (!hi->hostname_lookup_done && hi->hostname.len) {
 #ifndef NO_IPV6
                struct addrinfo hints;
                struct addrinfo *ai;
@@ -626,19 +610,20 @@ static void lookup_hostname(void)
                memset(&hints, 0, sizeof(hints));
                hints.ai_flags = AI_CANONNAME;
 
-               gai = getaddrinfo(hostname, NULL, &hints, &ai);
+               gai = getaddrinfo(hi->hostname.buf, NULL, &hints, &ai);
                if (!gai) {
                        struct sockaddr_in *sin_addr = (void *)ai->ai_addr;
 
                        inet_ntop(AF_INET, &sin_addr->sin_addr,
                                  addrbuf, sizeof(addrbuf));
-                       free(ip_address);
-                       ip_address = xstrdup(addrbuf);
+                       strbuf_addstr(&hi->ip_address, addrbuf);
 
-                       free(canon_hostname);
-                       canon_hostname = ai->ai_canonname ?
-                               sanitize_client(ai->ai_canonname) :
-                               xstrdup(ip_address);
+                       if (ai->ai_canonname)
+                               sanitize_client(&hi->canon_hostname,
+                                               ai->ai_canonname);
+                       else
+                               strbuf_addbuf(&hi->canon_hostname,
+                                             &hi->ip_address);
 
                        freeaddrinfo(ai);
                }
@@ -648,7 +633,7 @@ static void lookup_hostname(void)
                char **ap;
                static char addrbuf[HOST_NAME_MAX + 1];
 
-               hent = gethostbyname(hostname);
+               hent = gethostbyname(hostname.buf);
                if (hent) {
                        ap = hent->h_addr_list;
                        memset(&sa, 0, sizeof sa);
@@ -659,22 +644,39 @@ static void lookup_hostname(void)
                        inet_ntop(hent->h_addrtype, &sa.sin_addr,
                                  addrbuf, sizeof(addrbuf));
 
-                       free(canon_hostname);
-                       canon_hostname = sanitize_client(hent->h_name);
-                       free(ip_address);
-                       ip_address = xstrdup(addrbuf);
+                       sanitize_client(&hi->canon_hostname, hent->h_name);
+                       strbuf_addstr(&hi->ip_address, addrbuf);
                }
 #endif
-               hostname_lookup_done = 1;
+               hi->hostname_lookup_done = 1;
        }
 }
 
+static void hostinfo_init(struct hostinfo *hi)
+{
+       memset(hi, 0, sizeof(*hi));
+       strbuf_init(&hi->hostname, 0);
+       strbuf_init(&hi->canon_hostname, 0);
+       strbuf_init(&hi->ip_address, 0);
+       strbuf_init(&hi->tcp_port, 0);
+}
+
+static void hostinfo_clear(struct hostinfo *hi)
+{
+       strbuf_release(&hi->hostname);
+       strbuf_release(&hi->canon_hostname);
+       strbuf_release(&hi->ip_address);
+       strbuf_release(&hi->tcp_port);
+}
 
 static int execute(void)
 {
        char *line = packet_buffer;
        int pktlen, len, i;
        char *addr = getenv("REMOTE_ADDR"), *port = getenv("REMOTE_PORT");
+       struct hostinfo hi;
+
+       hostinfo_init(&hi);
 
        if (addr)
                loginfo("Connection from %s:%s", addr, port);
@@ -693,14 +695,8 @@ static int execute(void)
                pktlen--;
        }
 
-       free(hostname);
-       free(canon_hostname);
-       free(ip_address);
-       free(tcp_port);
-       hostname = canon_hostname = ip_address = tcp_port = NULL;
-
        if (len != pktlen)
-               parse_host_arg(line + len + 1, pktlen - len - 1);
+               parse_host_arg(&hi, line + len + 1, pktlen - len - 1);
 
        for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
                struct daemon_service *s = &(daemon_service[i]);
@@ -713,10 +709,13 @@ static int execute(void)
                         * Note: The directory here is probably context sensitive,
                         * and might depend on the actual service being performed.
                         */
-                       return run_service(arg, s);
+                       int rc = run_service(arg, s, &hi);
+                       hostinfo_clear(&hi);
+                       return rc;
                }
        }
 
+       hostinfo_clear(&hi);
        logerror("Protocol error: '%s'", line);
        return -1;
 }
diff --git a/diff.c b/diff.c
index abc32c8a7dcaf911c4b9af5168a7da35a5d5e24b..7500c5509550ccd9a86d620e06c51a71d61f8b6c 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2093,7 +2093,6 @@ static unsigned char *deflate_it(char *data,
        unsigned char *deflated;
        git_zstream stream;
 
-       memset(&stream, 0, sizeof(stream));
        git_deflate_init(&stream, zlib_compression_level);
        bound = git_deflate_bound(&stream, size);
        deflated = xmalloc(bound);
index b82fcdd24e34d9191aae33fed4e8afb3ca4b6f6a..e78ca107b3d66d7e537c86eb10dc7503be8681b9 100644 (file)
@@ -1062,7 +1062,6 @@ static int store_object(
        } else
                delta = NULL;
 
-       memset(&s, 0, sizeof(s));
        git_deflate_init(&s, pack_compression_level);
        if (delta) {
                s.next_in = delta;
@@ -1090,7 +1089,6 @@ static int store_object(
                        free(delta);
                        delta = NULL;
 
-                       memset(&s, 0, sizeof(s));
                        git_deflate_init(&s, pack_compression_level);
                        s.next_in = (void *)dat->buf;
                        s.avail_in = dat->len;
@@ -1190,7 +1188,6 @@ static void stream_blob(uintmax_t len, unsigned char *sha1out, uintmax_t mark)
 
        crc32_begin(pack_file);
 
-       memset(&s, 0, sizeof(s));
        git_deflate_init(&s, pack_compression_level);
 
        hdrlen = encode_in_pack_object_header(OBJ_BLOB, len, out_buf);
index a3095be962c04d5b55c54ec39c6c3e6989372c36..bc8fc8cf854e96badfdf4d96673d33b799207ff3 100644 (file)
 #else
 #include <poll.h>
 #endif
+#ifdef HAVE_BSD_SYSCTL
+#include <sys/sysctl.h>
+#endif
 
 #if defined(__MINGW32__)
 /* pull in Windows compatibility stuff */
@@ -876,4 +879,8 @@ struct tm *git_gmtime_r(const time_t *, struct tm *);
 #define USE_PARENS_AROUND_GETTEXT_N 1
 #endif
 
+#ifndef SHELL_PATH
+# define SHELL_PATH "/bin/sh"
+#endif
+
 #endif
index 513efa662e86cb157b8690bfb025556fa0c836f0..47e38f34c3a871349630660e6e3387d554c29d36 100755 (executable)
@@ -20,6 +20,7 @@ start          start the web server
 restart        restart the web server
 "
 
+SUBDIRECTORY_OK=Yes
 . git-sh-setup
 
 fqgitdir="$GIT_DIR"
@@ -204,7 +205,7 @@ webrick_conf () {
        # actual gitweb.cgi using a shell script to force it
   wrapper="$fqgitdir/gitweb/$httpd/wrapper.sh"
        cat > "$wrapper" <<EOF
-#!/bin/sh
+#!@SHELL_PATH@
 # we use this shell script wrapper around the real gitweb.cgi since
 # there appears to be no other way to pass arbitrary environment variables
 # into the CGI process
index c96b9847e9fc2aaf67997c74a8d5c0abe78b607d..f7deeb096e24f4de69bdfe08f0aa35ebf170577a 100644 (file)
@@ -1030,10 +1030,11 @@ test -n "$autosquash" && rearrange_squash "$todo"
 test -n "$cmd" && add_exec_commands "$todo"
 
 todocount=$(git stripspace --strip-comments <"$todo" | wc -l)
+todocount=${todocount##* }
 
 cat >>"$todo" <<EOF
 
-$comment_char Rebase $shortrevisions onto $shortonto ($todocount TODO item(s))
+$comment_char Rebase $shortrevisions onto $shortonto ($todocount command(s))
 EOF
 append_todo_help
 git stripspace --comment-lines >>"$todo" <<\EOF
diff --git a/git.c b/git.c
index 8c7ee9c83000765afa3808f3dd0941aa484ca1ec..42a4ee57843f569fb754121f01bb8c46feee2fd3 100644 (file)
--- a/git.c
+++ b/git.c
@@ -204,10 +204,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                                fprintf(stderr, "No directory given for -C.\n" );
                                usage(git_usage_string);
                        }
-                       if (chdir((*argv)[1]))
-                               die_errno("Cannot change to '%s'", (*argv)[1]);
-                       if (envchanged)
-                               *envchanged = 1;
+                       if ((*argv)[1][0]) {
+                               if (chdir((*argv)[1]))
+                                       die_errno("Cannot change to '%s'", (*argv)[1]);
+                               if (envchanged)
+                                       *envchanged = 1;
+                       }
                        (*argv)++;
                        (*argc)--;
                } else {
@@ -618,6 +620,7 @@ int main(int argc, char **av)
 {
        const char **argv = (const char **) av;
        const char *cmd;
+       int done_help = 0;
 
        startup_info = &git_startup_info;
 
@@ -680,9 +683,7 @@ int main(int argc, char **av)
        setup_path();
 
        while (1) {
-               static int done_help = 0;
-               static int was_alias = 0;
-               was_alias = run_argv(&argc, &argv);
+               int was_alias = run_argv(&argc, &argv);
                if (errno != ENOENT)
                        break;
                if (was_alias) {
index 0beb7ab67ffc93a6c8fe8517d711945e2c033b7d..bfb1c9605b46e8308e91a80c38643ea920cd4d1b 100644 (file)
@@ -365,7 +365,6 @@ static void start_put(struct transfer_request *request)
        hdrlen = sprintf(hdr, "%s %lu", typename(type), len) + 1;
 
        /* Set it up */
-       memset(&stream, 0, sizeof(stream));
        git_deflate_init(&stream, zlib_compression_level);
        size = git_deflate_bound(&stream, len + hdrlen);
        strbuf_init(&request->buffer.buf, size);
index d69887da5a8530b204a5f5baf7081787224fc3bd..37ac4aa86a740ecc8430afff3b9d3c7a0c753a34 100644 (file)
@@ -34,8 +34,16 @@ typedef void *SSL;
 #include "http.h"
 #endif
 
+#if defined(USE_CURL_FOR_IMAP_SEND) && defined(NO_OPENSSL)
+/* only available option */
+#define USE_CURL_DEFAULT 1
+#else
+/* strictly opt in */
+#define USE_CURL_DEFAULT 0
+#endif
+
 static int verbosity;
-static int use_curl; /* strictly opt in */
+static int use_curl = USE_CURL_DEFAULT;
 
 static const char * const imap_send_usage[] = { "git imap-send [-v] [-q] [--[no-]curl] < <mbox>", NULL };
 
@@ -1504,9 +1512,14 @@ int main(int argc, char **argv)
 
 #ifndef USE_CURL_FOR_IMAP_SEND
        if (use_curl) {
-               warning("--use-curl not supported in this build");
+               warning("--curl not supported in this build");
                use_curl = 0;
        }
+#elif defined(NO_OPENSSL)
+       if (!use_curl) {
+               warning("--no-curl not supported in this build");
+               use_curl = 1;
+       }
 #endif
 
        if (!server.port)
index 7f0890e4ac14348e78f7f1e305629fa745a79392..2c1ed0fa90170438e00a2eadbf74e15d89531613 100644 (file)
@@ -172,6 +172,43 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre
        }
 }
 
+/*
+ * Do we have HEAD in the output, and also the branch it points at?
+ * If so, find that decoration entry for that current branch.
+ */
+static const struct name_decoration *current_pointed_by_HEAD(const struct name_decoration *decoration)
+{
+       const struct name_decoration *list, *head = NULL;
+       const char *branch_name = NULL;
+       unsigned char unused[20];
+       int rru_flags;
+
+       /* First find HEAD */
+       for (list = decoration; list; list = list->next)
+               if (list->type == DECORATION_REF_HEAD) {
+                       head = list;
+                       break;
+               }
+       if (!head)
+               return NULL;
+
+       /* Now resolve and find the matching current branch */
+       branch_name = resolve_ref_unsafe("HEAD", 0, unused, &rru_flags);
+       if (!(rru_flags & REF_ISSYMREF))
+               return NULL;
+       if (!skip_prefix(branch_name, "refs/heads/", &branch_name))
+               return NULL;
+
+       /* OK, do we have that ref in the list? */
+       for (list = decoration; list; list = list->next)
+               if ((list->type == DECORATION_REF_LOCAL) &&
+                   !strcmp(branch_name, list->name)) {
+                       return list;
+               }
+
+       return NULL;
+}
+
 /*
  * The caller makes sure there is no funny color before calling.
  * format_decorations_extended makes sure the same after return.
@@ -184,6 +221,7 @@ void format_decorations_extended(struct strbuf *sb,
                        const char *suffix)
 {
        const struct name_decoration *decoration;
+       const struct name_decoration *current_and_HEAD;
        const char *color_commit =
                diff_get_color(use_color, DIFF_COMMIT);
        const char *color_reset =
@@ -192,15 +230,37 @@ void format_decorations_extended(struct strbuf *sb,
        decoration = get_name_decoration(&commit->object);
        if (!decoration)
                return;
+
+       current_and_HEAD = current_pointed_by_HEAD(decoration);
        while (decoration) {
-               strbuf_addstr(sb, color_commit);
-               strbuf_addstr(sb, prefix);
-               strbuf_addstr(sb, decorate_get_color(use_color, decoration->type));
-               if (decoration->type == DECORATION_REF_TAG)
-                       strbuf_addstr(sb, "tag: ");
-               strbuf_addstr(sb, decoration->name);
-               strbuf_addstr(sb, color_reset);
-               prefix = separator;
+               /*
+                * When both current and HEAD are there, only
+                * show HEAD->current where HEAD would have
+                * appeared, skipping the entry for current.
+                */
+               if (decoration != current_and_HEAD) {
+                       strbuf_addstr(sb, color_commit);
+                       strbuf_addstr(sb, prefix);
+                       strbuf_addstr(sb, color_reset);
+                       strbuf_addstr(sb, decorate_get_color(use_color, decoration->type));
+                       if (decoration->type == DECORATION_REF_TAG)
+                               strbuf_addstr(sb, "tag: ");
+
+                       strbuf_addstr(sb, decoration->name);
+
+                       if (current_and_HEAD &&
+                           decoration->type == DECORATION_REF_HEAD) {
+                               strbuf_addstr(sb, color_reset);
+                               strbuf_addstr(sb, color_commit);
+                               strbuf_addstr(sb, " -> ");
+                               strbuf_addstr(sb, color_reset);
+                               strbuf_addstr(sb, decorate_get_color(use_color, current_and_HEAD->type));
+                               strbuf_addstr(sb, current_and_HEAD->name);
+                       }
+                       strbuf_addstr(sb, color_reset);
+
+                       prefix = separator;
+               }
                decoration = decoration->next;
        }
        strbuf_addstr(sb, color_commit);
index deb4bfe684512ea48fbc0d2663270e44722db26b..af7b6786dc091035e3216c710dbc0ebc3c234a8a 100644 (file)
@@ -567,7 +567,6 @@ static int post_rpc(struct rpc_state *rpc)
                git_zstream stream;
                int ret;
 
-               memset(&stream, 0, sizeof(stream));
                git_deflate_init_gzip(&stream, Z_BEST_COMPRESSION);
                gzip_size = git_deflate_bound(&stream, rpc->len);
                gzip_body = xmalloc(gzip_size);
index 0b432cc9713251b4d116bedf52ae1f51bd9d80cf..3afb124c79dcb234344e17795205153d4a2e0643 100644 (file)
@@ -4,10 +4,6 @@
 #include "sigchain.h"
 #include "argv-array.h"
 
-#ifndef SHELL_PATH
-# define SHELL_PATH "/bin/sh"
-#endif
-
 void child_process_init(struct child_process *child)
 {
        memset(child, 0, sizeof(*child));
index 32aa05ed828dfa3bac79edb83dd8a222560206d3..c4f4b7d571fa088f80a0dbba815491a35f0c153f 100644 (file)
@@ -373,6 +373,7 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
 {
        struct argv_array array;
        int rc;
+       const char *value;
 
        argv_array_init(&array);
        argv_array_push(&array, "commit");
@@ -385,6 +386,10 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
        if (!opts->edit) {
                argv_array_push(&array, "-F");
                argv_array_push(&array, defmsg);
+               if (!opts->signoff &&
+                   !opts->record_origin &&
+                   git_config_get_value("commit.cleanup", &value))
+                       argv_array_push(&array, "--cleanup=verbatim");
        }
 
        if (allow_empty)
index 69a60ec88bad190f885cd89a93573236a88ddbd9..88f06bac926008dd40b6a53e0696274438278cfc 100644 (file)
@@ -2943,7 +2943,6 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
        }
 
        /* Set it up */
-       memset(&stream, 0, sizeof(stream));
        git_deflate_init(&stream, zlib_compression_level);
        stream.next_out = compressed;
        stream.avail_out = sizeof(compressed);
index 95f9f8fa1a72693757bbafe0f2a7773d8ae2de05..6d10f052b5050c64de5589733c2a8600e2ddb3dc 100644 (file)
@@ -757,7 +757,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)
 
        for (cp = name + len - 1; name + 2 <= cp; cp--) {
                char ch = *cp;
-               if (hexval(ch) & ~0377) {
+               if (!isxdigit(ch)) {
                        /* We must be looking at g in "SOMETHING-g"
                         * for it to be describe output.
                         */
index d154d1ed1dd8f3449ad21e0aeefdce7d3120e1fb..e6adf2f82d59027279e06e0d273e719226d82184 100644 (file)
@@ -79,6 +79,7 @@ HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www
 # hack to suppress apache PassEnv warnings
 GIT_VALGRIND=$GIT_VALGRIND; export GIT_VALGRIND
 GIT_VALGRIND_OPTIONS=$GIT_VALGRIND_OPTIONS; export GIT_VALGRIND_OPTIONS
+GIT_TRACE=$GIT_TRACE; export GIT_TRACE
 
 if ! test -x "$LIB_HTTPD_PATH"
 then
index 03a4c2ee842e51e13b14774f1f86a4e7b22ae10c..0b81a0047b8d9cd60266500907e95ddc5b87742c 100644 (file)
@@ -70,6 +70,7 @@ PassEnv GIT_VALGRIND
 PassEnv GIT_VALGRIND_OPTIONS
 PassEnv GNUPGHOME
 PassEnv ASAN_OPTIONS
+PassEnv GIT_TRACE
 
 Alias /dumb/ www/
 Alias /auth/dumb/ www/auth/dumb/
index 99c037703a676dd63e4c2b53ea87601fc2503b88..2630e756dab7322a5360a67766a648a80a5a7222 100755 (executable)
@@ -14,6 +14,16 @@ test_expect_success '"git -C <path>" runs git from the directory <path>' '
        test_cmp expected actual
 '
 
+test_expect_success '"git -C <path>" with an empty <path> is a no-op' '
+       (
+               mkdir -p dir1/subdir &&
+               cd dir1/subdir &&
+               git -C "" rev-parse --show-prefix >actual &&
+               echo subdir/ >expect &&
+               test_cmp expect actual
+       )
+'
+
 test_expect_success 'Multiple -C options: "-C dir1 -C dir2" is equivalent to "-C dir1/dir2"' '
        test_create_repo dir1/dir2 &&
        echo 1 >dir1/dir2/b.txt &&
index ba4f98e800f262242ef7925f82dc8d13272fe3ca..f51d0f3cadcb4f97f4cf9f2d79aad9ed401781d8 100755 (executable)
@@ -96,7 +96,7 @@ test_expect_success 'git branch -v pattern does not show branch summaries' '
 
 test_expect_success 'git branch shows detached HEAD properly' '
        cat >expect <<EOF &&
-* (detached from $(git rev-parse --short HEAD^0))
+* (HEAD detached at $(git rev-parse --short HEAD^0))
   branch-one
   branch-two
   master
@@ -106,4 +106,41 @@ EOF
        test_i18ncmp expect actual
 '
 
+test_expect_success 'git branch shows detached HEAD properly after moving' '
+       cat >expect <<EOF &&
+* (HEAD detached from $(git rev-parse --short HEAD))
+  branch-one
+  branch-two
+  master
+EOF
+       git reset --hard HEAD^1 &&
+       git branch >actual &&
+       test_i18ncmp expect actual
+'
+
+test_expect_success 'git branch shows detached HEAD properly from tag' '
+       cat >expect <<EOF &&
+* (HEAD detached at fromtag)
+  branch-one
+  branch-two
+  master
+EOF
+       git tag fromtag master &&
+       git checkout fromtag &&
+       git branch >actual &&
+       test_i18ncmp expect actual
+'
+
+test_expect_success 'git branch shows detached HEAD properly after moving from tag' '
+       cat >expect <<EOF &&
+* (HEAD detached from fromtag)
+  branch-one
+  branch-two
+  master
+EOF
+       git reset --hard HEAD^1 &&
+       git branch >actual &&
+       test_i18ncmp expect actual
+'
+
 test_done
index a31f7e0430e107c1fbe036ce412d4466fa5bd2c2..034eb35cdf3f13686f10737267567c08e749ad1c 100755 (executable)
@@ -1046,4 +1046,13 @@ test_expect_success 'respect core.abbrev' '
        test 4 = $(grep -c "pick [0-9a-f]\{12,\}" todo-list)
 '
 
+test_expect_success 'todo count' '
+       write_script dump-raw.sh <<-\EOF &&
+               cat "$1"
+       EOF
+       test_set_editor "$(pwd)/dump-raw.sh" &&
+       git rebase -i HEAD~4 >actual &&
+       grep "^# Rebase ..* onto ..* ([0-9]" actual
+'
+
 test_done
index f97727975b880ae52394c6af11dde15b71ac6eb7..b7dff09d0656930332f347bd3106d1473015abd0 100755 (executable)
@@ -36,6 +36,20 @@ mesg_with_cherry_footer="$mesg_with_footer_sob
 (cherry picked from commit da39a3ee5e6b4b0d3255bfef95601890afd80709)
 Tested-by: C.U. Thor <cuthor@example.com>"
 
+mesg_unclean="$mesg_one_line
+
+
+leading empty lines
+
+
+consecutive empty lines
+
+# hash tag comment
+
+trailing empty lines
+
+
+"
 
 test_expect_success setup '
        git config advice.detachedhead false &&
@@ -53,6 +67,10 @@ test_expect_success setup '
        test_commit "$mesg_with_footer_sob" foo b mesg-with-footer-sob &&
        git reset --hard initial &&
        test_commit "$mesg_with_cherry_footer" foo b mesg-with-cherry-footer &&
+       git reset --hard initial &&
+       test_config commit.cleanup verbatim &&
+       test_commit "$mesg_unclean" foo b mesg-unclean &&
+       test_unconfig commit.cleanup &&
        pristine_detach initial &&
        test_commit conflicting unrelated
 '
@@ -216,4 +234,14 @@ test_expect_success 'cherry-pick -x -s treats "(cherry picked from..." line as p
        test_cmp expect actual
 '
 
+test_expect_success 'cherry-pick preserves commit message' '
+       pristine_detach initial &&
+       printf "$mesg_unclean" >expect &&
+       git log -1 --pretty=format:%B mesg-unclean >actual &&
+       test_cmp expect actual &&
+       git cherry-pick mesg-unclean &&
+       git log -1 --pretty=format:%B >actual &&
+       test_cmp expect actual
+'
+
 test_done
index 27d3eabc26f35401581d64f0a933fb552e5f4d52..3aa16a9e423bae96815718d0aef235060659a7c1 100644 (file)
@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:06:00 2006 +0000
 
     Rearranged lines in dir/sub
 
-commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD, master)
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> master)
 Merge: 9a6d494 c7a2ab9
 Author: A U Thor <author@example.com>
 Date:   Mon Jun 26 00:04:00 2006 +0000
index 925f577a3c4652bed253787d5f540a415b16fccf..f8008b6a3d2a5fc200665998288d121d1c35dd25 100755 (executable)
@@ -44,15 +44,15 @@ test_expect_success setup '
 '
 
 cat >expected <<EOF
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_HEAD}HEAD${c_reset}${c_commit},\
- ${c_tag}tag: v1.0${c_reset}${c_commit},\
- ${c_tag}tag: B${c_reset}${c_commit},\
- ${c_branch}master${c_reset}${c_commit})${c_reset} B
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_tag}tag: A1${c_reset}${c_commit},\
- ${c_remoteBranch}other/master${c_reset}${c_commit})${c_reset} A1
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_HEAD}HEAD${c_reset}${c_commit} ->\
+ ${c_reset}${c_branch}master${c_reset}${c_commit},\
+ ${c_reset}${c_tag}tag: v1.0${c_reset}${c_commit},\
+ ${c_reset}${c_tag}tag: B${c_reset}${c_commit})${c_reset} B
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A1${c_reset}${c_commit},\
+ ${c_reset}${c_remoteBranch}other/master${c_reset}${c_commit})${c_reset} A1
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_stash}refs/stash${c_reset}${c_commit})${c_reset}\
  On master: Changes to A.t
-${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
+${c_commit}COMMIT_ID${c_reset}${c_commit} (${c_reset}${c_tag}tag: A${c_reset}${c_commit})${c_reset} A
 EOF
 
 # We want log to show all, but the second parent to refs/stash is irrelevant
index c929db563326614e01962b3e322f087640fa19d9..14744b2a4b1e646890176ec53970d36de6f8ec3b 100755 (executable)
@@ -33,6 +33,37 @@ check_zip() {
        test_expect_success UNZIP " validate file contents" "
                diff -r a ${dir_with_prefix}a
        "
+
+       dir=eol_$1
+       dir_with_prefix=$dir/$2
+       extracted=${dir_with_prefix}a
+       original=a
+
+       test_expect_success UNZIP " extract ZIP archive with EOL conversion" '
+               (mkdir $dir && cd $dir && "$GIT_UNZIP" -a ../$zipfile)
+       '
+
+       test_expect_success UNZIP " validate that text files are converted" "
+               test_cmp_bin $extracted/text.cr $extracted/text.crlf &&
+               test_cmp_bin $extracted/text.cr $extracted/text.lf
+       "
+
+       test_expect_success UNZIP " validate that binary files are unchanged" "
+               test_cmp_bin $original/binary.cr   $extracted/binary.cr &&
+               test_cmp_bin $original/binary.crlf $extracted/binary.crlf &&
+               test_cmp_bin $original/binary.lf   $extracted/binary.lf
+       "
+
+       test_expect_success UNZIP " validate that diff files are converted" "
+               test_cmp_bin $extracted/diff.cr $extracted/diff.crlf &&
+               test_cmp_bin $extracted/diff.cr $extracted/diff.lf
+       "
+
+       test_expect_success UNZIP " validate that -diff files are unchanged" "
+               test_cmp_bin $original/nodiff.cr   $extracted/nodiff.cr &&
+               test_cmp_bin $original/nodiff.crlf $extracted/nodiff.crlf &&
+               test_cmp_bin $original/nodiff.lf   $extracted/nodiff.lf
+       "
 }
 
 test_expect_success \
@@ -41,6 +72,18 @@ test_expect_success \
      echo simple textfile >a/a &&
      mkdir a/bin &&
      cp /bin/sh a/bin &&
+     printf "text\r"   >a/text.cr &&
+     printf "text\r\n" >a/text.crlf &&
+     printf "text\n"   >a/text.lf &&
+     printf "text\r"   >a/nodiff.cr &&
+     printf "text\r\n" >a/nodiff.crlf &&
+     printf "text\n"   >a/nodiff.lf &&
+     printf "\0\r"     >a/binary.cr &&
+     printf "\0\r\n"   >a/binary.crlf &&
+     printf "\0\n"     >a/binary.lf &&
+     printf "\0\r"     >a/diff.cr &&
+     printf "\0\r\n"   >a/diff.crlf &&
+     printf "\0\n"     >a/diff.lf &&
      printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
      printf "A not substituted O" >a/substfile2 &&
      (p=long_path_to_a_file && cd a &&
@@ -66,7 +109,9 @@ test_expect_success 'add files to repository' '
        GIT_COMMITTER_DATE="2005-05-27 22:00" git commit -m initial
 '
 
-test_expect_success 'setup export-subst' '
+test_expect_success 'setup export-subst and diff attributes' '
+       echo "a/nodiff.* -diff" >>.git/info/attributes &&
+       echo "a/diff.* diff" >>.git/info/attributes &&
        echo "substfile?" export-subst >>.git/info/attributes &&
        git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
                >a/substfile1
index cc7451908baa815467606dae49a36d0df26492dc..73f4bb63465e50aa12de824859903e5293696a85 100755 (executable)
@@ -26,7 +26,7 @@ check_pushed_commit () {
 # $2 = expected target branch for the push
 # $3 = [optional] repo to check for actual output (repo1 by default)
 test_push_success () {
-       git ${1:+-c push.default="$1"} push &&
+       git ${1:+-c} ${1:+push.default="$1"} push &&
        check_pushed_commit HEAD "$2" "$3"
 }
 
@@ -34,7 +34,7 @@ test_push_success () {
 # check that push fails and does not modify any remote branch
 test_push_failure () {
        git --git-dir=repo1 log --no-walk --format='%h %s' --all >expect &&
-       test_must_fail git ${1:+-c push.default="$1"} push &&
+       test_must_fail git ${1:+-c} ${1:+push.default="$1"} push &&
        git --git-dir=repo1 log --no-walk --format='%h %s' --all >actual &&
        test_cmp expect actual
 }
index d2c681ebfde39fcccef190c3a242dfae9d8af2f2..1ecb5881acf720e7c0dc8b885750f6e641764591 100755 (executable)
@@ -324,12 +324,6 @@ test_expect_success 'push into half-auth-complete requires password' '
        test_cmp expect actual
 '
 
-run_with_limited_cmdline () {
-       (ulimit -s 128 && "$@")
-}
-
-test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
-
 test_expect_success CMDLINE_LIMIT 'push 2000 tags over http' '
        sha1=$(git rev-parse HEAD) &&
        test_seq 2000 |
index 6cbc12d9a7ad059f77967c0bdb702d8a5ec75bb9..df47851752f6b9b085d0feab8d6ba24ef2d0da29 100755 (executable)
@@ -213,10 +213,21 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
        test_cmp expect_cookies.txt cookies_tail.txt
 '
 
-test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
+test_expect_success 'transfer.hiderefs works over smart-http' '
+       test_commit hidden &&
+       test_commit visible &&
+       git push public HEAD^:refs/heads/a HEAD:refs/heads/b &&
+       git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
+               config transfer.hiderefs refs/heads/a &&
+       git clone --bare "$HTTPD_URL/smart/repo.git" hidden.git &&
+       test_must_fail git -C hidden.git rev-parse --verify a &&
+       git -C hidden.git rev-parse --verify b
+'
+
+test_expect_success 'create 2,000 tags in the repo' '
        (
        cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-       for i in `test_seq 50000`
+       for i in $(test_seq 2000)
        do
                echo "commit refs/heads/too-many-refs"
                echo "mark :$i"
@@ -237,13 +248,22 @@ test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
        )
 '
 
-test_expect_success EXPENSIVE 'clone the 50,000 tag repo to check OS command line overflow' '
-       git clone $HTTPD_URL/smart/repo.git too-many-refs &&
+test_expect_success CMDLINE_LIMIT \
+       'clone the 2,000 tag repo to check OS command line overflow' '
+       run_with_limited_cmdline git clone $HTTPD_URL/smart/repo.git too-many-refs &&
        (
                cd too-many-refs &&
-               test $(git for-each-ref refs/tags | wc -l) = 50000
+               git for-each-ref refs/tags >actual &&
+               test_line_count = 2000 actual
        )
 '
 
+test_expect_success 'large fetch-pack requests can be split across POSTs' '
+       GIT_CURL_VERBOSE=1 git -c http.postbuffer=65536 \
+               clone --bare "$HTTPD_URL/smart/repo.git" split.git 2>err &&
+       grep "^> POST" err >posts &&
+       test_line_count = 2 posts
+'
+
 stop_httpd
 test_done
index 35c805a44e817c637c667b1d1d14d97b4ee46803..8bfeef9b0bf6eedcd1f0b31a141efc87a37041f8 100755 (executable)
@@ -1459,6 +1459,34 @@ test_expect_success 'invalid sort parameter in configuratoin' '
        test_cmp expect actual
 '
 
+test_expect_success 'version sort with prerelease reordering' '
+       git config --unset tag.sort &&
+       git config versionsort.prereleaseSuffix -rc &&
+       git tag foo1.6-rc1 &&
+       git tag foo1.6-rc2 &&
+       git tag -l --sort=version:refname "foo*" >actual &&
+       cat >expect <<-\EOF &&
+       foo1.3
+       foo1.6-rc1
+       foo1.6-rc2
+       foo1.6
+       foo1.10
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'reverse version sort with prerelease reordering' '
+       git tag -l --sort=-version:refname "foo*" >actual &&
+       cat >expect <<-\EOF &&
+       foo1.10
+       foo1.6
+       foo1.6-rc2
+       foo1.6-rc1
+       foo1.3
+       EOF
+       test_cmp expect actual
+'
+
 run_with_limited_stack () {
        (ulimit -s 128 && "$@")
 }
index 8ed5788808055889208ac9451054f098538a6878..6b16bcb64031e32c7200deac8ceb46711a8e7bed 100755 (executable)
@@ -66,6 +66,12 @@ strip_comments () {
        rm "$1" && mv "$1".tmp "$1"
 }
 
+cat >.gitignore <<\EOF
+.gitignore
+expect*
+output*
+EOF
+
 test_expect_success 'status --column' '
        cat >expect <<\EOF &&
 # On branch master
@@ -83,8 +89,8 @@ test_expect_success 'status --column' '
 # Untracked files:
 #   (use "git add <file>..." to include in what will be committed)
 #
-#      dir1/untracked dir2/untracked output
-#      dir2/modified  expect         untracked
+#      dir1/untracked dir2/untracked
+#      dir2/modified  untracked
 #
 EOF
        COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output &&
@@ -116,8 +122,6 @@ cat >expect <<\EOF
 #      dir1/untracked
 #      dir2/modified
 #      dir2/untracked
-#      expect
-#      output
 #      untracked
 #
 EOF
@@ -133,6 +137,23 @@ test_expect_success 'status with status.displayCommentPrefix=false' '
        test_i18ncmp expect output
 '
 
+test_expect_success 'status -v' '
+       (cat expect && git diff --cached) >expect-with-v &&
+       git status -v >output &&
+       test_i18ncmp expect-with-v output
+'
+
+test_expect_success 'status -v -v' '
+       (cat expect &&
+        echo "Changes to be committed:" &&
+        git -c diff.mnemonicprefix=true diff --cached &&
+        echo "--------------------------------------------------" &&
+        echo "Changes not staged for commit:" &&
+        git -c diff.mnemonicprefix=true diff) >expect-with-v &&
+       git status -v -v >output &&
+       test_i18ncmp expect-with-v output
+'
+
 test_expect_success 'setup fake editor' '
        cat >.git/editor <<-\EOF &&
        #! /bin/sh
@@ -167,8 +188,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
@@ -186,8 +205,6 @@ A  dir2/added
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 
@@ -201,7 +218,7 @@ test_expect_success 'status -s' '
 test_expect_success 'status with gitignore' '
        {
                echo ".gitignore" &&
-               echo "expect" &&
+               echo "expect*" &&
                echo "output" &&
                echo "untracked"
        } >.gitignore &&
@@ -222,6 +239,7 @@ test_expect_success 'status with gitignore' '
        !! dir1/untracked
        !! dir2/untracked
        !! expect
+       !! expect-with-v
        !! output
        !! untracked
        EOF
@@ -253,6 +271,7 @@ Ignored files:
        dir1/untracked
        dir2/untracked
        expect
+       expect-with-v
        output
        untracked
 
@@ -264,7 +283,7 @@ EOF
 test_expect_success 'status with gitignore (nothing untracked)' '
        {
                echo ".gitignore" &&
-               echo "expect" &&
+               echo "expect*" &&
                echo "dir2/modified" &&
                echo "output" &&
                echo "untracked"
@@ -285,6 +304,7 @@ test_expect_success 'status with gitignore (nothing untracked)' '
        !! dir2/modified
        !! dir2/untracked
        !! expect
+       !! expect-with-v
        !! output
        !! untracked
        EOF
@@ -312,6 +332,7 @@ Ignored files:
        dir2/modified
        dir2/untracked
        expect
+       expect-with-v
        output
        untracked
 
@@ -320,7 +341,11 @@ EOF
        test_i18ncmp expect output
 '
 
-rm -f .gitignore
+cat >.gitignore <<\EOF
+.gitignore
+expect*
+output*
+EOF
 
 cat >expect <<\EOF
 ## master
@@ -329,8 +354,6 @@ A  dir2/added
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 
@@ -434,8 +457,6 @@ Untracked files:
        dir2/modified
        dir2/untracked
        dir3/
-       expect
-       output
        untracked
 
 EOF
@@ -456,8 +477,6 @@ A  dir2/added
 ?? dir2/modified
 ?? dir2/untracked
 ?? dir3/
-?? expect
-?? output
 ?? untracked
 EOF
 test_expect_success 'status -s -unormal' '
@@ -493,8 +512,6 @@ Untracked files:
        dir2/untracked
        dir3/untracked1
        dir3/untracked2
-       expect
-       output
        untracked
 
 EOF
@@ -518,8 +535,6 @@ A  dir2/added
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 test_expect_success 'status -s -uall' '
@@ -554,8 +569,6 @@ Untracked files:
        untracked
        ../dir2/modified
        ../dir2/untracked
-       ../expect
-       ../output
        ../untracked
 
 EOF
@@ -569,8 +582,6 @@ A  ../dir2/added
 ?? untracked
 ?? ../dir2/modified
 ?? ../dir2/untracked
-?? ../expect
-?? ../output
 ?? ../untracked
 EOF
 test_expect_success 'status -s with relative paths' '
@@ -586,8 +597,6 @@ A  dir2/added
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 
@@ -625,8 +634,6 @@ Untracked files:
        <BLUE>dir1/untracked<RESET>
        <BLUE>dir2/modified<RESET>
        <BLUE>dir2/untracked<RESET>
-       <BLUE>expect<RESET>
-       <BLUE>output<RESET>
        <BLUE>untracked<RESET>
 
 EOF
@@ -647,8 +654,6 @@ cat >expect <<\EOF
 <BLUE>??<RESET> dir1/untracked
 <BLUE>??<RESET> dir2/modified
 <BLUE>??<RESET> dir2/untracked
-<BLUE>??<RESET> expect
-<BLUE>??<RESET> output
 <BLUE>??<RESET> untracked
 EOF
 
@@ -676,8 +681,6 @@ cat >expect <<\EOF
 <BLUE>??<RESET> dir1/untracked
 <BLUE>??<RESET> dir2/modified
 <BLUE>??<RESET> dir2/untracked
-<BLUE>??<RESET> expect
-<BLUE>??<RESET> output
 <BLUE>??<RESET> untracked
 EOF
 
@@ -694,8 +697,6 @@ A  dir2/added
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 
@@ -755,8 +756,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
@@ -772,8 +771,6 @@ A  dir2/added
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 
@@ -798,8 +795,6 @@ Untracked files:
 
        dir1/untracked
        dir2/
-       expect
-       output
        untracked
 
 EOF
@@ -848,8 +843,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
@@ -870,8 +863,6 @@ A  sm
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 test_expect_success 'status -s submodule summary is disabled by default' '
@@ -913,8 +904,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
@@ -940,8 +929,6 @@ A  sm
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 test_expect_success 'status -s submodule summary' '
@@ -964,8 +951,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 no changes added to commit (use "git add" and/or "git commit -a")
@@ -983,8 +968,6 @@ cat >expect <<EOF
 ?? dir1/untracked
 ?? dir2/modified
 ?? dir2/untracked
-?? expect
-?? output
 ?? untracked
 EOF
 test_expect_success 'status -s submodule summary (clean submodule)' '
@@ -1025,8 +1008,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
@@ -1080,8 +1061,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
@@ -1192,8 +1171,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
@@ -1254,8 +1231,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
@@ -1336,8 +1311,6 @@ cat > expect << EOF
 ;      dir1/untracked
 ;      dir2/modified
 ;      dir2/untracked
-;      expect
-;      output
 ;      untracked
 ;
 EOF
@@ -1369,8 +1342,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 no changes added to commit (use "git add" and/or "git commit -a")
@@ -1400,8 +1371,6 @@ Untracked files:
        dir1/untracked
        dir2/modified
        dir2/untracked
-       expect
-       output
        untracked
 
 EOF
index 474dab381aef027207026cb938df7a09cc7a9056..3cef18cfdaa587d12aafec5fe32742f0356fc501 100755 (executable)
@@ -86,8 +86,8 @@ test_expect_success GPG 'show signed commit with signature' '
        git show -s --show-signature initial >show &&
        git verify-commit -v initial >verify.1 2>verify.2 &&
        git cat-file commit initial >cat &&
-       grep -v "gpg: " show >show.commit &&
-       grep "gpg: " show >show.gpg &&
+       grep -v -e "gpg: " -e "Warning: " show >show.commit &&
+       grep -e "gpg: " -e "Warning: " show >show.gpg &&
        grep -v "^ " cat | grep -v "^gpgsig " >cat.commit &&
        test_cmp show.commit commit &&
        test_cmp show.gpg verify.2 &&
index f10a75290e6e854763d10fa571b8c50901dce981..7a883d1a674dbed174611470c93ffe32f4f8a4bc 100755 (executable)
@@ -351,6 +351,25 @@ test_expect_success '__gitcomp_nl - doesnt fail because of invalid variable name
        __gitcomp_nl "$invalid_variable_name"
 '
 
+test_expect_success '__git_remotes - list remotes from $GIT_DIR/remotes and from config file' '
+       cat >expect <<-EOF &&
+       remote_from_file_1
+       remote_from_file_2
+       remote_in_config_1
+       remote_in_config_2
+       EOF
+       test_when_finished "rm -rf .git/remotes" &&
+       mkdir -p .git/remotes &&
+       >.git/remotes/remote_from_file_1 &&
+       >.git/remotes/remote_from_file_2 &&
+       test_when_finished "git remote remove remote_in_config_1" &&
+       git remote add remote_in_config_1 git://remote_1 &&
+       test_when_finished "git remote remove remote_in_config_2" &&
+       git remote add remote_in_config_2 git://remote_2 &&
+       __git_remotes >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'basic' '
        run_completion "git " &&
        # built-in
index c09677802cce067a946a2550cdd2d8ef33434e81..9914d3e1cfe20f09b47fdc02896dc18ed0f61e45 100644 (file)
@@ -152,10 +152,7 @@ unset UNZIP
 
 case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
 1|2|true)
-       echo "* warning: Some tests will not work if GIT_TRACE" \
-               "is set as to trace on STDERR ! *"
-       echo "* warning: Please set GIT_TRACE to something" \
-               "other than 1, 2 or true ! *"
+       GIT_TRACE=4
        ;;
 esac
 
@@ -299,6 +296,7 @@ die () {
 
 GIT_EXIT_OK=
 trap 'die' EXIT
+trap 'exit $?' INT
 
 # The user-facing functions are loaded from a separate file so that
 # test_perf subshells can have them too
@@ -1064,3 +1062,9 @@ test_lazy_prereq UNZIP '
        "$GIT_UNZIP" -v
        test $? -ne 127
 '
+
+run_with_limited_cmdline () {
+       (ulimit -s 128 && "$@")
+}
+
+test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
index 97396a75ae4fc3f118750dd687fba85e3fc526cc..a2135e0743ac60d8d4512210a81bac2102948fa1 100644 (file)
@@ -35,7 +35,23 @@ int online_cpus(void)
 
        if (!pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0))
                return (int)psd.psd_proc_cnt;
-#endif
+#elif defined(HAVE_BSD_SYSCTL) && defined(HW_NCPU)
+       int mib[2];
+       size_t len;
+       int cpucount;
+
+       mib[0] = CTL_HW;
+#  ifdef HW_AVAILCPU
+       mib[1] = HW_AVAILCPU;
+       len = sizeof(cpucount);
+       if (!sysctl(mib, 2, &cpucount, &len, NULL, 0))
+               return cpucount;
+#  endif /* HW_AVAILCPU */
+       mib[1] = HW_NCPU;
+       len = sizeof(cpucount);
+       if (!sysctl(mib, 2, &cpucount, &len, NULL, 0))
+               return cpucount;
+#endif /* defined(HAVE_BSD_SYSCTL) && defined(HW_NCPU) */
 
 #ifdef _SC_NPROCESSORS_ONLN
        if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0)
index 0694a7cf3e4a8bd7bec9fefcd440d65423021a1b..00f39d9f5ba8c024ec2b9c6c2a054a0045eadbbb 100644 (file)
@@ -117,7 +117,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
                        return;
                }
 
-               if (hexval(buffer[0]) > 0xf)
+               if (!isxdigit(buffer[0]))
                        continue;
                len = strlen(buffer);
                if (len && buffer[len - 1] == '\n')
index b531a325d2864e94bdc86e689f78663255bb7cf2..aa845765009ac7fb9105851306c3288b3f602369 100644 (file)
@@ -681,7 +681,7 @@ static void receive_needs(void)
 }
 
 /* return non-zero if the ref is hidden, otherwise 0 */
-static int mark_our_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
+static int mark_our_ref(const char *refname, const unsigned char *sha1)
 {
        struct object *o = lookup_unknown_object(sha1);
 
@@ -689,12 +689,16 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1, int flag
                o->flags |= HIDDEN_REF;
                return 1;
        }
-       if (!o)
-               die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
        o->flags |= OUR_REF;
        return 0;
 }
 
+static int check_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
+{
+       mark_our_ref(refname, sha1);
+       return 0;
+}
+
 static void format_symref_info(struct strbuf *buf, struct string_list *symref)
 {
        struct string_list_item *item;
@@ -713,7 +717,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo
        const char *refname_nons = strip_namespace(refname);
        unsigned char peeled[20];
 
-       if (mark_our_ref(refname, sha1, flag, NULL))
+       if (mark_our_ref(refname, sha1))
                return 0;
 
        if (capabilities) {
@@ -767,8 +771,8 @@ static void upload_pack(void)
                advertise_shallow_grafts(1);
                packet_flush(1);
        } else {
-               head_ref_namespaced(mark_our_ref, NULL);
-               for_each_namespaced_ref(mark_our_ref, NULL);
+               head_ref_namespaced(check_ref, NULL);
+               for_each_namespaced_ref(check_ref, NULL);
        }
        string_list_clear(&symref, 1);
        if (advertise_refs)
index 7511e08271fb60276008c0b364a45b9512f49cea..80bfd109fa1285a24dbfa8e9aabdfc3b3bd59801 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "string-list.h"
 
 /*
  * versioncmp(): copied from string/strverscmp.c in glibc commit
 #define  CMP    2
 #define  LEN    3
 
+static const struct string_list *prereleases;
+static int initialized;
+
+/*
+ * p1 and p2 point to the first different character in two strings. If
+ * either p1 or p2 starts with a prerelease suffix, it will be forced
+ * to be on top.
+ *
+ * If both p1 and p2 start with (different) suffix, the order is
+ * determined by config file.
+ *
+ * Note that we don't have to deal with the situation when both p1 and
+ * p2 start with the same suffix because the common part is already
+ * consumed by the caller.
+ *
+ * Return non-zero if *diff contains the return value for versioncmp()
+ */
+static int swap_prereleases(const void *p1_,
+                           const void *p2_,
+                           int *diff)
+{
+       const char *p1 = p1_;
+       const char *p2 = p2_;
+       int i, i1 = -1, i2 = -1;
+
+       for (i = 0; i < prereleases->nr; i++) {
+               const char *suffix = prereleases->items[i].string;
+               if (i1 == -1 && starts_with(p1, suffix))
+                       i1 = i;
+               if (i2 == -1 && starts_with(p2, suffix))
+                       i2 = i;
+       }
+       if (i1 == -1 && i2 == -1)
+               return 0;
+       if (i1 >= 0 && i2 >= 0)
+               *diff = i1 - i2;
+       else if (i1 >= 0)
+               *diff = -1;
+       else /* if (i2 >= 0) */
+               *diff = 1;
+       return 1;
+}
 
 /*
  * Compare S1 and S2 as strings holding indices/version numbers,
@@ -74,6 +117,13 @@ int versioncmp(const char *s1, const char *s2)
                state += (c1 == '0') + (isdigit (c1) != 0);
        }
 
+       if (!initialized) {
+               initialized = 1;
+               prereleases = git_config_get_value_multi("versionsort.prereleasesuffix");
+       }
+       if (prereleases && swap_prereleases(p1 - 1, p2 - 1, &diff))
+               return diff;
+
        state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))];
 
        switch (state) {
index 29666d0dbaa5af768aca86f3ca0b644ac9720648..7036fa28dc39f72ed2064ca0ad15f2e381808020 100644 (file)
@@ -849,6 +849,8 @@ static void wt_status_print_verbose(struct wt_status *s)
 {
        struct rev_info rev;
        struct setup_revision_opt opt;
+       int dirty_submodules;
+       const char *c = color(WT_STATUS_HEADER, s);
 
        init_revisions(&rev, NULL);
        DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
@@ -873,7 +875,25 @@ static void wt_status_print_verbose(struct wt_status *s)
                rev.diffopt.use_color = 0;
                wt_status_add_cut_line(s->fp);
        }
+       if (s->verbose > 1 && s->commitable) {
+               /* print_updated() printed a header, so do we */
+               if (s->fp != stdout)
+                       wt_status_print_trailer(s);
+               status_printf_ln(s, c, _("Changes to be committed:"));
+               rev.diffopt.a_prefix = "c/";
+               rev.diffopt.b_prefix = "i/";
+       } /* else use prefix as per user config */
        run_diff_index(&rev, 1);
+       if (s->verbose > 1 &&
+           wt_status_check_worktree_changes(s, &dirty_submodules)) {
+               status_printf_ln(s, c,
+                       "--------------------------------------------------");
+               status_printf_ln(s, c, _("Changes not staged for commit:"));
+               setup_work_tree();
+               rev.diffopt.a_prefix = "i/";
+               rev.diffopt.b_prefix = "w/";
+               run_diff_files(&rev, 0);
+       }
 }
 
 static void wt_status_print_tracking(struct wt_status *s)
@@ -1222,6 +1242,8 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
                state->detached_from =
                        xstrdup(find_unique_abbrev(cb.nsha1, DEFAULT_ABBREV));
        hashcpy(state->detached_sha1, cb.nsha1);
+       state->detached_at = !get_sha1("HEAD", sha1) &&
+                            !hashcmp(sha1, state->detached_sha1);
 
        free(ref);
        strbuf_release(&cb.buf);
@@ -1310,10 +1332,8 @@ void wt_status_print(struct wt_status *s)
                                on_what = _("rebase in progress; onto ");
                                branch_name = state.onto;
                        } else if (state.detached_from) {
-                               unsigned char sha1[20];
                                branch_name = state.detached_from;
-                               if (!get_sha1("HEAD", sha1) &&
-                                   !hashcmp(sha1, state.detached_sha1))
+                               if (state.detached_at)
                                        on_what = _("HEAD detached at ");
                                else
                                        on_what = _("HEAD detached from ");
index 283a9fef0335ce272c6799a5af17274e4798e15f..e0a99f75c745acd3e7fb6fd8aecd06a4d3bd5522 100644 (file)
@@ -84,6 +84,7 @@ struct wt_status_state {
        int cherry_pick_in_progress;
        int bisect_in_progress;
        int revert_in_progress;
+       int detached_at;
        char *branch;
        char *onto;
        char *detached_from;
diff --git a/zlib.c b/zlib.c
index 61e6df0fdce6dfaf38da7af996d7fe801db8f00c..4223f1a8c57a281d5e41c329a4f983a7bb3b57a0 100644 (file)
--- a/zlib.c
+++ b/zlib.c
@@ -159,6 +159,7 @@ void git_deflate_init(git_zstream *strm, int level)
 {
        int status;
 
+       memset(strm, 0, sizeof(*strm));
        zlib_pre_call(strm);
        status = deflateInit(&strm->z, level);
        zlib_post_call(strm);
@@ -172,6 +173,7 @@ static void do_git_deflate_init(git_zstream *strm, int level, int windowBits)
 {
        int status;
 
+       memset(strm, 0, sizeof(*strm));
        zlib_pre_call(strm);
        status = deflateInit2(&strm->z, level,
                                  Z_DEFLATED, windowBits,