Code

Merge branch 'lt/in-core-index'
authorJunio C Hamano <gitster@pobox.com>
Tue, 12 Feb 2008 00:46:20 +0000 (16:46 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Feb 2008 00:46:20 +0000 (16:46 -0800)
* lt/in-core-index:
  lazy index hashing
  Create pathname-based hash-table lookup into index
  read-cache.c: introduce is_racy_timestamp() helper
  read-cache.c: fix a couple more CE_REMOVE conversion
  Also use unpack_trees() in do_diff_cache()
  Make run_diff_index() use unpack_trees(), not read_tree()
  Avoid running lstat(2) on the same cache entry.
  index: be careful when handling long names
  Make on-disk index representation separate from in-core one

156 files changed:
.gitattributes [new file with mode: 0644]
Documentation/.gitattributes [new file with mode: 0644]
Documentation/Makefile
Documentation/RelNotes-1.5.3.3.txt
Documentation/RelNotes-1.5.4.txt
Documentation/blame-options.txt
Documentation/config.txt
Documentation/fetch-options.txt
Documentation/git-branch.txt
Documentation/git-checkout.txt
Documentation/git-clone.txt
Documentation/git-config.txt
Documentation/git-cvsserver.txt
Documentation/git-describe.txt
Documentation/git-help.txt
Documentation/git-http-push.txt
Documentation/git-pack-objects.txt
Documentation/git-pull.txt
Documentation/git-remote.txt
Documentation/git-rev-parse.txt
Documentation/git-send-email.txt
Documentation/git-stash.txt
Documentation/git-submodule.txt
Documentation/git-svn.txt
Documentation/git.txt
Documentation/manpage-1.72.xsl [new file with mode: 0644]
Documentation/technical/racy-git.txt
GIT-VERSION-GEN
INSTALL
Makefile
archive-tar.c
attr.c
builtin-apply.c
builtin-branch.c
builtin-commit.c
builtin-config.c
builtin-describe.c
builtin-fsck.c
builtin-gc.c
builtin-init-db.c
builtin-log.c
builtin-name-rev.c
builtin-pack-objects.c
builtin-prune.c
builtin-reflog.c
builtin-show-branch.c
builtin-tag.c
cache.h
color.c
config.c
config.mak.in
configure.ac
connect.c
contrib/completion/git-completion.bash
contrib/emacs/git-blame.el
contrib/emacs/git.el
contrib/fast-import/git-p4
convert.c
diff.c
fast-import.c
git-am.sh
git-bisect.sh
git-checkout.sh
git-compat-util.h
git-cvsserver.perl
git-filter-branch.sh
git-gui/Makefile
git-gui/git-gui.sh
git-gui/lib/choose_rev.tcl
git-gui/lib/commit.tcl
git-gui/lib/error.tcl
git-gui/po/glossary/fr.po
git-gui/po/po2msg.sh
git-instaweb.sh
git-pull.sh
git-rebase--interactive.sh
git-relink.perl
git-remote.perl
git-send-email.perl
git-submodule.sh
git-svn.perl
git.c
git.spec.in
gitweb/README
gitweb/gitweb.perl
help.c
http.c
http.h
imap-send.c
merge-recursive.c
object.c
parse-options.c
remote.c
setup.c
t/.gitattributes [new file with mode: 0644]
t/README
t/t0000-basic.sh
t/t0003-attributes.sh [new file with mode: 0755]
t/t0030-stripspace.sh
t/t0040-parse-options.sh
t/t1000-read-tree-m-3way.sh
t/t1200-tutorial.sh
t/t1300-repo-config.sh
t/t1302-repo-version.sh
t/t1400-update-ref.sh
t/t2000-checkout-cache-clash.sh
t/t2002-checkout-cache-u.sh
t/t2008-checkout-subdir.sh
t/t2100-update-cache-badpath.sh
t/t3020-ls-files-error-unmatch.sh
t/t3200-branch.sh
t/t3210-pack-refs.sh
t/t3400-rebase.sh
t/t3403-rebase-skip.sh
t/t3404-rebase-interactive.sh
t/t3600-rm.sh
t/t4026-color.sh [new file with mode: 0755]
t/t4103-apply-binary.sh
t/t4113-apply-ending.sh
t/t5300-pack-object.sh
t/t5302-pack-index.sh
t/t5304-prune.sh [new file with mode: 0644]
t/t5401-update-hooks.sh
t/t5402-post-merge-hook.sh
t/t5500-fetch-pack.sh
t/t5510-fetch.sh
t/t5520-pull.sh
t/t5530-upload-pack-error.sh
t/t5600-clone-fail-cleanup.sh
t/t5710-info-alternate.sh
t/t6009-rev-list-parent.sh [new file with mode: 0755]
t/t6023-merge-file.sh
t/t6024-recursive-merge.sh
t/t6025-merge-symlinks.sh
t/t6030-bisect-porcelain.sh
t/t6101-rev-parse-parents.sh
t/t6300-for-each-ref.sh
t/t7001-mv.sh
t/t7002-grep.sh
t/t7004-tag.sh
t/t7101-reset.sh
t/t7201-co.sh
t/t7400-submodule-basic.sh
t/t7501-commit.sh
t/t7503-pre-commit-hook.sh
t/t7504-commit-msg-hook.sh
t/t9001-send-email.sh
t/t9100-git-svn-basic.sh
t/t9106-git-svn-commit-diff-clobber.sh
t/t9106-git-svn-dcommit-clobber-series.sh
t/t9300-fast-import.sh
t/t9400-git-cvsserver-server.sh
t/test-lib.sh
test-parse-options.c
transport.c
wt-status.c

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..6b9c715
--- /dev/null
@@ -0,0 +1,2 @@
+* whitespace=!indent,trail,space
+*.[ch] whitespace
diff --git a/Documentation/.gitattributes b/Documentation/.gitattributes
new file mode 100644 (file)
index 0000000..ddb0301
--- /dev/null
@@ -0,0 +1 @@
+*.txt whitespace
index 7a325462ee84ec030e54b1f9e25b514e01a8ead8..43781fb2486eefb09d9249150c15e286a3668b55 100644 (file)
@@ -45,6 +45,7 @@ man7dir=$(mandir)/man7
 
 ASCIIDOC=asciidoc
 ASCIIDOC_EXTRA =
+MANPAGE_XSL = callouts.xsl
 INSTALL?=install
 RM ?= rm -f
 DOC_REF = origin/man
@@ -65,6 +66,7 @@ ASCIIDOC_EXTRA += -a asciidoc7compatible
 endif
 ifdef DOCBOOK_XSL_172
 ASCIIDOC_EXTRA += -a docbook-xsl-172
+MANPAGE_XSL = manpage-1.72.xsl
 endif
 
 #
@@ -159,7 +161,7 @@ $(MAN_HTML): %.html : %.txt
 
 %.1 %.5 %.7 : %.xml
        $(RM) $@
-       xmlto -m callouts.xsl man $<
+       xmlto -m $(MANPAGE_XSL) man $<
 
 %.xml : %.txt
        $(RM) $@+ $@
index 2a7bfdd5cc7b0a9494f3f151ba593146553a4945..d2138469511d3dc111d81b9354f100ed344d9524 100644 (file)
@@ -12,7 +12,7 @@ Fixes since v1.5.3.2
  * The default shell on some FreeBSD did not execute the
    argument parsing code correctly and made git unusable.
 
- * git-svn incorrectly spawned pager even when the user user
+ * git-svn incorrectly spawned pager even when the user
    explicitly asked not to.
 
  * sample post-receive hook overquoted the envelope sender
index 9c864c9def3ece2e42189076922cf19548474921..f1323b61746ee5d7f2a9d2fc3835c2cd75e76434 100644 (file)
@@ -10,22 +10,32 @@ Removal
  * As git-commit and git-status have been rewritten, "git runstatus"
    helper script lost all its users and has been removed.
 
- * Curl library older than 7.10 is not supported by "git http-push",
-   as it does not work without CURLM.
+
+Temporarily disabled
+--------------------
+
+ * "git http-push" is known not to work well with cURL library older
+   than 7.16, and we had reports of repository corruption.  It is
+   disabled on such platforms for now.  Unfortunately, 1.5.3.8 shares
+   the same issue.  In other words, this does not mean you will be
+   fine if you stick to an older git release.  For now, please do not
+   use http-push from older git with cURL older than 7.16 if you
+   value your data. A proper fix will hopefully materialize in
+   later versions.
 
 
 Deprecation notices
 -------------------
 
- * The next feature release of git (this change is scheduled for v1.6.0)
-   will by default install dashed form of commands (e.g. "git-commit")
-   outside of users' normal $PATH, and will install only selected
-   commands ("git" itself, and "gitk") in $PATH.  This implies:
+ * From v1.6.0, git will by default install dashed form of commands
+   (e.g. "git-commit") outside of users' normal $PATH, and will install
+   only selected commands ("git" itself, and "gitk") in $PATH.  This
+   implies:
 
    - Using dashed forms of git commands (e.g. "git-commit") from the
      command line has been informally deprecated since early 2006, but
      now it officially is, and will be removed in the future.  Use
-     dashless forms (e.g. "git commit") instead.
+     dash-less forms (e.g. "git commit") instead.
 
    - Using dashed forms from your scripts, without first prepending the
      return value from "git --exec-path" to the scripts' PATH, has been
@@ -34,8 +44,8 @@ Deprecation notices
    - Use of dashed forms with "PATH=$(git --exec-path):$PATH; export
      PATH" early in your script is not deprecated with this change.
 
-  Users are strongly encouraged to adjust their habits and scripts now
-  to prepare for this.
+   Users are strongly encouraged to adjust their habits and scripts now
+   to prepare for this change.
 
  * The post-receive hook was introduced in March 2007 to supersede
    the post-update hook, primarily to overcome the command line length
@@ -70,7 +80,7 @@ Updates since v1.5.3
 
  * Comes with much improved gitk, with i18n.
 
- * Comes with "git gui" 0.9.1 with i18n.
+ * Comes with git-gui 0.9.2 with i18n.
 
  * gitk is now merged as a subdirectory of git.git project, in
    preparation for its i18n.
@@ -156,7 +166,7 @@ Updates since v1.5.3
    command line in the generated log message, when told to cherry-pick a
    commit by naming a tag that points at it.  It does not anymore.
 
- * "git for-each-ref" learned %(xxxdate:<dateformat>) syntax to show the
+ * "git for-each-ref" learned %(xxxdate:<date-format>) syntax to show the
    various date fields in different formats.
 
  * "git gc --auto" is a low-impact way to automatically run a variant of
@@ -211,7 +221,7 @@ Updates since v1.5.3
  * "git pull --rebase" is a different way to integrate what you fetched
    into your current branch.
 
- * "git fast-export" produces datastream that can be fed to fast-import
+ * "git fast-export" produces data-stream that can be fed to fast-import
    to reproduce the history recorded in a git repository.
 
  * "git add -i" takes pathspecs to limit the set of files to work on.
@@ -232,8 +242,8 @@ Updates since v1.5.3
    from its first parent.
 
  * "git commit" used to unconditionally strip comment lines that
-   began with '#' and removed excess blank lines.  This
-   behaviour has been made configurable.
+   began with '#' and removed excess blank lines.  This behavior has
+   been made configurable.
 
  * "git commit" has been rewritten in C.
 
@@ -317,7 +327,7 @@ Updates since v1.5.3
 
  * "git status" from a subdirectory now shows relative paths, which
    makes copy-and-pasting for git-checkout/git-add/git-rm easier.  The
-   traditional behaviour to show the full path relative to the top of
+   traditional behavior to show the full path relative to the top of
    the work tree can be had by setting status.relativepaths
    configuration variable to false.
 
@@ -332,7 +342,7 @@ Updates since v1.5.3
 
  * "git help" learned "-w" option to show documentation in browsers.
 
- * In addition there are quite a few internal clean-ups. Notably
+ * In addition there are quite a few internal clean-ups. Notably:
 
    - many fork/exec have been replaced with run-command API,
      brought from the msysgit effort.
@@ -341,6 +351,7 @@ Updates since v1.5.3
 
    - enhancement and more use of the strbuf API.
 
+ * Makefile tweaks to support HP-UX is in.
 
 Fixes since v1.5.3
 ------------------
@@ -354,7 +365,7 @@ series.
  * The way "git diff --check" behaves is much more consistent with the way
    "git apply --whitespace=warn" works.
 
- * "git svn" talking with the SVN over http will correctly quote branch
+ * "git svn" talking with the SVN over HTTP will correctly quote branch
    and project names.
 
  * "git config" did not work correctly on platforms that define
@@ -364,9 +375,3 @@ series.
    documentation; a workaround has been implemented.
 
  * "git diff --color-words" colored context lines in a wrong color.
-
---
-exec >/var/tmp/1
-O=v1.5.4-rc4
-echo O=`git describe refs/heads/master`
-git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint
index ea1007bfb0e759a7b3704c8d44270023cb78dc6b..c11bb7d36c39899d782f8c2d3f87b5a59178840a 100644 (file)
@@ -52,7 +52,7 @@ of lines before or after the line given by <start>.
        When <rev> is not specified, the command annotates the
        changes starting backwards from the working tree copy.
        This flag makes the command pretend as if the working
-       tree copy has the contents of he named file (specify
+       tree copy has the contents of the named file (specify
        `-` to make the command read from the standard input).
 
 -M|<num>|::
index 877eda960d5964b4c036433899977cf47f17846b..f9bdb164e054ec2d633baab3da69ddd47e14931f 100644 (file)
@@ -333,7 +333,7 @@ branch.autosetupmerge::
        so that linkgit:git-pull[1] will appropriately merge from that
        remote branch.  Note that even if this option is not set,
        this behavior can be chosen per-branch using the `--track`
-       and `--no-track` options.  This option defaults to false.
+       and `--no-track` options.  This option defaults to true.
 
 branch.<name>.remote::
        When in branch <name>, it tells `git fetch` which remote to fetch.
@@ -367,6 +367,11 @@ branch.<name>.rebase::
        it unless you understand the implications (see linkgit:git-rebase[1]
        for details).
 
+browser.<tool>.path::
+       Override the path for the given tool that may be used to
+       browse HTML help (see '-w' option in linkgit:git-help[1]) or a
+       working repository in gitweb (see linkgit:git-instaweb[1]).
+
 clean.requireForce::
        A boolean to make git-clean do nothing unless given -f
        or -n.   Defaults to true.
@@ -761,6 +766,12 @@ pack.indexVersion::
        whenever the corresponding pack is larger than 2 GB.  Otherwise
        the default is 1.
 
+pack.packSizeLimit:
+       The default maximum size of a pack.  This setting only affects
+       packing to a file, i.e. the git:// protocol is unaffected.  It
+       can be overridden by the `\--max-pack-size` option of
+       linkgit:git-repack[1].
+
 pull.octopus::
        The default merge strategy to use when pulling multiple branches
        at once.
index 61e48ccf0284d60c93e049bacf9bbe1050bfa987..b6759114804e89d6f92e48b8dfe4d93b1f8202d0 100644 (file)
        fetches is a descendant of `<lbranch>`.  This option
        overrides that check.
 
+ifdef::git-pull[]
+\--no-tags::
+endif::git-pull[]
+ifndef::git-pull[]
 -n, \--no-tags::
-       By default, `git-fetch` fetches tags that point at
-       objects that are downloaded from the remote repository
-       and stores them locally.  This option disables this
-       automatic tag following.
+endif::git-pull[]
+       By default, tags that point at objects that are downloaded
+       from the remote repository are fetched and stored locally.
+       This option disables this automatic tag following.
 
 -t, \--tags::
        Most of the tags are fetched automatically as branch
index f920c04cc01e1d8a8675876adcb747f91ed86f30..7e8874acaacbd6990ccaf66d5bddbff6e4c1e5ba 100644 (file)
@@ -34,11 +34,11 @@ Note that this will create the new branch, but it will not switch the
 working tree to it; use "git checkout <newbranch>" to switch to the
 new branch.
 
-When a local branch is started off a remote branch, git can setup the
+When a local branch is started off a remote branch, git sets up the
 branch so that linkgit:git-pull[1] will appropriately merge from that
-remote branch.  If this behavior is desired, it is possible to make it
-the default using the global `branch.autosetupmerge` configuration
-flag.  Otherwise, it can be chosen per-branch using the `--track`
+remote branch.  If this behavior is not desired, it is possible to
+disable it using the global `branch.autosetupmerge` configuration
+flag.  That setting can be overridden by using the `--track`
 and `--no-track` options.
 
 With a '-m' or '-M' option, <oldbranch> will be renamed to <newbranch>.
@@ -108,10 +108,11 @@ OPTIONS
        Set up configuration so that git-pull will automatically
        retrieve data from the remote branch.  Use this if you always
        pull from the same remote branch into the new branch, or if you
-       don't want to use "git pull <repository> <refspec>" explicitly.  Set the
-       branch.autosetupmerge configuration variable to true if you
+       don't want to use "git pull <repository> <refspec>" explicitly.
+       This behavior is the default.  Set the
+       branch.autosetupmerge configuration variable to false if you
        want git-checkout and git-branch to always behave as if
-       '--track' were given.
+       '--no-track' were given.
 
 --no-track::
        When a branch is created off a remote branch,
index 584359ff3fdc4167b4af404ab92d34d3a057033c..b4cfa044bbb969add6f434070a8666fc0c325d15 100644 (file)
@@ -52,10 +52,11 @@ OPTIONS
        set up configuration so that git-pull will automatically
        retrieve data from the remote branch.  Use this if you always
        pull from the same remote branch into the new branch, or if you
-       don't want to use "git pull <repository> <refspec>" explicitly.  Set the
-       branch.autosetupmerge configuration variable to true if you
+       don't want to use "git pull <repository> <refspec>" explicitly.
+       This behavior is the default.  Set the
+       branch.autosetupmerge configuration variable to false if you
        want git-checkout and git-branch to always behave as if
-       '--track' were given.
+       '--no-track' were given.
 
 --no-track::
        When -b is given and a branch is created off a remote branch,
index fdccbd4cbe8fcb336b412d75dc070a5d7b5acb1e..23418816146d0b65eeabdd7a3d67dcd7e8c760e1 100644 (file)
@@ -62,6 +62,14 @@ OPTIONS
        .git/objects/info/alternates to share the objects
        with the source repository.  The resulting repository
        starts out without any object of its own.
+       *NOTE*: this is a possibly dangerous operation; do *not* use
+       it unless you understand what it does. If you clone your
+       repository using this option, then delete branches in the
+       source repository and then run linkgit:git-gc[1] using the
+       '--prune' option in the source repository, it may remove
+       objects which are referenced by the cloned repository.
+
+
 
 --reference <repository>::
        If the reference repository is on the local machine
index e4d0e475292654664f800b27f76e347de32af9e4..fa161718dd33a0b4c3b58fb3898e74369bcc3d94 100644 (file)
@@ -130,7 +130,7 @@ See also <<FILES>>.
 
 -z, --null::
        For all options that output values and/or keys, always
-       end values with with the null character (instead of a
+       end values with the null character (instead of a
        newline). Use newline instead as a delimiter between
        key and value. This allows for secure parsing of the
        output without getting confused e.g. by values that
index d75e4013431c82d11d853e1c84bea09c9695e671..d3e99931d7d344cdfb04b90133dd926a2aac1c9b 100644 (file)
@@ -183,7 +183,7 @@ access method and requested operation.
 That means that even if you offer only read access (e.g. by using
 the pserver method), git-cvsserver should have write access to
 the database to work reliably (otherwise you need to make sure
-that the database if up-to-date all the time git-cvsserver is run).
+that the database is up-to-date any time git-cvsserver is executed).
 
 By default it uses SQLite databases in the git directory, named
 `gitcvs.<module_name>.sqlite`. Note that the SQLite backend creates
@@ -204,7 +204,7 @@ about `DBI->connect()`.
 
 gitcvs.dbname::
        Database name. The exact meaning depends on the
-       used database driver, for SQLite this is a filename.
+       selected database driver, for SQLite this is a filename.
        Supports variable substitution (see below). May
        not contain semicolons (`;`).
        Default: '%Ggitcvs.%m.sqlite'
@@ -215,7 +215,7 @@ gitcvs.dbdriver::
        with 'DBD::SQLite', reported to work with
        'DBD::Pg', and reported *not* to work with 'DBD::mysql'.
        Please regard this as an experimental feature. May not
-       contain double colons (`:`).
+       contain colons (`:`).
        Default: 'SQLite'
 
 gitcvs.dbuser::
index 0742152b811e23ea304feb368c8d949785e2fdfb..1c3dfb40c63350651efb570ed540b69c34ccbc81 100644 (file)
@@ -51,6 +51,10 @@ OPTIONS
        being employed to standard error.  The tag name will still
        be printed to standard out.
 
+--match <pattern>::
+       Only consider tags matching the given pattern (can be used to avoid
+       leaking private tags made from the repository).
+
 EXAMPLES
 --------
 
index 09904c75c40e5b44bb9ddd6458edc4cb89af5e35..fb77ca3a57d9377e8939c6d32601cf1386f0261b 100644 (file)
@@ -58,6 +58,16 @@ is available in PATH.
 +
 Note that the script tries, as much as possible, to display the HTML
 page in a new tab on an already opened browser.
++
+The following browsers are currently supported by 'git-help--browse':
++
+* firefox (this is the default under X Window when not using KDE)
+* iceweasel
+* konqueror (this is the default under KDE)
+* w3m (this is the default outside X Window)
+* links
+* lynx
+* dillo
 
 CONFIGURATION VARIABLES
 -----------------------
index cca77f10d277bad10af5b0b3b6ce320652a43d79..0b827223429f61ebd7fff7a1ab85ab6d25dda04a 100644 (file)
@@ -15,6 +15,9 @@ DESCRIPTION
 Sends missing objects to remote repository, and updates the
 remote branch.
 
+*NOTE*: This command is temporarily disabled if your cURL
+library is older than 7.16, as the combination has been reported
+not to work and sometimes corrupts repository.
 
 OPTIONS
 -------
index 74cc7c1cb831c700c14406f6e306e7a3002054d2..8353be186fcc83092acac16b4fc164d6ea669621 100644 (file)
@@ -99,7 +99,8 @@ base-name::
 --max-pack-size=<n>::
        Maximum size of each output packfile, expressed in MiB.
        If specified,  multiple packfiles may be created.
-       The default is unlimited.
+       The default is unlimited, unless the config variable
+       `pack.packSizeLimit` is set.
 
 --incremental::
        This flag causes an object already in a pack ignored
index 77fdaf146eaa20327b0830ac69a6cc6b3e8f9797..179bdfc69ddfeff9d272ec309721e4098f3b051e 100644 (file)
@@ -25,6 +25,7 @@ OPTIONS
 -------
 include::merge-options.txt[]
 
+:git-pull: 1
 include::fetch-options.txt[]
 
 include::pull-fetch-param.txt[]
@@ -34,11 +35,15 @@ include::urls-remotes.txt[]
 include::merge-strategies.txt[]
 
 \--rebase::
-       Instead of a merge, perform a rebase after fetching.
-       *NOTE:* This is a potentially _dangerous_ mode of operation.
-       It rewrites history, which does not bode well when you
-       published that history already.  Do *not* use this option
-       unless you have read linkgit:git-rebase[1] carefully.
+       Instead of a merge, perform a rebase after fetching.  If
+       there is a remote ref for the upstream branch, and this branch
+       was rebased since last fetched, the rebase uses that information
+       to avoid rebasing non-local changes.
++
+*NOTE:* This is a potentially _dangerous_ mode of operation.
+It rewrites history, which does not bode well when you
+published that history already.  Do *not* use this option
+unless you have read linkgit:git-rebase[1] carefully.
 
 \--no-rebase::
        Override earlier \--rebase.
index 10f6fa58bfddda7f0f017a2e4b02560fa012e370..2cbd1f764b7d4d8e8c026f50b727c6cc70f5158e 100644 (file)
@@ -10,7 +10,7 @@ SYNOPSIS
 --------
 [verse]
 'git-remote'
-'git-remote' add [-t <branch>] [-m <branch>] [-f] [--mirror] <name> <url>
+'git-remote' add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>
 'git-remote' rm <name>
 'git-remote' show <name>
 'git-remote' prune <name>
index 5d9c36985f4e37cdbecf29e4be52918dc4e8781f..f02f6bbb49182c0dffce205b24a4199d824dc776 100644 (file)
@@ -229,13 +229,13 @@ blobs contained in a commit.
 * A colon, optionally followed by a stage number (0 to 3) and a
   colon, followed by a path; this names a blob object in the
   index at the given path.  Missing stage number (and the colon
-  that follows it) names an stage 0 entry. During a merge, stage
+  that follows it) names a stage 0 entry. During a merge, stage
   1 is the common ancestor, stage 2 is the target branch's version
   (typically the current branch), and stage 3 is the version from
   the branch being merged.
 
-Here is an illustration, by Jon Loeliger.  Both node B and C are
-a commit parents of commit node A.  Parent commits are ordered
+Here is an illustration, by Jon Loeliger.  Both commit nodes B
+and C are parents of commit node A.  Parent commits are ordered
 left-to-right.
 
     G   H   I   J
@@ -291,7 +291,7 @@ and its parent commits exists.  `r1{caret}@` notation means all
 parents of `r1`.  `r1{caret}!` includes commit `r1` but excludes
 its all parents.
 
-Here are a handful examples:
+Here are a handful of examples:
 
    D                G H D
    D F              G H I J D F
index 4b8ec8a2005fe5704d43e1bab247d517e1218e5e..0554f2b3741bef4213bf7197bf1bb6335c1268c4 100644 (file)
@@ -137,6 +137,8 @@ The --cc option must be repeated for each user you want on the cc list.
        Specify the primary recipient of the emails generated.
        Generally, this will be the upstream maintainer of the
        project involved.
+       Default is the value of the 'sendemail.to' configuration value;
+       if that is unspecified, this will be prompted for.
 +
 The --to option must be repeated for each user you want on the to list.
 
index 9889806a5ef2cf7a93ead43383920364dac90b40..cd0dc1bd9d53282d65c52e6b9ded6d40fe087598 100644 (file)
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git-stash' (list | show [<stash>] | apply [<stash>] | clear)
-'git-stash' [save] [message...]
+'git-stash' [save [<message>]]
 
 DESCRIPTION
 -----------
@@ -36,11 +36,12 @@ is also possible).
 OPTIONS
 -------
 
-save::
+save [<message>]::
 
        Save your local modifications to a new 'stash', and run `git-reset
        --hard` to revert them.  This is the default action when no
-       subcommand is given.
+       subcommand is given. The <message> part is optional and gives
+       the description along with the stashed state.
 
 list::
 
index cffc6d48fb0f74c744181de25fb34532eb3d1adb..e818e6e7895a94af0b05f04d2c8ecdae64583efd 100644 (file)
@@ -9,8 +9,9 @@ git-submodule - Initialize, update or inspect submodules
 SYNOPSIS
 --------
 [verse]
-'git-submodule' [--quiet] [-b branch] add <repository> [<path>]
-'git-submodule' [--quiet] [--cached] [status|init|update] [--] [<path>...]
+'git-submodule' [--quiet] add [-b branch] [--] <repository> [<path>]
+'git-submodule' [--quiet] status [--cached] [--] [<path>...]
+'git-submodule' [--quiet] [init|update] [--] [<path>...]
 
 
 COMMANDS
index e1a1d46a9fefd8d2d34f118b5e2eefce4fc7575a..340f1be02a21495182584b0c09512a8608c1a61a 100644 (file)
@@ -161,6 +161,13 @@ New features:
 +
 Any other arguments are passed directly to `git log'
 
+'blame'::
+       Show what revision and author last modified each line of a file. This is
+       identical to `git blame', but SVN revision numbers are shown instead of git
+       commit hashes.
++
+All arguments are passed directly to `git blame'.
+
 --
 'find-rev'::
        When given an SVN revision number of the form 'rN', returns the
@@ -456,10 +463,13 @@ have each person clone that repository with 'git clone':
 ------------------------------------------------------------------------
 # Do the initial import on a server
        ssh server "cd /pub && git-svn clone http://svn.foo.org/project
-# Clone locally
-       git clone server:/pub/project
-# Tell git-svn which branch contains the Subversion commits
-       git update-ref refs/remotes/git-svn origin/master
+# Clone locally - make sure the refs/remotes/ space matches the server
+       mkdir project
+       cd project
+       git-init
+       git remote add origin server:/pub/project
+       git config --add remote.origin.fetch=+refs/remotes/*:refs/remotes/*
+       git fetch
 # Initialize git-svn locally (be sure to use the same URL and -T/-b/-t options as were used on server)
        git-svn init http://svn.foo.org/project
 # Pull the latest changes from Subversion
index 4ece40d1ebe88b87e1f1048f63f7446c8c4928e0..17aee93ec5c89e1f1d0d499acaf08bf3cc300662 100644 (file)
@@ -43,6 +43,11 @@ unreleased) version of git, that is available from 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
+* link:v1.5.4/git.html[documentation for release 1.5.4]
+
+* release notes for
+  link:RelNotes-1.5.4.txt[1.5.4].
+
 * link:v1.5.3.8/git.html[documentation for release 1.5.3.8]
 
 * release notes for
diff --git a/Documentation/manpage-1.72.xsl b/Documentation/manpage-1.72.xsl
new file mode 100644 (file)
index 0000000..fe3cd72
--- /dev/null
@@ -0,0 +1,17 @@
+<!-- callout.xsl: converts asciidoc callouts to man page format -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:template match="co">
+       <xsl:value-of select="concat('&#x2593;fB(',substring-after(@id,'-'),')&#x2593;fR')"/>
+</xsl:template>
+<xsl:template match="calloutlist">
+       <xsl:text>&#x2302;sp&#10;</xsl:text>
+       <xsl:apply-templates/>
+       <xsl:text>&#10;</xsl:text>
+</xsl:template>
+<xsl:template match="callout">
+       <xsl:value-of select="concat('&#x2593;fB',substring-after(@arearefs,'-'),'. &#x2593;fR')"/>
+       <xsl:apply-templates/>
+       <xsl:text>&#x2302;br&#10;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
index 5030d9f2f831651f231d5c40d0e2110564646ef2..6bdf034b3af55c8d881fee9153d5cd1824660692 100644 (file)
@@ -184,7 +184,7 @@ In a large project where raciness avoidance cost really matters,
 however, the initial computation of all object names in the
 index takes more than one second, and the index file is written
 out after all that happens.  Therefore the timestamp of the
-index file will be more than one seconds later than the the
+index file will be more than one seconds later than the
 youngest file in the working tree.  This means that in these
 cases there actually will not be any racily clean entry in
 the resulting index.
index 2ba142a11ecb5140c55b0f14c10b8be230400f21..38a3273974e3313550218cdb8b50f3f2a8b4dec6 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.5.4-rc3.GIT
+DEF_VER=v1.5.4.GIT
 
 LF='
 '
diff --git a/INSTALL b/INSTALL
index f1eb4049b9f839c1b3d1aa5a4d7387d0e93f0f5c..6f3bcb45253367e0bf7fc8e43e45ccb404b23824 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -79,8 +79,8 @@ Issues of note:
        - "perl" and POSIX-compliant shells are needed to use most of
          the barebone Porcelainish scripts.
 
-       - "cpio" is used by git-merge for saving and restoring the index,
-         and by git-clone when doing a local (possibly hardlinked) clone.
+       - "cpio" is used by git-clone when doing a local (possibly
+         hardlinked) clone.
 
  - Some platform specific issues are dealt with Makefile rules,
    but depending on your specific installation, you may not
index 5aac0c0c876957445cd6e2e7b81a59f40965930b..92341c4bbe3f65671271211c9cbac3d4ffdc3eef 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,8 @@ all::
 #
 # Define NO_MKDTEMP if you don't have mkdtemp in the C library.
 #
+# Define NO_SYS_SELECT_H if you don't have sys/select.h.
+#
 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
 # Enable it on Windows.  By default, symrefs are still used.
 #
@@ -503,6 +505,17 @@ ifeq ($(uname_S),IRIX64)
        # for now, build 32-bit version
        BASIC_LDFLAGS += -L/usr/lib32
 endif
+ifeq ($(uname_S),HP-UX)
+       NO_IPV6=YesPlease
+       NO_SETENV=YesPlease
+       NO_STRCASESTR=YesPlease
+       NO_MEMMEM = YesPlease
+       NO_STRLCPY = YesPlease
+       NO_MKDTEMP = YesPlease
+       NO_UNSETENV = YesPlease
+       NO_HSTRERROR = YesPlease
+       NO_SYS_SELECT_H = YesPlease
+endif
 ifneq (,$(findstring arm,$(uname_M)))
        ARM_SHA1 = YesPlease
 endif
@@ -635,6 +648,9 @@ ifdef NO_UNSETENV
        COMPAT_CFLAGS += -DNO_UNSETENV
        COMPAT_OBJS += compat/unsetenv.o
 endif
+ifdef NO_SYS_SELECT_H
+       BASIC_CFLAGS += -DNO_SYS_SELECT_H
+endif
 ifdef NO_MMAP
        COMPAT_CFLAGS += -DNO_MMAP
        COMPAT_OBJS += compat/mmap.o
@@ -928,7 +944,7 @@ git-%$X: %.o $(GITLIBS)
 
 git-imap-send$X: imap-send.o $(LIB_FILE)
 
-http.o http-walker.o http-push.o: http.h
+http.o http-walker.o http-push.o transport.o: http.h
 
 git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
index e1bced56093dc08bbc260736637af3356b8598bb..30aa2e23fdbb1630dffb27db4509bc529bbd884a 100644 (file)
@@ -222,7 +222,7 @@ static void write_global_extended_header(const unsigned char *sha1)
 static int git_tar_config(const char *var, const char *value)
 {
        if (!strcmp(var, "tar.umask")) {
-               if (!strcmp(value, "user")) {
+               if (value && !strcmp(value, "user")) {
                        tar_umask = umask(0);
                        umask(tar_umask);
                } else {
diff --git a/attr.c b/attr.c
index 741db3b468c6a6ebbcd1414e42b4ef7d6ab3cc9d..64b77b16636482d3448027d7823e5dc07861faa5 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -406,7 +406,7 @@ static void debug_info(const char *what, struct attr_stack *elem)
 {
        fprintf(stderr, "%s: %s\n", what, elem->origin ? elem->origin : "()");
 }
-static void debug_set(const char *what, const char *match, struct git_attr *attr, void *v)
+static void debug_set(const char *what, const char *match, struct git_attr *attr, const void *v)
 {
        const char *value = v;
 
@@ -543,10 +543,10 @@ static int path_matches(const char *pathname, int pathlen,
        if (*pattern == '/')
                pattern++;
        if (pathlen < baselen ||
-           (baselen && pathname[baselen - 1] != '/') ||
+           (baselen && pathname[baselen] != '/') ||
            strncmp(pathname, base, baselen))
                return 0;
-       return fnmatch(pattern, pathname + baselen, FNM_PATHNAME) == 0;
+       return fnmatch(pattern, pathname + baselen + 1, FNM_PATHNAME) == 0;
 }
 
 static int fill_one(const char *what, struct match_attr *a, int rem)
index 30d86f21972d1f7e0bee45d6bf582859b9819921..46dad5b2a1ce6d70d540df8a40da94702dde68c7 100644 (file)
@@ -2746,6 +2746,8 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
 static int git_apply_config(const char *var, const char *value)
 {
        if (!strcmp(var, "apply.whitespace")) {
+               if (!value)
+                       return config_error_nonbool(var);
                apply_default_whitespace = xstrdup(value);
                return 0;
        }
index 089cae59299659b20359b7249e57ddc3a43ded06..e414c8898317736d632064d6c0545d7d128c6bc8 100644 (file)
@@ -70,12 +70,15 @@ static int git_branch_config(const char *var, const char *value)
        }
        if (!prefixcmp(var, "color.branch.")) {
                int slot = parse_branch_color_slot(var, 13);
+               if (!value)
+                       return config_error_nonbool(var);
                color_parse(value, var, branch_colors[slot]);
                return 0;
        }
-       if (!strcmp(var, "branch.autosetupmerge"))
-                       branch_track = git_config_bool(var, value);
-
+       if (!strcmp(var, "branch.autosetupmerge")) {
+               branch_track = git_config_bool(var, value);
+               return 0;
+       }
        return git_default_config(var, value);
 }
 
index c63ff826fc1c87c232b61c0059f12bb26f3098b2..717eb18da0e0cbe901dd8a660649388ccc0a24e1 100644 (file)
@@ -122,19 +122,23 @@ static void rollback_index_files(void)
        }
 }
 
-static void commit_index_files(void)
+static int commit_index_files(void)
 {
+       int err = 0;
+
        switch (commit_style) {
        case COMMIT_AS_IS:
                break; /* nothing to do */
        case COMMIT_NORMAL:
-               commit_lock_file(&index_lock);
+               err = commit_lock_file(&index_lock);
                break;
        case COMMIT_PARTIAL:
-               commit_lock_file(&index_lock);
+               err = commit_lock_file(&index_lock);
                rollback_lock_file(&false_lock);
                break;
        }
+
+       return err;
 }
 
 /*
@@ -597,7 +601,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
 
                if (get_sha1(use_message, sha1))
                        die("could not lookup commit %s", use_message);
-               commit = lookup_commit(sha1);
+               commit = lookup_commit_reference(sha1);
                if (!commit || parse_commit(commit))
                        die("could not parse commit %s", use_message);
 
@@ -739,6 +743,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 int git_commit_config(const char *k, const char *v)
 {
        if (!strcmp(k, "commit.template")) {
+               if (!v)
+                       return config_error_nonbool(v);
                template_file = xstrdup(v);
                return 0;
        }
@@ -925,8 +931,12 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
        unlink(git_path("MERGE_HEAD"));
        unlink(git_path("MERGE_MSG"));
+       unlink(git_path("SQUASH_MSG"));
 
-       commit_index_files();
+       if (commit_index_files())
+               die ("Repository has been updated, but unable to write\n"
+                    "new_index file. Check that disk is not full or quota is\n"
+                    "not exceeded, and then \"git reset HEAD\" to recover.");
 
        rerere();
        run_hook(get_index_file(), "post-commit", NULL);
index e4a12e316648e6b0ab1ee0b424773f3c672c751e..077d8ef2df4ae38d668293cc35810b39e0488f6b 100644 (file)
@@ -168,6 +168,8 @@ static char parsed_color[COLOR_MAXLEN];
 static int git_get_color_config(const char *var, const char *value)
 {
        if (!strcmp(var, get_color_slot)) {
+               if (!value)
+                       config_error_nonbool(var);
                color_parse(value, var, parsed_color);
                get_color_found = 1;
        }
index 7a148a2c26591d82e6057d610182445eae5fe171..3428483134156f4e1761aa47ed2e8098a294808c 100644 (file)
@@ -19,6 +19,7 @@ static int all;       /* Default to annotated tags only */
 static int tags;       /* But allow any tags if --tags is specified */
 static int abbrev = DEFAULT_ABBREV;
 static int max_candidates = 10;
+const char *pattern = NULL;
 
 struct commit_name {
        int prio; /* annotated tag = 2, tag = 1, head = 0 */
@@ -57,9 +58,11 @@ static int get_name(const char *path, const unsigned char *sha1, int flag, void
         * Otherwise only annotated tags are used.
         */
        if (!prefixcmp(path, "refs/tags/")) {
-               if (object->type == OBJ_TAG)
+               if (object->type == OBJ_TAG) {
                        prio = 2;
-               else
+                       if (pattern && fnmatch(pattern, path + 10, 0))
+                               prio = 0;
+               } else
                        prio = 1;
        }
        else
@@ -253,7 +256,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                OPT_BOOLEAN(0, "tags",       &tags, "use any tag in .git/refs/tags"),
                OPT__ABBREV(&abbrev),
                OPT_INTEGER(0, "candidates", &max_candidates,
-                                       "consider <n> most recent tags (default: 10)"),
+                           "consider <n> most recent tags (default: 10)"),
+               OPT_STRING(0, "match",       &pattern, "pattern",
+                          "only consider tags matching <pattern>"),
                OPT_END(),
        };
 
@@ -266,12 +271,19 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
        save_commit_buffer = 0;
 
        if (contains) {
-               const char **args = xmalloc((4 + argc) * sizeof(char*));
+               const char **args = xmalloc((6 + argc) * sizeof(char*));
                int i = 0;
                args[i++] = "name-rev";
                args[i++] = "--name-only";
-               if (!all)
+               args[i++] = "--no-undefined";
+               if (!all) {
                        args[i++] = "--tags";
+                       if (pattern) {
+                               char *s = xmalloc(strlen("--refs=refs/tags/") + strlen(pattern) + 1);
+                               sprintf(s, "--refs=refs/tags/%s", pattern);
+                               args[i++] = s;
+                       }
+               }
                memcpy(args + i, argv, argc * sizeof(char*));
                args[i + argc] = NULL;
                return cmd_name_rev(i + argc, args, prefix);
index 6fc9525e0485f3dba00fa6bea8df1479221f0ce0..cc7524be80f51bca45ef8a205900cf50135bfc5d 100644 (file)
@@ -360,6 +360,9 @@ static int fsck_commit(struct commit *commit)
                fprintf(stderr, "Checking commit %s\n",
                        sha1_to_hex(commit->object.sha1));
 
+       if (!commit->date)
+               return objerror(&commit->object, "invalid author/committer line");
+
        if (memcmp(buffer, "tree ", 5))
                return objerror(&commit->object, "invalid format - expected 'tree' line");
        if (get_sha1_hex(buffer+5, tree_sha1) || buffer[45] != '\n')
@@ -378,9 +381,6 @@ static int fsck_commit(struct commit *commit)
                return objerror(&commit->object, "could not load commit's tree %s", tree_sha1);
        if (!commit->parents && show_root)
                printf("root %s\n", sha1_to_hex(commit->object.sha1));
-       if (!commit->date)
-               printf("bad commit date in %s\n",
-                      sha1_to_hex(commit->object.sha1));
        return 0;
 }
 
index ac34788c89c315d036ab041afbac91a0302e6d6a..ad4a75eedddb1dfc0ecef2b536727970335673f9 100644 (file)
@@ -37,7 +37,7 @@ static const char *argv_rerere[] = {"rerere", "gc", NULL};
 static int gc_config(const char *var, const char *value)
 {
        if (!strcmp(var, "gc.packrefs")) {
-               if (!strcmp(value, "notbare"))
+               if (value && !strcmp(value, "notbare"))
                        pack_refs = -1;
                else
                        pack_refs = git_config_bool(var, value);
index e1393b8d1e74c03ff2b45ec93e268daa2e286fd8..5d7cdda93314b1d40f5f512897e8a35af0480a8f 100644 (file)
@@ -141,9 +141,9 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
                 */
                template_dir = DEFAULT_GIT_TEMPLATE_DIR;
                if (!is_absolute_path(template_dir)) {
-                       const char *exec_path = git_exec_path();
-                       template_dir = prefix_path(exec_path, strlen(exec_path),
-                                                  template_dir);
+                       struct strbuf d = STRBUF_INIT;
+                       strbuf_addf(&d, "%s/%s", git_exec_path(), template_dir);
+                       template_dir = strbuf_detach(&d, NULL);
                }
        }
        strcpy(template_path, template_dir);
index dcc9f817930a3caf8d434dfd54fe476501bcdda2..99d69f079132ed67e2d5bc83bf95e6e60ba22f6f 100644 (file)
@@ -219,7 +219,7 @@ static int git_log_config(const char *var, const char *value)
 {
        if (!strcmp(var, "format.subjectprefix")) {
                if (!value)
-                       die("format.subjectprefix without value");
+                       config_error_nonbool(var);
                fmt_patch_subject_prefix = xstrdup(value);
                return 0;
        }
@@ -432,7 +432,7 @@ static int git_format_config(const char *var, const char *value)
        }
        if (!strcmp(var, "format.suffix")) {
                if (!value)
-                       die("format.suffix without value");
+                       return config_error_nonbool(var);
                fmt_patch_suffix = xstrdup(value);
                return 0;
        }
@@ -440,11 +440,10 @@ static int git_format_config(const char *var, const char *value)
                return 0;
        }
        if (!strcmp(var, "format.numbered")) {
-               if (!strcasecmp(value, "auto")) {
+               if (value && !strcasecmp(value, "auto")) {
                        auto_number = 1;
                        return 0;
                }
-
                numbered = git_config_bool(var, value);
                return 0;
        }
index a0c89a827b666d8e01ba64597b732205ce1a643e..f22c8b5f5da0031657f10ddb827d33a07056e3a5 100644 (file)
@@ -125,18 +125,18 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void
 }
 
 /* returns a static buffer */
-static const charget_rev_name(struct object *o)
+static const char *get_rev_name(struct object *o)
 {
        static char buffer[1024];
        struct rev_name *n;
        struct commit *c;
 
        if (o->type != OBJ_COMMIT)
-               return "undefined";
+               return NULL;
        c = (struct commit *) o;
        n = c->util;
        if (!n)
-               return "undefined";
+               return NULL;
 
        if (!n->generation)
                return n->tip_name;
@@ -159,7 +159,7 @@ static char const * const name_rev_usage[] = {
 int cmd_name_rev(int argc, const char **argv, const char *prefix)
 {
        struct object_array revs = { 0, 0, NULL };
-       int all = 0, transform_stdin = 0;
+       int all = 0, transform_stdin = 0, allow_undefined = 1;
        struct name_ref_data data = { 0, 0, NULL };
        struct option opts[] = {
                OPT_BOOLEAN(0, "name-only", &data.name_only, "print only names (no SHA-1)"),
@@ -169,6 +169,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
                OPT_GROUP(""),
                OPT_BOOLEAN(0, "all", &all, "list all commits reachable from all refs"),
                OPT_BOOLEAN(0, "stdin", &transform_stdin, "read from stdin"),
+               OPT_BOOLEAN(0, "undefined", &allow_undefined, "allow to print `undefined` names"),
                OPT_END(),
        };
 
@@ -226,7 +227,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
                                else if (++forty == 40 &&
                                                !ishex(*(p+1))) {
                                        unsigned char sha1[40];
-                                       const char *name = "undefined";
+                                       const char *name = NULL;
                                        char c = *(p+1);
 
                                        forty = 0;
@@ -240,11 +241,10 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
                                        }
                                        *(p+1) = c;
 
-                                       if (!strcmp(name, "undefined"))
+                                       if (!name)
                                                continue;
 
-                                       fwrite(p_start, p - p_start + 1, 1,
-                                              stdout);
+                                       fwrite(p_start, p - p_start + 1, 1, stdout);
                                        printf(" (%s)", name);
                                        p_start = p + 1;
                                }
@@ -260,18 +260,32 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
                max = get_max_object_index();
                for (i = 0; i < max; i++) {
                        struct object * obj = get_indexed_object(i);
+                       const char *name;
                        if (!obj)
                                continue;
                        if (!data.name_only)
                                printf("%s ", sha1_to_hex(obj->sha1));
-                       printf("%s\n", get_rev_name(obj));
+                       name = get_rev_name(obj);
+                       if (name)
+                               printf("%s\n", name);
+                       else if (allow_undefined)
+                               printf("undefined\n");
+                       else
+                               die("cannot describe '%s'", sha1_to_hex(obj->sha1));
                }
        } else {
                int i;
                for (i = 0; i < revs.nr; i++) {
+                       const char *name;
                        if (!data.name_only)
                                printf("%s ", revs.objects[i].name);
-                       printf("%s\n", get_rev_name(revs.objects[i].item));
+                       name = get_rev_name(revs.objects[i].item);
+                       if (name)
+                               printf("%s\n", name);
+                       else if (allow_undefined)
+                               printf("undefined\n");
+                       else
+                               die("cannot describe '%s'", sha1_to_hex(revs.objects[i].item->sha1));
                }
        }
 
index ec10238e4a0d81773820d255ed0861dd66e0c3d6..acb05554d499598677bc1f0cec3b6ff37e796d88 100644 (file)
@@ -68,7 +68,7 @@ static int allow_ofs_delta;
 static const char *base_name;
 static int progress = 1;
 static int window = 10;
-static uint32_t pack_size_limit;
+static uint32_t pack_size_limit, pack_size_limit_cfg;
 static int depth = 50;
 static int delta_search_threads = 1;
 static int pack_to_stdout;
@@ -1464,7 +1464,7 @@ static unsigned int check_delta_limit(struct object_entry *me, unsigned int n)
        return m;
 }
 
-static unsigned long free_unpacked(struct unpacked *n)
+static unsigned long free_unpacked_data(struct unpacked *n)
 {
        unsigned long freed_mem = sizeof_delta_index(n->index);
        free_delta_index(n->index);
@@ -1474,6 +1474,12 @@ static unsigned long free_unpacked(struct unpacked *n)
                free(n->data);
                n->data = NULL;
        }
+       return freed_mem;
+}
+
+static unsigned long free_unpacked(struct unpacked *n)
+{
+       unsigned long freed_mem = free_unpacked_data(n);
        n->entry = NULL;
        n->depth = 0;
        return freed_mem;
@@ -1514,7 +1520,7 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
                       mem_usage > window_memory_limit &&
                       count > 1) {
                        uint32_t tail = (idx + window - count) % window;
-                       mem_usage -= free_unpacked(array + tail);
+                       mem_usage -= free_unpacked_data(array + tail);
                        count--;
                }
 
@@ -1547,6 +1553,9 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
                        if (!m->entry)
                                break;
                        ret = try_delta(n, m, max_depth, &mem_usage);
+                       if (window_memory_limit &&
+                           mem_usage > window_memory_limit)
+                               mem_usage -= free_unpacked_data(m);
                        if (ret < 0)
                                break;
                        else if (ret > 0)
@@ -1672,7 +1681,8 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
                p[i].data_ready = 0;
 
                /* try to split chunks on "path" boundaries */
-               while (sub_size < list_size && list[sub_size]->hash &&
+               while (sub_size && sub_size < list_size &&
+                      list[sub_size]->hash &&
                       list[sub_size]->hash == list[sub_size-1]->hash)
                        sub_size++;
 
@@ -1866,6 +1876,10 @@ static int git_pack_config(const char *k, const char *v)
                        die("bad pack.indexversion=%d", pack_idx_default_version);
                return 0;
        }
+       if (!strcmp(k, "pack.packsizelimit")) {
+               pack_size_limit_cfg = git_config_ulong(k, v);
+               return 0;
+       }
        return git_default_config(k, v);
 }
 
@@ -2095,6 +2109,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                }
                if (!prefixcmp(arg, "--max-pack-size=")) {
                        char *end;
+                       pack_size_limit_cfg = 0;
                        pack_size_limit = strtoul(arg+16, &end, 0) * 1024 * 1024;
                        if (!arg[16] || *end)
                                usage(pack_usage);
@@ -2219,6 +2234,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
        if (pack_to_stdout != !base_name)
                usage(pack_usage);
 
+       if (!pack_to_stdout && !pack_size_limit)
+               pack_size_limit = pack_size_limit_cfg;
+
        if (pack_to_stdout && pack_size_limit)
                die("--max-pack-size cannot be used to build a pack for transfer.");
 
index b5e768421ba548efaf0dd62ca876c15911df55d2..bb8ead92cf41c3cbdbc421a1490fb40ce19f11c3 100644 (file)
@@ -83,6 +83,44 @@ static void prune_object_dir(const char *path)
        }
 }
 
+/*
+ * Write errors (particularly out of space) can result in
+ * failed temporary packs (and more rarely indexes and other
+ * files begining with "tmp_") accumulating in the
+ * object directory.
+ */
+static void remove_temporary_files(void)
+{
+       DIR *dir;
+       struct dirent *de;
+       char* dirname=get_object_directory();
+
+       dir = opendir(dirname);
+       if (!dir) {
+               fprintf(stderr, "Unable to open object directory %s\n",
+                       dirname);
+               return;
+       }
+       while ((de = readdir(dir)) != NULL) {
+               if (!prefixcmp(de->d_name, "tmp_")) {
+                       char name[PATH_MAX];
+                       int c = snprintf(name, PATH_MAX, "%s/%s",
+                                        dirname, de->d_name);
+                       if (c < 0 || c >= PATH_MAX)
+                               continue;
+                       if (expire) {
+                               struct stat st;
+                               if (stat(name, &st) != 0 || st.st_mtime >= expire)
+                                       continue;
+                       }
+                       printf("Removing stale temporary file %s\n", name);
+                       if (!show_only)
+                               unlink(name);
+               }
+       }
+       closedir(dir);
+}
+
 int cmd_prune(int argc, const char **argv, const char *prefix)
 {
        int i;
@@ -115,5 +153,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
 
        sync();
        prune_packed_objects(show_only);
+       remove_temporary_files();
        return 0;
 }
index ce093cad78ce8008cd8a60d3ab6be5663a712a9d..4836ec951be727512bcd550dd3604c43c39aa557 100644 (file)
@@ -34,6 +34,16 @@ struct expire_reflog_cb {
        struct cmd_reflog_expire_cb *cmd;
 };
 
+struct collected_reflog {
+       unsigned char sha1[20];
+       char reflog[FLEX_ARRAY];
+};
+struct collect_reflog_cb {
+       struct collected_reflog **e;
+       int alloc;
+       int nr;
+};
+
 #define INCOMPLETE     (1u<<10)
 #define STUDYING       (1u<<11)
 
@@ -281,15 +291,35 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
        return status;
 }
 
+static int collect_reflog(const char *ref, const unsigned char *sha1, int unused, void *cb_data)
+{
+       struct collected_reflog *e;
+       struct collect_reflog_cb *cb = cb_data;
+       size_t namelen = strlen(ref);
+
+       e = xmalloc(sizeof(*e) + namelen + 1);
+       hashcpy(e->sha1, sha1);
+       memcpy(e->reflog, ref, namelen + 1);
+       ALLOC_GROW(cb->e, cb->nr + 1, cb->alloc);
+       cb->e[cb->nr++] = e;
+       return 0;
+}
+
 static int reflog_expire_config(const char *var, const char *value)
 {
-       if (!strcmp(var, "gc.reflogexpire"))
+       if (!strcmp(var, "gc.reflogexpire")) {
+               if (!value)
+                       config_error_nonbool(var);
                default_reflog_expire = approxidate(value);
-       else if (!strcmp(var, "gc.reflogexpireunreachable"))
+               return 0;
+       }
+       if (!strcmp(var, "gc.reflogexpireunreachable")) {
+               if (!value)
+                       config_error_nonbool(var);
                default_reflog_expire_unreachable = approxidate(value);
-       else
-               return git_default_config(var, value);
-       return 0;
+               return 0;
+       }
+       return git_default_config(var, value);
 }
 
 static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
@@ -349,8 +379,20 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
                        putchar('\n');
        }
 
-       if (do_all)
-               status |= for_each_reflog(expire_reflog, &cb);
+       if (do_all) {
+               struct collect_reflog_cb collected;
+               int i;
+
+               memset(&collected, 0, sizeof(collected));
+               for_each_reflog(collect_reflog, &collected);
+               for (i = 0; i < collected.nr; i++) {
+                       struct collected_reflog *e = collected.e[i];
+                       status |= expire_reflog(e->reflog, e->sha1, 0, &cb);
+                       free(e);
+               }
+               free(collected.e);
+       }
+
        while (i < argc) {
                const char *ref = argv[i++];
                unsigned char sha1[20];
index 6dc835d30a6a726c3dd40d23564b0dc32d20b7db..019abd3527e7c573c69900a58313749e2ef2280a 100644 (file)
@@ -536,6 +536,8 @@ static void append_one_rev(const char *av)
 static int git_show_branch_config(const char *var, const char *value)
 {
        if (!strcmp(var, "showbranch.default")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (default_alloc <= default_num + 1) {
                        default_alloc = default_alloc * 3 / 2 + 20;
                        default_arg = xrealloc(default_arg, sizeof *default_arg * default_alloc);
index 03e70155fc676a8dd38ca5cef800ed4a446e921a..4a4a88c10b4b2f9e55662bd4c1c17051ae7e6aac 100644 (file)
@@ -258,7 +258,7 @@ static int git_tag_config(const char *var, const char *value)
 {
        if (!strcmp(var, "user.signingkey")) {
                if (!value)
-                       die("user.signingkey without value");
+                       return config_error_nonbool(value);
                set_signingkey(value);
                return 0;
        }
diff --git a/cache.h b/cache.h
index e4aeff07d1ac5243aff118f57d4adb806976730b..3867ba7ff5c3946e0449c78b26880a71107730a0 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -630,6 +630,7 @@ extern int git_config_set_multivar(const char *, const char *, const char *, int
 extern int git_config_rename_section(const char *, const char *);
 extern const char *git_etc_gitconfig(void);
 extern int check_repository_format_version(const char *var, const char *value);
+extern int config_error_nonbool(const char *);
 
 #define MAX_GITNAME (1000)
 extern char git_default_email[MAX_GITNAME];
diff --git a/color.c b/color.c
index 7f66c29fae57abceda30b1257c2a66626f3be0b2..cb70340420b6285786b988d4a98d2023a37d4ffc 100644 (file)
--- a/color.c
+++ b/color.c
@@ -17,7 +17,7 @@ static int parse_color(const char *name, int len)
                        return i - 1;
        }
        i = strtol(name, &end, 10);
-       if (*name && !*end && i >= -1 && i <= 255)
+       if (end - name == len && i >= -1 && i <= 255)
                return i;
        return -2;
 }
index 526a3f4294fdce7e69f495df039cfcbfbb5e9955..3e72778e94267044780a180145eae0a6a229e3a3 100644 (file)
--- a/config.c
+++ b/config.c
@@ -408,21 +408,29 @@ int git_default_config(const char *var, const char *value)
        }
 
        if (!strcmp(var, "user.name")) {
+               if (!value)
+                       return config_error_nonbool(var);
                strlcpy(git_default_name, value, sizeof(git_default_name));
                return 0;
        }
 
        if (!strcmp(var, "user.email")) {
+               if (!value)
+                       return config_error_nonbool(var);
                strlcpy(git_default_email, value, sizeof(git_default_email));
                return 0;
        }
 
        if (!strcmp(var, "i18n.commitencoding")) {
+               if (!value)
+                       return config_error_nonbool(var);
                git_commit_encoding = xstrdup(value);
                return 0;
        }
 
        if (!strcmp(var, "i18n.logoutputencoding")) {
+               if (!value)
+                       return config_error_nonbool(var);
                git_log_output_encoding = xstrdup(value);
                return 0;
        }
@@ -434,23 +442,29 @@ int git_default_config(const char *var, const char *value)
        }
 
        if (!strcmp(var, "core.pager")) {
+               if (!value)
+                       return config_error_nonbool(var);
                pager_program = xstrdup(value);
                return 0;
        }
 
        if (!strcmp(var, "core.editor")) {
+               if (!value)
+                       return config_error_nonbool(var);
                editor_program = xstrdup(value);
                return 0;
        }
 
        if (!strcmp(var, "core.excludesfile")) {
                if (!value)
-                       die("core.excludesfile without value");
+                       return config_error_nonbool(var);
                excludes_file = xstrdup(value);
                return 0;
        }
 
        if (!strcmp(var, "core.whitespace")) {
+               if (!value)
+                       return config_error_nonbool(var);
                whitespace_rule_cfg = parse_whitespace_rule(value);
                return 0;
        }
@@ -484,9 +498,9 @@ const char *git_etc_gitconfig(void)
                system_wide = ETC_GITCONFIG;
                if (!is_absolute_path(system_wide)) {
                        /* interpret path relative to exec-dir */
-                       const char *exec_path = git_exec_path();
-                       system_wide = prefix_path(exec_path, strlen(exec_path),
-                                               system_wide);
+                       struct strbuf d = STRBUF_INIT;
+                       strbuf_addf(&d, "%s/%s", git_exec_path(), system_wide);
+                       system_wide = strbuf_detach(&d, NULL);
                }
        }
        return system_wide;
@@ -701,12 +715,17 @@ static ssize_t find_beginning_of_line(const char* contents, size_t size,
        size_t equal_offset = size, bracket_offset = size;
        ssize_t offset;
 
+contline:
        for (offset = offset_-2; offset > 0
                        && contents[offset] != '\n'; offset--)
                switch (contents[offset]) {
                        case '=': equal_offset = offset; break;
                        case ']': bracket_offset = offset; break;
                }
+       if (offset > 0 && contents[offset-1] == '\\') {
+               offset_ = offset;
+               goto contline;
+       }
        if (bracket_offset < equal_offset) {
                *found_bracket = 1;
                offset = bracket_offset+1;
@@ -1074,3 +1093,12 @@ int git_config_rename_section(const char *old_name, const char *new_name)
        free(config_filename);
        return ret;
 }
+
+/*
+ * Call this to report error for your variable that should not
+ * get a boolean value (i.e. "[my] var" means "true").
+ */
+int config_error_nonbool(const char *var)
+{
+       return error("Missing value for '%s'", var);
+}
index 40b14d985ac6815fb3467e1af06428bcf4e3f75d..ee6c33df0385291623b900ac2b2cc088011b764d 100644 (file)
@@ -30,6 +30,7 @@ NO_CURL=@NO_CURL@
 NO_EXPAT=@NO_EXPAT@
 NEEDS_LIBICONV=@NEEDS_LIBICONV@
 NEEDS_SOCKET=@NEEDS_SOCKET@
+NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
 NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@
 NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@
 NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@
index af177fdb4dbc1879112c27ecffa9c33c62c678ef..85d7ef570d390d56d3ec3ba8af406eee30d700ea 100644 (file)
@@ -235,6 +235,12 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
 ## Checks for header files.
 AC_MSG_NOTICE([CHECKS for header files])
 #
+# Define NO_SYS_SELECT_H if you don't have sys/select.h.
+AC_CHECK_HEADER([sys/select.h],
+[NO_SYS_SELECT_H=],
+[NO_SYS_SELECT_H=UnfortunatelyYes])
+AC_SUBST(NO_SYS_SELECT_H)
+#
 # Define OLD_ICONV if your library has an old iconv(), where the second
 # (input buffer pointer) parameter is declared with type (const char **).
 AC_DEFUN([OLDICONVTEST_SRC], [[
index 3aefd4ace590082b85bd3c4b9b41b8d1f1c72268..71597d4920ff11ed474be1a8bd39b4791611e422 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -370,6 +370,8 @@ static int git_proxy_command_options(const char *var, const char *value)
 
                if (git_proxy_command)
                        return 0;
+               if (!value)
+                       return config_error_nonbool(var);
                /* [core]
                 * ;# matches www.kernel.org as well
                 * gitproxy = netcatter-1 for kernel.org
index 0d33f9a3dc9d5a593ce2691ab850ba1e38aa32de..4ea727b14303e397117067993dbda446ed154ea1 100755 (executable)
@@ -64,12 +64,41 @@ __gitdir ()
 
 __git_ps1 ()
 {
-       local b="$(git symbolic-ref HEAD 2>/dev/null)"
-       if [ -n "$b" ]; then
+       local g="$(git rev-parse --git-dir 2>/dev/null)"
+       if [ -n "$g" ]; then
+               local r
+               local b
+               if [ -d "$g/../.dotest" ]
+               then
+                       r="|AM/REBASE"
+                       b="$(git symbolic-ref HEAD 2>/dev/null)"
+               elif [ -f "$g/.dotest-merge/interactive" ]
+               then
+                       r="|REBASE-i"
+                       b="$(cat $g/.dotest-merge/head-name)"
+               elif [ -d "$g/.dotest-merge" ]
+               then
+                       r="|REBASE-m"
+                       b="$(cat $g/.dotest-merge/head-name)"
+               elif [ -f "$g/MERGE_HEAD" ]
+               then
+                       r="|MERGING"
+                       b="$(git symbolic-ref HEAD 2>/dev/null)"
+               else
+                       if [ -f $g/BISECT_LOG ]
+                       then
+                               r="|BISECTING"
+                       fi
+                       if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
+                       then
+                               b="$(cut -c1-7 $g/HEAD)..."
+                       fi
+               fi
+
                if [ -n "$1" ]; then
-                       printf "$1" "${b##refs/heads/}"
+                       printf "$1" "${b##refs/heads/}$r"
                else
-                       printf " (%s)" "${b##refs/heads/}"
+                       printf " (%s)" "${b##refs/heads/}$r"
                fi
        fi
 }
index bb671d561ebc9af51bb9a5d52017e71fd81881e9..9f92cd250b2ba2c3057bff87daa1b7990f85403d 100644 (file)
@@ -105,6 +105,13 @@ selected element from l."
      (setq ,l (remove e ,l))
      e))
 
+(defvar git-blame-log-oneline-format
+  "format:[%cr] %cn: %s"
+  "*Formatting option used for describing current line in the minibuffer.
+
+This option is used to pass to git log --pretty= command-line option,
+and describe which commit the current line was made.")
+
 (defvar git-blame-dark-colors
   (git-blame-color-scale "0c" "04" "24" "1c" "2c" "34" "14" "3c")
   "*List of colors (format #RGB) to use in a dark environment.
@@ -371,7 +378,8 @@ See also function `git-blame-mode'."
 (defun git-describe-commit (hash)
   (with-temp-buffer
     (call-process "git" nil t nil
-                  "log" "-1" "--pretty=oneline"
+                  "log" "-1"
+                 (concat "--pretty=" git-blame-log-oneline-format)
                   hash)
     (buffer-substring (point-min) (1- (point-max)))))
 
index d8a06381f4140a777f03fda67f68838e4aa3e493..a8bf0ef883358c7eaf9a13dde8f371a86ff840f0 100644 (file)
@@ -35,7 +35,6 @@
 ;;
 ;; TODO
 ;;  - portability to XEmacs
-;;  - better handling of subprocess errors
 ;;  - diff against other branch
 ;;  - renaming files from the status buffer
 ;;  - creating tags
@@ -191,6 +190,18 @@ if there is already one that displays the same directory."
              (append (git-get-env-strings env) (list "git") args))
     (apply #'call-process "git" nil buffer nil args)))
 
+(defun git-call-process-display-error (&rest args)
+  "Wrapper for call-process that displays error messages."
+  (let* ((dir default-directory)
+         (buffer (get-buffer-create "*Git Command Output*"))
+         (ok (with-current-buffer buffer
+               (let ((default-directory dir)
+                     (buffer-read-only nil))
+                 (erase-buffer)
+                 (eq 0 (apply 'call-process "git" nil (list buffer t) nil args))))))
+    (unless ok (display-message-or-buffer buffer))
+    ok))
+
 (defun git-call-process-env-string (env &rest args)
   "Wrapper for call-process that sets environment strings,
 and returns the process output as a string."
@@ -377,7 +388,7 @@ and returns the process output as a string."
     (when reason
      (push reason args)
      (push "-m" args))
-    (eq 0 (apply #'git-call-process-env nil nil "update-ref" args))))
+    (apply 'git-call-process-display-error "update-ref" args)))
 
 (defun git-read-tree (tree &optional index-file)
   "Read a tree into the index file."
@@ -558,12 +569,15 @@ and returns the process output as a string."
                     (?\100 "   (type change file -> subproject)")
                     (?\120 "   (type change symlink -> subproject)")
                     (t "   (subproject)")))
+                  (?\110 nil)  ;; directory (internal, not a real git state)
                  (?\000  ;; deleted or unknown
                   (case old-type
                     (?\120 "   (symlink)")
                     (?\160 "   (subproject)")))
                  (t (format "   (unknown type %o)" new-type)))))
-    (if str (propertize str 'face 'git-status-face) "")))
+    (cond (str (propertize str 'face 'git-status-face))
+          ((eq new-type ?\110) "/")
+          (t ""))))
 
 (defun git-rename-as-string (info)
   "Return a string describing the copy or rename associated with INFO, or an empty string if none."
@@ -666,9 +680,11 @@ Return the list of files that haven't been handled."
     (with-temp-buffer
       (apply #'git-call-process-env t nil "ls-files" "-z" (append options (list "--") files))
       (goto-char (point-min))
-      (while (re-search-forward "\\([^\0]*\\)\0" nil t 1)
+      (while (re-search-forward "\\([^\0]*?\\)\\(/?\\)\0" nil t 1)
         (let ((name (match-string 1)))
-          (push (git-create-fileinfo default-state name) infolist)
+          (push (git-create-fileinfo default-state name 0
+                                     (if (string-equal "/" (match-string 2)) (lsh ?\110 9) 0))
+                infolist)
           (setq files (delete name files)))))
     (git-insert-info-list status infolist)
     files))
@@ -713,7 +729,7 @@ Return the list of files that haven't been handled."
 (defun git-run-ls-files-with-excludes (status files default-state &rest options)
   "Run git-ls-files on FILES with appropriate --exclude-from options."
   (let ((exclude-files (git-get-exclude-files)))
-    (apply #'git-run-ls-files status files default-state
+    (apply #'git-run-ls-files status files default-state "--directory"
            (concat "--exclude-per-directory=" git-per-dir-ignore-file)
            (append options (mapcar (lambda (f) (concat "--exclude-from=" f)) exclude-files)))))
 
@@ -735,6 +751,27 @@ Return the list of files that haven't been handled."
     (git-refresh-files)
     (git-refresh-ewoc-hf git-status)))
 
+(defun git-mark-files (status files)
+  "Mark all the specified FILES, and unmark the others."
+  (setq files (sort files #'string-lessp))
+  (let ((file (and files (pop files)))
+        (node (ewoc-nth status 0)))
+    (while node
+      (let ((info (ewoc-data node)))
+        (if (and file (string-equal (git-fileinfo->name info) file))
+            (progn
+              (unless (git-fileinfo->marked info)
+                (setf (git-fileinfo->marked info) t)
+                (setf (git-fileinfo->needs-refresh info) t))
+              (setq file (pop files))
+              (setq node (ewoc-next status node)))
+          (when (git-fileinfo->marked info)
+            (setf (git-fileinfo->marked info) nil)
+            (setf (git-fileinfo->needs-refresh info) t))
+          (if (and file (string-lessp file (git-fileinfo->name info)))
+              (setq file (pop files))
+            (setq node (ewoc-next status node))))))))
+
 (defun git-marked-files ()
   "Return a list of all marked files, or if none a list containing just the file at cursor position."
   (unless git-status (error "Not in git-status buffer."))
@@ -840,16 +877,17 @@ Return the list of files that haven't been handled."
                       (if (or (not (string-equal tree head-tree))
                               (yes-or-no-p "The tree was not modified, do you really want to perform an empty commit? "))
                           (let ((commit (git-commit-tree buffer tree head)))
-                            (condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
-                            (condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
-                            (with-current-buffer buffer (erase-buffer))
-                           (git-update-status-files (git-get-filenames files) 'uptodate)
-                            (git-call-process-env nil nil "rerere")
-                            (git-call-process-env nil nil "gc" "--auto")
-                            (git-refresh-files)
-                            (git-refresh-ewoc-hf git-status)
-                            (message "Committed %s." commit)
-                            (git-run-hook "post-commit" nil))
+                            (when commit
+                              (condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
+                              (condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
+                              (with-current-buffer buffer (erase-buffer))
+                              (git-update-status-files (git-get-filenames files) 'uptodate)
+                              (git-call-process-env nil nil "rerere")
+                              (git-call-process-env nil nil "gc" "--auto")
+                              (git-refresh-files)
+                              (git-refresh-ewoc-hf git-status)
+                              (message "Committed %s." commit)
+                              (git-run-hook "post-commit" nil)))
                         (message "Commit aborted."))))
                 (message "No files to commit.")))
           (delete-file index-file))))))
@@ -957,11 +995,12 @@ Return the list of files that haven't been handled."
   "Add marked file(s) to the index cache."
   (interactive)
   (let ((files (git-get-filenames (git-marked-files-state 'unknown 'ignored))))
+    ;; FIXME: add support for directories
     (unless files
       (push (file-relative-name (read-file-name "File to add: " nil nil t)) files))
-    (apply #'git-call-process-env nil nil "update-index" "--add" "--" files)
-    (git-update-status-files files 'uptodate)
-    (git-success-message "Added" files)))
+    (when (apply 'git-call-process-display-error "update-index" "--add" "--" files)
+      (git-update-status-files files 'uptodate)
+      (git-success-message "Added" files))))
 
 (defun git-ignore-file ()
   "Add marked file(s) to the ignore list."
@@ -983,16 +1022,19 @@ Return the list of files that haven't been handled."
          (format "Remove %d file%s? " (length files) (if (> (length files) 1) "s" "")))
         (progn
           (dolist (name files)
-            (when (file-exists-p name) (delete-file name)))
-          (apply #'git-call-process-env nil nil "update-index" "--remove" "--" files)
-          (git-update-status-files files nil)
-          (git-success-message "Removed" files))
+            (ignore-errors
+              (if (file-directory-p name)
+                  (delete-directory name)
+                (delete-file name))))
+          (when (apply 'git-call-process-display-error "update-index" "--remove" "--" files)
+            (git-update-status-files files nil)
+            (git-success-message "Removed" files)))
       (message "Aborting"))))
 
 (defun git-revert-file ()
   "Revert changes to the marked file(s)."
   (interactive)
-  (let ((files (git-marked-files))
+  (let ((files (git-marked-files-state 'added 'deleted 'modified 'unmerged))
         added modified)
     (when (and files
                (yes-or-no-p
@@ -1003,21 +1045,31 @@ Return the list of files that haven't been handled."
           ('deleted (push (git-fileinfo->name info) modified))
           ('unmerged (push (git-fileinfo->name info) modified))
           ('modified (push (git-fileinfo->name info) modified))))
-      (when added
-        (apply #'git-call-process-env nil nil "update-index" "--force-remove" "--" added))
-      (when modified
-        (apply #'git-call-process-env nil nil "checkout" "HEAD" modified))
-      (git-update-status-files (append added modified) 'uptodate)
-      (git-success-message "Reverted" (git-get-filenames files)))))
+      ;; check if a buffer contains one of the files and isn't saved
+      (dolist (file modified)
+        (let ((buffer (get-file-buffer file)))
+          (when (and buffer (buffer-modified-p buffer))
+            (error "Buffer %s is modified. Please kill or save modified buffers before reverting." (buffer-name buffer)))))
+      (let ((ok (and
+                 (or (not added)
+                     (apply 'git-call-process-display-error "update-index" "--force-remove" "--" added))
+                 (or (not modified)
+                     (apply 'git-call-process-display-error "checkout" "HEAD" modified)))))
+        (git-update-status-files (append added modified) 'uptodate)
+        (when ok
+          (dolist (file modified)
+            (let ((buffer (get-file-buffer file)))
+              (when buffer (with-current-buffer buffer (revert-buffer t t t)))))
+          (git-success-message "Reverted" (git-get-filenames files)))))))
 
 (defun git-resolve-file ()
   "Resolve conflicts in marked file(s)."
   (interactive)
   (let ((files (git-get-filenames (git-marked-files-state 'unmerged))))
     (when files
-      (apply #'git-call-process-env nil nil "update-index" "--" files)
-      (git-update-status-files files 'uptodate)
-      (git-success-message "Resolved" files))))
+      (when (apply 'git-call-process-display-error "update-index" "--" files)
+        (git-update-status-files files 'uptodate)
+        (git-success-message "Resolved" files)))))
 
 (defun git-remove-handled ()
   "Remove handled files from the status list."
@@ -1063,6 +1115,16 @@ Return the list of files that haven't been handled."
         (message "Inserting unknown files...done"))
     (git-remove-handled)))
 
+(defun git-expand-directory (info)
+  "Expand the directory represented by INFO to list its files."
+  (when (eq (lsh (git-fileinfo->new-perm info) -9) ?\110)
+    (let ((dir (git-fileinfo->name info)))
+      (git-set-filenames-state git-status (list dir) nil)
+      (git-run-ls-files-with-excludes git-status (list (concat dir "/")) 'unknown "-o")
+      (git-refresh-files)
+      (git-refresh-ewoc-hf git-status)
+      t)))
+
 (defun git-setup-diff-buffer (buffer)
   "Setup a buffer for displaying a diff."
   (let ((dir default-directory))
@@ -1199,7 +1261,8 @@ Return the list of files that haven't been handled."
       (goto-char (point-min))
       (when (re-search-forward "\n+\\'" nil t)
         (replace-match "\n" t t))
-      (when sign-off (git-append-sign-off committer-name committer-email)))))
+      (when sign-off (git-append-sign-off committer-name committer-email)))
+    buffer))
 
 (defun git-commit-file ()
   "Commit the marked file(s), asking for a commit message."
@@ -1232,14 +1295,61 @@ Return the list of files that haven't been handled."
       (setq buffer-file-coding-system coding-system)
       (re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
 
+(defun git-setup-commit-buffer (commit)
+  "Setup the commit buffer with the contents of COMMIT."
+  (let (author-name author-email subject date msg)
+    (with-temp-buffer
+      (let ((coding-system (git-get-logoutput-coding-system)))
+        (git-call-process-env t nil "log" "-1" commit)
+        (goto-char (point-min))
+        (when (re-search-forward "^Author: *\\(.*\\) <\\(.*\\)>$" nil t)
+          (setq author-name (match-string 1))
+          (setq author-email (match-string 2)))
+        (when (re-search-forward "^Date: *\\(.*\\)$" nil t)
+          (setq date (match-string 1)))
+        (while (re-search-forward "^    \\(.*\\)$" nil t)
+          (push (match-string 1) msg))
+        (setq msg (nreverse msg))
+        (setq subject (pop msg))
+        (while (and msg (zerop (length (car msg))) (pop msg)))))
+    (git-setup-log-buffer (get-buffer-create "*git-commit*")
+                          author-name author-email subject date
+                          (mapconcat #'identity msg "\n"))))
+
+(defun git-get-commit-files (commit)
+  "Retrieve the list of files modified by COMMIT."
+  (let (files)
+    (with-temp-buffer
+      (git-call-process-env t nil "diff-tree" "-r" "-z" "--name-only" "--no-commit-id" commit)
+      (goto-char (point-min))
+      (while (re-search-forward "\\([^\0]*\\)\0" nil t 1)
+        (push (match-string 1) files)))
+    files))
+
+(defun git-amend-commit ()
+  "Undo the last commit on HEAD, and set things up to commit an
+amended version of it."
+  (interactive)
+  (unless git-status (error "Not in git-status buffer."))
+  (when (git-empty-db-p) (error "No commit to amend."))
+  (let* ((commit (git-rev-parse "HEAD"))
+         (files (git-get-commit-files commit)))
+    (when (git-call-process-display-error "reset" "--soft" "HEAD^")
+      (git-update-status-files (copy-sequence files) 'uptodate)
+      (git-mark-files git-status files)
+      (git-refresh-files)
+      (git-setup-commit-buffer commit)
+      (git-commit-file))))
+
 (defun git-find-file ()
   "Visit the current file in its own buffer."
   (interactive)
   (unless git-status (error "Not in git-status buffer."))
   (let ((info (ewoc-data (ewoc-locate git-status))))
-    (find-file (git-fileinfo->name info))
-    (when (eq 'unmerged (git-fileinfo->state info))
-      (smerge-mode 1))))
+    (unless (git-expand-directory info)
+      (find-file (git-fileinfo->name info))
+      (when (eq 'unmerged (git-fileinfo->state info))
+        (smerge-mode 1)))))
 
 (defun git-find-file-other-window ()
   "Visit the current file in its own buffer in another window."
@@ -1309,6 +1419,7 @@ Return the list of files that haven't been handled."
 
 (unless git-status-mode-map
   (let ((map (make-keymap))
+        (commit-map (make-sparse-keymap))
         (diff-map (make-sparse-keymap))
         (toggle-map (make-sparse-keymap)))
     (suppress-keymap map)
@@ -1317,6 +1428,7 @@ Return the list of files that haven't been handled."
     (define-key map " "   'git-next-file)
     (define-key map "a"   'git-add-file)
     (define-key map "c"   'git-commit-file)
+    (define-key map "\C-c" commit-map)
     (define-key map "d"    diff-map)
     (define-key map "="   'git-diff-file)
     (define-key map "f"   'git-find-file)
@@ -1342,6 +1454,8 @@ Return the list of files that haven't been handled."
     (define-key map "x"   'git-remove-handled)
     (define-key map "\C-?" 'git-unmark-file-up)
     (define-key map "\M-\C-?" 'git-unmark-all)
+    ; the commit submap
+    (define-key commit-map "\C-a" 'git-amend-commit)
     ; the diff submap
     (define-key diff-map "b" 'git-diff-file-base)
     (define-key diff-map "c" 'git-diff-file-combined)
index c80a6da2522b690e15f84fedf52a132078cd265a..781a0cbbbc96d7bf5c6d77518f2d6c9d043ba68b 100755 (executable)
@@ -469,9 +469,7 @@ class P4Submit(Command):
                 optparse.make_option("--origin", dest="origin"),
                 optparse.make_option("--reset", action="store_true", dest="reset"),
                 optparse.make_option("--log-substitutions", dest="substFile"),
-                optparse.make_option("--dry-run", action="store_true"),
                 optparse.make_option("--direct", dest="directSubmit", action="store_true"),
-                optparse.make_option("--trust-me-like-a-fool", dest="trustMeLikeAFool", action="store_true"),
                 optparse.make_option("-M", dest="detectRename", action="store_true"),
         ]
         self.description = "Submit changes from git to the perforce depot."
@@ -479,12 +477,10 @@ class P4Submit(Command):
         self.firstTime = True
         self.reset = False
         self.interactive = True
-        self.dryRun = False
         self.substFile = ""
         self.firstTime = True
         self.origin = ""
         self.directSubmit = False
-        self.trustMeLikeAFool = False
         self.detectRename = False
         self.verbose = False
         self.isWindows = (platform.system() == "Windows")
@@ -681,57 +677,30 @@ class P4Submit(Command):
                 separatorLine += "\r"
             separatorLine += "\n"
 
-            response = "e"
-            if self.trustMeLikeAFool:
-                response = "y"
-
-            firstIteration = True
-            while response == "e":
-                if not firstIteration:
-                    response = raw_input("Do you want to submit this change? [y]es/[e]dit/[n]o/[s]kip ")
-                firstIteration = False
-                if response == "e":
-                    [handle, fileName] = tempfile.mkstemp()
-                    tmpFile = os.fdopen(handle, "w+")
-                    tmpFile.write(submitTemplate + separatorLine + diff)
-                    tmpFile.close()
-                    defaultEditor = "vi"
-                    if platform.system() == "Windows":
-                        defaultEditor = "notepad"
-                    editor = os.environ.get("EDITOR", defaultEditor);
-                    system(editor + " " + fileName)
-                    tmpFile = open(fileName, "rb")
-                    message = tmpFile.read()
-                    tmpFile.close()
-                    os.remove(fileName)
-                    submitTemplate = message[:message.index(separatorLine)]
-                    if self.isWindows:
-                        submitTemplate = submitTemplate.replace("\r\n", "\n")
-
-            if response == "y" or response == "yes":
-               if self.dryRun:
-                   print submitTemplate
-                   raw_input("Press return to continue...")
-               else:
-                   if self.directSubmit:
-                       print "Submitting to git first"
-                       os.chdir(self.oldWorkingDirectory)
-                       write_pipe("git commit -a -F -", submitTemplate)
-                       os.chdir(self.clientPath)
-
-                   write_pipe("p4 submit -i", submitTemplate)
-            elif response == "s":
-                for f in editedFiles:
-                    system("p4 revert \"%s\"" % f);
-                for f in filesToAdd:
-                    system("p4 revert \"%s\"" % f);
-                    system("rm %s" %f)
-                for f in filesToDelete:
-                    system("p4 delete \"%s\"" % f);
-                return
-            else:
-                print "Not submitting!"
-                self.interactive = False
+            [handle, fileName] = tempfile.mkstemp()
+            tmpFile = os.fdopen(handle, "w+")
+            tmpFile.write(submitTemplate + separatorLine + diff)
+            tmpFile.close()
+            defaultEditor = "vi"
+            if platform.system() == "Windows":
+                defaultEditor = "notepad"
+            editor = os.environ.get("EDITOR", defaultEditor);
+            system(editor + " " + fileName)
+            tmpFile = open(fileName, "rb")
+            message = tmpFile.read()
+            tmpFile.close()
+            os.remove(fileName)
+            submitTemplate = message[:message.index(separatorLine)]
+            if self.isWindows:
+                submitTemplate = submitTemplate.replace("\r\n", "\n")
+
+            if self.directSubmit:
+                print "Submitting to git first"
+                os.chdir(self.oldWorkingDirectory)
+                write_pipe("git commit -a -F -", submitTemplate)
+                os.chdir(self.clientPath)
+
+            write_pipe("p4 submit -i", submitTemplate)
         else:
             fileName = "submit.txt"
             file = open(fileName, "w+")
@@ -828,10 +797,8 @@ class P4Submit(Command):
                 sync = P4Sync()
                 sync.run([])
 
-                response = raw_input("Do you want to rebase current HEAD from Perforce now using git-p4 rebase? [y]es/[n]o ")
-                if response == "y" or response == "yes":
-                    rebase = P4Rebase()
-                    rebase.rebase()
+                rebase = P4Rebase()
+                rebase.rebase()
             os.remove(self.configFile)
 
         return True
@@ -964,9 +931,13 @@ class P4Sync(Command):
             stat = filedata[j]
             j += 1
             text = ''
-            while j < len(filedata) and filedata[j]['code'] in ('text',
-                                                                'binary'):
-                text += filedata[j]['data']
+            while j < len(filedata) and filedata[j]['code'] in ('text', 'unicode', 'binary'):
+                tmp = filedata[j]['data']
+                if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
+                    tmp = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', tmp)
+                elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
+                    tmp = re.sub(r'(?i)\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', tmp)
+                text += tmp
                 j += 1
 
 
@@ -1640,6 +1611,11 @@ class P4Rebase(Command):
         return self.rebase()
 
     def rebase(self):
+        if os.system("git update-index --refresh") != 0:
+            die("Some files in your working directory are modified and different than what is in your index. You can use git update-index <filename> to bring the index up-to-date or stash away all your changes with git stash.");
+        if len(read_pipe("git diff-index HEAD --")) > 0:
+            die("You have uncommited changes. Please commit them before rebasing or stash them away with git stash.");
+
         [upstream, settings] = findUpstreamBranchPoint()
         if len(upstream) == 0:
             die("Cannot find upstream branchpoint for rebase")
@@ -1670,7 +1646,7 @@ class P4Clone(P4Sync):
         depotPath = args[0]
         depotDir = re.sub("(@[^@]*)$", "", depotPath)
         depotDir = re.sub("(#[^#]*)$", "", depotDir)
-        depotDir = re.sub(r"\.\.\.$,", "", depotDir)
+        depotDir = re.sub(r"\.\.\.$", "", depotDir)
         depotDir = re.sub(r"/$", "", depotDir)
         return os.path.split(depotDir)[1]
 
index 80f114b2e2d169eef2a046d112d7e8729f2c1880..552707e8e65997ebfc2120887783c4fc5698e19f 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -326,14 +326,14 @@ static int read_convert_config(const char *var, const char *value)
 
        if (!strcmp("smudge", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                drv->smudge = strdup(value);
                return 0;
        }
 
        if (!strcmp("clean", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                drv->clean = strdup(value);
                return 0;
        }
diff --git a/diff.c b/diff.c
index d464fe3b20efd13bfc7ed08304eb94aca80fa3d9..cd8bc4dcc32757dfed9374fa8769599a6a7857ad 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -158,6 +158,8 @@ int git_diff_ui_config(const char *var, const char *value)
                return 0;
        }
        if (!strcmp(var, "diff.external")) {
+               if (!value)
+                       return config_error_nonbool(var);
                external_diff_cmd_cfg = xstrdup(value);
                return 0;
        }
@@ -165,8 +167,11 @@ int git_diff_ui_config(const char *var, const char *value)
                const char *ep = strrchr(var, '.');
 
                if (ep != var + 4) {
-                       if (!strcmp(ep, ".command"))
+                       if (!strcmp(ep, ".command")) {
+                               if (!value)
+                                       return config_error_nonbool(var);
                                return parse_lldiff_command(var, ep, value);
+                       }
                }
        }
 
@@ -177,6 +182,8 @@ int git_diff_basic_config(const char *var, const char *value)
 {
        if (!prefixcmp(var, "diff.color.") || !prefixcmp(var, "color.diff.")) {
                int slot = parse_diff_color_slot(var, 11);
+               if (!value)
+                       return config_error_nonbool(var);
                color_parse(value, var, diff_colors[slot]);
                return 0;
        }
@@ -184,8 +191,11 @@ int git_diff_basic_config(const char *var, const char *value)
        if (!prefixcmp(var, "diff.")) {
                const char *ep = strrchr(var, '.');
                if (ep != var + 4) {
-                       if (!strcmp(ep, ".funcname"))
+                       if (!strcmp(ep, ".funcname")) {
+                               if (!value)
+                                       return config_error_nonbool(var);
                                return parse_funcname_pattern(var, ep, value);
+                       }
                }
        }
 
index 45b4edf36b04970ccb5589e9abf93d8382c6da9b..a523b171e22f83d6a656b372cf20afe52d27d1b2 100644 (file)
@@ -275,6 +275,8 @@ struct recent_command
 static unsigned long max_depth = 10;
 static off_t max_packsize = (1LL << 32) - 1;
 static int force_update;
+static int pack_compression_level = Z_DEFAULT_COMPRESSION;
+static int pack_compression_seen;
 
 /* Stats and misc. counters */
 static uintmax_t alloc_count;
@@ -1038,7 +1040,7 @@ static int store_object(
                delta = NULL;
 
        memset(&s, 0, sizeof(s));
-       deflateInit(&s, zlib_compression_level);
+       deflateInit(&s, pack_compression_level);
        if (delta) {
                s.next_in = delta;
                s.avail_in = deltalen;
@@ -1066,7 +1068,7 @@ static int store_object(
                        delta = NULL;
 
                        memset(&s, 0, sizeof(s));
-                       deflateInit(&s, zlib_compression_level);
+                       deflateInit(&s, pack_compression_level);
                        s.next_in = (void *)dat->buf;
                        s.avail_in = dat->len;
                        s.avail_out = deflateBound(&s, s.avail_in);
@@ -1123,6 +1125,24 @@ static int store_object(
        return 0;
 }
 
+/* All calls must be guarded by find_object() or find_mark() to
+ * ensure the 'struct object_entry' passed was written by this
+ * process instance.  We unpack the entry by the offset, avoiding
+ * the need for the corresponding .idx file.  This unpacking rule
+ * works because we only use OBJ_REF_DELTA within the packfiles
+ * created by fast-import.
+ *
+ * oe must not be NULL.  Such an oe usually comes from giving
+ * an unknown SHA-1 to find_object() or an undefined mark to
+ * find_mark().  Callers must test for this condition and use
+ * the standard read_sha1_file() when it happens.
+ *
+ * oe->pack_id must not be MAX_PACK_ID.  Such an oe is usually from
+ * find_mark(), where the mark was reloaded from an existing marks
+ * file and is referencing an object that this fast-import process
+ * instance did not write out to a packfile.  Callers must test for
+ * this condition and use read_sha1_file() instead.
+ */
 static void *gfi_unpack_entry(
        struct object_entry *oe,
        unsigned long *sizep)
@@ -1130,7 +1150,22 @@ static void *gfi_unpack_entry(
        enum object_type type;
        struct packed_git *p = all_packs[oe->pack_id];
        if (p == pack_data && p->pack_size < (pack_size + 20)) {
+               /* The object is stored in the packfile we are writing to
+                * and we have modified it since the last time we scanned
+                * back to read a previously written object.  If an old
+                * window covered [p->pack_size, p->pack_size + 20) its
+                * data is stale and is not valid.  Closing all windows
+                * and updating the packfile length ensures we can read
+                * the newly written data.
+                */
                close_pack_windows(p);
+
+               /* We have to offer 20 bytes additional on the end of
+                * the packfile as the core unpacker code assumes the
+                * footer is present at the file end and must promise
+                * at least 20 bytes within any window it maps.  But
+                * we don't actually create the footer here.
+                */
                p->pack_size = pack_size + 20;
        }
        return unpack_entry(p, oe->offset, &type, sizep);
@@ -2282,6 +2317,27 @@ static void import_marks(const char *input_file)
        fclose(f);
 }
 
+static int git_pack_config(const char *k, const char *v)
+{
+       if (!strcmp(k, "pack.depth")) {
+               max_depth = git_config_int(k, v);
+               if (max_depth > MAX_DEPTH)
+                       max_depth = MAX_DEPTH;
+               return 0;
+       }
+       if (!strcmp(k, "pack.compression")) {
+               int level = git_config_int(k, v);
+               if (level == -1)
+                       level = Z_DEFAULT_COMPRESSION;
+               else if (level < 0 || level > Z_BEST_COMPRESSION)
+                       die("bad pack compression level %d", level);
+               pack_compression_level = level;
+               pack_compression_seen = 1;
+               return 0;
+       }
+       return git_default_config(k, v);
+}
+
 static const char fast_import_usage[] =
 "git-fast-import [--date-format=f] [--max-pack-size=n] [--depth=n] [--active-branches=n] [--export-marks=marks.file]";
 
@@ -2289,7 +2345,10 @@ int main(int argc, const char **argv)
 {
        unsigned int i, show_stats = 1;
 
-       git_config(git_default_config);
+       git_config(git_pack_config);
+       if (!pack_compression_seen && core_compression_seen)
+               pack_compression_level = core_compression_level;
+
        alloc_objects(object_entry_alloc);
        strbuf_init(&command_buf, 0);
        atom_table = xcalloc(atom_table_sz, sizeof(struct atom_str*));
index 5f0f241ad0bb53960d5969df5445760633f87dbc..2ecebc45a93784f1ca377941cd9b96569b3ade1c 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -14,7 +14,7 @@ b,binary        pass --allo-binary-replacement to git-apply
 3,3way          allow fall back on 3way merging if needed
 s,signoff       add a Signed-off-by line to the commit message
 u,utf8          recode into utf8 (default)
-k,keep          pass -k flagg to git-mailinfo
+k,keep          pass -k flag to git-mailinfo
 whitespace=     pass it through git-apply
 C=              pass it through git-apply
 p=              pass it through git-apply
index 5385249890698632dedcaf8dda03d865f66abca9..393fa355849f88d6c5227f90cbf6cbb45b39631e 100755 (executable)
@@ -26,6 +26,9 @@ OPTIONS_SPEC=
 . git-sh-setup
 require_work_tree
 
+_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
+_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
+
 sq() {
        @@PERL@@ -e '
                for (@ARGV) {
@@ -60,7 +63,8 @@ bisect_start() {
        # top-of-line master first!
        #
        head=$(GIT_DIR="$GIT_DIR" git symbolic-ref HEAD) ||
-       die "Bad HEAD - I need a symbolic ref"
+       head=$(GIT_DIR="$GIT_DIR" git rev-parse --verify HEAD) ||
+       die "Bad HEAD - I need a HEAD"
        case "$head" in
        refs/heads/bisect)
                if [ -s "$GIT_DIR/head-name" ]; then
@@ -70,7 +74,7 @@ bisect_start() {
                fi
                git checkout $branch || exit
                ;;
-       refs/heads/*)
+       refs/heads/*|$_x40)
                [ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree"
                echo "${head#refs/heads/}" >"$GIT_DIR/head-name"
                ;;
index 5621c69d86062c7c75c0b8c2749d34efc78cafb4..bd74d701a1f0abb63e2bcdcb47035cb2c6eee745 100755 (executable)
@@ -71,7 +71,8 @@ while test $# != 0; do
 done
 
 arg="$1"
-if rev=$(git rev-parse --verify "$arg^0" 2>/dev/null)
+rev=$(git rev-parse --verify "$arg" 2>/dev/null)
+if rev=$(git rev-parse --verify "$rev^0" 2>/dev/null)
 then
        [ -z "$rev" ] && die "unknown flag $arg"
        new_name="$arg"
@@ -82,11 +83,11 @@ then
        fi
        new="$rev"
        shift
-elif rev=$(git rev-parse --verify "$arg^{tree}" 2>/dev/null)
+elif rev=$(git rev-parse --verify "$rev^{tree}" 2>/dev/null)
 then
        # checking out selected paths from a tree-ish.
        new="$rev"
-       new_name="$arg^{tree}"
+       new_name="$rev^{tree}"
        shift
 fi
 [ "$1" = "--" ] && shift
index b6ef5442b79bc8a071597c1b0ad5508a4ed55a33..4df90cb34e61deb56ecb49797e48e67bdc98ff3b 100644 (file)
@@ -68,7 +68,9 @@
 #include <sys/poll.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#ifndef NO_SYS_SELECT_H
 #include <sys/select.h>
+#endif
 #include <assert.h>
 #include <regex.h>
 #include <netinet/in.h>
index ecded3b9cba9e18117f7372af37e9b56203a6fcf..afe3d0b7fe4d643688e672f62844cc86ec64fab5 100755 (executable)
@@ -2543,8 +2543,15 @@ sub update
                     if ($parent eq $lastpicked) {
                         next;
                     }
-                    my $base = safe_pipe_capture('git-merge-base',
+                   my $base = eval {
+                           safe_pipe_capture('git-merge-base',
                                                 $lastpicked, $parent);
+                   };
+                   # The two branches may not be related at all,
+                   # in which case merge base simply fails to find
+                   # any, but that's Ok.
+                   next if ($@);
+
                     chomp $base;
                     if ($base) {
                         my @merged;
index ebf05ca600739fcb8103dcebc6b9172eebfdacca..ff716cabb084526ddb5655c3b7c6dd02f4ed1b39 100755 (executable)
@@ -114,7 +114,6 @@ orig_namespace=refs/original/
 force=
 while :
 do
-       test $# = 0 && usage
        case "$1" in
        --)
                shift
@@ -189,6 +188,9 @@ cd "$tempdir/t" &&
 workdir="$(pwd)" ||
 die ""
 
+# Remove tempdir on exit
+trap 'cd ../..; rm -rf "$tempdir"' 0
+
 # Make sure refs/original is empty
 git for-each-ref > "$tempdir"/backup-refs
 while read sha1 type name
@@ -210,7 +212,7 @@ GIT_WORK_TREE=.
 export GIT_DIR GIT_WORK_TREE
 
 # The refs should be updated if their heads were rewritten
-git rev-parse --no-flags --revs-only --symbolic-full-name "$@" |
+git rev-parse --no-flags --revs-only --symbolic-full-name --default HEAD "$@" |
 sed -e '/^^/d' >"$tempdir"/heads
 
 test -s "$tempdir"/heads ||
@@ -406,6 +408,8 @@ fi
 cd ../..
 rm -rf "$tempdir"
 
+trap - 0
+
 unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
 test -z "$ORIG_GIT_DIR" || GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
 test -z "$ORIG_GIT_WORK_TREE" || GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&
index 1baf4b086131a10ab7e33529274ebd15100f375e..34438cdf5cc219ac71cbc90a23c23550276f5af2 100644 (file)
@@ -67,7 +67,7 @@ ifndef V
        QUIET_GEN      = $(QUIET)echo '   ' GEN '$@' &&
        QUIET_INDEX    = $(QUIET)echo '   ' INDEX $(dir $@) &&
        QUIET_MSGFMT0  = $(QUIET)printf '    MSGFMT %12s ' $@ && v=`
-       QUIET_MSGFMT1  = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages//g'
+       QUIET_MSGFMT1  = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages*//g'
        QUIET_2DEVNULL = 2>/dev/null
 
        INSTALL_D0 = dir=
@@ -198,6 +198,9 @@ ifdef NO_MSGFMT
        MSGFMT ?= $(TCL_PATH) po/po2msg.sh
 else
        MSGFMT ?= msgfmt
+       ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
+               MSGFMT := $(TCL_PATH) po/po2msg.sh
+       endif
 endif
 
 msgsdir     = $(gg_libdir)/msgs
index fcb2ab2fb7447ec2c3fec625afea292fc8a59e92..f42e461fd42ad37075d433f3509d6bd415a0b97a 100755 (executable)
@@ -438,6 +438,34 @@ proc git_write {args} {
        return [open [concat $opt $cmdp $args] w]
 }
 
+proc githook_read {hook_name args} {
+       set pchook [gitdir hooks $hook_name]
+       lappend args 2>@1
+
+       # On Cygwin [file executable] might lie so we need to ask
+       # the shell if the hook is executable.  Yes that's annoying.
+       #
+       if {[is_Cygwin]} {
+               upvar #0 _sh interp
+               if {![info exists interp]} {
+                       set interp [_which sh]
+               }
+               if {$interp eq {}} {
+                       error "hook execution requires sh (not in PATH)"
+               }
+
+               set scr {if test -x "$1";then exec "$@";fi}
+               set sh_c [list | $interp -c $scr $interp $pchook]
+               return [_open_stdout_stderr [concat $sh_c $args]]
+       }
+
+       if {[file executable $pchook]} {
+               return [_open_stdout_stderr [concat [list | $pchook] $args]]
+       }
+
+       return {}
+}
+
 proc sq {value} {
        regsub -all ' $value "'\\''" value
        return "'$value'"
index a063c5bc49fc9bad58f7fd78e7446a097ce86b88..c8821c146386f850c0794df70f605cd9f18dcff3 100644 (file)
@@ -451,7 +451,8 @@ method _sb_set {sb orient first last} {
                        focus $old_focus
                }
        }
-       $sb set $first $last
+
+       catch {$sb set $first $last}
 }
 
 method _show_tooltip {pos} {
index 1c0586c409b1700f250270a87f178f621989c32b..947b201c328eef044cfe21b463e8228031f6f8cd 100644 (file)
@@ -192,45 +192,52 @@ A good commit message has the following format:
                return
        }
 
-       # -- Run the pre-commit hook.
+       # -- Build the message file.
        #
-       set pchook [gitdir hooks pre-commit]
+       set msg_p [gitdir GITGUI_EDITMSG]
+       set msg_wt [open $msg_p w]
+       fconfigure $msg_wt -translation lf
+       if {[catch {set enc $repo_config(i18n.commitencoding)}]} {
+               set enc utf-8
+       }
+       set use_enc [tcl_encoding $enc]
+       if {$use_enc ne {}} {
+               fconfigure $msg_wt -encoding $use_enc
+       } else {
+               puts stderr [mc "warning: Tcl does not support encoding '%s'." $enc]
+               fconfigure $msg_wt -encoding utf-8
+       }
+       puts $msg_wt $msg
+       close $msg_wt
 
-       # On Cygwin [file executable] might lie so we need to ask
-       # the shell if the hook is executable.  Yes that's annoying.
+       # -- Run the pre-commit hook.
        #
-       if {[is_Cygwin] && [file isfile $pchook]} {
-               set pchook [list sh -c [concat \
-                       "if test -x \"$pchook\";" \
-                       "then exec \"$pchook\" 2>&1;" \
-                       "fi"]]
-       } elseif {[file executable $pchook]} {
-               set pchook [list $pchook |& cat]
-       } else {
-               commit_writetree $curHEAD $msg
+       set fd_ph [githook_read pre-commit]
+       if {$fd_ph eq {}} {
+               commit_commitmsg $curHEAD $msg_p
                return
        }
 
        ui_status {Calling pre-commit hook...}
        set pch_error {}
-       set fd_ph [open "| $pchook" r]
        fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
        fileevent $fd_ph readable \
-               [list commit_prehook_wait $fd_ph $curHEAD $msg]
+               [list commit_prehook_wait $fd_ph $curHEAD $msg_p]
 }
 
-proc commit_prehook_wait {fd_ph curHEAD msg} {
+proc commit_prehook_wait {fd_ph curHEAD msg_p} {
        global pch_error
 
        append pch_error [read $fd_ph]
        fconfigure $fd_ph -blocking 1
        if {[eof $fd_ph]} {
                if {[catch {close $fd_ph}]} {
+                       catch {file delete $msg_p}
                        ui_status {Commit declined by pre-commit hook.}
                        hook_failed_popup pre-commit $pch_error
                        unlock_index
                } else {
-                       commit_writetree $curHEAD $msg
+                       commit_commitmsg $curHEAD $msg_p
                }
                set pch_error {}
                return
@@ -238,14 +245,52 @@ proc commit_prehook_wait {fd_ph curHEAD msg} {
        fconfigure $fd_ph -blocking 0
 }
 
-proc commit_writetree {curHEAD msg} {
+proc commit_commitmsg {curHEAD msg_p} {
+       global pch_error
+
+       # -- Run the commit-msg hook.
+       #
+       set fd_ph [githook_read commit-msg $msg_p]
+       if {$fd_ph eq {}} {
+               commit_writetree $curHEAD $msg_p
+               return
+       }
+
+       ui_status {Calling commit-msg hook...}
+       set pch_error {}
+       fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
+       fileevent $fd_ph readable \
+               [list commit_commitmsg_wait $fd_ph $curHEAD $msg_p]
+}
+
+proc commit_commitmsg_wait {fd_ph curHEAD msg_p} {
+       global pch_error
+
+       append pch_error [read $fd_ph]
+       fconfigure $fd_ph -blocking 1
+       if {[eof $fd_ph]} {
+               if {[catch {close $fd_ph}]} {
+                       catch {file delete $msg_p}
+                       ui_status {Commit declined by commit-msg hook.}
+                       hook_failed_popup commit-msg $pch_error
+                       unlock_index
+               } else {
+                       commit_writetree $curHEAD $msg_p
+               }
+               set pch_error {}
+               return
+       }
+       fconfigure $fd_ph -blocking 0
+}
+
+proc commit_writetree {curHEAD msg_p} {
        ui_status {Committing changes...}
        set fd_wt [git_read write-tree]
        fileevent $fd_wt readable \
-               [list commit_committree $fd_wt $curHEAD $msg]
+               [list commit_committree $fd_wt $curHEAD $msg_p]
 }
 
-proc commit_committree {fd_wt curHEAD msg} {
+proc commit_committree {fd_wt curHEAD msg_p} {
        global HEAD PARENT MERGE_HEAD commit_type
        global current_branch
        global ui_comm selected_commit_type
@@ -254,6 +299,7 @@ proc commit_committree {fd_wt curHEAD msg} {
 
        gets $fd_wt tree_id
        if {[catch {close $fd_wt} err]} {
+               catch {file delete $msg_p}
                error_popup [strcat [mc "write-tree failed:"] "\n\n$err"]
                ui_status {Commit failed.}
                unlock_index
@@ -276,6 +322,7 @@ proc commit_committree {fd_wt curHEAD msg} {
                }
 
                if {$tree_id eq $old_tree} {
+                       catch {file delete $msg_p}
                        info_popup [mc "No changes to commit.
 
 No files were modified by this commit and it was not a merge commit.
@@ -288,24 +335,6 @@ A rescan will be automatically started now.
                }
        }
 
-       # -- Build the message.
-       #
-       set msg_p [gitdir COMMIT_EDITMSG]
-       set msg_wt [open $msg_p w]
-       fconfigure $msg_wt -translation lf
-       if {[catch {set enc $repo_config(i18n.commitencoding)}]} {
-               set enc utf-8
-       }
-       set use_enc [tcl_encoding $enc]
-       if {$use_enc ne {}} {
-               fconfigure $msg_wt -encoding $use_enc
-       } else {
-               puts stderr [mc "warning: Tcl does not support encoding '%s'." $enc]
-               fconfigure $msg_wt -encoding utf-8
-       }
-       puts $msg_wt $msg
-       close $msg_wt
-
        # -- Create the commit.
        #
        set cmd [list commit-tree $tree_id]
@@ -314,6 +343,7 @@ A rescan will be automatically started now.
        }
        lappend cmd <$msg_p
        if {[catch {set cmt_id [eval git $cmd]} err]} {
+               catch {file delete $msg_p}
                error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
                ui_status {Commit failed.}
                unlock_index
@@ -326,16 +356,14 @@ A rescan will be automatically started now.
        if {$commit_type ne {normal}} {
                append reflogm " ($commit_type)"
        }
-       set i [string first "\n" $msg]
-       if {$i >= 0} {
-               set subject [string range $msg 0 [expr {$i - 1}]]
-       } else {
-               set subject $msg
-       }
+       set msg_fd [open $msg_p r]
+       gets $msg_fd subject
+       close $msg_fd
        append reflogm {: } $subject
        if {[catch {
                        git update-ref -m $reflogm HEAD $cmt_id $curHEAD
                } err]} {
+               catch {file delete $msg_p}
                error_popup [strcat [mc "update-ref failed:"] "\n\n$err"]
                ui_status {Commit failed.}
                unlock_index
@@ -363,17 +391,13 @@ A rescan will be automatically started now.
 
        # -- Run the post-commit hook.
        #
-       set pchook [gitdir hooks post-commit]
-       if {[is_Cygwin] && [file isfile $pchook]} {
-               set pchook [list sh -c [concat \
-                       "if test -x \"$pchook\";" \
-                       "then exec \"$pchook\";" \
-                       "fi"]]
-       } elseif {![file executable $pchook]} {
-               set pchook {}
-       }
-       if {$pchook ne {}} {
-               catch {exec $pchook &}
+       set fd_ph [githook_read post-commit]
+       if {$fd_ph ne {}} {
+               upvar #0 pch_error$cmt_id pc_err
+               set pc_err {}
+               fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
+               fileevent $fd_ph readable \
+                       [list commit_postcommit_wait $fd_ph $cmt_id]
        }
 
        $ui_comm delete 0.0 end
@@ -429,3 +453,18 @@ A rescan will be automatically started now.
        reshow_diff
        ui_status [mc "Created commit %s: %s" [string range $cmt_id 0 7] $subject]
 }
+
+proc commit_postcommit_wait {fd_ph cmt_id} {
+       upvar #0 pch_error$cmt_id pch_error
+
+       append pch_error [read $fd_ph]
+       fconfigure $fd_ph -blocking 1
+       if {[eof $fd_ph]} {
+               if {[catch {close $fd_ph}]} {
+                       hook_failed_popup post-commit $pch_error 0
+               }
+               unset pch_error
+               return
+       }
+       fconfigure $fd_ph -blocking 0
+}
index 13565b7ab02b22123f0b7b9000dc1f4a993994b0..0fdd7531dac07e68315cebc2efa87e99947821b6 100644 (file)
@@ -62,7 +62,7 @@ proc ask_popup {msg} {
        eval $cmd
 }
 
-proc hook_failed_popup {hook msg} {
+proc hook_failed_popup {hook msg {is_fatal 1}} {
        set w .hookfail
        toplevel $w
 
@@ -77,14 +77,16 @@ proc hook_failed_popup {hook msg} {
                -width 80 -height 10 \
                -font font_diff \
                -yscrollcommand [list $w.m.sby set]
-       label $w.m.l2 \
-               -text [mc "You must correct the above errors before committing."] \
-               -anchor w \
-               -justify left \
-               -font font_uibold
        scrollbar $w.m.sby -command [list $w.m.t yview]
        pack $w.m.l1 -side top -fill x
-       pack $w.m.l2 -side bottom -fill x
+       if {$is_fatal} {
+               label $w.m.l2 \
+                       -text [mc "You must correct the above errors before committing."] \
+                       -anchor w \
+                       -justify left \
+                       -font font_uibold
+               pack $w.m.l2 -side bottom -fill x
+       }
        pack $w.m.sby -side right -fill y
        pack $w.m.t -side left -fill both -expand 1
        pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10
@@ -99,6 +101,6 @@ proc hook_failed_popup {hook msg} {
 
        bind $w <Visibility> "grab $w; focus $w"
        bind $w <Key-Return> "destroy $w"
-       wm title $w [append "[appname] ([reponame]): " [mc "error"]]
+       wm title $w [strcat "[appname] ([reponame]): " [mc "error"]]
        tkwait window $w
 }
index bb2feaf1374873b81f285bde91e0ca9976d5267f..27c006abb2adca055ebf7e44ce9a4ec351af19c5 100644 (file)
@@ -34,7 +34,7 @@ msgstr "branche"
 
 #. ""
 msgid "branch [verb]"
-msgstr "créer une branche"
+msgstr "créer une branche"
 
 #. ""
 msgid "checkout [noun]"
@@ -58,7 +58,7 @@ msgstr "commiter"
 
 #. ""
 msgid "diff [noun]"
-msgstr "différence"
+msgstr "différence"
 
 #. ""
 msgid "diff [verb]"
@@ -70,11 +70,11 @@ msgstr "fusion par avance rapide"
 
 #. "Fetching a branch means to get the branch's head from a remote repository, to find out which objects are missing from the local object database, and to get them, too."
 msgid "fetch"
-msgstr "récupérer"
+msgstr "récupérer"
 
 #. "A collection of files. The index is a stored version of your working tree."
 msgid "index (in git-gui: staging area)"
-msgstr "pré-commit"
+msgstr "pré-commit"
 
 #. "A successful merge results in the creation of a new commit representing the result of the merge."
 msgid "merge [noun]"
@@ -106,15 +106,15 @@ msgstr "refaire"
 
 #. "An other repository ('remote'). One might have a set of remotes whose branches one tracks."
 msgid "remote"
-msgstr "référentiel distant"
+msgstr "référentiel distant"
 
 #. "A collection of refs (?) together with an object database containing all objects which are reachable from the refs... (oops, you've lost me here. Again, please an explanation for mere mortals?)"
 msgid "repository"
-msgstr "référentiel"
+msgstr "référentiel"
 
 #. ""
 msgid "reset"
-msgstr "réinitialiser"
+msgstr "réinitialiser"
 
 #. ""
 msgid "revert"
@@ -122,7 +122,7 @@ msgstr "inverser"
 
 #. "A particular state of files and directories which was stored in the object database."
 msgid "revision"
-msgstr "révision"
+msgstr "révision"
 
 #. ""
 msgid "sign off"
@@ -130,11 +130,11 @@ msgstr "signer"
 
 #. ""
 msgid "staging area"
-msgstr "pré-commit"
+msgstr "pré-commit"
 
 #. ""
 msgid "status"
-msgstr "état"
+msgstr "état"
 
 #. "A ref pointing to a tag or commit object"
 msgid "tag [noun]"
@@ -150,15 +150,15 @@ msgstr "branche de suivi"
 
 #. ""
 msgid "undo"
-msgstr "défaire"
+msgstr "défaire"
 
 #. ""
 msgid "update"
-msgstr "mise Ã  jour"
+msgstr "mise Ã  jour"
 
 #. ""
 msgid "verify"
-msgstr "vérifier"
+msgstr "vérifier"
 
 #. "The tree of actual checked out files."
 msgid "working copy, working tree"
index c63248e3752b8b479f75ad2fe772dd40f684be54..b7c4bf3fdffb3d04b8c01b25e99a706e499de0d1 100644 (file)
@@ -127,7 +127,26 @@ foreach file $files {
 }
 
 if {$show_statistics} {
-       puts [concat "$translated_count translated messages, " \
-               "$fuzzy_count fuzzy ones, " \
-               "$not_translated_count untranslated ones."]
+       set str ""
+
+       append str  "$translated_count translated message"
+       if {$translated_count != 1} {
+               append str s
+       }
+
+       if {$fuzzy_count > 1} {
+               append str  ", $fuzzy_count fuzzy translation"
+               if {$fuzzy_count != 1} {
+                       append str s
+               }
+       }
+       if {$not_translated_count > 0} {
+               append str  ", $not_translated_count untranslated message"
+               if {$not_translated_count != 1} {
+                       append str s
+               }
+       }
+
+       append str  .
+       puts $str
 }
index ad0723ccc64cc2cb7d0e79a165a68707d3ddfde7..3e4452bc4bc1fe57c75848ccd9c073aeb065a980 100755 (executable)
@@ -274,6 +274,14 @@ webrick)
        ;;
 esac
 
+init_browser_path() {
+       browser_path="`git config browser.$1.path`"
+       test -z "$browser_path" && browser_path="$1"
+}
+
 start_httpd
 url=http://127.0.0.1:$port
-test -n "$browser" && "$browser" $url || echo $url
+test -n "$browser" && {
+       init_browser_path "$browser"
+       "$browser_path" $url
+} || echo $url
index fa97b0f3562ab34b7cf1b7b68b293d9174121088..46da0f4ca2bfc2b30e4da8eb551565a06c876fb1 100755 (executable)
@@ -106,6 +106,15 @@ error_on_no_merge_candidates () {
        exit 1
 }
 
+test true = "$rebase" && {
+       . git-parse-remote &&
+       origin="$1"
+       test -z "$origin" && origin=$(get_default_remote)
+       reflist="$(get_remote_refs_for_fetch "$@" 2>/dev/null |
+               sed "s|refs/heads/\(.*\):|\1|")" &&
+       oldremoteref="$(git rev-parse --verify \
+               "refs/remotes/$origin/$reflist" 2>/dev/null)"
+}
 orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
 git-fetch --update-head-ok "$@" || exit 1
 
@@ -164,6 +173,7 @@ then
 fi
 
 merge_name=$(git fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit
-test true = "$rebase" && exec git-rebase $merge_head
+test true = "$rebase" &&
+       exec git-rebase --onto $merge_head ${oldremoteref:-$merge_head}
 exec git-merge $no_summary $no_commit $squash $no_ff $strategy_args \
        "$merge_name" HEAD $merge_head
index 402ff3782c0aaa472a2013ff3a9bef44a6cd8550..fb12b03b201836bb4c3b43a5d1120b3305d1ccf0 100755 (executable)
@@ -432,7 +432,7 @@ do
                        shift ;;
                esac
                ;;
-       --merge)
+       -m|--merge)
                # we use merge anyway
                ;;
        -C*)
index f6b4f6a2f81767fdcb2ccadbf7757eaa2b556c36..15fb932021e03e2b7b856b3a2285021be2ebac61 100755 (executable)
@@ -40,7 +40,7 @@ my $master_dir = pop @dirs;
 opendir(D,$master_dir . "objects/")
        or die "Failed to open $master_dir/objects/ : $!";
 
-my @hashdirs = grep !/^\.{1,2}$/, readdir(D);
+my @hashdirs = grep { ($_ eq 'pack') || /^[0-9a-f]{2}$/ } readdir(D);
 
 foreach my $repo (@dirs) {
        $linked = 0;
index d13e4c1fea93f0c345f6638bfd8a3715c73fa693..5cd69513cf84111d1152d07f8cda77b201ffc416 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/perl -w
 
+use strict;
 use Git;
 my $git = Git->repository();
 
@@ -296,12 +297,13 @@ sub add_remote {
 
 sub update_remote {
        my ($name) = @_;
+       my @remotes;
 
         my $conf = $git->config("remotes." . $name);
        if (defined($conf)) {
                @remotes = split(' ', $conf);
        } elsif ($name eq 'default') {
-               undef @remotes;
+               @remotes = ();
                for (sort keys %$remote) {
                        my $do_fetch = $git->config_bool("remote." . $_ .
                                                    ".skipDefaultUpdate");
@@ -341,7 +343,7 @@ sub rm_remote {
        my @refs = $git->command('for-each-ref',
                '--format=%(refname) %(objectname)', "refs/remotes/$name");
        for (@refs) {
-               ($ref, $object) = split;
+               my ($ref, $object) = split;
                $git->command(qw(update-ref -d), $ref, $object);
        }
        return 0;
@@ -352,7 +354,7 @@ sub add_usage {
        exit(1);
 }
 
-local $VERBOSE = 0;
+my $VERBOSE = 0;
 @ARGV = grep {
        if ($_ eq '-v' or $_ eq '--verbose') {
                $VERBOSE=1;
@@ -395,7 +397,7 @@ elsif ($ARGV[0] eq 'update') {
                update_remote("default");
                exit(1);
        }
-       for ($i = 1; $i < @ARGV; $i++) {
+       for (my $i = 1; $i < @ARGV; $i++) {
                update_remote($ARGV[$i]);
        }
 }
index 6c72952fcc09934a4e710be733b4926a9e5a2658..a1a9d14b00d01844509a87c598314e2ffbbfa47c 100755 (executable)
@@ -462,7 +462,7 @@ EOT
                exit(0);
        }
 
-       @files = ($compose_filename . ".final");
+       @files = ($compose_filename . ".final", @files);
 }
 
 # Variables we set as part of the loop over files
index ad9fe628fdf0f7d5a9a968abeb03d6213e3772d7..a6aaf40b0ac5b477b73684b5a2b8b7417adaad81 100755 (executable)
@@ -9,11 +9,8 @@ OPTIONS_SPEC=
 . git-sh-setup
 require_work_tree
 
-add=
+command=
 branch=
-init=
-update=
-status=
 quiet=
 cached=
 
@@ -86,9 +83,9 @@ module_name()
 #
 # Clone a submodule
 #
-# Prior to calling, modules_update checks that a possibly existing
+# Prior to calling, cmd_update checks that a possibly existing
 # path is not a git repository.
-# Likewise, module_add checks that path does not exist at all,
+# Likewise, cmd_add checks that path does not exist at all,
 # since it is the location of a new submodule.
 #
 module_clone()
@@ -121,8 +118,34 @@ module_clone()
 #
 # optional branch is stored in global branch variable
 #
-module_add()
+cmd_add()
 {
+       # parse $args after "submodule ... add".
+       while test $# -ne 0
+       do
+               case "$1" in
+               -b | --branch)
+                       case "$2" in '') usage ;; esac
+                       branch=$2
+                       shift
+                       ;;
+               -q|--quiet)
+                       quiet=1
+                       ;;
+               --)
+                       shift
+                       break
+                       ;;
+               -*)
+                       usage
+                       ;;
+               *)
+                       break
+                       ;;
+               esac
+               shift
+       done
+
        repo=$1
        path=$2
 
@@ -174,8 +197,29 @@ module_add()
 #
 # $@ = requested paths (default to all)
 #
-modules_init()
+cmd_init()
 {
+       # parse $args after "submodule ... init".
+       while test $# -ne 0
+       do
+               case "$1" in
+               -q|--quiet)
+                       quiet=1
+                       ;;
+               --)
+                       shift
+                       break
+                       ;;
+               -*)
+                       usage
+                       ;;
+               *)
+                       break
+                       ;;
+               esac
+               shift
+       done
+
        git ls-files --stage -- "$@" | grep -e '^160000 ' |
        while read mode sha1 stage path
        do
@@ -207,8 +251,29 @@ modules_init()
 #
 # $@ = requested paths (default to all)
 #
-modules_update()
+cmd_update()
 {
+       # parse $args after "submodule ... update".
+       while test $# -ne 0
+       do
+               case "$1" in
+               -q|--quiet)
+                       quiet=1
+                       ;;
+               --)
+                       shift
+                       break
+                       ;;
+               -*)
+                       usage
+                       ;;
+               *)
+                       break
+                       ;;
+               esac
+               shift
+       done
+
        git ls-files --stage -- "$@" | grep -e '^160000 ' |
        while read mode sha1 stage path
        do
@@ -266,8 +331,32 @@ set_name_rev () {
 #
 # $@ = requested paths (default to all)
 #
-modules_list()
+cmd_status()
 {
+       # parse $args after "submodule ... status".
+       while test $# -ne 0
+       do
+               case "$1" in
+               -q|--quiet)
+                       quiet=1
+                       ;;
+               --cached)
+                       cached=1
+                       ;;
+               --)
+                       shift
+                       break
+                       ;;
+               -*)
+                       usage
+                       ;;
+               *)
+                       break
+                       ;;
+               esac
+               shift
+       done
+
        git ls-files --stage -- "$@" | grep -e '^160000 ' |
        while read mode sha1 stage path
        do
@@ -293,20 +382,17 @@ modules_list()
        done
 }
 
-while test $# != 0
+# This loop parses the command line arguments to find the
+# subcommand name to dispatch.  Parsing of the subcommand specific
+# options are primarily done by the subcommand implementations.
+# Subcommand specific options such as --branch and --cached are
+# parsed here as well, for backward compatibility.
+
+while test $# != 0 && test -z "$command"
 do
        case "$1" in
-       add)
-               add=1
-               ;;
-       init)
-               init=1
-               ;;
-       update)
-               update=1
-               ;;
-       status)
-               status=1
+       add | init | update | status)
+               command=$1
                ;;
        -q|--quiet)
                quiet=1
@@ -335,30 +421,19 @@ do
        shift
 done
 
-case "$add,$branch" in
-1,*)
-       ;;
-,)
-       ;;
-,*)
+# No command word defaults to "status"
+test -n "$command" || command=status
+
+# "-b branch" is accepted only by "add"
+if test -n "$branch" && test "$command" != add
+then
        usage
-       ;;
-esac
-
-case "$add,$init,$update,$status,$cached" in
-1,,,,)
-       module_add "$@"
-       ;;
-,1,,,)
-       modules_init "$@"
-       ;;
-,,1,,)
-       modules_update "$@"
-       ;;
-,,,*,*)
-       modules_list "$@"
-       ;;
-*)
+fi
+
+# "--cached" is accepted only by "status"
+if test -n "$cached" && test "$command" != status
+then
        usage
-       ;;
-esac
+fi
+
+"cmd_$command" "$@"
index 9f2b587b2534e29054b5399a745d56e2ed5ea216..05fb3582d92e05e6b95ff8f249ae2ecb9892b45b 100755 (executable)
@@ -186,6 +186,9 @@ my %cmd = (
                    "Show info about the latest SVN revision
                     on the current branch",
                    { 'url' => \$_url, } ],
+       'blame' => [ \&Git::SVN::Log::cmd_blame,
+                   "Show what revision and author last modified each line of a file",
+                   {} ],
 );
 
 my $cmd;
@@ -1247,7 +1250,8 @@ use File::Path qw/mkpath/;
 use File::Copy qw/copy/;
 use IPC::Open3;
 
-my $_repack_nr;
+my ($_gc_nr, $_gc_period);
+
 # properties that we do not log:
 my %SKIP_PROP;
 BEGIN {
@@ -1408,10 +1412,9 @@ sub read_all_remotes {
 }
 
 sub init_vars {
-       if (defined $_repack) {
-               $_repack = 1000 if ($_repack <= 0);
-               $_repack_nr = $_repack;
-               $_repack_flags ||= '-d';
+       $_gc_nr = $_gc_period = 1000;
+       if (defined $_repack || defined $_repack_flags) {
+              warn "Repack options are obsolete; they have no effect.\n";
        }
 }
 
@@ -2098,6 +2101,10 @@ sub restore_commit_header_env {
        }
 }
 
+sub gc {
+       command_noisy('gc', '--auto');
+};
+
 sub do_git_commit {
        my ($self, $log_entry) = @_;
        my $lr = $self->last_rev;
@@ -2151,12 +2158,9 @@ sub do_git_commit {
                                   0, $self->svm_uuid);
        }
        print " = $commit ($self->{ref_id})\n";
-       if (defined $_repack && (--$_repack_nr == 0)) {
-               $_repack_nr = $_repack;
-               # repack doesn't use any arguments with spaces in them, does it?
-               print "Running git repack $_repack_flags ...\n";
-               command_noisy('repack', split(/\s+/, $_repack_flags));
-               print "Done repacking\n";
+       if (--$_gc_nr == 0) {
+               $_gc_nr = $_gc_period;
+               gc();
        }
        return $commit;
 }
@@ -2228,7 +2232,12 @@ sub find_parent_branch {
                # just grow a tail if we're not unique enough :x
                $ref_id .= '-' while find_ref($ref_id);
                print STDERR "Initializing parent: $ref_id\n";
-               $gs = Git::SVN->init($new_url, '', $ref_id, $ref_id, 1);
+               my ($u, $p) = ($new_url, '');
+               if ($u =~ s#^\Q$url\E(/|$)##) {
+                       $p = $u;
+                       $u = $url;
+               }
+               $gs = Git::SVN->init($u, $p, $self->{repo_id}, $ref_id, 1);
        }
        my ($r0, $parent) = $gs->find_rev_before($r, 1);
        if (!defined $r0 || !defined $parent) {
@@ -3985,6 +3994,7 @@ sub gs_fetch_loop_common {
                $max += $inc;
                $max = $head if ($max > $head);
        }
+       Git::SVN::gc();
 }
 
 sub match_globs {
@@ -4441,6 +4451,24 @@ out:
        print commit_log_separator unless $incremental || $oneline;
 }
 
+sub cmd_blame {
+       my $path = shift;
+
+       config_pager();
+       run_pager();
+
+       my ($fh, $ctx) = command_output_pipe('blame', @_, $path);
+       while (my $line = <$fh>) {
+               if ($line =~ /^\^?([[:xdigit:]]+)\s/) {
+                       my (undef, $rev, undef) = ::cmt_metadata($1);
+                       $rev = sprintf('%-10s', $rev);
+                       $line =~ s/^\^?[[:xdigit:]]+(\s)/$rev$1/;
+               }
+               print $line;
+       }
+       command_close_pipe($fh, $ctx);
+}
+
 package Git::SVN::Migration;
 # these version numbers do NOT correspond to actual version numbers
 # of git nor git-svn.  They are just relative.
diff --git a/git.c b/git.c
index 15fec8974ad5361a2308b3c46424e896bc8e3246..0cb86884d738a8314f164c82e4cc619a9998f3db 100644 (file)
--- a/git.c
+++ b/git.c
@@ -93,6 +93,8 @@ static char *alias_string;
 static int git_alias_config(const char *var, const char *value)
 {
        if (!prefixcmp(var, "alias.") && !strcmp(var + 6, alias_command)) {
+               if (!value)
+                       return config_error_nonbool(var);
                alias_string = xstrdup(value);
        }
        return 0;
index 659f058819d1aa0f2b7f1b19863f9139f648ffd6..3f9f88815b865cb6c405268d83f67f1b2f858f88 100644 (file)
@@ -8,7 +8,7 @@ License:        GPL
 Group:                 Development/Tools
 URL:           http://kernel.org/pub/software/scm/git/
 Source:        http://kernel.org/pub/software/scm/git/%{name}-%{version}.tar.gz
-BuildRequires: zlib-devel >= 1.2, openssl-devel, curl-devel, expat-devel  %{!?_without_docs:, xmlto, asciidoc > 6.0.3}
+BuildRequires: zlib-devel >= 1.2, openssl-devel, curl-devel, expat-devel, gettext  %{!?_without_docs:, xmlto, asciidoc > 6.0.3}
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires:      git-core = %{version}-%{release}
@@ -181,6 +181,9 @@ rm -rf $RPM_BUILD_ROOT
 %{!?_without_docs: %doc Documentation/technical}
 
 %changelog
+* Sun Feb 03 2008 James Bowes <jbowes@dangerouslyinc.com>
+- Add a BuildRequires for gettext
+
 * Fri Jan 11 2008 Junio C Hamano <gitster@pobox.com>
 - Include gitk message files
 
index b28f59f574e2a6b7da3a186bce4bf88b7cd71a6f..4c8bedf7449266229e8102efac249e68fd9d8b39 100644 (file)
@@ -129,17 +129,30 @@ descriptions.
 Gitweb config file variables
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-You can set, among others,  the following variables in gitweb config files:
+You can set, among others, the following variables in gitweb config files
+(with the exception of $projectroot and $projects_list this list does
+not include variables usually directly set during build):
  * $GIT
    Cure git executable to use.  By default set to "$GIT_BINDIR/git", which
    in turn is by default set to "$(bindir)/git".  If you use git from binary
    package, set this to "/usr/bin/git".  This can just be "git" if your
    webserver has a sensible PATH.  If you have multiple git versions
-   installed it is / can be used to choose which one to use.
+   installed it can be used to choose which one to use.
  * $version
    Gitweb version, set automatically when creating gitweb.cgi from
    gitweb.perl. You might want to modify it if you are running modified
    gitweb.
+ * $projectroot
+   Absolute filesystem path which will be prepended to project path;
+   the path to repository is $projectroot/$project.  Set to
+   $GITWEB_PROJECTROOT during installation.  This variable have to be
+   set correctly for gitweb to find repositories.
+ * $projects_list
+   Source of projects list, either directory to scan, or text file
+   with list of repositories (in the "<URI-encoded repository path> SPC
+   <URI-encoded repository owner>" format).  Set to $GITWEB_LIST
+   during installation.  If empty, $projectroot is used to scan for
+   repositories.
  * $my_url, $my_uri
    URL and absolute URL of gitweb script; you might need to set those
    variables if you are using 'pathinfo' feature: see also below.
index 6256641ace0cb2a3b362503437f6126487096fc5..5e88637b5e0e67143692bac336a57ab6cc1c0c38 100755 (executable)
@@ -1606,7 +1606,7 @@ sub git_get_project_description {
        my $path = shift;
 
        $git_dir = "$projectroot/$path";
-       open my $fd, "$projectroot/$path/description"
+       open my $fd, "$git_dir/description"
                or return git_get_project_config('description');
        my $descr = <$fd>;
        close $fd;
@@ -1620,7 +1620,7 @@ sub git_get_project_url_list {
        my $path = shift;
 
        $git_dir = "$projectroot/$path";
-       open my $fd, "$projectroot/$path/cloneurl"
+       open my $fd, "$git_dir/cloneurl"
                or return wantarray ?
                @{ config_to_multi(git_get_project_config('url')) } :
                   config_to_multi(git_get_project_config('url'));
@@ -5048,16 +5048,15 @@ sub git_commitdiff {
                        -expires => $expires,
                        -content_disposition => 'inline; filename="' . "$filename" . '"');
                my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
-               print <<TEXT;
-From: $co{'author'}
-Date: $ad{'rfc2822'} ($ad{'tz_local'})
-Subject: $co{'title'}
-TEXT
+               print "From: " . to_utf8($co{'author'}) . "\n";
+               print "Date: $ad{'rfc2822'} ($ad{'tz_local'})\n";
+               print "Subject: " . to_utf8($co{'title'}) . "\n";
+
                print "X-Git-Tag: $tagname\n" if $tagname;
                print "X-Git-Url: " . $cgi->self_url() . "\n\n";
 
                foreach my $line (@{$co{'comment'}}) {
-                       print "$line\n";
+                       print to_utf8($line) . "\n";
                }
                print "---\n\n";
        }
@@ -5566,7 +5565,7 @@ XML
                        or next;
 
                # print element (entry, item)
-               my $co_url = href(-full=>1, action=>"commit", hash=>$commit);
+               my $co_url = href(-full=>1, action=>"commitdiff", hash=>$commit);
                if ($format eq 'rss') {
                        print "<item>\n" .
                              "<title>" . esc_html($co{'title'}) . "</title>\n" .
diff --git a/help.c b/help.c
index 1302a61c83c524099e7d39257daa273a09edad4f..95e7640fedebb1574a4259d85d7b95d5220f0e6f 100644 (file)
--- a/help.c
+++ b/help.c
@@ -40,6 +40,8 @@ static void parse_help_format(const char *format)
 static int git_help_config(const char *var, const char *value)
 {
        if (!strcmp(var, "help.format")) {
+               if (!value)
+                       return config_error_nonbool(var);
                help_default_format = xstrdup(value);
                return 0;
        }
diff --git a/http.c b/http.c
index d2c11aee9077e0834c5c56b1284df478eb8debbc..5925d07478b763ee9f91d7b273f64f0ae956219b 100644 (file)
--- a/http.c
+++ b/http.c
@@ -101,16 +101,18 @@ static int http_options(const char *var, const char *value)
 
        if (!strcmp("http.sslcert", var)) {
                if (ssl_cert == NULL) {
-                       ssl_cert = xmalloc(strlen(value)+1);
-                       strcpy(ssl_cert, value);
+                       if (!value)
+                               return config_error_nonbool(var);
+                       ssl_cert = xstrdup(value);
                }
                return 0;
        }
 #if LIBCURL_VERSION_NUM >= 0x070902
        if (!strcmp("http.sslkey", var)) {
                if (ssl_key == NULL) {
-                       ssl_key = xmalloc(strlen(value)+1);
-                       strcpy(ssl_key, value);
+                       if (!value)
+                               return config_error_nonbool(var);
+                       ssl_key = xstrdup(value);
                }
                return 0;
        }
@@ -118,16 +120,18 @@ static int http_options(const char *var, const char *value)
 #if LIBCURL_VERSION_NUM >= 0x070908
        if (!strcmp("http.sslcapath", var)) {
                if (ssl_capath == NULL) {
-                       ssl_capath = xmalloc(strlen(value)+1);
-                       strcpy(ssl_capath, value);
+                       if (!value)
+                               return config_error_nonbool(var);
+                       ssl_capath = xstrdup(value);
                }
                return 0;
        }
 #endif
        if (!strcmp("http.sslcainfo", var)) {
                if (ssl_cainfo == NULL) {
-                       ssl_cainfo = xmalloc(strlen(value)+1);
-                       strcpy(ssl_cainfo, value);
+                       if (!value)
+                               return config_error_nonbool(var);
+                       ssl_cainfo = xstrdup(value);
                }
                return 0;
        }
@@ -157,8 +161,9 @@ static int http_options(const char *var, const char *value)
        }
        if (!strcmp("http.proxy", var)) {
                if (curl_http_proxy == NULL) {
-                       curl_http_proxy = xmalloc(strlen(value)+1);
-                       strcpy(curl_http_proxy, value);
+                       if (!value)
+                               return config_error_nonbool(var);
+                       curl_http_proxy = xstrdup(value);
                }
                return 0;
        }
diff --git a/http.h b/http.h
index aeba9301f8fe1a1d4e2f9819257579375be648aa..9bab2c88210650e2aaa271a72eb7192cd2f7331b 100644 (file)
--- a/http.h
+++ b/http.h
@@ -8,6 +8,14 @@
 
 #include "strbuf.h"
 
+/*
+ * We detect based on the cURL version if multi-transfer is
+ * usable in this implementation and define this symbol accordingly.
+ * This is not something Makefile should set nor users should pass
+ * via CFLAGS.
+ */
+#undef USE_CURL_MULTI
+
 #if LIBCURL_VERSION_NUM >= 0x071000
 #define USE_CURL_MULTI
 #define DEFAULT_MAX_REQUESTS 5
index a429a76a6385bb7d7935cfaddec9cfc8508c77e5..9025d9aa3ef37b1a1ce4ae5d4b447e3b0918cb7e 100644 (file)
@@ -1254,6 +1254,10 @@ git_imap_config(const char *key, const char *val)
 
        if (strncmp( key, imap_key, sizeof imap_key - 1 ))
                return 0;
+
+       if (!val)
+               return config_error_nonbool(key);
+
        key += sizeof imap_key - 1;
 
        if (!strcmp( "folder", key )) {
index bdf03b1f1f7acacafebc0541309be097cc80336c..dd52342539cd05e59bb13e956d51251417f21e3c 100644 (file)
@@ -844,8 +844,9 @@ static int read_merge_config(const char *var, const char *value)
        int namelen;
 
        if (!strcmp(var, "merge.default")) {
-               if (value)
-                       default_ll_merge = strdup(value);
+               if (!value)
+                       return config_error_nonbool(var);
+               default_ll_merge = strdup(value);
                return 0;
        }
 
@@ -878,14 +879,14 @@ static int read_merge_config(const char *var, const char *value)
 
        if (!strcmp("name", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                fn->description = strdup(value);
                return 0;
        }
 
        if (!strcmp("driver", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                /*
                 * merge.<name>.driver specifies the command line:
                 *
@@ -908,7 +909,7 @@ static int read_merge_config(const char *var, const char *value)
 
        if (!strcmp("recursive", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                fn->recursive = strdup(value);
                return 0;
        }
index 5a5ebe27b0db0506dc1a6606d30e328c53275c18..50b6528001fe4bafdfe70126dc2078860c3d1969 100644 (file)
--- a/object.c
+++ b/object.c
@@ -140,7 +140,8 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
        if (type == OBJ_BLOB) {
                struct blob *blob = lookup_blob(sha1);
                if (blob) {
-                       parse_blob_buffer(blob, buffer, size);
+                       if (parse_blob_buffer(blob, buffer, size))
+                               return NULL;
                        obj = &blob->object;
                }
        } else if (type == OBJ_TREE) {
@@ -148,14 +149,16 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
                if (tree) {
                        obj = &tree->object;
                        if (!tree->object.parsed) {
-                               parse_tree_buffer(tree, buffer, size);
+                               if (parse_tree_buffer(tree, buffer, size))
+                                       return NULL;
                                eaten = 1;
                        }
                }
        } else if (type == OBJ_COMMIT) {
                struct commit *commit = lookup_commit(sha1);
                if (commit) {
-                       parse_commit_buffer(commit, buffer, size);
+                       if (parse_commit_buffer(commit, buffer, size))
+                               return NULL;
                        if (!commit->buffer) {
                                commit->buffer = buffer;
                                eaten = 1;
@@ -165,7 +168,8 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
        } else if (type == OBJ_TAG) {
                struct tag *tag = lookup_tag(sha1);
                if (tag) {
-                       parse_tag_buffer(tag, buffer, size);
+                       if (parse_tag_buffer(tag, buffer, size))
+                              return NULL;
                        obj = &tag->object;
                }
        } else {
index 7a08a0c64f9f447e09ef6771d83dbf95f8f3545d..d9562ba5047ff1c9994755a4dbec5162b551c788 100644 (file)
@@ -216,6 +216,26 @@ is_abbreviated:
        return error("unknown option `%s'", arg);
 }
 
+void check_typos(const char *arg, const struct option *options)
+{
+       if (strlen(arg) < 3)
+               return;
+
+       if (!prefixcmp(arg, "no-")) {
+               error ("did you mean `--%s` (with two dashes ?)", arg);
+               exit(129);
+       }
+
+       for (; options->type != OPTION_END; options++) {
+               if (!options->long_name)
+                       continue;
+               if (!prefixcmp(options->long_name, arg)) {
+                       error ("did you mean `--%s` (with two dashes ?)", arg);
+                       exit(129);
+               }
+       }
+}
+
 static NORETURN void usage_with_options_internal(const char * const *,
                                                  const struct option *, int);
 
@@ -235,12 +255,18 @@ int parse_options(int argc, const char **argv, const struct option *options,
 
                if (arg[1] != '-') {
                        args.opt = arg + 1;
-                       do {
+                       if (*args.opt == 'h')
+                               usage_with_options(usagestr, options);
+                       if (parse_short_opt(&args, options) < 0)
+                               usage_with_options(usagestr, options);
+                       if (args.opt)
+                               check_typos(arg + 1, options);
+                       while (args.opt) {
                                if (*args.opt == 'h')
                                        usage_with_options(usagestr, options);
                                if (parse_short_opt(&args, options) < 0)
                                        usage_with_options(usagestr, options);
-                       } while (args.opt);
+                       }
                        continue;
                }
 
index 0e006804ef3cc190fa286c85e2de034a33791886..20abbc07acb2e48aefb2129683b5dc159661211e 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -222,15 +222,18 @@ static int handle_config(const char *key, const char *value)
                subkey = strrchr(name, '.');
                if (!subkey)
                        return 0;
-               if (!value)
-                       return 0;
                branch = make_branch(name, subkey - name);
                if (!strcmp(subkey, ".remote")) {
+                       if (!value)
+                               return config_error_nonbool(key);
                        branch->remote_name = xstrdup(value);
                        if (branch == current_branch)
                                default_remote_name = branch->remote_name;
-               } else if (!strcmp(subkey, ".merge"))
+               } else if (!strcmp(subkey, ".merge")) {
+                       if (!value)
+                               return config_error_nonbool(key);
                        add_merge(branch, xstrdup(value));
+               }
                return 0;
        }
        if (prefixcmp(key,  "remote."))
diff --git a/setup.c b/setup.c
index adede16a4deea1423f52c3b736de735d27f7172a..4509598d577baba8b1d7e8782d8e6ff8e74f9556 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -372,6 +372,8 @@ int check_repository_format_version(const char *var, const char *value)
                if (is_bare_repository_cfg == 1)
                        inside_work_tree = -1;
        } else if (strcmp(var, "core.worktree") == 0) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (git_work_tree_cfg)
                        free(git_work_tree_cfg);
                git_work_tree_cfg = xstrdup(value);
diff --git a/t/.gitattributes b/t/.gitattributes
new file mode 100644 (file)
index 0000000..562b12e
--- /dev/null
@@ -0,0 +1 @@
+* -whitespace
index 36f251761739c6cda0053bbe26cc6331ed7be40c..73ed11bfe24edf56879d90a43c8df0813332fb08 100644 (file)
--- a/t/README
+++ b/t/README
@@ -160,14 +160,12 @@ library for your script to use.
 
  - test_expect_failure <message> <script>
 
-   This is the opposite of test_expect_success.  If <script>
-   yields success, test is considered a failure.
-
-   Example:
-
-       test_expect_failure \
-           'git-update-index without --add should fail adding.' \
-           'git-update-index should-be-empty'
+   This is NOT the opposite of test_expect_success, but is used
+   to mark a test that demonstrates a known breakage.  Unlike
+   the usual test_expect_success tests, which say "ok" on
+   success and "FAIL" on failure, this will say "FIXED" on
+   success and "still broken" on failure.  Failures from these
+   tests won't cause -i (immediate) to stop.
 
  - test_debug <script>
 
index 9f84b8d3acf198aafbd0d2a8445dce7ce976ee3d..92de08822702f780c6895a5d2c070ee009ecfef7 100755 (executable)
@@ -46,13 +46,25 @@ test_expect_success \
     '.git/objects should have 3 subdirectories.' \
     'test $(wc -l < full-of-directories) = 3'
 
+################################################################
+# Test harness
+test_expect_success 'success is reported like this' '
+    :
+'
+test_expect_failure 'pretend we have a known breakage' '
+    false
+'
+test_expect_failure 'pretend we have fixed a known breakage' '
+    :
+'
+
 ################################################################
 # Basics of the basics
 
 # updating a new file without --add should fail.
-test_expect_failure \
-    'git update-index without --add should fail adding.' \
-    'git update-index should-be-empty'
+test_expect_success 'git update-index without --add should fail adding.' '
+    ! git update-index should-be-empty
+'
 
 # and with --add it should succeed, even if it is empty (it used to fail).
 test_expect_success \
@@ -70,9 +82,9 @@ test_expect_success \
 
 # Removing paths.
 rm -f should-be-empty full-of-directories
-test_expect_failure \
-    'git update-index without --remove should fail removing.' \
-    'git update-index should-be-empty'
+test_expect_success 'git update-index without --remove should fail removing.' '
+    ! git update-index should-be-empty
+'
 
 test_expect_success \
     'git update-index with --remove should be able to remove.' \
@@ -204,9 +216,9 @@ test_expect_success \
     'put invalid objects into the index.' \
     'git update-index --index-info < badobjects'
 
-test_expect_failure \
-    'writing this tree without --missing-ok.' \
-    'git write-tree'
+test_expect_success 'writing this tree without --missing-ok.' '
+    ! git write-tree
+'
 
 test_expect_success \
     'writing this tree with --missing-ok.' \
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
new file mode 100755 (executable)
index 0000000..47f08a4
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+test_description=gitattributes
+
+. ./test-lib.sh
+
+attr_check () {
+
+       path="$1"
+       expect="$2"
+
+       git check-attr test -- "$path" >actual &&
+       echo "$path: test: $2" >expect &&
+       diff -u expect actual
+
+}
+
+
+test_expect_success 'setup' '
+
+       mkdir -p a/b/d a/c &&
+       (
+               echo "f test=f"
+       ) >.gitattributes &&
+       (
+               echo "g test=a/g" &&
+               echo "b/g test=a/b/g"
+       ) >a/.gitattributes &&
+       (
+               echo "h test=a/b/h" &&
+               echo "d/* test=a/b/d/*"
+       ) >a/b/.gitattributes
+
+'
+
+test_expect_success 'attribute test' '
+
+       attr_check f f &&
+       attr_check a/f f &&
+       attr_check a/c/f f &&
+       attr_check a/g a/g &&
+       attr_check a/b/g a/b/g &&
+       attr_check b/g unspecified &&
+       attr_check a/b/h a/b/h &&
+       attr_check a/b/d/g "a/b/d/*"
+
+'
+
+test_done
index cad95f35adad5864e99ef5cd1633c820ff25b6c0..818c8621f239dd7f61a2d79e9c65779dbbf9f6ef 100755 (executable)
@@ -243,14 +243,14 @@ test_expect_success \
     test `printf "$ttt$sss$sss$sss" | git stripspace | wc -l` -gt 0
 '
 
-test_expect_failure \
+test_expect_success \
     'text plus spaces without newline at end should not show spaces' '
-    printf "$ttt$sss" | git stripspace | grep -q "  " ||
-    printf "$ttt$ttt$sss" | git stripspace | grep -q "  " ||
-    printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q "  " ||
-    printf "$ttt$sss$sss" | git stripspace | grep -q "  " ||
-    printf "$ttt$ttt$sss$sss" | git stripspace | grep -q "  " ||
-    printf "$ttt$sss$sss$sss" | git stripspace | grep -q "  "
+    ! (printf "$ttt$sss" | git stripspace | grep -q "  ") &&
+    ! (printf "$ttt$ttt$sss" | git stripspace | grep -q "  ") &&
+    ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q "  ") &&
+    ! (printf "$ttt$sss$sss" | git stripspace | grep -q "  ") &&
+    ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep -q "  ") &&
+    ! (printf "$ttt$sss$sss$sss" | git stripspace | grep -q "  ")
 '
 
 test_expect_success \
@@ -280,14 +280,14 @@ test_expect_success \
     git diff expect actual
 '
 
-test_expect_failure \
+test_expect_success \
     'text plus spaces at end should not show spaces' '
-    echo "$ttt$sss" | git stripspace | grep -q "  " ||
-    echo "$ttt$ttt$sss" | git stripspace | grep -q "  " ||
-    echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q "  " ||
-    echo "$ttt$sss$sss" | git stripspace | grep -q "  " ||
-    echo "$ttt$ttt$sss$sss" | git stripspace | grep -q "  " ||
-    echo "$ttt$sss$sss$sss" | git stripspace | grep -q "  "
+    ! (echo "$ttt$sss" | git stripspace | grep -q "  ") &&
+    ! (echo "$ttt$ttt$sss" | git stripspace | grep -q "  ") &&
+    ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q "  ") &&
+    ! (echo "$ttt$sss$sss" | git stripspace | grep -q "  ") &&
+    ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep -q "  ") &&
+    ! (echo "$ttt$sss$sss$sss" | git stripspace | grep -q "  ")
 '
 
 test_expect_success \
@@ -339,13 +339,13 @@ test_expect_success \
     git diff expect actual
 '
 
-test_expect_failure \
+test_expect_success \
     'spaces without newline at end should not show spaces' '
-    printf "" | git stripspace | grep -q " " ||
-    printf "$sss" | git stripspace | grep -q " " ||
-    printf "$sss$sss" | git stripspace | grep -q " " ||
-    printf "$sss$sss$sss" | git stripspace | grep -q " " ||
-    printf "$sss$sss$sss$sss" | git stripspace | grep -q " "
+    ! (printf "" | git stripspace | grep -q " ") &&
+    ! (printf "$sss" | git stripspace | grep -q " ") &&
+    ! (printf "$sss$sss" | git stripspace | grep -q " ") &&
+    ! (printf "$sss$sss$sss" | git stripspace | grep -q " ") &&
+    ! (printf "$sss$sss$sss$sss" | git stripspace | grep -q " ")
 '
 
 test_expect_success \
index 462fdf262fe451c14679753018a415e1cc778732..0e2933a984fcf6a23b60e54ed43c411c699d4347 100755 (executable)
@@ -19,6 +19,7 @@ string options
                           get a string
     --string2 <str>       get another string
     --st <st>             get another string (pervert ordering)
+    -o <str>              get another string
 
 EOF
 
@@ -86,9 +87,9 @@ test_expect_success 'unambiguously abbreviated option with "="' '
        git diff expect output
 '
 
-test_expect_failure 'ambiguously abbreviated option' '
+test_expect_success 'ambiguously abbreviated option' '
        test-parse-options --strin 123;
-        test $? != 129
+       test $? = 129
 '
 
 cat > expect << EOF
@@ -103,4 +104,14 @@ test_expect_success 'non ambiguous option (after two options it abbreviates)' '
        git diff expect output
 '
 
+cat > expect.err << EOF
+error: did you mean \`--boolean\` (with two dashes ?)
+EOF
+
+test_expect_success 'detect possible typos' '
+       ! test-parse-options -boolean > output 2> output.err &&
+       test ! -s output &&
+       git diff expect.err output.err
+'
+
 test_done
index 37add1b50472e23ccb6b938ac6cdadba0c097fb8..6c065bfa21b68e23fb92fbb25aea0907cb22aa3e 100755 (executable)
@@ -210,12 +210,12 @@ DF (file) when tree B require DF to be a directory by having DF/DF
 
 END_OF_CASE_TABLE
 
-test_expect_failure \
-    '1 - must not have an entry not in A.' \
-    "rm -f .git/index XX &&
+test_expect_success '1 - must not have an entry not in A.' "
+     rm -f .git/index XX &&
      echo XX >XX &&
      git update-index --add XX &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '2 - must match B in !O && !A && B case.' \
@@ -248,13 +248,14 @@ test_expect_success \
      echo extra >>AN &&
      git read-tree -m $tree_O $tree_A $tree_B"
 
-test_expect_failure \
-    '3 (fail) - must match A in !O && A && !B case.' \
-    "rm -f .git/index AN &&
+test_expect_success \
+    '3 (fail) - must match A in !O && A && !B case.' "
+     rm -f .git/index AN &&
      cp .orig-A/AN AN &&
      echo extra >>AN &&
      git update-index --add AN &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '4 - must match and be up-to-date in !O && A && B && A!=B case.' \
@@ -264,21 +265,23 @@ test_expect_success \
      git read-tree -m $tree_O $tree_A $tree_B &&
      check_result"
 
-test_expect_failure \
-    '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \
-    "rm -f .git/index AA &&
+test_expect_success \
+    '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
+     rm -f .git/index AA &&
      cp .orig-A/AA AA &&
      git update-index --add AA &&
      echo extra >>AA &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
-test_expect_failure \
-    '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \
-    "rm -f .git/index AA &&
+test_expect_success \
+    '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
+     rm -f .git/index AA &&
      cp .orig-A/AA AA &&
      echo extra >>AA &&
      git update-index --add AA &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '5 - must match in !O && A && B && A==B case.' \
@@ -297,34 +300,38 @@ test_expect_success \
      git read-tree -m $tree_O $tree_A $tree_B &&
      check_result"
 
-test_expect_failure \
-    '5 (fail) - must match A in !O && A && B && A==B case.' \
-    "rm -f .git/index LL &&
+test_expect_success \
+    '5 (fail) - must match A in !O && A && B && A==B case.' "
+     rm -f .git/index LL &&
      cp .orig-A/LL LL &&
      echo extra >>LL &&
      git update-index --add LL &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
-test_expect_failure \
-    '6 - must not exist in O && !A && !B case' \
-    "rm -f .git/index DD &&
+test_expect_success \
+    '6 - must not exist in O && !A && !B case' "
+     rm -f .git/index DD &&
      echo DD >DD
      git update-index --add DD &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
-test_expect_failure \
-    '7 - must not exist in O && !A && B && O!=B case' \
-    "rm -f .git/index DM &&
+test_expect_success \
+    '7 - must not exist in O && !A && B && O!=B case' "
+     rm -f .git/index DM &&
      cp .orig-B/DM DM &&
      git update-index --add DM &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
-test_expect_failure \
-    '8 - must not exist in O && !A && B && O==B case' \
-    "rm -f .git/index DN &&
+test_expect_success \
+    '8 - must not exist in O && !A && B && O==B case' "
+     rm -f .git/index DN &&
      cp .orig-B/DN DN &&
      git update-index --add DN &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '9 - must match and be up-to-date in O && A && !B && O!=A case' \
@@ -334,21 +341,23 @@ test_expect_success \
      git read-tree -m $tree_O $tree_A $tree_B &&
      check_result"
 
-test_expect_failure \
-    '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \
-    "rm -f .git/index MD &&
+test_expect_success \
+    '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
+     rm -f .git/index MD &&
      cp .orig-A/MD MD &&
      git update-index --add MD &&
      echo extra >>MD &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
-test_expect_failure \
-    '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \
-    "rm -f .git/index MD &&
+test_expect_success \
+    '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
+     rm -f .git/index MD &&
      cp .orig-A/MD MD &&
      echo extra >>MD &&
      git update-index --add MD &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '10 - must match and be up-to-date in O && A && !B && O==A case' \
@@ -358,21 +367,23 @@ test_expect_success \
      git read-tree -m $tree_O $tree_A $tree_B &&
      check_result"
 
-test_expect_failure \
-    '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \
-    "rm -f .git/index ND &&
+test_expect_success \
+    '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
+     rm -f .git/index ND &&
      cp .orig-A/ND ND &&
      git update-index --add ND &&
      echo extra >>ND &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
-test_expect_failure \
-    '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \
-    "rm -f .git/index ND &&
+test_expect_success \
+    '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
+     rm -f .git/index ND &&
      cp .orig-A/ND ND &&
      echo extra >>ND &&
      git update-index --add ND &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
@@ -382,21 +393,23 @@ test_expect_success \
      git read-tree -m $tree_O $tree_A $tree_B &&
      check_result"
 
-test_expect_failure \
-    '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
-    "rm -f .git/index MM &&
+test_expect_success \
+    '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
+     rm -f .git/index MM &&
      cp .orig-A/MM MM &&
      git update-index --add MM &&
      echo extra >>MM &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
-test_expect_failure \
-    '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
-    "rm -f .git/index MM &&
+test_expect_success \
+    '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
+     rm -f .git/index MM &&
      cp .orig-A/MM MM &&
      echo extra >>MM &&
      git update-index --add MM &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '12 - must match A in O && A && B && O!=A && A==B case' \
@@ -415,13 +428,14 @@ test_expect_success \
      git read-tree -m $tree_O $tree_A $tree_B &&
      check_result"
 
-test_expect_failure \
-    '12 (fail) - must match A in O && A && B && O!=A && A==B case' \
-    "rm -f .git/index SS &&
+test_expect_success \
+    '12 (fail) - must match A in O && A && B && O!=A && A==B case' "
+     rm -f .git/index SS &&
      cp .orig-A/SS SS &&
      echo extra >>SS &&
      git update-index --add SS &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '13 - must match A in O && A && B && O!=A && O==B case' \
@@ -457,21 +471,23 @@ test_expect_success \
      git read-tree -m $tree_O $tree_A $tree_B &&
      check_result"
 
-test_expect_failure \
-    '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \
-    "rm -f .git/index NM &&
+test_expect_success \
+    '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
+     rm -f .git/index NM &&
      cp .orig-A/NM NM &&
      git update-index --add NM &&
      echo extra >>NM &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
-test_expect_failure \
-    '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \
-    "rm -f .git/index NM &&
+test_expect_success \
+    '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
+     rm -f .git/index NM &&
      cp .orig-A/NM NM &&
      echo extra >>NM &&
      git update-index --add NM &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 test_expect_success \
     '15 - must match A in O && A && B && O==A && O==B case' \
@@ -490,13 +506,14 @@ test_expect_success \
      git read-tree -m $tree_O $tree_A $tree_B &&
      check_result"
 
-test_expect_failure \
-    '15 (fail) - must match A in O && A && B && O==A && O==B case' \
-    "rm -f .git/index NN &&
+test_expect_success \
+    '15 (fail) - must match A in O && A && B && O==A && O==B case' "
+     rm -f .git/index NN &&
      cp .orig-A/NN NN &&
      echo extra >>NN &&
      git update-index --add NN &&
-     git read-tree -m $tree_O $tree_A $tree_B"
+     ! git read-tree -m $tree_O $tree_A $tree_B
+"
 
 # #16
 test_expect_success \
index 991d3c5e9c5c8dc9e59b0105010f1b77d4bf3a3f..dcb3108c290813dae178394011bb2b44f2f7ca9e 100755 (executable)
@@ -101,8 +101,8 @@ echo "Play, play, play" >>hello
 echo "Lots of fun" >>example
 git commit -m 'Some fun.' -i hello example
 
-test_expect_failure 'git resolve now fails' '
-       git merge -m "Merge work in mybranch" mybranch
+test_expect_success 'git resolve now fails' '
+       git merge -m "Merge work in mybranch" mybranch
 '
 
 cat > hello << EOF
@@ -156,6 +156,8 @@ test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.outp
 
 test_expect_success 'git repack' 'git repack'
 test_expect_success 'git prune-packed' 'git prune-packed'
-test_expect_failure '-> only packed objects' 'find -type f .git/objects/[0-9a-f][0-9a-f]'
+test_expect_success '-> only packed objects' '
+       ! find -type f .git/objects/[0-9a-f][0-9a-f]
+'
 
 test_done
index 42eac2a7cb0c8404b09a669c9526606eb89ab80e..4928a571144b3fb9ec38312d917e9f95e40ceb99 100755 (executable)
@@ -71,6 +71,25 @@ EOF
 
 test_expect_success 'non-match result' 'cmp .git/config expect'
 
+cat > .git/config <<\EOF
+[alpha]
+bar = foo
+[beta]
+baz = multiple \
+lines
+EOF
+
+test_expect_success 'unset with cont. lines' \
+       'git config --unset beta.baz'
+
+cat > expect <<\EOF
+[alpha]
+bar = foo
+[beta]
+EOF
+
+test_expect_success 'unset with cont. lines is correct' 'cmp .git/config expect'
+
 cat > .git/config << EOF
 [beta] ; silly comment # another comment
 noIndent= sillyValue ; 'nother silly comment
@@ -181,8 +200,9 @@ test_expect_success 'non-match' \
 test_expect_success 'non-match value' \
        'test wow = $(git config --get nextsection.nonewline !for)'
 
-test_expect_failure 'ambiguous get' \
-       'git config --get nextsection.nonewline'
+test_expect_success 'ambiguous get' '
+       ! git config --get nextsection.nonewline
+'
 
 test_expect_success 'get multivar' \
        'git config --get-all nextsection.nonewline'
@@ -202,13 +222,17 @@ EOF
 
 test_expect_success 'multivar replace' 'cmp .git/config expect'
 
-test_expect_failure 'ambiguous value' 'git config nextsection.nonewline'
+test_expect_success 'ambiguous value' '
+       ! git config nextsection.nonewline
+'
 
-test_expect_failure 'ambiguous unset' \
-       'git config --unset nextsection.nonewline'
+test_expect_success 'ambiguous unset' '
+       ! git config --unset nextsection.nonewline
+'
 
-test_expect_failure 'invalid unset' \
-       'git config --unset somesection.nonewline'
+test_expect_success 'invalid unset' '
+       ! git config --unset somesection.nonewline
+'
 
 git config --unset nextsection.nonewline "wow3$"
 
@@ -224,7 +248,7 @@ EOF
 
 test_expect_success 'multivar unset' 'cmp .git/config expect'
 
-test_expect_failure 'invalid key' 'git config inval.2key blabla'
+test_expect_success 'invalid key' '! git config inval.2key blabla'
 
 test_expect_success 'correct key' 'git config 123456.a123 987'
 
@@ -278,17 +302,40 @@ test_expect_success '--add' \
 cat > .git/config << EOF
 [novalue]
        variable
+[emptyvalue]
+       variable =
 EOF
 
 test_expect_success 'get variable with no value' \
        'git config --get novalue.variable ^$'
 
+test_expect_success 'get variable with empty value' \
+       'git config --get emptyvalue.variable ^$'
+
 echo novalue.variable > expect
 
 test_expect_success 'get-regexp variable with no value' \
        'git config --get-regexp novalue > output &&
         cmp output expect'
 
+echo 'emptyvalue.variable ' > expect
+
+test_expect_success 'get-regexp variable with empty value' \
+       'git config --get-regexp emptyvalue > output &&
+        cmp output expect'
+
+echo true > expect
+
+test_expect_success 'get bool variable with no value' \
+       'git config --bool novalue.variable > output &&
+        cmp output expect'
+
+echo false > expect
+
+test_expect_success 'get bool variable with empty value' \
+       'git config --bool emptyvalue.variable > output &&
+        cmp output expect'
+
 git config > output 2>&1
 
 test_expect_success 'no arguments, but no crash' \
@@ -382,8 +429,9 @@ EOF
 
 test_expect_success "rename succeeded" "git diff expect .git/config"
 
-test_expect_failure "rename non-existing section" \
-       'git config --rename-section branch."world domination" branch.drei'
+test_expect_success "rename non-existing section" '
+       ! git config --rename-section branch."world domination" branch.drei
+'
 
 test_expect_success "rename succeeded" "git diff expect .git/config"
 
@@ -494,14 +542,14 @@ test_expect_success bool '
         done &&
        cmp expect result'
 
-test_expect_failure 'invalid bool (--get)' '
+test_expect_success 'invalid bool (--get)' '
 
        git config bool.nobool foobar &&
-       git config --bool --get bool.nobool'
+       git config --bool --get bool.nobool'
 
-test_expect_failure 'invalid bool (set)' '
+test_expect_success 'invalid bool (set)' '
 
-       git config --bool bool.nobool foobar'
+       git config --bool bool.nobool foobar'
 
 rm .git/config
 
@@ -562,8 +610,9 @@ EOF
 
 test_expect_success 'quoting' 'cmp .git/config expect'
 
-test_expect_failure 'key with newline' 'git config key.with\\\
-newline 123'
+test_expect_success 'key with newline' '
+       ! git config "key.with
+newline" 123'
 
 test_expect_success 'value with newline' 'git config key.sub value.with\\\
 newline'
index 37fc1c8d36ba6e0a12c83d0c38c87a37863870e5..9be0770e7627ee094349af85b0d4702e156ff6cd 100755 (executable)
@@ -40,7 +40,8 @@ test_expect_success 'gitdir required mode on normal repos' '
        (git apply --check --index test.patch &&
        cd test && git apply --check --index ../test.patch)'
 
-test_expect_failure 'gitdir required mode on unsupported repo' '
-       (cd test2 && git apply --check --index ../test.patch)'
+test_expect_success 'gitdir required mode on unsupported repo' '
+       (cd test2 && ! git apply --check --index ../test.patch)
+'
 
 test_done
index 71ab2dd0eedd5fa79300fe84fbd168b538dfd36c..78cd41245b301e731dc0fdd0066b3d3bac4f5405 100755 (executable)
@@ -51,23 +51,23 @@ test_expect_success \
         test $B"' = $(cat .git/'"$m"')'
 rm -f .git/$m
 
-test_expect_failure \
-       '(not) create HEAD with old sha1' \
-       "git update-ref HEAD $A $B"
-test_expect_failure \
-       "(not) prior created .git/$m" \
-       "test -f .git/$m"
+test_expect_success '(not) create HEAD with old sha1' "
+       ! git update-ref HEAD $A $B
+"
+test_expect_success "(not) prior created .git/$m" "
+       ! test -f .git/$m
+"
 rm -f .git/$m
 
 test_expect_success \
        "create HEAD" \
        "git update-ref HEAD $A"
-test_expect_failure \
-       '(not) change HEAD with wrong SHA1' \
-       "git update-ref HEAD $B $Z"
-test_expect_failure \
-       "(not) changed .git/$m" \
-       "test $B"' = $(cat .git/'"$m"')'
+test_expect_success '(not) change HEAD with wrong SHA1' "
+       ! git update-ref HEAD $B $Z
+"
+test_expect_success "(not) changed .git/$m" "
+       ! test $B"' = $(cat .git/'"$m"')
+'
 rm -f .git/$m
 
 : a repository with working tree always has reflog these days...
index ac84335b0a47fe1d26794e4c92f00d0ed051e540..5141fab7cf567fc5d16a8e9a296d2aff5f6c67e6 100755 (executable)
@@ -36,9 +36,9 @@ mkdir path0
 date >path0/file0
 date >path1
 
-test_expect_failure \
+test_expect_success \
     'git checkout-index without -f should fail on conflicting work tree.' \
-    'git checkout-index -a'
+    'git checkout-index -a'
 
 test_expect_success \
     'git checkout-index with -f should succeed.' \
index f7a00559209872fab5c79896ed5bc71ba64c884e..0f441bcef768ca68ead9bfa2d06b714b8d2c35ac 100755 (executable)
@@ -16,12 +16,12 @@ echo frotz >path0 &&
 git update-index --add path0 &&
 t=$(git write-tree)'
 
-test_expect_failure \
+test_expect_success \
 'without -u, git checkout-index smudges stat information.' '
 rm -f path0 &&
 git read-tree $t &&
 git checkout-index -f -a &&
-git diff-files | diff - /dev/null'
+git diff-files | diff - /dev/null'
 
 test_expect_success \
 'with -u, git checkout-index picks up stat information from new files.' '
index f78945ed8e8fe5fea3c2656460a120363c546185..4a723dc0e564d3b9f8b38a4f85d1b2e917a6edda 100755 (executable)
@@ -67,16 +67,16 @@ test_expect_success 'checkout with simple prefix' '
 
 '
 
-test_expect_failure 'relative path outside tree should fail' \
-       'git checkout HEAD -- ../../Makefile'
+test_expect_success 'relative path outside tree should fail' \
+       'git checkout HEAD -- ../../Makefile'
 
-test_expect_failure 'incorrect relative path to file should fail (1)' \
-       'git checkout HEAD -- ../file0'
+test_expect_success 'incorrect relative path to file should fail (1)' \
+       'git checkout HEAD -- ../file0'
 
-test_expect_failure 'incorrect relative path should fail (2)' \
-       '( cd dir1 && git checkout HEAD -- ./file0 )'
+test_expect_success 'incorrect relative path should fail (2)' \
+       '( cd dir1 && git checkout HEAD -- ./file0 )'
 
-test_expect_failure 'incorrect relative path should fail (3)' \
-       '( cd dir1 && git checkout HEAD -- ../../file0 )'
+test_expect_success 'incorrect relative path should fail (3)' \
+       '( cd dir1 && git checkout HEAD -- ../../file0 )'
 
 test_done
index 04a1ed1a6b9dd4eabc2b95d348b77b0fd08b0da4..9beaecd18b25cb7e22b09c11234c05a8fa1d4116 100755 (executable)
@@ -44,8 +44,8 @@ date >path1/file1
 
 for p in path0/file0 path1/file1 path2 path3
 do
-       test_expect_failure \
+       test_expect_success \
            "git update-index to add conflicting path $p should fail." \
-           "git update-index --add -- $p"
+           "git update-index --add -- $p"
 done
 test_done
index c83f820ad2d8588b8e5e15b3cb55172b26b7c33e..f4da869932e40429f94d19a9cf2e18dc1e838f0a 100755 (executable)
@@ -15,9 +15,9 @@ touch foo bar
 git update-index --add foo bar
 git-commit -m "add foo bar"
 
-test_expect_failure \
+test_expect_success \
     'git ls-files --error-unmatch should fail with unmatched path.' \
-    'git ls-files --error-unmatch foo bar-does-not-match'
+    'git ls-files --error-unmatch foo bar-does-not-match'
 
 test_expect_success \
     'git ls-files --error-unmatch should succeed eith matched paths.' \
index ef1eeb7d8ac349821559dd358470f10ae0531739..d21081d0f19bc52e1f1da54c220bc30a026f1093 100755 (executable)
@@ -17,10 +17,11 @@ test_expect_success \
      git-commit -m "Initial commit." &&
      HEAD=$(git rev-parse --verify HEAD)'
 
-test_expect_failure \
-    'git branch --help should not have created a bogus branch' \
-    'git branch --help </dev/null >/dev/null 2>/dev/null || :
-     test -f .git/refs/heads/--help'
+test_expect_success \
+    'git branch --help should not have created a bogus branch' '
+     git branch --help </dev/null >/dev/null 2>/dev/null;
+     ! test -f .git/refs/heads/--help
+'
 
 test_expect_success \
     'git branch abc should create a branch' \
@@ -71,17 +72,17 @@ test_expect_success \
         git branch -m n/n n
         test -f .git/logs/refs/heads/n'
 
-test_expect_failure \
-    'git branch -m o/o o should fail when o/p exists' \
-       'git branch o/o &&
+test_expect_success 'git branch -m o/o o should fail when o/p exists' '
+       git branch o/o &&
         git branch o/p &&
-        git branch -m o/o o'
+       ! git branch -m o/o o
+'
 
-test_expect_failure \
-    'git branch -m q r/q should fail when r exists' \
-       'git branch q &&
-         git branch r &&
-         git branch -m q r/q'
+test_expect_success 'git branch -m q r/q should fail when r exists' '
+       git branch q &&
+       git branch r &&
+       ! git branch -m q r/q
+'
 
 mv .git/config .git/config-saved
 
@@ -108,12 +109,13 @@ test_expect_success 'config information was renamed, too' \
        "test $(git config branch.s.dummy) = Hello &&
         ! git config branch.s/s/dummy"
 
-test_expect_failure \
-    'git branch -m u v should fail when the reflog for u is a symlink' \
-    'git branch -l u &&
+test_expect_success \
+    'git branch -m u v should fail when the reflog for u is a symlink' '
+     git branch -l u &&
      mv .git/logs/refs/heads/u real-u &&
      ln -s real-u .git/logs/refs/heads/u &&
-     git branch -m u v'
+     ! git branch -m u v
+'
 
 test_expect_success 'test tracking setup via --track' \
     'git config remote.local.url . &&
index 4ddc6342a94b9e7b39153cf5ac93ae3c3fb3c31e..b64ccfbc5bcf40717f8e04bdadc841bc8cd6c51f 100755 (executable)
@@ -39,12 +39,12 @@ test_expect_success \
      git show-ref b >result &&
      diff expect result'
 
-test_expect_failure \
-    'git branch c/d should barf if branch c exists' \
-    'git branch c &&
+test_expect_success 'git branch c/d should barf if branch c exists' '
+     git branch c &&
      git pack-refs --all &&
-     rm .git/refs/heads/c &&
-     git branch c/d'
+     rm -f .git/refs/heads/c &&
+     ! git branch c/d
+'
 
 test_expect_success \
     'see if a branch still exists after git pack-refs --prune' \
@@ -54,11 +54,11 @@ test_expect_success \
      git show-ref e >result &&
      diff expect result'
 
-test_expect_failure \
-    'see if git pack-refs --prune remove ref files' \
-    'git branch f &&
+test_expect_success 'see if git pack-refs --prune remove ref files' '
+     git branch f &&
      git pack-refs --all --prune &&
-     ls .git/refs/heads/f'
+     ! test -f .git/refs/heads/f
+'
 
 test_expect_success \
     'git branch g should work when git branch g/h has been deleted' \
@@ -69,11 +69,11 @@ test_expect_success \
      git pack-refs --all &&
      git branch -d g'
 
-test_expect_failure \
-    'git branch i/j/k should barf if branch i exists' \
-    'git branch i &&
+test_expect_success 'git branch i/j/k should barf if branch i exists' '
+     git branch i &&
      git pack-refs --all --prune &&
-     git branch i/j/k'
+     ! git branch i/j/k
+'
 
 test_expect_success \
     'test git branch k after branch k/l/m and k/lm have been deleted' \
index 95e33b52100bb360ab3fcfa1b419b66321340b8a..496f4ec17217769228954116528b0fc0c1ef2a62 100755 (executable)
@@ -42,9 +42,9 @@ test_expect_success \
 test_expect_success 'rebase against master' '
      git rebase master'
 
-test_expect_failure \
+test_expect_success \
     'the rebase operation should not have destroyed author information' \
-    'git log | grep "Author:" | grep "<>"'
+    'git log | grep "Author:" | grep "<>"'
 
 test_expect_success 'rebase after merge master' '
      git reset --hard topic &&
index 657f68104d52558668119234a0637ac2bca33c0a..0a26099658f4307f06fe594feb3fc046ff267076 100755 (executable)
@@ -31,8 +31,8 @@ test_expect_success setup '
        git branch skip-merge skip-reference
        '
 
-test_expect_failure 'rebase with git am -3 (default)' '
-       git rebase master
+test_expect_success 'rebase with git am -3 (default)' '
+       git rebase master
 '
 
 test_expect_success 'rebase --skip with am -3' '
@@ -53,7 +53,7 @@ test_expect_success 'rebase moves back to skip-reference' '
 
 test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
 
-test_expect_failure 'rebase with --merge' 'git rebase --merge master'
+test_expect_success 'rebase with --merge' '! git rebase --merge master'
 
 test_expect_success 'rebase --skip with --merge' '
        git rebase --skip
index 74a7eb30f84baf2f381c2af7a6c21225bfcd2b08..e33ea4e9f4c33cc1f94cd184c371a8fa05bedf3b 100755 (executable)
@@ -324,4 +324,20 @@ test_expect_success 'rebase a detached HEAD' '
        test $grandparent = $(git rev-parse HEAD~2)
 '
 
+test_expect_success 'rebase a commit violating pre-commit' '
+
+       mkdir -p .git/hooks &&
+       PRE_COMMIT=.git/hooks/pre-commit &&
+       echo "#!/bin/sh" > $PRE_COMMIT &&
+       echo "test -z \"\$(git diff --cached --check)\"" >> $PRE_COMMIT &&
+       chmod a+x $PRE_COMMIT &&
+       echo "monde! " >> file1 &&
+       test_tick &&
+       ! git commit -m doesnt-verify file1 &&
+       git commit -m doesnt-verify --no-verify file1 &&
+       test_tick &&
+       FAKE_LINES=2 git rebase -i HEAD~2
+
+'
+
 test_done
index b1ee622ef7887407c93bc55d95827f9eb7a2b951..f542f0af41989aee51f75b9844abf97943d9e33f 100755 (executable)
@@ -59,15 +59,16 @@ test_expect_success \
      echo "other content" > foo
      git rm --cached foo'
 
-test_expect_failure \
-    'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' \
-    'echo content > foo
+test_expect_success \
+    'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
+     echo content > foo
      git add foo
      git commit -m foo
      echo "other content" > foo
      git add foo
      echo "yet another content" > foo
-     git rm --cached foo'
+     ! git rm --cached foo
+'
 
 test_expect_success \
     'Test that git rm --cached -f foo works in case where --cached only did not' \
@@ -106,9 +107,9 @@ embedded'"
 
 if test "$test_failed_remove" = y; then
 chmod a-w .
-test_expect_failure \
+test_expect_success \
     'Test that "git rm -f" fails if its rm fails' \
-    'git rm -f baz'
+    'git rm -f baz'
 chmod 775 .
 else
     test_expect_success 'skipping removal failure (perhaps running as root?)' :
@@ -212,8 +213,8 @@ test_expect_success 'Recursive with -r -f' '
        ! test -d frotz
 '
 
-test_expect_failure 'Remove nonexistent file returns nonzero exit status' '
-       git rm nonexistent
+test_expect_success 'Remove nonexistent file returns nonzero exit status' '
+       git rm nonexistent
 '
 
 test_done
diff --git a/t/t4026-color.sh b/t/t4026-color.sh
new file mode 100755 (executable)
index 0000000..b61e516
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Timo Hirvonen
+#
+
+test_description='Test diff/status color escape codes'
+. ./test-lib.sh
+
+color()
+{
+       git config diff.color.new "$1" &&
+       test "`git config --get-color diff.color.new`" = "\e$2"
+}
+
+invalid_color()
+{
+       git config diff.color.new "$1" &&
+       test -z "`git config --get-color diff.color.new 2>/dev/null`"
+}
+
+test_expect_success 'reset' '
+       color "reset" "[m"
+'
+
+test_expect_success 'attribute before color name' '
+       color "bold red" "[1;31m"
+'
+
+test_expect_success 'color name before attribute' '
+       color "red bold" "[1;31m"
+'
+
+test_expect_success 'attr fg bg' '
+       color "ul blue red" "[4;34;41m"
+'
+
+test_expect_success 'fg attr bg' '
+       color "blue ul red" "[4;34;41m"
+'
+
+test_expect_success 'fg bg attr' '
+       color "blue red ul" "[4;34;41m"
+'
+
+test_expect_success '256 colors' '
+       color "254 bold 255" "[1;38;5;254;48;5;255m"
+'
+
+test_expect_success 'color too small' '
+       invalid_color "-2"
+'
+
+test_expect_success 'color too big' '
+       invalid_color "256"
+'
+
+test_expect_success 'extra character after color number' '
+       invalid_color "3X"
+'
+
+test_expect_success 'extra character after color name' '
+       invalid_color "redX"
+'
+
+test_expect_success 'extra character after attribute' '
+       invalid_color "dimX"
+'
+
+test_done
index 74f06ec730c0bdf34b6197b6cd6e6b774055aab8..7c25634fc2962fc7b71d7d34ea6ac8d6c8061559 100755 (executable)
@@ -46,21 +46,25 @@ test_expect_success 'stat binary diff (copy) -- should not fail.' \
        'git-checkout master
         git apply --stat --summary C.diff'
 
-test_expect_failure 'check binary diff -- should fail.' \
-       'git-checkout master
-        git apply --check B.diff'
-
-test_expect_failure 'check binary diff (copy) -- should fail.' \
-       'git-checkout master
-        git apply --check C.diff'
-
-test_expect_failure 'check incomplete binary diff with replacement -- should fail.' \
-       'git-checkout master
-        git apply --check --allow-binary-replacement B.diff'
+test_expect_success 'check binary diff -- should fail.' \
+       'git-checkout master &&
+        ! git apply --check B.diff'
+
+test_expect_success 'check binary diff (copy) -- should fail.' \
+       'git-checkout master &&
+        ! git apply --check C.diff'
+
+test_expect_success \
+       'check incomplete binary diff with replacement -- should fail.' '
+       git-checkout master &&
+       ! git apply --check --allow-binary-replacement B.diff
+'
 
-test_expect_failure 'check incomplete binary diff with replacement (copy) -- should fail.' \
-       'git-checkout master
-        git apply --check --allow-binary-replacement C.diff'
+test_expect_success \
+    'check incomplete binary diff with replacement (copy) -- should fail.' '
+        git-checkout master &&
+        ! git apply --check --allow-binary-replacement C.diff
+'
 
 test_expect_success 'check binary diff with replacement.' \
        'git-checkout master
@@ -73,42 +77,42 @@ test_expect_success 'check binary diff with replacement (copy).' \
 # Now we start applying them.
 
 do_reset () {
-       rm -f file?
-       git-reset --hard
+       rm -f file? &&
+       git-reset --hard &&
        git-checkout -f master
 }
 
-test_expect_failure 'apply binary diff -- should fail.' \
-       'do_reset
-        git apply B.diff'
+test_expect_success 'apply binary diff -- should fail.' \
+       'do_reset &&
+        git apply B.diff'
 
-test_expect_failure 'apply binary diff -- should fail.' \
-       'do_reset
-        git apply --index B.diff'
+test_expect_success 'apply binary diff -- should fail.' \
+       'do_reset &&
+        git apply --index B.diff'
 
-test_expect_failure 'apply binary diff (copy) -- should fail.' \
-       'do_reset
-        git apply C.diff'
+test_expect_success 'apply binary diff (copy) -- should fail.' \
+       'do_reset &&
+        git apply C.diff'
 
-test_expect_failure 'apply binary diff (copy) -- should fail.' \
-       'do_reset
-        git apply --index C.diff'
+test_expect_success 'apply binary diff (copy) -- should fail.' \
+       'do_reset &&
+        git apply --index C.diff'
 
 test_expect_success 'apply binary diff without replacement.' \
-       'do_reset
+       'do_reset &&
         git apply BF.diff'
 
 test_expect_success 'apply binary diff without replacement (copy).' \
-       'do_reset
+       'do_reset &&
         git apply CF.diff'
 
 test_expect_success 'apply binary diff.' \
-       'do_reset
+       'do_reset &&
         git apply --allow-binary-replacement --index BF.diff &&
         test -z "$(git diff --name-status binary)"'
 
 test_expect_success 'apply binary diff (copy).' \
-       'do_reset
+       'do_reset &&
         git apply --allow-binary-replacement --index CF.diff &&
         test -z "$(git diff --name-status binary)"'
 
index 1c6bec044a00faf24e275280e0b9fa667356f2b3..d74103988201b0c189e7a2564bfb0894e434c056 100755 (executable)
@@ -29,8 +29,8 @@ test_expect_success setup \
 
 # test
 
-test_expect_failure 'apply at the end' \
-    'git apply --index test-patch'
+test_expect_success 'apply at the end' \
+    'git apply --index test-patch'
 
 cat >test-patch <<\EOF
 diff a/file b/file
@@ -47,7 +47,7 @@ b
 c'
 git update-index file
 
-test_expect_failure 'apply at the beginning' \
-       'git apply --index test-patch'
+test_expect_success 'apply at the beginning' \
+       'git apply --index test-patch'
 
 test_done
index 6e594bf1e211e246cdc02ab22d7be4a9da91d5d2..cd3c149800395553cc973317ef41e89e53771f60 100755 (executable)
@@ -264,8 +264,14 @@ test_expect_success \
      cp -f     .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
                .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
 
-test_expect_failure \
+test_expect_success \
     'make sure index-pack detects the SHA1 collision' \
-    'git-index-pack -o bad.idx test-3.pack'
+    '! git-index-pack -o bad.idx test-3.pack'
+
+test_expect_success \
+    'honor pack.packSizeLimit' \
+    'git config pack.packSizeLimit 200 &&
+     packname_4=$(git pack-objects test-4 <obj-list) &&
+     test 3 = $(ls test-4-*.pack | wc -l)'
 
 test_done
index 2a2878b57229016ad473ccfd65ff7f609ba7d966..67b9a7b84a6a411d44b6b5f90f7b33d6160b5702 100755 (executable)
@@ -42,9 +42,9 @@ test_expect_success \
     'both packs should be identical' \
     'cmp "test-1-${pack1}.pack" "test-2-${pack2}.pack"'
 
-test_expect_failure \
+test_expect_success \
     'index v1 and index v2 should be different' \
-    'cmp "test-1-${pack1}.idx" "test-2-${pack2}.idx"'
+    'cmp "test-1-${pack1}.idx" "test-2-${pack2}.idx"'
 
 test_expect_success \
     'index-pack with index version 1' \
@@ -78,9 +78,9 @@ test_expect_success \
     'git verify-pack -v "test-3-${pack3}.pack"'
 
 test "$have_64bits" &&
-test_expect_failure \
+test_expect_success \
     '64-bit offsets: should be different from previous index v2 results' \
-    'cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"'
+    'cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"'
 
 test "$have_64bits" &&
 test_expect_success \
@@ -112,22 +112,22 @@ test_expect_success \
          bs=1 count=20 conv=notrunc &&
        git cat-file blob "$delta_sha1" > blob_2 )'
 
-test_expect_failure \
+test_expect_success \
     '[index v1] 3) corrupted delta happily returned wrong data' \
-    'cmp blob_1 blob_2'
+    'cmp blob_1 blob_2'
 
-test_expect_failure \
+test_expect_success \
     '[index v1] 4) confirm that the pack is actually corrupted' \
-    'git fsck --full $commit'
+    'git fsck --full $commit'
 
 test_expect_success \
     '[index v1] 5) pack-objects happily reuses corrupted data' \
     'pack4=$(git pack-objects test-4 <obj-list) &&
      test -f "test-4-${pack1}.pack"'
 
-test_expect_failure \
+test_expect_success \
     '[index v1] 6) newly created pack is BAD !' \
-    'git verify-pack -v "test-4-${pack1}.pack"'
+    'git verify-pack -v "test-4-${pack1}.pack"'
 
 test_expect_success \
     '[index v2] 1) stream pack to repository' \
@@ -150,16 +150,16 @@ test_expect_success \
          bs=1 count=20 conv=notrunc &&
        git cat-file blob "$delta_sha1" > blob_4 )'
 
-test_expect_failure \
+test_expect_success \
     '[index v2] 3) corrupted delta happily returned wrong data' \
-    'cmp blob_3 blob_4'
+    'cmp blob_3 blob_4'
 
-test_expect_failure \
+test_expect_success \
     '[index v2] 4) confirm that the pack is actually corrupted' \
-    'git fsck --full $commit'
+    'git fsck --full $commit'
 
-test_expect_failure \
+test_expect_success \
     '[index v2] 5) pack-objects refuses to reuse corrupted data' \
-    'git pack-objects test-5 <obj-list'
+    'git pack-objects test-5 <obj-list'
 
 test_done
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
new file mode 100644 (file)
index 0000000..6560af7
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Johannes E. Schindelin
+#
+
+test_description='prune'
+. ./test-lib.sh
+
+test_expect_success setup '
+
+       : > file &&
+       git add file &&
+       test_tick &&
+       git commit -m initial &&
+       git gc
+
+'
+
+test_expect_success 'prune stale packs' '
+
+       orig_pack=$(echo .git/objects/pack/*.pack) &&
+       : > .git/objects/tmp_1.pack &&
+       : > .git/objects/tmp_2.pack &&
+       test-chmtime -86501 .git/objects/tmp_1.pack &&
+       git prune --expire 1.day &&
+       test -f $orig_pack &&
+       test -f .git/objects/tmp_2.pack &&
+       ! test -f .git/objects/tmp_1.pack
+
+'
+
+test_done
index 3eea3069ebcc20f98bb563af409bb1e15b6e9f54..9a12024241aea21b6ebdbe692b2d7c173d4d2579 100755 (executable)
@@ -25,7 +25,7 @@ test_expect_success setup '
 
 cat >victim/.git/hooks/pre-receive <<'EOF'
 #!/bin/sh
-printf "$@" >>$GIT_DIR/pre-receive.args
+printf %s "$@" >>$GIT_DIR/pre-receive.args
 cat - >$GIT_DIR/pre-receive.stdin
 echo STDOUT pre-receive
 echo STDERR pre-receive >&2
@@ -35,7 +35,7 @@ chmod u+x victim/.git/hooks/pre-receive
 cat >victim/.git/hooks/update <<'EOF'
 #!/bin/sh
 echo "$@" >>$GIT_DIR/update.args
-read x; printf "$x" >$GIT_DIR/update.stdin
+read x; printf %s "$x" >$GIT_DIR/update.stdin
 echo STDOUT update $1
 echo STDERR update $1 >&2
 test "$1" = refs/heads/master || exit
@@ -44,7 +44,7 @@ chmod u+x victim/.git/hooks/update
 
 cat >victim/.git/hooks/post-receive <<'EOF'
 #!/bin/sh
-printf "$@" >>$GIT_DIR/post-receive.args
+printf %s "$@" >>$GIT_DIR/post-receive.args
 cat - >$GIT_DIR/post-receive.stdin
 echo STDOUT post-receive
 echo STDERR post-receive >&2
@@ -54,14 +54,14 @@ chmod u+x victim/.git/hooks/post-receive
 cat >victim/.git/hooks/post-update <<'EOF'
 #!/bin/sh
 echo "$@" >>$GIT_DIR/post-update.args
-read x; printf "$x" >$GIT_DIR/post-update.stdin
+read x; printf %s "$x" >$GIT_DIR/post-update.stdin
 echo STDOUT post-update
 echo STDERR post-update >&2
 EOF
 chmod u+x victim/.git/hooks/post-update
 
-test_expect_failure push '
-       git-send-pack --force ./victim/.git master tofail >send.out 2>send.err
+test_expect_success push '
+    ! git-send-pack --force ./victim/.git master tofail >send.out 2>send.err
 '
 
 test_expect_success 'updated as expected' '
@@ -112,8 +112,8 @@ test_expect_success 'all *-receive hook args are empty' '
        ! test -s victim/.git/post-receive.args
 '
 
-test_expect_failure 'send-pack produced no output' '
-       test -s send.out
+test_expect_success 'send-pack produced no output' '
+       test -s send.out
 '
 
 cat <<EOF >expect
index 1c4b0b32ab90b2af0b08521045d4bfb1d5609b4d..1394047a8dc3e87476e223db42936d59845f803b 100755 (executable)
@@ -30,9 +30,9 @@ EOF
     chmod u+x clone${clone}/.git/hooks/post-merge
 done
 
-test_expect_failure 'post-merge does not run for up-to-date ' '
+test_expect_success 'post-merge does not run for up-to-date ' '
         GIT_DIR=clone1/.git git merge $commit0 &&
-       test -e clone1/.git/post-merge.args
+       ! test -f clone1/.git/post-merge.args
 '
 
 test_expect_success 'post-merge runs as expected ' '
index 7b6798d8b50f878c8957a60c058f6ad307f72789..788b4a5aae17d33ad688446bb60973952c3ca918 100755 (executable)
@@ -176,7 +176,7 @@ test_expect_success "deepening fetch in shallow repo" \
 test_expect_success "clone shallow object count" \
        "test \"count: 18\" = \"$(grep count count.shallow)\""
 
-test_expect_failure "pull in shallow repo with missing merge base" \
-       "(cd shallow; git pull --depth 4 .. A)"
+test_expect_success "pull in shallow repo with missing merge base" \
+       "(cd shallow && ! git pull --depth 4 .. A)"
 
 test_done
index 02882c1e4bdcef725b3575ccee6fb298f01c21b4..9b948c14e6f92e8154373154b32a6d450ead47af 100755 (executable)
@@ -95,7 +95,7 @@ test_expect_success 'fetch following tags' '
 
 '
 
-test_expect_failure 'fetch must not resolve short tag name' '
+test_expect_success 'fetch must not resolve short tag name' '
 
        cd "$D" &&
 
@@ -103,11 +103,11 @@ test_expect_failure 'fetch must not resolve short tag name' '
        cd five &&
        git init &&
 
-       git fetch .. anno:five
+       git fetch .. anno:five
 
 '
 
-test_expect_failure 'fetch must not resolve short remote name' '
+test_expect_success 'fetch must not resolve short remote name' '
 
        cd "$D" &&
        git-update-ref refs/remotes/six/HEAD HEAD
@@ -116,7 +116,7 @@ test_expect_failure 'fetch must not resolve short remote name' '
        cd six &&
        git init &&
 
-       git fetch .. six:six
+       git fetch .. six:six
 
 '
 
@@ -139,10 +139,10 @@ test_expect_success 'create bundle 2' '
        git bundle create bundle2 master~2..master
 '
 
-test_expect_failure 'unbundle 1' '
+test_expect_success 'unbundle 1' '
        cd "$D/bundle" &&
        git checkout -b some-branch &&
-       git fetch "$D/bundle1" master:master
+       git fetch "$D/bundle1" master:master
 '
 
 test_expect_success 'bundle 1 has only 3 files ' '
index 52b3a0c6dde59b8a955f28f4e9ffe037b0271513..9484129ca5aafab369a6ee1f7a1264d568f8cb44 100755 (executable)
@@ -71,8 +71,25 @@ test_expect_success 'branch.to-rebase.rebase' '
        git reset --hard before-rebase &&
        git config branch.to-rebase.rebase 1 &&
        git pull . copy &&
+       git config branch.to-rebase.rebase 0 &&
        test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
        test new = $(git show HEAD:file2)
 '
 
+test_expect_success '--rebase with rebased upstream' '
+
+       git remote add -f me . &&
+       git checkout copy &&
+       git reset --hard HEAD^ &&
+       echo conflicting modification > file &&
+       git commit -m conflict file &&
+       git checkout to-rebase &&
+       echo file > file2 &&
+       git commit -m to-rebase file2 &&
+       git pull --rebase me copy &&
+       test "conflicting modification" = "$(cat file)" &&
+       test file = $(cat file2)
+
+'
+
 test_done
index cc8949e3eff7b8d7802c5cdea5eddc7c2f1f9a53..8b0509106951c5ddf2995862bc2a3887c963bfe6 100755 (executable)
@@ -26,9 +26,8 @@ test_expect_success 'setup and corrupt repository' '
 
 '
 
-test_expect_failure 'fsck fails' '
-
-       git fsck
+test_expect_success 'fsck fails' '
+       ! git fsck
 '
 
 test_expect_success 'upload-pack fails due to error in pack-objects' '
@@ -46,9 +45,8 @@ test_expect_success 'corrupt repo differently' '
 
 '
 
-test_expect_failure 'fsck fails' '
-
-       git fsck
+test_expect_success 'fsck fails' '
+       ! git fsck
 '
 test_expect_success 'upload-pack fails due to error in rev-list' '
 
@@ -66,9 +64,9 @@ test_expect_success 'create empty repository' '
 
 '
 
-test_expect_failure 'fetch fails' '
+test_expect_success 'fetch fails' '
 
-       git fetch .. master
+       git fetch .. master
 
 '
 
index 1776b377f3c787977b145980f05aa74da5038657..acf34cec8f0ce5930f48a6e31ef84b8843097d74 100755 (executable)
@@ -11,13 +11,13 @@ remove the directory before attempting a clone again.'
 
 . ./test-lib.sh
 
-test_expect_failure \
+test_expect_success \
     'clone of non-existent source should fail' \
-    'git-clone foo bar'
+    'git-clone foo bar'
 
-test_expect_failure \
+test_expect_success \
     'failed clone should not leave a directory' \
-    'cd bar'
+    '! test -d bar'
 
 # Need a repo to clone
 test_create_repo foo
@@ -27,9 +27,9 @@ test_create_repo foo
 
 # source repository given to git-clone should be relative to the
 # current path not to the target dir
-test_expect_failure \
+test_expect_success \
     'clone of non-existent (relative to $PWD) source should fail' \
-    'git-clone ../foo baz'
+    'git-clone ../foo baz'
 
 test_expect_success \
     'clone should work now that source exists' \
index 699df6ebd8b6e76f95b255783c892de23610e504..910ccb4fff561360ba7060ab8df71c0349c4207a 100755 (executable)
@@ -53,14 +53,18 @@ git prune'
 
 cd "$base_dir"
 
-test_expect_failure 'creating too deep nesting' \
+test_expect_success 'creating too deep nesting' \
 'git clone -l -s C D &&
 git clone -l -s D E &&
 git clone -l -s E F &&
 git clone -l -s F G &&
-git clone -l -s G H &&
-cd H &&
-test_valid_repo'
+git clone -l -s G H'
+
+test_expect_success 'invalidity of deepest repository' \
+'cd H && {
+       test_valid_repo
+       test $? -ne 0
+}'
 
 cd "$base_dir"
 
@@ -83,10 +87,10 @@ test_valid_repo"
 
 cd "$base_dir"
 
-test_expect_failure 'that info/alternates is necessary' \
+test_expect_success 'that info/alternates is necessary' \
 'cd C &&
-rm .git/objects/info/alternates &&
-test_valid_repo'
+rm -f .git/objects/info/alternates &&
+! (test_valid_repo)'
 
 cd "$base_dir"
 
@@ -97,9 +101,11 @@ test_valid_repo'
 
 cd "$base_dir"
 
-test_expect_failure 'that relative alternate is only possible for current dir' \
-'cd D &&
-test_valid_repo'
+test_expect_success \
+    'that relative alternate is only possible for current dir' '
+    cd D &&
+    ! (test_valid_repo)
+'
 
 cd "$base_dir"
 
diff --git a/t/t6009-rev-list-parent.sh b/t/t6009-rev-list-parent.sh
new file mode 100755 (executable)
index 0000000..be3d238
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='properly cull all ancestors'
+
+. ./test-lib.sh
+
+commit () {
+       test_tick &&
+       echo $1 >file &&
+       git commit -a -m $1 &&
+       git tag $1
+}
+
+test_expect_success setup '
+
+       touch file &&
+       git add file &&
+
+       commit one &&
+
+       test_tick=$(($test_tick - 2400))
+
+       commit two &&
+       commit three &&
+       commit four &&
+
+       git log --pretty=oneline --abbrev-commit
+'
+
+test_expect_failure 'one is ancestor of others and should not be shown' '
+
+       git rev-list one --not four >result &&
+       >expect &&
+       diff -u expect result
+
+'
+
+test_done
index ae3b6f28315d54349601a5c4e162a25949b626ec..86419964b441ebcc15592b872933915472c463d2 100755 (executable)
@@ -66,8 +66,8 @@ test_expect_success "merge result added missing LF" \
        "git diff test.txt test2.txt"
 
 cp test.txt backup.txt
-test_expect_failure "merge with conflicts" \
-       "git merge-file test.txt orig.txt new3.txt"
+test_expect_success "merge with conflicts" \
+       "git merge-file test.txt orig.txt new3.txt"
 
 cat > expect.txt << EOF
 <<<<<<< test.txt
@@ -89,8 +89,8 @@ EOF
 test_expect_success "expected conflict markers" "git diff test.txt expect.txt"
 
 cp backup.txt test.txt
-test_expect_failure "merge with conflicts, using -L" \
-       "git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
+test_expect_success "merge with conflicts, using -L" \
+       "git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
 
 cat > expect.txt << EOF
 <<<<<<< 1
@@ -113,8 +113,8 @@ test_expect_success "expected conflict markers, with -L" \
        "git diff test.txt expect.txt"
 
 sed "s/ tu / TU /" < new1.txt > new5.txt
-test_expect_failure "conflict in removed tail" \
-       "git merge-file -p orig.txt new1.txt new5.txt > out"
+test_expect_success "conflict in removed tail" \
+       "git merge-file -p orig.txt new1.txt new5.txt > out"
 
 cat > expect << EOF
 Dominus regit me,
index c154f03cf5f80198b9b8d19f6b0c04db11c79965..149ea8543af153d39c8cba8c43bb3436aaaef3b4 100755 (executable)
@@ -60,7 +60,7 @@ git update-index a1 &&
 GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F
 '
 
-test_expect_failure "combined merge conflicts" "git merge -m final G"
+test_expect_success "combined merge conflicts" "! git merge -m final G"
 
 cat > expect << EOF
 <<<<<<< HEAD:a1
index 950c2e9b632f59a9405ba2100eb077836223291d..6004deb43228836f61e0c4b8762a2511a2c1780a 100755 (executable)
@@ -30,30 +30,29 @@ echo plain-file > symlink &&
 git add symlink &&
 git-commit -m b-file'
 
-test_expect_failure \
+test_expect_success \
 'merge master into b-symlink, which has a different symbolic link' '
-! git-checkout b-symlink ||
-git-merge master'
+git-checkout b-symlink &&
+git-merge master'
 
 test_expect_success \
 'the merge result must be a file' '
 test -f symlink'
 
-test_expect_failure \
+test_expect_success \
 'merge master into b-file, which has a file instead of a symbolic link' '
-! (git-reset --hard &&
-git-checkout b-file) ||
-git-merge master'
+git-reset --hard && git-checkout b-file &&
+! git-merge master'
 
 test_expect_success \
 'the merge result must be a file' '
 test -f symlink'
 
-test_expect_failure \
+test_expect_success \
 'merge b-file, which has a file instead of a symbolic link, into master' '
-! (git-reset --hard &&
-git-checkout master) ||
-git-merge b-file'
+git-reset --hard &&
+git-checkout master &&
+git-merge b-file'
 
 test_expect_success \
 'the merge result must be a file' '
index 2ba4b00e526eb00c5d236777f896772c6cad538b..ec71123f4be187c1399c90dc806dbae53cda5b7f 100755 (executable)
@@ -254,6 +254,18 @@ test_expect_success 'bisect run & skip: find first bad' '
        grep "$HASH6 is first bad commit" my_bisect_log.txt
 '
 
+test_expect_success 'bisect starting with a detached HEAD' '
+
+       git bisect reset &&
+       git checkout master^ &&
+       HEAD=$(git rev-parse --verify HEAD) &&
+       git bisect start &&
+       test $HEAD = $(cat .git/head-name) &&
+       git bisect reset &&
+       test $HEAD = $(git rev-parse --verify HEAD)
+
+'
+
 #
 #
 test_done
index 0724864e562a53e7079c021f8b331c5b8213ac98..2328b699474cbe338def30179b07f25fa7fa357a 100755 (executable)
@@ -26,7 +26,7 @@ test_expect_success 'final^1^1^1 = final^^^' "test $(git rev-parse final^1^1^1)
 test_expect_success 'final^1^2' "test $(git rev-parse start2) = $(git rev-parse final^1^2)"
 test_expect_success 'final^1^2 != final^1^1' "test $(git rev-parse final^1^2) != $(git rev-parse final^1^1)"
 test_expect_success 'final^1^3 not valid' "if git rev-parse --verify final^1^3; then false; else :; fi"
-test_expect_failure '--verify start2^1' 'git rev-parse --verify start2^1'
+test_expect_success '--verify start2^1' '! git rev-parse --verify start2^1'
 test_expect_success '--verify start2^0' 'git rev-parse --verify start2^0'
 
 test_expect_success 'repack for next test' 'git repack -a -d'
index 8a23aaf21b1977fab66aa2989cac56635251ecb6..f46ec93c83d990c0887d3ff9d59f9d365b4d5eed 100755 (executable)
@@ -43,8 +43,8 @@ test_expect_success 'Check atom names are valid' '
        test -z "$bad"
 '
 
-test_expect_failure 'Check invalid atoms names are errors' '
-       git-for-each-ref --format="%(INVALID)" refs/heads
+test_expect_success 'Check invalid atoms names are errors' '
+       git-for-each-ref --format="%(INVALID)" refs/heads
 '
 
 test_expect_success 'Check format specifiers are ignored in naming date atoms' '
@@ -63,8 +63,8 @@ test_expect_success 'Check valid format specifiers for date fields' '
        git-for-each-ref --format="%(authordate:rfc2822)" refs/heads
 '
 
-test_expect_failure 'Check invalid format specifiers are errors' '
-       git-for-each-ref --format="%(authordate:INVALID)" refs/heads
+test_expect_success 'Check invalid format specifiers are errors' '
+       git-for-each-ref --format="%(authordate:INVALID)" refs/heads
 '
 
 cat >expected <<\EOF
index b730c900b18543cd363ceaeb2dc6f6681c61524d..b1243b4163d231bb0f29fd91fe7fa15c34463c82 100755 (executable)
@@ -78,9 +78,9 @@ test_expect_success \
      git diff-tree -r -M --name-status  HEAD^ HEAD | \
      grep "^R100..*path2/README..*path1/path2/README"'
 
-test_expect_failure \
+test_expect_success \
     'do not move directory over existing directory' \
-    'mkdir path0 && mkdir path0/path2 && git mv path2 path0'
+    'mkdir path0 && mkdir path0/path2 && git mv path2 path0'
 
 test_expect_success \
     'move into "."' \
index 68b2b92879c5e187a33d34d3daf54bb3c131e40f..c8b4f65f380f3941c75bd6ed52975777d2b28d67 100755 (executable)
@@ -107,8 +107,8 @@ do
                diff expected actual
        '
 
-        test_expect_failure "grep -c $L (no /dev/null)" '
-               git grep -c test $H | grep -q "/dev/null"
+       test_expect_success "grep -c $L (no /dev/null)" '
+               ! git grep -c test $H | grep -q /dev/null
         '
 
 done
index df496a95ff16b1a42cfa140cc3d1c4449e4023ab..75cd33bde8e5906ad68ecdcc904248745d79975c 100755 (executable)
@@ -26,8 +26,8 @@ test_expect_success 'listing all tags in an empty tree should output nothing' '
        test `git-tag | wc -l` -eq 0
 '
 
-test_expect_failure 'looking for a tag in an empty tree should fail' \
-       'tag_exists mytag'
+test_expect_success 'looking for a tag in an empty tree should fail' \
+       '! (tag_exists mytag)'
 
 test_expect_success 'creating a tag in an empty tree should fail' '
        ! git-tag mynotag &&
@@ -83,9 +83,9 @@ test_expect_success \
 
 # special cases for creating tags:
 
-test_expect_failure \
+test_expect_success \
        'trying to create a tag with the name of one existing should fail' \
-       'git tag mytag'
+       'git tag mytag'
 
 test_expect_success \
        'trying to create a tag with a non-valid name should fail' '
@@ -146,8 +146,8 @@ test_expect_success \
        ! tag_exists myhead
 '
 
-test_expect_failure 'trying to delete an already deleted tag should fail' \
-       'git-tag -d mytag'
+test_expect_success 'trying to delete an already deleted tag should fail' \
+       'git-tag -d mytag'
 
 # listing various tags with pattern matching:
 
@@ -265,16 +265,16 @@ test_expect_success \
        test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD)
 '
 
-test_expect_failure 'trying to verify an unknown tag should fail' \
-       'git-tag -v unknown-tag'
+test_expect_success 'trying to verify an unknown tag should fail' \
+       'git-tag -v unknown-tag'
 
-test_expect_failure \
+test_expect_success \
        'trying to verify a non-annotated and non-signed tag should fail' \
-       'git-tag -v non-annotated-tag'
+       'git-tag -v non-annotated-tag'
 
-test_expect_failure \
+test_expect_success \
        'trying to verify many non-annotated or unknown tags, should fail' \
-       'git-tag -v unknown-tag1 non-annotated-tag unknown-tag2'
+       'git-tag -v unknown-tag1 non-annotated-tag unknown-tag2'
 
 # creating annotated tags:
 
@@ -1027,21 +1027,21 @@ test_expect_success \
 
 # try to sign with bad user.signingkey
 git config user.signingkey BobTheMouse
-test_expect_failure \
+test_expect_success \
        'git-tag -s fails if gpg is misconfigured' \
-       'git tag -s -m tail tag-gpg-failure'
+       'git tag -s -m tail tag-gpg-failure'
 git config --unset user.signingkey
 
 # try to verify without gpg:
 
 rm -rf gpghome
-test_expect_failure \
+test_expect_success \
        'verify signed tag fails when public key is not present' \
-       'git-tag -v signed-tag'
+       'git-tag -v signed-tag'
 
-test_expect_failure \
+test_expect_success \
        'git-tag -a fails if tag annotation is empty' '
-       GIT_EDITOR=cat git tag -a initial-comment
+       ! (GIT_EDITOR=cat git tag -a initial-comment)
 '
 
 test_expect_success \
index 66d40430b293b2c1f8c7bc72416730e502c41f58..0d9874bfd7082f9ef16c1f6b3ff8a848a19d8937 100755 (executable)
@@ -36,28 +36,28 @@ test_expect_success \
     'test -d path0 &&
      test -f path0/COPYING'
 
-test_expect_failure \
+test_expect_success \
     'checking lack of path1/path2/COPYING' \
-    'test -f path1/path2/COPYING'
+    'test -f path1/path2/COPYING'
 
-test_expect_failure \
+test_expect_success \
     'checking lack of path1/COPYING' \
-    'test -f path1/COPYING'
+    'test -f path1/COPYING'
 
-test_expect_failure \
+test_expect_success \
     'checking lack of COPYING' \
-    'test -f COPYING'
+    'test -f COPYING'
 
-test_expect_failure \
+test_expect_success \
     'checking checking lack of path1/COPYING-TOO' \
-    'test -f path0/COPYING-TOO'
+    'test -f path0/COPYING-TOO'
 
-test_expect_failure \
+test_expect_success \
     'checking lack of path1/path2' \
-    'test -d path1/path2'
+    'test -d path1/path2'
 
-test_expect_failure \
+test_expect_success \
     'checking lack of path1' \
-    'test -d path1'
+    'test -d path1'
 
 test_done
index 73d8a00e2cca907e562c50c70a10c02e3c0e02ca..dbf1ace29ef8ad178a0ad8539e6bde30482ee60f 100755 (executable)
@@ -214,6 +214,22 @@ test_expect_success 'checkout to detach HEAD with branchname^' '
        fi
 '
 
+test_expect_success 'checkout to detach HEAD with :/message' '
+
+       git checkout -f master && git clean -f &&
+       git checkout ":/Initial" &&
+       H=$(git rev-parse --verify HEAD) &&
+       M=$(git show-ref -s --verify refs/heads/master) &&
+       test "z$H" = "z$M" &&
+       if git symbolic-ref HEAD >/dev/null 2>&1
+       then
+               echo "OOPS, HEAD is still symbolic???"
+               false
+       else
+               : happy
+       fi
+'
+
 test_expect_success 'checkout to detach HEAD with HEAD^0' '
 
        git checkout -f master && git clean -f &&
index 4fe3a41f07f2f05865b219ff00afaa5786c679d5..2ef85a869d515b557815476f126386dc19f755c5 100755 (executable)
@@ -13,11 +13,11 @@ subcommands of git-submodule.
 
 #
 # Test setup:
-#  -create a repository in directory lib
+#  -create a repository in directory init
 #  -add a couple of files
-#  -add directory lib to 'superproject', this creates a DIRLINK entry
+#  -add directory init to 'superproject', this creates a DIRLINK entry
 #  -add a couple of regular files to enable testing of submodule filtering
-#  -mv lib subrepo
+#  -mv init subrepo
 #  -add an entry to .gitmodules for submodule 'example'
 #
 test_expect_success 'Prepare submodule testing' '
@@ -25,8 +25,8 @@ test_expect_success 'Prepare submodule testing' '
        git-add t &&
        git-commit -m "initial commit" &&
        git branch initial HEAD &&
-       mkdir lib &&
-       cd lib &&
+       mkdir init &&
+       cd init &&
        git init &&
        echo a >a &&
        git add a &&
@@ -41,10 +41,10 @@ test_expect_success 'Prepare submodule testing' '
        cd .. &&
        echo a >a &&
        echo z >z &&
-       git add a lib z &&
+       git add a init z &&
        git-commit -m "super commit 1" &&
-       mv lib .subrepo &&
-       GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/lib.git
+       mv init .subrepo &&
+       GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git
 '
 
 test_expect_success 'status should fail for unmapped paths' '
@@ -52,7 +52,7 @@ test_expect_success 'status should fail for unmapped paths' '
        then
                echo "[OOPS] submodule status succeeded"
                false
-       elif ! GIT_CONFIG=.gitmodules git config submodule.example.path lib
+       elif ! GIT_CONFIG=.gitmodules git config submodule.example.path init
        then
                echo "[OOPS] git config failed to update .gitmodules"
                false
@@ -71,7 +71,7 @@ test_expect_success 'status should initially be "missing"' '
 test_expect_success 'init should register submodule url in .git/config' '
        git-submodule init &&
        url=$(git config submodule.example.url) &&
-       if test "$url" != "git://example.com/lib.git"
+       if test "$url" != "git://example.com/init.git"
        then
                echo "[OOPS] init succeeded but submodule url is wrong"
                false
@@ -83,41 +83,41 @@ test_expect_success 'init should register submodule url in .git/config' '
 '
 
 test_expect_success 'update should fail when path is used by a file' '
-       echo "hello" >lib &&
+       echo "hello" >init &&
        if git-submodule update
        then
                echo "[OOPS] update should have failed"
                false
-       elif test "$(cat lib)" != "hello"
+       elif test "$(cat init)" != "hello"
        then
-               echo "[OOPS] update failed but lib file was molested"
+               echo "[OOPS] update failed but init file was molested"
                false
        else
-               rm lib
+               rm init
        fi
 '
 
 test_expect_success 'update should fail when path is used by a nonempty directory' '
-       mkdir lib &&
-       echo "hello" >lib/a &&
+       mkdir init &&
+       echo "hello" >init/a &&
        if git-submodule update
        then
                echo "[OOPS] update should have failed"
                false
-       elif test "$(cat lib/a)" != "hello"
+       elif test "$(cat init/a)" != "hello"
        then
-               echo "[OOPS] update failed but lib/a was molested"
+               echo "[OOPS] update failed but init/a was molested"
                false
        else
-               rm lib/a
+               rm init/a
        fi
 '
 
 test_expect_success 'update should work when path is an empty dir' '
-       rm -rf lib &&
-       mkdir lib &&
+       rm -rf init &&
+       mkdir init &&
        git-submodule update &&
-       head=$(cd lib && git rev-parse HEAD) &&
+       head=$(cd init && git rev-parse HEAD) &&
        if test -z "$head"
        then
                echo "[OOPS] Failed to obtain submodule head"
@@ -134,7 +134,7 @@ test_expect_success 'status should be "up-to-date" after update' '
 '
 
 test_expect_success 'status should be "modified" after submodule commit' '
-       cd lib &&
+       cd init &&
        echo b >b &&
        git add b &&
        git-commit -m "submodule commit 2" &&
@@ -157,8 +157,8 @@ test_expect_success 'git diff should report the SHA1 of the new submodule commit
 '
 
 test_expect_success 'update should checkout rev1' '
-       git-submodule update &&
-       head=$(cd lib && git rev-parse HEAD) &&
+       git-submodule update init &&
+       head=$(cd init && git rev-parse HEAD) &&
        if test -z "$head"
        then
                echo "[OOPS] submodule git rev-parse returned nothing"
@@ -182,13 +182,13 @@ test_expect_success 'checkout superproject with subproject already present' '
 test_expect_success 'apply submodule diff' '
        git branch second &&
        (
-               cd lib &&
+               cd init &&
                echo s >s &&
                git add s &&
                git commit -m "change subproject"
        ) &&
-       git update-index --add lib &&
-       git-commit -m "change lib" &&
+       git update-index --add init &&
+       git-commit -m "change init" &&
        git-format-patch -1 --stdout >P.diff &&
        git checkout second &&
        git apply --index P.diff &&
index d1a415a12624f4a116a9001bad48c34420671280..361886c3d62b8bf81db0be5999c1e98c4e972f6a 100755 (executable)
@@ -17,49 +17,49 @@ test_expect_success \
         git-add file && \
         git-status | grep 'Initial commit'"
 
-test_expect_failure \
+test_expect_success \
        "fail initial amend" \
-       "git-commit --amend"
+       "git-commit --amend"
 
 test_expect_success \
        "initial commit" \
        "git-commit -m initial"
 
-test_expect_failure \
+test_expect_success \
        "invalid options 1" \
-       "git-commit -m foo -m bar -F file"
+       "git-commit -m foo -m bar -F file"
 
-test_expect_failure \
+test_expect_success \
        "invalid options 2" \
-       "git-commit -C HEAD -m illegal"
+       "git-commit -C HEAD -m illegal"
 
-test_expect_failure \
+test_expect_success \
        "using paths with -a" \
        "echo King of the bongo >file &&
-       git-commit -m foo -a file"
+       git-commit -m foo -a file"
 
-test_expect_failure \
+test_expect_success \
        "using paths with --interactive" \
        "echo bong-o-bong >file &&
-       echo 7 | git-commit -m foo --interactive file"
+       echo 7 | git-commit -m foo --interactive file"
 
-test_expect_failure \
+test_expect_success \
        "using invalid commit with -C" \
-       "git-commit -C bogus"
+       "git-commit -C bogus"
 
-test_expect_failure \
+test_expect_success \
        "testing nothing to commit" \
-       "git-commit -m initial"
+       "git-commit -m initial"
 
 test_expect_success \
        "next commit" \
        "echo 'bongo bongo bongo' >file \
         git-commit -m next -a"
 
-test_expect_failure \
+test_expect_success \
        "commit message from non-existing file" \
        "echo 'more bongo: bongo bongo bongo bongo' >file && \
-        git-commit -F gah -a"
+        git-commit -F gah -a"
 
 # Empty except stray tabs and spaces on a few lines.
 sed -e 's/@$//' >msg <<EOF
@@ -68,9 +68,9 @@ sed -e 's/@$//' >msg <<EOF
   @
 Signed-off-by: hula
 EOF
-test_expect_failure \
+test_expect_success \
        "empty commit message" \
-       "git-commit -F msg -a"
+       "git-commit -F msg -a"
 
 test_expect_success \
        "commit message from file" \
@@ -88,10 +88,10 @@ test_expect_success \
        "amend commit" \
        "VISUAL=./editor git-commit --amend"
 
-test_expect_failure \
+test_expect_success \
        "passing -m and -F" \
        "echo 'enough with the bongos' >file && \
-        git-commit -F msg -m amending ."
+        git-commit -F msg -m amending ."
 
 test_expect_success \
        "using message from other commit" \
@@ -327,4 +327,22 @@ test_expect_success 'amend using the message from another commit' '
 
 '
 
+test_expect_success 'amend using the message from a commit named with tag' '
+
+       git reset --hard &&
+       test_tick &&
+       git commit --allow-empty -m "old commit" &&
+       old=$(git rev-parse --verify HEAD) &&
+       git tag -a -m "tag on old" tagged-old HEAD &&
+       test_tick &&
+       git commit --allow-empty -m "new commit" &&
+       new=$(git rev-parse --verify HEAD) &&
+       test_tick &&
+       git commit --allow-empty --amend -C tagged-old &&
+       git show --pretty="format:%ad %s" "$old" >expected &&
+       git show --pretty="format:%ad %s" HEAD >actual &&
+       diff -u expected actual
+
+'
+
 test_done
index d787cac2f7c09c0d84cb4cdfdf68401b660d3c6c..2dd5a5e30279e6c3e5ac2be9425c19328a65aff1 100755 (executable)
@@ -52,11 +52,11 @@ cat > "$HOOK" <<EOF
 exit 1
 EOF
 
-test_expect_failure 'with failing hook' '
+test_expect_success 'with failing hook' '
 
        echo "another" >> file &&
        git add file &&
-       git commit -m "another"
+       git commit -m "another"
 
 '
 
index 751b11300bb887d552697879201217ca1dcff648..eff36aaee32200075f815de43af781cb115ea38e 100755 (executable)
@@ -98,20 +98,20 @@ cat > "$HOOK" <<EOF
 exit 1
 EOF
 
-test_expect_failure 'with failing hook' '
+test_expect_success 'with failing hook' '
 
        echo "another" >> file &&
        git add file &&
-       git commit -m "another"
+       git commit -m "another"
 
 '
 
-test_expect_failure 'with failing hook (editor)' '
+test_expect_success 'with failing hook (editor)' '
 
        echo "more another" >> file &&
        git add file &&
        echo "more another" > FAKE_MSG &&
-       GIT_EDITOR="$FAKE_EDITOR" git commit
+       ! (GIT_EDITOR="$FAKE_EDITOR" git commit)
 
 '
 
index 4f6822f2c5d717edd20cb97e49fad3017d34897e..08f7c3d8d7666aeb7a116f475127c9c183e64d5a 100755 (executable)
@@ -8,7 +8,7 @@ test_expect_success \
     'prepare reference tree' \
     'echo "1A quick brown fox jumps over the" >file &&
      echo "lazy dog" >>file &&
-     git add file
+     git add file &&
      GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
 
 test_expect_success \
@@ -20,9 +20,9 @@ test_expect_success \
       echo "  echo \"!\$a!\""
       echo "done >commandline"
       echo "cat > msgtxt"
-      ) >fake.sendmail
-     chmod +x ./fake.sendmail
-     git add fake.sendmail
+      ) >fake.sendmail &&
+     chmod +x ./fake.sendmail &&
+     git add fake.sendmail &&
      GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
 
 test_expect_success 'Extract patches' '
index 614cf50d195bb3b055fd8166d425eeffa7106509..4e24ab3a7db96d396c108dd0cbe677aa067c9460 100755 (executable)
@@ -56,19 +56,19 @@ test_expect_success "$name" "
 
 
 name='detect node change from file to directory #1'
-test_expect_failure "$name" "
+test_expect_success "$name" "
        mkdir dir/new_file &&
        mv dir/file dir/new_file/file &&
        mv dir/new_file dir/file &&
        git update-index --remove dir/file &&
        git update-index --add dir/file/file &&
-       git commit -m '$name'  &&
-       git-svn set-tree --find-copies-harder --rmdir \
+       git commit -m '$name' &&
+       git-svn set-tree --find-copies-harder --rmdir \
                remotes/git-svn..mybranch" || true
 
 
 name='detect node change from directory to file #1'
-test_expect_failure "$name" "
+test_expect_success "$name" "
        rm -rf dir '$GIT_DIR'/index &&
        git checkout -f -b mybranch2 remotes/git-svn &&
        mv bar/zzz zzz &&
@@ -77,12 +77,12 @@ test_expect_failure "$name" "
        git update-index --remove -- bar/zzz &&
        git update-index --add -- bar &&
        git commit -m '$name' &&
-       git-svn set-tree --find-copies-harder --rmdir \
+       git-svn set-tree --find-copies-harder --rmdir \
                remotes/git-svn..mybranch2" || true
 
 
 name='detect node change from file to directory #2'
-test_expect_failure "$name" "
+test_expect_success "$name" "
        rm -f '$GIT_DIR'/index &&
        git checkout -f -b mybranch3 remotes/git-svn &&
        rm bar/zzz &&
@@ -91,12 +91,12 @@ test_expect_failure "$name" "
        echo yyy > bar/zzz/yyy &&
        git update-index --add bar/zzz/yyy &&
        git commit -m '$name' &&
-       git-svn set-tree --find-copies-harder --rmdir \
+       git-svn set-tree --find-copies-harder --rmdir \
                remotes/git-svn..mybranch3" || true
 
 
 name='detect node change from directory to file #2'
-test_expect_failure "$name" "
+test_expect_success "$name" "
        rm -f '$GIT_DIR'/index &&
        git checkout -f -b mybranch4 remotes/git-svn &&
        rm -rf dir &&
@@ -105,7 +105,7 @@ test_expect_failure "$name" "
        echo asdf > dir &&
        git update-index --add -- dir &&
        git commit -m '$name' &&
-       git-svn set-tree --find-copies-harder --rmdir \
+       git-svn set-tree --find-copies-harder --rmdir \
                remotes/git-svn..mybranch4" || true
 
 
@@ -213,18 +213,18 @@ EOF
 
 test_expect_success "$name" "git diff a expected"
 
-test_expect_failure 'exit if remote refs are ambigious' "
+test_expect_success 'exit if remote refs are ambigious' "
         git config --add svn-remote.svn.fetch \
                               bar:refs/remotes/git-svn &&
-        git-svn migrate
-        "
+       ! git-svn migrate
+"
 
-test_expect_failure 'exit if init-ing a would clobber a URL' "
+test_expect_success 'exit if init-ing a would clobber a URL' "
         svnadmin create ${PWD}/svnrepo2 &&
         svn mkdir -m 'mkdir bar' ${svnrepo}2/bar &&
         git config --unset svn-remote.svn.fetch \
                                 '^bar:refs/remotes/git-svn$' &&
-        git-svn init ${svnrepo}2/bar
+       ! git-svn init ${svnrepo}2/bar
         "
 
 test_expect_success \
index 79b7968eaf4d4bfa3673edf78e31ca43b54becb3..f74ab1269e3fa79a34aa9f9a3a64df08728e6354 100755 (executable)
@@ -24,11 +24,11 @@ test_expect_success 'commit change from svn side' "
        rm -rf t.svn
        "
 
-test_expect_failure 'commit conflicting change from git' "
+test_expect_success 'commit conflicting change from git' "
        echo second line from git >> file &&
        git commit -a -m 'second line from git' &&
-       git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
-       " || true
+       git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
+"
 
 test_expect_success 'commit complementing change from git' "
        git reset --hard HEAD~1 &&
@@ -39,7 +39,7 @@ test_expect_success 'commit complementing change from git' "
        git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
        "
 
-test_expect_failure 'dcommit fails to commit because of conflict' "
+test_expect_success 'dcommit fails to commit because of conflict' "
        git-svn init $svnrepo &&
        git-svn fetch &&
        git reset --hard refs/remotes/git-svn &&
@@ -52,8 +52,8 @@ test_expect_failure 'dcommit fails to commit because of conflict' "
        rm -rf t.svn &&
        echo 'fourth line from git' >> file &&
        git commit -a -m 'fourth line from git' &&
-       git-svn dcommit
-       " || true
+       git-svn dcommit
+       "
 
 test_expect_success 'dcommit does the svn equivalent of an index merge' "
        git reset --hard refs/remotes/git-svn &&
@@ -76,15 +76,15 @@ test_expect_success 'commit another change from svn side' "
        rm -rf t.svn
        "
 
-test_expect_failure 'multiple dcommit from git-svn will not clobber svn' "
+test_expect_success 'multiple dcommit from git-svn will not clobber svn' "
        git reset --hard refs/remotes/git-svn &&
        echo new file >> new-file &&
        git update-index --add new-file &&
        git commit -a -m 'new file' &&
        echo clobber > file &&
        git commit -a -m 'clobber' &&
-       git svn dcommit
-       " || true
+       git svn dcommit
+       "
 
 
 test_expect_success 'check that rebase really failed' 'test -d .dotest'
index 745254665dd2d8f73b8c511b39aca82682bf1bbb..ca8a00ed0af0382c20a4883e5aa5f1914b6ecd3f 100755 (executable)
@@ -54,10 +54,10 @@ test_expect_success 'change file but in unrelated area' "
                test x\"\`sed -n -e 61p < file\`\" = x6611
        "
 
-test_expect_failure 'attempt to dcommit with a dirty index' '
+test_expect_success 'attempt to dcommit with a dirty index' '
        echo foo >>file &&
        git add file &&
-       git svn dcommit
+       git svn dcommit
 '
 
 test_done
index 0595041af5d310f905306c6a289945cde26d88fc..cceedbb2b7efc20b79155889ed20c5a7866fed9c 100755 (executable)
@@ -165,9 +165,9 @@ from refs/heads/master
 M 755 0000000000000000000000000000000000000001 zero1
 
 INPUT_END
-test_expect_failure \
-    'B: fail on invalid blob sha1' \
-    'git-fast-import <input'
+test_expect_success 'B: fail on invalid blob sha1' '
+    ! git-fast-import <input
+'
 rm -f .git/objects/pack_* .git/objects/index_*
 
 cat >input <<INPUT_END
@@ -180,9 +180,9 @@ COMMIT
 from refs/heads/master
 
 INPUT_END
-test_expect_failure \
-    'B: fail on invalid branch name ".badbranchname"' \
-    'git-fast-import <input'
+test_expect_success 'B: fail on invalid branch name ".badbranchname"' '
+    ! git-fast-import <input
+'
 rm -f .git/objects/pack_* .git/objects/index_*
 
 cat >input <<INPUT_END
@@ -195,9 +195,9 @@ COMMIT
 from refs/heads/master
 
 INPUT_END
-test_expect_failure \
-    'B: fail on invalid branch name "bad[branch]name"' \
-    'git-fast-import <input'
+test_expect_success 'B: fail on invalid branch name "bad[branch]name"' '
+    ! git-fast-import <input
+'
 rm -f .git/objects/pack_* .git/objects/index_*
 
 cat >input <<INPUT_END
@@ -339,9 +339,9 @@ COMMIT
 from refs/heads/branch^0
 
 INPUT_END
-test_expect_failure \
-    'E: rfc2822 date, --date-format=raw' \
-    'git-fast-import --date-format=raw <input'
+test_expect_success 'E: rfc2822 date, --date-format=raw' '
+    ! git-fast-import --date-format=raw <input
+'
 test_expect_success \
     'E: rfc2822 date, --date-format=rfc2822' \
     'git-fast-import --date-format=rfc2822 <input'
index 641303e0a18c1c9958e4dae86d1fcdee644dbcff..0a20971ebb693250ab1fa78cdd9ec269e7129f6e 100755 (executable)
@@ -33,19 +33,28 @@ CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
 rm -rf "$CVSWORK" "$SERVERDIR"
-echo >empty &&
+test_expect_success 'setup' '
+  echo >empty &&
   git add empty &&
   git commit -q -m "First Commit" &&
+  mkdir secondroot &&
+  ( cd secondroot &&
+  git init &&
+  touch secondrootfile &&
+  git add secondrootfile &&
+  git commit -m "second root") &&
+  git pull secondroot master &&
   git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
   GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
-  GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
-  exit 1
+  GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log"
+'
 
 # note that cvs doesn't accept absolute pathnames
 # as argument to co -d
 test_expect_success 'basic checkout' \
   'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master &&
-   test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))" = "empty/1.1/"'
+   test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/"
+   test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | tail -n 1))" = "secondrootfile/1.1/"'
 
 #------------------------
 # PSERVER AUTHENTICATION
@@ -147,15 +156,19 @@ test_expect_success 'req_Root (strict paths)' \
   'cat request-anonymous | git-cvsserver --strict-paths pserver $SERVERDIR >log 2>&1 &&
    tail -n1 log | grep -q "^I LOVE YOU$"'
 
-test_expect_failure 'req_Root failure (strict-paths)' \
-  'cat request-anonymous | git-cvsserver --strict-paths pserver $WORKDIR >log 2>&1'
+test_expect_success 'req_Root failure (strict-paths)' '
+    ! cat request-anonymous |
+    git-cvsserver --strict-paths pserver $WORKDIR >log 2>&1
+'
 
 test_expect_success 'req_Root (w/o strict-paths)' \
   'cat request-anonymous | git-cvsserver pserver $WORKDIR/ >log 2>&1 &&
    tail -n1 log | grep -q "^I LOVE YOU$"'
 
-test_expect_failure 'req_Root failure (w/o strict-paths)' \
-  'cat request-anonymous | git-cvsserver pserver $WORKDIR/gitcvs >log 2>&1'
+test_expect_success 'req_Root failure (w/o strict-paths)' '
+    ! cat request-anonymous |
+    git-cvsserver pserver $WORKDIR/gitcvs >log 2>&1
+'
 
 cat >request-base  <<EOF
 BEGIN AUTH REQUEST
@@ -170,8 +183,10 @@ test_expect_success 'req_Root (base-path)' \
   'cat request-base | git-cvsserver --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
    tail -n1 log | grep -q "^I LOVE YOU$"'
 
-test_expect_failure 'req_Root failure (base-path)' \
-  'cat request-anonymous | git-cvsserver --strict-paths --base-path $WORKDIR pserver $SERVERDIR >log 2>&1'
+test_expect_success 'req_Root failure (base-path)' '
+    ! cat request-anonymous |
+    git-cvsserver --strict-paths --base-path $WORKDIR pserver $SERVERDIR >log 2>&1
+'
 
 GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
 
@@ -179,9 +194,8 @@ test_expect_success 'req_Root (export-all)' \
   'cat request-anonymous | git-cvsserver --export-all pserver $WORKDIR >log 2>&1 &&
    tail -n1 log | grep -q "^I LOVE YOU$"'
 
-test_expect_failure 'req_Root failure (export-all w/o whitelist)' \
-  'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 ||
-   false'
+test_expect_success 'req_Root failure (export-all w/o whitelist)' \
+  '! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
 
 test_expect_success 'req_Root (everything together)' \
   'cat request-base | git-cvsserver --export-all --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
@@ -281,15 +295,16 @@ test_expect_success 'cvs update (update existing file)' \
 
 cd "$WORKDIR"
 #TODO: cvsserver doesn't support update w/o -d
-test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" \
-  'mkdir test &&
+test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" '
+   mkdir test &&
    echo >test/empty &&
    git add test &&
    git commit -q -m "Single Subdirectory" &&
    git push gitcvs.git >/dev/null &&
    cd cvswork &&
    GIT_CONFIG="$git_config" cvs -Q update &&
-   test ! -d test'
+   test ! -d test
+'
 
 cd "$WORKDIR"
 test_expect_success 'cvs update (subdirectories)' \
index 90b6844d00c3cb288c23488923b98a7276eb83e8..da47bd7c9eaac7f01106c290fab8364e1ce838a4 100644 (file)
@@ -139,6 +139,8 @@ fi
 
 test_failure=0
 test_count=0
+test_fixed=0
+test_broken=0
 
 trap 'echo >&5 "FATAL: Unexpected exit with code $?"; exit 1' exit
 
@@ -171,6 +173,17 @@ test_failure_ () {
        test "$immediate" = "" || { trap - exit; exit 1; }
 }
 
+test_known_broken_ok_ () {
+       test_count=$(expr "$test_count" + 1)
+       test_fixed=$(($test_fixed+1))
+       say_color "" "  FIXED $test_count: $@"
+}
+
+test_known_broken_failure_ () {
+       test_count=$(expr "$test_count" + 1)
+       test_broken=$(($test_broken+1))
+       say_color skip "  still broken $test_count: $@"
+}
 
 test_debug () {
        test "$debug" = "" || eval "$1"
@@ -211,13 +224,13 @@ test_expect_failure () {
        error "bug in the test script: not 2 parameters to test-expect-failure"
        if ! test_skip "$@"
        then
-               say >&3 "expecting failure: $2"
+               say >&3 "checking known breakage: $2"
                test_run_ "$2"
-               if [ "$?" = 0 -a "$eval_ret" != 0 -a "$eval_ret" -lt 129 ]
+               if [ "$?" = 0 -a "$eval_ret" = 0 ]
                then
-                       test_ok_ "$1"
+                       test_known_broken_ok_ "$1"
                else
-                       test_failure_ "$@"
+                   test_known_broken_failure_ "$1"
                fi
        fi
        echo >&3 ""
@@ -257,7 +270,7 @@ test_expect_code () {
        echo >&3 ""
 }
 
-# Most tests can use the created repository, but some amy need to create more.
+# Most tests can use the created repository, but some may need to create more.
 # Usage: test_create_repo <directory>
 test_create_repo () {
        test "$#" = 1 ||
@@ -274,6 +287,18 @@ test_create_repo () {
 
 test_done () {
        trap - exit
+
+       if test "$test_fixed" != 0
+       then
+               say_color pass "fixed $test_fixed known breakage(s)"
+       fi
+       if test "$test_broken" != 0
+       then
+               say_color error "still have $test_broken known breakage(s)"
+               msg="remaining $(($test_count-$test_broken)) test(s)"
+       else
+               msg="$test_count test(s)"
+       fi
        case "$test_failure" in
        0)
                # We could:
@@ -284,11 +309,11 @@ test_done () {
                # The Makefile provided will clean this test area so
                # we will leave things as they are.
 
-               say_color pass "passed all $test_count test(s)"
+               say_color pass "passed all $msg"
                exit 0 ;;
 
        *)
-               say_color error "failed $test_failure among $test_count test(s)"
+               say_color error "failed $test_failure among $msg"
                exit 1 ;;
 
        esac
index 4d3e2ec39e33f6301cc6df162dab7de9dbb2ea80..eed8a02c6589bcb9af46188b56054eace3cd4d19 100644 (file)
@@ -19,6 +19,7 @@ int main(int argc, const char **argv)
                OPT_STRING('s', "string", &string, "string", "get a string"),
                OPT_STRING(0, "string2", &string, "str", "get another string"),
                OPT_STRING(0, "st", &string, "st", "get another string (pervert ordering)"),
+               OPT_STRING('o', NULL, &string, "str", "get another string"),
                OPT_END(),
        };
        int i;
index babaa21398522939076151f1c240a4f18f9a90a1..497f85372173f6f270a4c0ee9474f165bb884413 100644 (file)
@@ -441,11 +441,12 @@ static struct ref *get_refs_via_curl(struct transport *transport)
        struct ref *ref = NULL;
        struct ref *last_ref = NULL;
 
+       if (!transport->data)
+               transport->data = get_http_walker(transport->url);
+
        refs_url = xmalloc(strlen(transport->url) + 11);
        sprintf(refs_url, "%s/info/refs", transport->url);
 
-       http_init();
-
        slot = get_active_slot();
        slot->results = &results;
        curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
@@ -473,8 +474,6 @@ static struct ref *get_refs_via_curl(struct transport *transport)
                return NULL;
        }
 
-       http_cleanup();
-
        data = buffer.buf;
        start = NULL;
        mid = data;
index 27b946d55299d66031b31949da187ffb670e484b..f14022f2a9b8ce740067f7c6bf03bd51203cf2ca 100644 (file)
@@ -392,6 +392,8 @@ int git_status_config(const char *k, const char *v)
        }
        if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
                int slot = parse_status_slot(k, 13);
+               if (!v)
+                       return config_error_nonbool(k);
                color_parse(v, k, wt_status_colors[slot]);
                return 0;
        }