]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'nm/maint-conflicted-submodule-entries'
authorJunio C Hamano <gitster@pobox.com>
Mon, 4 Apr 2011 10:41:24 +0000 (03:41 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 4 Apr 2011 10:41:24 +0000 (03:41 -0700)
* nm/maint-conflicted-submodule-entries:
  submodule: process conflicting submodules only once

439 files changed:
.gitignore
Documentation/RelNotes/1.7.4.3.txt [new file with mode: 0644]
Documentation/RelNotes/1.7.4.4.txt [new file with mode: 0644]
Documentation/RelNotes/1.7.5.txt [new file with mode: 0644]
Documentation/config.txt
Documentation/git-add.txt
Documentation/git-am.txt
Documentation/git-annotate.txt
Documentation/git-apply.txt
Documentation/git-archimport.txt
Documentation/git-archive.txt
Documentation/git-bisect.txt
Documentation/git-blame.txt
Documentation/git-branch.txt
Documentation/git-bundle.txt
Documentation/git-cat-file.txt
Documentation/git-check-attr.txt
Documentation/git-checkout-index.txt
Documentation/git-checkout.txt
Documentation/git-cherry-pick.txt
Documentation/git-cherry.txt
Documentation/git-citool.txt
Documentation/git-clean.txt
Documentation/git-clone.txt
Documentation/git-commit-tree.txt
Documentation/git-commit.txt
Documentation/git-config.txt
Documentation/git-count-objects.txt
Documentation/git-cvsexportcommit.txt
Documentation/git-cvsimport.txt
Documentation/git-cvsserver.txt
Documentation/git-daemon.txt
Documentation/git-describe.txt
Documentation/git-diff-files.txt
Documentation/git-diff-index.txt
Documentation/git-diff-tree.txt
Documentation/git-diff.txt
Documentation/git-difftool.txt
Documentation/git-fast-export.txt
Documentation/git-fast-import.txt
Documentation/git-fetch-pack.txt
Documentation/git-fetch.txt
Documentation/git-filter-branch.txt
Documentation/git-fmt-merge-msg.txt
Documentation/git-format-patch.txt
Documentation/git-fsck-objects.txt
Documentation/git-fsck.txt
Documentation/git-gc.txt
Documentation/git-get-tar-commit-id.txt
Documentation/git-grep.txt
Documentation/git-gui.txt
Documentation/git-hash-object.txt
Documentation/git-help.txt
Documentation/git-http-fetch.txt
Documentation/git-http-push.txt
Documentation/git-imap-send.txt
Documentation/git-index-pack.txt
Documentation/git-init-db.txt
Documentation/git-init.txt
Documentation/git-instaweb.txt
Documentation/git-log.txt
Documentation/git-lost-found.txt
Documentation/git-ls-files.txt
Documentation/git-ls-remote.txt
Documentation/git-ls-tree.txt
Documentation/git-mailinfo.txt
Documentation/git-mailsplit.txt
Documentation/git-merge-base.txt
Documentation/git-merge-file.txt
Documentation/git-merge-index.txt
Documentation/git-merge-one-file.txt
Documentation/git-merge-tree.txt
Documentation/git-merge.txt
Documentation/git-mergetool--lib.txt
Documentation/git-mergetool.txt
Documentation/git-mktag.txt
Documentation/git-mktree.txt
Documentation/git-mv.txt
Documentation/git-name-rev.txt
Documentation/git-pack-objects.txt
Documentation/git-pack-redundant.txt
Documentation/git-pack-refs.txt
Documentation/git-parse-remote.txt
Documentation/git-patch-id.txt
Documentation/git-peek-remote.txt
Documentation/git-prune-packed.txt
Documentation/git-prune.txt
Documentation/git-pull.txt
Documentation/git-push.txt
Documentation/git-quiltimport.txt
Documentation/git-read-tree.txt
Documentation/git-rebase.txt
Documentation/git-receive-pack.txt
Documentation/git-reflog.txt
Documentation/git-relink.txt
Documentation/git-remote-helpers.txt
Documentation/git-remote.txt
Documentation/git-repack.txt
Documentation/git-replace.txt
Documentation/git-repo-config.txt
Documentation/git-request-pull.txt
Documentation/git-rerere.txt
Documentation/git-reset.txt
Documentation/git-rev-list.txt
Documentation/git-rev-parse.txt
Documentation/git-revert.txt
Documentation/git-rm.txt
Documentation/git-send-email.txt
Documentation/git-send-pack.txt
Documentation/git-sh-setup.txt
Documentation/git-shell.txt
Documentation/git-shortlog.txt
Documentation/git-show-branch.txt
Documentation/git-show-index.txt
Documentation/git-show-ref.txt
Documentation/git-show.txt
Documentation/git-stage.txt
Documentation/git-stash.txt
Documentation/git-status.txt
Documentation/git-stripspace.txt
Documentation/git-submodule.txt
Documentation/git-svn.txt
Documentation/git-symbolic-ref.txt
Documentation/git-tag.txt
Documentation/git-tar-tree.txt
Documentation/git-unpack-file.txt
Documentation/git-unpack-objects.txt
Documentation/git-update-index.txt
Documentation/git-update-ref.txt
Documentation/git-update-server-info.txt
Documentation/git-upload-archive.txt
Documentation/git-upload-pack.txt
Documentation/git-var.txt
Documentation/git-verify-pack.txt
Documentation/git-verify-tag.txt
Documentation/git-web--browse.txt
Documentation/git-whatchanged.txt
Documentation/git-write-tree.txt
Documentation/git.txt
Documentation/gitcli.txt
Documentation/gitignore.txt
Documentation/gitk.txt
Documentation/gitmodules.txt
Documentation/glossary-content.txt
Documentation/merge-config.txt
Documentation/merge-options.txt
Documentation/rev-list-options.txt
Documentation/revisions.txt
Documentation/technical/index-format.txt [new file with mode: 0644]
GIT-VERSION-GEN
Makefile
RelNotes
abspath.c
alloc.c
attr.c
branch.c
builtin.h
builtin/add.c
builtin/apply.c
builtin/archive.c
builtin/branch.c
builtin/bundle.c
builtin/checkout.c
builtin/clean.c
builtin/clone.c
builtin/commit.c
builtin/config.c
builtin/describe.c
builtin/diff-files.c
builtin/diff.c
builtin/fast-export.c
builtin/fetch-pack.c
builtin/fetch.c
builtin/fmt-merge-msg.c
builtin/fsck.c
builtin/gc.c
builtin/grep.c
builtin/hash-object.c
builtin/index-pack.c
builtin/init-db.c
builtin/log.c
builtin/ls-remote.c
builtin/merge-index.c
builtin/merge-recursive.c
builtin/merge-tree.c
builtin/merge.c
builtin/mktag.c
builtin/mv.c
builtin/notes.c
builtin/pack-redundant.c
builtin/pack-refs.c
builtin/patch-id.c
builtin/push.c
builtin/receive-pack.c
builtin/remote-ext.c
builtin/remote-fd.c
builtin/remote.c
builtin/rerere.c
builtin/reset.c
builtin/rev-list.c
builtin/rev-parse.c
builtin/revert.c
builtin/rm.c
builtin/send-pack.c
builtin/shortlog.c
builtin/tag.c
builtin/unpack-file.c
builtin/update-index.c
builtin/var.c
cache.h
color.c
color.h
compat/mingw.c
compat/mingw.h
compat/msvc.h
config.c
config.mak.in
configure.ac
contrib/completion/git-completion.bash
contrib/emacs/git.el
contrib/examples/git-revert.sh
contrib/fast-import/git-p4
contrib/fast-import/git-p4.txt
contrib/svn-fe/svn-fe.c
csum-file.c
daemon.c
diff-lib.c
diff-no-index.c
diff.c
diff.h
diffcore-rename.c
dir.c
dir.h
environment.c
exec_cmd.c
fast-import.c
fsck.c
gettext.c [new file with mode: 0644]
gettext.h [new file with mode: 0644]
git-compat-util.h
git-cvsimport.perl
git-gui/git-gui.sh
git-gui/lib/browser.tcl
git-gui/lib/choose_repository.tcl
git-gui/lib/commit.tcl
git-gui/lib/diff.tcl
git-gui/lib/index.tcl
git-gui/lib/merge.tcl
git-gui/lib/mergetool.tcl
git-gui/lib/remote.tcl
git-gui/lib/remote_branch_delete.tcl
git-gui/lib/transport.tcl
git-gui/po/glossary/pt_br.po [new file with mode: 0644]
git-gui/po/pt_br.po [new file with mode: 0644]
git-gui/po/ru.po
git-instaweb.sh
git-mergetool--lib.sh
git-mergetool.sh
git-parse-remote.sh
git-pull.sh
git-request-pull.sh
git-stash.sh
git-svn.perl
git.c
gitweb/gitweb.perl
graph.c
http-fetch.c
imap-send.c
list-objects.c
lockfile.c
log-tree.c
merge-recursive.c
merge-recursive.h
notes-merge.c
object.h
pack-check.c
parse-options.c
path.c
pkt-line.c
po/.gitignore [new file with mode: 0644]
preload-index.c
pretty.c
reachable.c
read-cache.c
remote-curl.c
replace_object.c
rerere.c
rerere.h
revision.c
revision.h
run-command.c
setup.c
sha1_file.c
strbuf.c
strbuf.h
submodule.c
symlinks.c
t/README
t/lib-httpd.sh
t/t0000-basic.sh
t/t0001-init.sh
t/t0080-vcs-svn.sh
t/t0081-line-buffer.sh [new file with mode: 0755]
t/t1007-hash-object.sh
t/t1021-rerere-in-workdir.sh [new file with mode: 0755]
t/t1200-tutorial.sh
t/t1300-repo-config.sh
t/t1510-repo-setup.sh
t/t2019-checkout-ambiguous-ref.sh [new file with mode: 0755]
t/t2020-checkout-detach.sh [new file with mode: 0755]
t/t2021-checkout-overwrite.sh [new file with mode: 0755]
t/t2200-add-update.sh
t/t2204-add-ignored.sh
t/t3030-merge-recursive.sh
t/t3032-merge-recursive-options.sh
t/t3200-branch.sh
t/t3203-branch-output.sh
t/t3501-revert-cherry-pick.sh
t/t3507-cherry-pick-conflict.sh
t/t3700-add.sh
t/t3903-stash.sh
t/t4001-diff-rename.sh
t/t4010-diff-pathspec.sh
t/t4013-diff-various.sh
t/t4013/diff.log_-SF_master_--max-count=0 [new file with mode: 0644]
t/t4013/diff.log_-SF_master_--max-count=1 [new file with mode: 0644]
t/t4013/diff.log_-SF_master_--max-count=2 [new file with mode: 0644]
t/t4014-format-patch.sh
t/t4034-diff-words.sh
t/t4034/bibtex/expect [new file with mode: 0644]
t/t4034/bibtex/post [new file with mode: 0644]
t/t4034/bibtex/pre [new file with mode: 0644]
t/t4034/cpp/expect [new file with mode: 0644]
t/t4034/cpp/post [new file with mode: 0644]
t/t4034/cpp/pre [new file with mode: 0644]
t/t4034/csharp/expect [new file with mode: 0644]
t/t4034/csharp/post [new file with mode: 0644]
t/t4034/csharp/pre [new file with mode: 0644]
t/t4034/fortran/expect [new file with mode: 0644]
t/t4034/fortran/post [new file with mode: 0644]
t/t4034/fortran/pre [new file with mode: 0644]
t/t4034/html/expect [new file with mode: 0644]
t/t4034/html/post [new file with mode: 0644]
t/t4034/html/pre [new file with mode: 0644]
t/t4034/java/expect [new file with mode: 0644]
t/t4034/java/post [new file with mode: 0644]
t/t4034/java/pre [new file with mode: 0644]
t/t4034/objc/expect [new file with mode: 0644]
t/t4034/objc/post [new file with mode: 0644]
t/t4034/objc/pre [new file with mode: 0644]
t/t4034/pascal/expect [new file with mode: 0644]
t/t4034/pascal/post [new file with mode: 0644]
t/t4034/pascal/pre [new file with mode: 0644]
t/t4034/perl/expect [new file with mode: 0644]
t/t4034/perl/post [new file with mode: 0644]
t/t4034/perl/pre [new file with mode: 0644]
t/t4034/php/expect [new file with mode: 0644]
t/t4034/php/post [new file with mode: 0644]
t/t4034/php/pre [new file with mode: 0644]
t/t4034/python/expect [new file with mode: 0644]
t/t4034/python/post [new file with mode: 0644]
t/t4034/python/pre [new file with mode: 0644]
t/t4034/ruby/expect [new file with mode: 0644]
t/t4034/ruby/post [new file with mode: 0644]
t/t4034/ruby/pre [new file with mode: 0644]
t/t4034/tex/expect [new file with mode: 0644]
t/t4034/tex/post [new file with mode: 0644]
t/t4034/tex/pre [new file with mode: 0644]
t/t4040-whitespace-status.sh
t/t5501-fetch-push-alternates.sh [new file with mode: 0755]
t/t5520-pull.sh
t/t5526-fetch-submodules.sh
t/t5541-http-push.sh
t/t5601-clone.sh
t/t6000-rev-list-misc.sh [new file with mode: 0755]
t/t6004-rev-list-path-optim.sh
t/t6007-rev-list-cherry-pick-file.sh
t/t6009-rev-list-parent.sh
t/t6035-merge-dir-to-symlink.sh
t/t6040-tracking-info.sh
t/t6110-rev-list-sparse.sh [new file with mode: 0755]
t/t6120-describe.sh
t/t7004-tag.sh
t/t7012-skip-worktree-writing.sh
t/t7060-wtstatus.sh
t/t7102-reset.sh
t/t7110-reset-merge.sh
t/t7201-co.sh
t/t7300-clean.sh
t/t7500-commit.sh
t/t7501-commit.sh
t/t7502-commit.sh
t/t7506-status-submodule.sh
t/t7508-status.sh
t/t7509-commit.sh
t/t7600-merge.sh
t/t7607-merge-overwrite.sh
t/t7610-mergetool.sh
t/t7611-merge-abort.sh
t/t7810-grep.sh
t/t7811-grep-open.sh
t/t9010-svn-fe.sh
t/t9130-git-svn-authors-file.sh
t/t9300-fast-import.sh
t/t9500-gitweb-standalone-no-errors.sh
t/t9800-git-p4.sh [new file with mode: 0755]
t/test-lib.sh
test-line-buffer.c
test-path-utils.c
test-subprocess.c
test-svn-fe.c
thread-utils.c
trace.c
transport-helper.c
transport.c
transport.h
tree-diff.c
tree-walk.c
tree-walk.h
unpack-trees.c
upload-pack.c
url.c
usage.c
userdiff.c
utf8.c
utf8.h
vcs-svn/fast_export.c
vcs-svn/fast_export.h
vcs-svn/line_buffer.c
vcs-svn/line_buffer.h
vcs-svn/line_buffer.txt
vcs-svn/repo_tree.c
vcs-svn/repo_tree.h
vcs-svn/string_pool.c
vcs-svn/svndump.c
vcs-svn/svndump.h
wrapper.c
wt-status.c
wt-status.h

index 3dd6ef7d259d8fe2811f68525b5309e97c79f4cc..2cf3ca5808b51be3921a0f25b5871f806ce447e1 100644 (file)
@@ -43,7 +43,6 @@
 /git-fast-export
 /git-fast-import
 /git-fetch
-/git-fetch--tool
 /git-fetch-pack
 /git-filter-branch
 /git-fmt-merge-msg
 /git-reflog
 /git-relink
 /git-remote
-/git-remote-curl
 /git-remote-http
 /git-remote-https
 /git-remote-ftp
 /test-index-version
 /test-line-buffer
 /test-match-trees
+/test-mktemp
 /test-obj-pool
 /test-parse-options
 /test-path-utils
diff --git a/Documentation/RelNotes/1.7.4.3.txt b/Documentation/RelNotes/1.7.4.3.txt
new file mode 100644 (file)
index 0000000..02a3d5b
--- /dev/null
@@ -0,0 +1,32 @@
+Git v1.7.4.3 Release Notes
+==========================
+
+Fixes since v1.7.4.2
+--------------------
+
+ * "git apply" used to confuse lines updated by previous hunks as lines
+   that existed before when applying a hunk, contributing misapplication
+   of patches with offsets.
+
+ * "git branch --track" (and "git checkout --track --branch") used to
+   allow setting up a random non-branch that does not make sense to follow
+   as the "upstream".  The command correctly diagnoses it as an error.
+
+ * "git checkout $other_branch" silently removed untracked symbolic links
+   in the working tree that are in the way in order to check out paths
+   under it from the named branch.
+
+ * "git cvsimport" did not bail out immediately when the cvs server cannot
+   be reached, spewing unnecessary error messages that complain about the
+   server response that it never got.
+
+ * "git diff --quiet" did not work very well with the "--diff-filter"
+   option.
+
+ * "git grep -n" lacked a long-hand synonym --line-number.
+
+ * "git stash apply" reported the result of its operation by running
+   "git status" from the top-level of the working tree; it should (and
+   now does) run it from the user's working directory.
+
+And other minor fixes and documentation updates.
diff --git a/Documentation/RelNotes/1.7.4.4.txt b/Documentation/RelNotes/1.7.4.4.txt
new file mode 100644 (file)
index 0000000..e914904
--- /dev/null
@@ -0,0 +1,37 @@
+Git v1.7.4.4 Release Notes
+==========================
+
+Fixes since v1.7.4.3
+--------------------
+
+ * Compilation of sha1_file.c on BSD platforms were broken due to our
+   recent use of getrlimit() without including <sys/resource.h>.
+
+ * "git config" did not diagnose incorrect configuration variable names.
+
+ * "git format-patch" did not wrap a long subject line that resulted from
+   rfc2047 encoding.
+
+ * "git instaweb" should work better again with plackup.
+
+ * "git log --max-count=4 -Sfoobar" now shows 4 commits that changes the
+   number of occurrences of string "foobar"; it used to scan only for 4
+   commits and then emitted only matching ones.
+
+ * "git log --first-parent --boundary $c^..$c" segfaulted on a merge.
+
+ * "git pull" into an empty branch should have behaved as if
+   fast-forwarding from emptiness to the version being pulled, with
+   the usual protection against overwriting untracked files.
+
+ * "git status" spent all the effort to notice racily-clean index entries
+   but didn't update the index file to help later operations go faster in
+   some cases.
+
+And other minor fixes and documentation updates.
+
+---
+exec >/var/tmp/1
+O=v1.7.4.3-22-g8c8674f
+echo O=$(git describe maint)
+git shortlog --no-merges $O..maint
diff --git a/Documentation/RelNotes/1.7.5.txt b/Documentation/RelNotes/1.7.5.txt
new file mode 100644 (file)
index 0000000..9c72084
--- /dev/null
@@ -0,0 +1,136 @@
+Git v1.7.5 Release Notes (draft)
+========================
+
+Updates since v1.7.4
+--------------------
+
+ * Various MinGW portability fixes.
+
+ * Various git-p4 enhancements (in contrib).
+
+ * Various vcs-svn enhancements.
+
+ * Various git-gui updates (0.14.0).
+
+ * Update to more modern HP-UX port.
+
+ * The codebase is getting prepared for i18n/l10n; no translated
+   strings nor translation mechanism in the code yet, but the strings
+   are being marked for l10n.
+
+ * The bash completion script can now complete symmetric difference
+   for "git diff" command, e.g. "git diff ...bra<TAB>".
+
+ * The default minimum length of abbreviated and unique object names
+   can now be configured by setting the core.abbrev configuration
+   variable.
+
+ * "git apply -v" reports offset lines when the patch does not apply at
+   the exact location recorded in the diff output.
+
+ * "git config" used to be also known as "git repo-config", but the old
+   name is now officially deprecated.
+
+ * "git checkout --detach <commit>" is a more user friendly synonym for
+   "git checkout <commit>^0".
+
+ * "git checkout" performed on detached HEAD gives a warning and
+   advice when the commit being left behind will become unreachable from
+   any branch or tag.
+
+ * "git cherry-pick" and "git revert" can be told to use a custom merge
+   strategy, similar to "git rebase".
+
+ * "git cherry-pick" remembers which commit failed to apply when it is
+   stopped by conflicts, making it unnecessary to use "commit -c $commit"
+   to conclude it.
+
+ * "git cvsimport" bails out immediately when the cvs server cannot be
+   reached, without spewing unnecessary error messages that complain about
+   the server response it never got.
+
+ * "git fetch" vs "git upload-pack" transfer learned 'no-done'
+   protocol extension to save one round-trip after the content
+   negotiation is done. This saves one HTTP RPC, reducing the overall
+   latency for a trivial fetch.
+
+ * "git grep -f <filename>" learned to treat "-" as "read from the
+   standard input stream".
+
+ * "git grep --no-index" did not honor pathspecs correctly, returning
+   paths outside the specified area.
+
+ * "git init" learned the --separate-git-dir option to allow the git
+   directory for a new repository created elsewhere and linked via the
+   gitdir mechanism. This is primarily to help submodule support later
+   to switch between a branch of superproject that has the submodule
+   and another that does not.
+
+ * "git log" type commands now understand globbing pathspecs.  You
+   can say "git log -- '*.txt'" for example.
+
+ * "git log" family of commands learned --cherry and --cherry-mark
+   options that can be used to view two diverged branches while omitting
+   or highlighting equivalent changes that appear on both sides of a
+   symmetric difference (e.g. "log --cherry A...B").
+
+ * A lazy "git merge" that didn't say what to merge used to be an error.
+   When run on a branch that has an upstream defined, however, the command
+   now merges from the configured upstream.
+
+ * "git mergetool" learned how to drive "beyond compare 3" as well.
+
+ * "git rerere forget" without pathspec used to forget all the saved
+   conflicts that relate to the current merge; it now requires you to
+   give it pathspecs.
+
+ * "git rev-list --objects $revs -- $pathspec" now limits the objects listed
+   in its output properly with the pathspec, in preparation for narrow
+   clones.
+
+ * "git push" with no parameters gives better advice messages when
+   "tracking" is used as the push.default semantics or there is no remote
+   configured yet.
+
+ * "git rerere" learned a new subcommand "remaining" that is similar to
+   "status" and lists the paths that had conflicts which are known to
+   rerere, but excludes the paths that have already been marked as
+   resolved in the index from its output.  "git mergetool" has been
+   updated to use this facility.
+
+ * A possible value to the "push.default" configuration variable,
+   'tracking', gained a synonym that more naturally describes what it
+   does, 'upstream'.
+
+Also contains various documentation updates.
+
+
+Fixes since v1.7.4
+------------------
+
+All of the fixes in the v1.7.4.X maintenance series are included in this
+release, unless otherwise noted.
+
+ * "git fetch" from a client that is mostly following the remote
+   needlessly told all of its refs to the server for both sides to
+   compute the set of objects that need to be transferred efficiently,
+   instead of stopping when the server heard enough. In a project with
+   many tags, this turns out to be extremely wasteful, especially over
+   the smart HTTP transport (sp/maint-{upload,fetch}-pack-stop-early~1).
+
+ * "git fetch" run from a repository that uses the same repository as
+   its alternate object store as the repository it is fetching from
+   did not tell the server that it already has access to objects
+   reachable from the refs in their common alternate object store,
+   causing it to fetch unnecessary objects (jc/maint-fetch-alt).
+
+ * "git pull" into an empty branch should have behaved as if
+   fast-forwarding from emptiness to the version being pulled, with
+   the usual protection against overwriting untracked files (need to
+   cherry-pick 4b3ffe5).
+
+---
+exec >/var/tmp/1
+O=v1.7.5-rc0-99-g8f84c95
+echo O=$(git describe 'master')
+git shortlog --no-merges ^maint ^$O master
index 1a571f41742af09f52cc31462f501521aacd00d9..1d0d1b76772cf33bd6dba110fef614e2e87a5f09 100644 (file)
@@ -558,6 +558,12 @@ core.sparseCheckout::
        Enable "sparse checkout" feature. See section "Sparse checkout" in
        linkgit:git-read-tree[1] for more information.
 
+core.abbrev::
+       Set the length object names are abbreviated to.  If unspecified,
+       many commands abbreviate to 7 hexdigits, which may not be enough
+       for abbreviated object names to stay unique for sufficiently long
+       time.
+
 add.ignore-errors::
 add.ignoreErrors::
        Tells 'git add' to continue adding files when some files cannot be
@@ -1092,6 +1098,12 @@ All gitcvs variables except for 'gitcvs.usecrlfattr' and
 is one of "ext" and "pserver") to make them apply only for the given
 access method.
 
+grep.lineNumber::
+       If set to true, enable '-n' option by default.
+
+grep.extendedRegexp::
+       If set to true, enable '--extended-regexp' option by default.
+
 gui.commitmsgwidth::
        Defines how wide the commit message window is in the
        linkgit:git-gui[1]. "75" is the default.
index a03448f9231f78340fc492bffa009b96648ee6ac..7eebbefe7b6f665a8f6a5003eb37d7bcb3c196bd 100644 (file)
@@ -378,14 +378,6 @@ linkgit:git-mv[1]
 linkgit:git-commit[1]
 linkgit:git-update-index[1]
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 4d37de639dd6f6deaf2c52231c0ae879cd30f23d..6b1b5af64e2daec1ecc8ee832f58f5186d740a79 100644 (file)
@@ -189,15 +189,6 @@ SEE ALSO
 --------
 linkgit:git-apply[1].
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Petr Baudis, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 0590eec0566cf9f318ddd1ac27d10bb989b2c52f..9eb75c37dae574f4f9d4699b795f53e94e6fa0dd 100644 (file)
@@ -27,10 +27,6 @@ SEE ALSO
 --------
 linkgit:git-blame[1]
 
-AUTHOR
-------
-Written by Ryan Anderson <ryan@michonline.com>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 2dcfc097d39dc3a18c774dbc1eab8ac343abf601..afd2c9ae59e9145f377d5c702df27bf861c9b2f5 100644 (file)
@@ -246,20 +246,10 @@ If `--index` is not specified, then the submodule commits in the patch
 are ignored and only the absence or presence of the corresponding
 subdirectory is checked and (if possible) updated.
 
-
 SEE ALSO
 --------
 linkgit:git-am[1].
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 2411ce5bfe05a14ed45c1546c3d1a6d92b39d8eb..f4504ba9bfd7285f2e117d3f54cab37801cc5b25 100644 (file)
@@ -107,14 +107,6 @@ OPTIONS
        Archive/branch identifier in a format that `tla log` understands.
 
 
-Author
-------
-Written by Martin Langhoff <martin@laptop.org>.
-
-Documentation
---------------
-Documentation by Junio C Hamano, Martin Langhoff and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index bf5037ab2a5042a20e9cb603f0831bb186ac3b74..f2b8684596576cd515e617ea68f06a479348b522 100644 (file)
@@ -153,14 +153,6 @@ SEE ALSO
 --------
 linkgit:gitattributes[5]
 
-Author
-------
-Written by Franck Bui-Huu and Rene Scharfe.
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 1701e42e4aa87fe6beb78c38201ae35adf1d68dd..7b7bafba0c514755f9eec423b5aed19db640c091 100644 (file)
@@ -279,61 +279,68 @@ $ git bisect start HEAD origin --    # HEAD is bad, origin is good
 $ git bisect run make test           # "make test" builds and tests
 ------------
 
-* Automatically bisect a broken test suite:
+* Automatically bisect a broken test case:
 +
 ------------
 $ cat ~/test.sh
 #!/bin/sh
-make || exit 125                   # this skips broken builds
-make test                          # "make test" runs the test suite
-$ git bisect start v1.3 v1.1 --    # v1.3 is bad, v1.1 is good
+make || exit 125                     # this skips broken builds
+~/check_test_case.sh                 # does the test case pass?
+$ git bisect start HEAD HEAD~10 --   # culprit is among the last 10
 $ git bisect run ~/test.sh
 ------------
 +
 Here we use a "test.sh" custom script. In this script, if "make"
 fails, we skip the current commit.
+"check_test_case.sh" should "exit 0" if the test case passes,
+and "exit 1" otherwise.
 +
-It is safer to use a custom script outside the repository to prevent
-interactions between the bisect, make and test processes and the
-script.
-+
-"make test" should "exit 0", if the test suite passes, and
-"exit 1" otherwise.
+It is safer if both "test.sh" and "check_test_case.sh" are
+outside the repository to prevent interactions between the bisect,
+make and test processes and the scripts.
 
-* Automatically bisect a broken test case:
+* Automatically bisect with temporary modifications (hot-fix):
 +
 ------------
 $ cat ~/test.sh
 #!/bin/sh
-make || exit 125                     # this skips broken builds
-~/check_test_case.sh                 # does the test case passes ?
-$ git bisect start HEAD HEAD~10 --   # culprit is among the last 10
-$ git bisect run ~/test.sh
+
+# tweak the working tree by merging the hot-fix branch
+# and then attempt a build
+if     git merge --no-commit hot-fix &&
+       make
+then
+       # run project specific test and report its status
+       ~/check_test_case.sh
+       status=$?
+else
+       # tell the caller this is untestable
+       status=125
+fi
+
+# undo the tweak to allow clean flipping to the next commit
+git reset --hard
+
+# return control
+exit $status
 ------------
 +
-Here "check_test_case.sh" should "exit 0" if the test case passes,
-and "exit 1" otherwise.
-+
-It is safer if both "test.sh" and "check_test_case.sh" scripts are
-outside the repository to prevent interactions between the bisect,
-make and test processes and the scripts.
+This applies modifications from a hot-fix branch before each test run,
+e.g. in case your build or test environment changed so that older
+revisions may need a fix which newer ones have already. (Make sure the
+hot-fix branch is based off a commit which is contained in all revisions
+which you are bisecting, so that the merge does not pull in too much, or
+use `git cherry-pick` instead of `git merge`.)
 
-* Automatically bisect a broken test suite:
+* Automatically bisect a broken test case:
 +
 ------------
 $ git bisect start HEAD HEAD~10 --   # culprit is among the last 10
 $ git bisect run sh -c "make || exit 125; ~/check_test_case.sh"
 ------------
 +
-Does the same as the previous example, but on a single line.
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
--------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+This shows that you can do without a run script if you write the test
+on a single line.
 
 SEE ALSO
 --------
index c71671b4f99e0be3670fc6d7e4872927a86ed02e..c4d1ff86c90d22ffea3fff173ee6b76d88013dab 100644 (file)
@@ -198,10 +198,6 @@ SEE ALSO
 --------
 linkgit:git-annotate[1]
 
-AUTHOR
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 9106d38e406003cd53fd690ca66ee8e98630e4e3..c50f1898272f6b2a9a1c1cd236d3b27621d4fdb9 100644 (file)
@@ -232,14 +232,6 @@ linkgit:git-remote[1],
 link:user-manual.html#what-is-a-branch[``Understanding history: What is
 a branch?''] in the Git User's Manual.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org> and Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 299007b206cb5d810d19eed9b7831c3ea6368043..92b01ec25d147831afaa0ffa43e11549af69e18c 100644 (file)
@@ -201,10 +201,6 @@ You can also see what references it offers:
 $ git ls-remote mybundle
 ----------------
 
-Author
-------
-Written by Mark Levedahl <mdl123@verizon.net>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 544ba7ba218550ac1b09d9c95dc6f60ac604f7e8..2fb95bbd19f26317a542abfdb78d3b2be72f577b 100644 (file)
@@ -100,14 +100,6 @@ for each object specified on stdin that does not exist in the repository:
 <object> SP missing LF
 ------------
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 50824e3a2d7d00370d7311088349da84ee23b728..30eca6cee62ad7b9ccfc9d71209a17287c65d48c 100644 (file)
@@ -86,15 +86,6 @@ SEE ALSO
 --------
 linkgit:gitattributes[5].
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by James Bowes.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 0c0a9c14bc8e78ada9fb9b7174fcb90698e497a0..4d33e7be0f5599cc3bb74a45cb0d20fcde1631e8 100644 (file)
@@ -172,18 +172,6 @@ $ git checkout-index --prefix=.merged- Makefile
 This will check out the currently cached copy of `Makefile`
 into the file `.merged-Makefile`.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-
-Documentation
---------------
-Documentation by David Greaves,
-Junio C Hamano and the git-list <git@vger.kernel.org>.
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 880763d391d18364485edc2e1e3dfc6f52243973..1063f69023f97357c747cf73f8a4bcc9d9a59c4b 100644 (file)
@@ -9,6 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git checkout' [-q] [-f] [-m] [<branch>]
+'git checkout' [-q] [-f] [-m] [--detach] [<commit>]
 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
 'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
 'git checkout' --patch [<tree-ish>] [--] [<paths>...]
@@ -22,9 +23,10 @@ branch.
 
 'git checkout' [<branch>]::
 'git checkout' -b|-B <new_branch> [<start point>]::
+'git checkout' [--detach] [<commit>]::
 
        This form switches branches by updating the index, working
-       tree, and HEAD to reflect the specified branch.
+       tree, and HEAD to reflect the specified branch or commit.
 +
 If `-b` is given, a new branch is created as if linkgit:git-branch[1]
 were called and then checked out; in this case you can
@@ -115,6 +117,13 @@ explicitly give a name with '-b' in such a case.
        Create the new branch's reflog; see linkgit:git-branch[1] for
        details.
 
+--detach::
+       Rather than checking out a branch to work on it, check out a
+       commit for inspection and discardable experiments.
+       This is the default behavior of "git checkout <commit>" when
+       <commit> is not a branch name.  See the "DETACHED HEAD" section
+       below for details.
+
 --orphan::
        Create a new 'orphan' branch, named <new_branch>, started from
        <start_point> and switch to it.  The first commit made on this
@@ -204,42 +213,140 @@ leave out at most one of `A` and `B`, in which case it defaults to `HEAD`.
 
 
 
-Detached HEAD
+DETACHED HEAD
 -------------
+HEAD normally refers to a named branch (e.g. 'master'). Meanwhile, each
+branch refers to a specific commit. Let's look at a repo with three
+commits, one of them tagged, and with branch 'master' checked out:
+
+------------
+          HEAD (refers to branch 'master')
+           |
+           v
+a---b---c  branch 'master' (refers to commit 'c')
+    ^
+    |
+  tag 'v2.0' (refers to commit 'b')
+------------
 
-It is sometimes useful to be able to 'checkout' a commit that is
-not at the tip of one of your branches.  The most obvious
-example is to check out the commit at a tagged official release
-point, like this:
+When a commit is created in this state, the branch is updated to refer to
+the new commit. Specifically, 'git commit' creates a new commit 'd', whose
+parent is commit 'c', and then updates branch 'master' to refer to new
+commit 'd'. HEAD still refers to branch 'master' and so indirectly now refers
+to commit 'd':
 
 ------------
-$ git checkout v2.6.18
+$ edit; git add; git commit
+
+              HEAD (refers to branch 'master')
+               |
+               v
+a---b---c---d  branch 'master' (refers to commit 'd')
+    ^
+    |
+  tag 'v2.0' (refers to commit 'b')
 ------------
 
-Earlier versions of git did not allow this and asked you to
-create a temporary branch using the `-b` option, but starting from
-version 1.5.0, the above command 'detaches' your HEAD from the
-current branch and directly points at the commit named by the tag
-(`v2.6.18` in the example above).
+It is sometimes useful to be able to checkout a commit that is not at
+the tip of any named branch, or even to create a new commit that is not
+referenced by a named branch. Let's look at what happens when we
+checkout commit 'b' (here we show two ways this may be done):
 
-You can use all git commands while in this state.  You can use
-`git reset --hard $othercommit` to further move around, for
-example.  You can make changes and create a new commit on top of
-a detached HEAD.  You can even create a merge by using `git
-merge $othercommit`.
+------------
+$ git checkout v2.0  # or
+$ git checkout master^^
+
+   HEAD (refers to commit 'b')
+    |
+    v
+a---b---c---d  branch 'master' (refers to commit 'd')
+    ^
+    |
+  tag 'v2.0' (refers to commit 'b')
+------------
 
-The state you are in while your HEAD is detached is not recorded
-by any branch (which is natural --- you are not on any branch).
-What this means is that you can discard your temporary commits
-and merges by switching back to an existing branch (e.g. `git
-checkout master`), and a later `git prune` or `git gc` would
-garbage-collect them.  If you did this by mistake, you can ask
-the reflog for HEAD where you were, e.g.
+Notice that regardless of which checkout command we use, HEAD now refers
+directly to commit 'b'. This is known as being in detached HEAD state.
+It means simply that HEAD refers to a specific commit, as opposed to
+referring to a named branch. Let's see what happens when we create a commit:
 
 ------------
-$ git log -g -2 HEAD
+$ edit; git add; git commit
+
+     HEAD (refers to commit 'e')
+      |
+      v
+      e
+     /
+a---b---c---d  branch 'master' (refers to commit 'd')
+    ^
+    |
+  tag 'v2.0' (refers to commit 'b')
+------------
+
+There is now a new commit 'e', but it is referenced only by HEAD. We can
+of course add yet another commit in this state:
+
+------------
+$ edit; git add; git commit
+
+        HEAD (refers to commit 'f')
+         |
+         v
+      e---f
+     /
+a---b---c---d  branch 'master' (refers to commit 'd')
+    ^
+    |
+  tag 'v2.0' (refers to commit 'b')
+------------
+
+In fact, we can perform all the normal git operations. But, let's look
+at what happens when we then checkout master:
+
+------------
+$ git checkout master
+
+              HEAD (refers to branch 'master')
+      e---f     |
+     /          v
+a---b---c---d  branch 'master' (refers to commit 'd')
+    ^
+    |
+  tag 'v2.0' (refers to commit 'b')
 ------------
 
+It is important to realize that at this point nothing refers to commit
+'f'. Eventually commit 'f' (and by extension commit 'e') will be deleted
+by the routine git garbage collection process, unless we create a reference
+before that happens. If we have not yet moved away from commit 'f',
+any of these will create a reference to it:
+
+------------
+$ git checkout -b foo   <1>
+$ git branch foo        <2>
+$ git tag foo           <3>
+------------
+
+<1> creates a new branch 'foo', which refers to commit 'f', and then
+updates HEAD to refer to branch 'foo'. In other words, we'll no longer
+be in detached HEAD state after this command.
+
+<2> similarly creates a new branch 'foo', which refers to commit 'f',
+but leaves HEAD detached.
+
+<3> creates a new tag 'foo', which refers to commit 'f',
+leaving HEAD detached.
+
+If we have moved away from commit 'f', then we must first recover its object
+name (typically by using git reflog), and then we can create a reference to
+it. For example, to see the last two commits to which HEAD referred, we
+can use either of these commands:
+
+------------
+$ git reflog -2 HEAD # or
+$ git log -g -2 HEAD
+------------
 
 EXAMPLES
 --------
@@ -315,15 +422,6 @@ $ edit frotz
 $ git add frotz
 ------------
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 73008705ebe304c8d2a2d089e9328be369c50fc6..01db83039fc36aa4bc08eab730db48ec513ec583 100644 (file)
@@ -16,6 +16,25 @@ Given one or more existing commits, apply the change each one
 introduces, recording a new commit for each.  This requires your
 working tree to be clean (no modifications from the HEAD commit).
 
+When it is not obvious how to apply a change, the following
+happens:
+
+1. The current branch and `HEAD` pointer stay at the last commit
+   successfully made.
+2. The `CHERRY_PICK_HEAD` ref is set to point at the commit that
+   introduced the change that is difficult to apply.
+3. Paths in which the change applied cleanly are updated both
+   in the index file and in your working tree.
+4. For conflicting paths, the index file records up to three
+   versions, as described in the "TRUE MERGE" section of
+   linkgit:git-merge[1].  The working tree files will include
+   a description of the conflict bracketed by the usual
+   conflict markers `<<<<<<<` and `>>>>>>>`.
+5. No other modifications are made.
+
+See linkgit:git-merge[1] for some hints on resolving such
+conflicts.
+
 OPTIONS
 -------
 <commit>...::
@@ -79,6 +98,16 @@ effect to your index in a row.
        cherry-pick'ed commit, then a fast forward to this commit will
        be performed.
 
+--strategy=<strategy>::
+       Use the given merge strategy.  Should only be used once.
+       See the MERGE STRATEGIES section in linkgit:git-merge[1]
+       for details.
+
+-X<option>::
+--strategy-option=<option>::
+       Pass the merge strategy-specific option through to the
+       merge strategy.  See linkgit:git-merge[1] for details.
+
 EXAMPLES
 --------
 git cherry-pick master::
@@ -120,13 +149,27 @@ git rev-list --reverse master \-- README | git cherry-pick -n --stdin::
        so the result can be inspected and made into a single new
        commit if suitable.
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+The following sequence attempts to backport a patch, bails out because
+the code the patch applies to has changed too much, and then tries
+again, this time exercising more care about matching up context lines.
+
+------------
+$ git cherry-pick topic^             <1>
+$ git diff                           <2>
+$ git reset --merge ORIG_HEAD        <3>
+$ git cherry-pick -Xpatience topic^  <4>
+------------
+<1> apply the change that would be shown by `git show topic^`.
+In this example, the patch does not apply cleanly, so
+information about the conflict is written to the index and
+working tree and no new commit results.
+<2> summarize changes to be reconciled
+<3> cancel the cherry-pick.  In other words, return to the
+pre-cherry-pick state, preserving any local modifications you had in
+the working tree.
+<4> try to apply the change introduced by `topic^` again,
+spending extra time to avoid mistakes based on incorrectly matching
+context lines.
 
 SEE ALSO
 --------
index fed115acd01a63801a647ae870357d4c2d59ea44..79448c505bd66f370ab0d79fd9f6a31af84752be 100644 (file)
@@ -63,14 +63,6 @@ SEE ALSO
 --------
 linkgit:git-patch-id[1]
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index fb2753c97eb186c63ba16f9b7714c2e3a5b82a64..6e5c8126f595b95f70df2b02c0779cb06527bfa7 100644 (file)
@@ -19,14 +19,6 @@ to the less interactive 'git commit' program.
 'git citool' is actually a standard alias for `git gui citool`.
 See linkgit:git-gui[1] for more details.
 
-Author
-------
-Written by Shawn O. Pearce <spearce@spearce.org>.
-
-Documentation
---------------
-Documentation by Shawn O. Pearce <spearce@spearce.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 60e38e6e275f5cf90a1ccba36dd3930cafa1b630..974e04ef1abaf4a3018b83b0323a46cbaa5339d4 100644 (file)
@@ -61,12 +61,6 @@ OPTIONS
        Remove only files ignored by git.  This may be useful to rebuild
        everything from scratch, but keep manually created files.
 
-
-Author
-------
-Written by Pavel Roskin <proski@gnu.org>
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 42e7021215563f146a66d14e1b642d4dbe55bfaf..86eb4c93682aa3d92fe001ae871913fc0dec8607 100644 (file)
@@ -12,6 +12,7 @@ SYNOPSIS
 'git clone' [--template=<template_directory>]
          [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
          [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
+         [--separate-git-dir|-L <git dir>]
          [--depth <depth>] [--recursive|--recurse-submodules] [--] <repository>
          [<directory>]
 
@@ -176,6 +177,15 @@ objects from the source repository into a pack in the cloned repository.
        repository does not have a worktree/checkout (i.e. if any of
        `--no-checkout`/`-n`, `--bare`, or `--mirror` is given)
 
+-L=<git dir>::
+--separate-git-dir=<git dir>::
+       Instead of placing the cloned repository where it is supposed
+       to be, place the cloned repository at the specified directory,
+       then make a filesytem-agnostic git symbolic link to there.
+       The result is git repository can be separated from working
+       tree.
+
+
 <repository>::
        The (possibly remote) repository to clone from.  See the
        <<URLS,URLS>> section below for more information on specifying
@@ -236,17 +246,6 @@ $ git clone --bare -l -s /pub/scm/.../torvalds/linux-2.6.git \
     /pub/scm/.../me/subsys-2.6.git
 ------------
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 5dcf4278fc497e4d72093069bdcd18b4ecff0949..f524d76019960512ba65a0110a542fedf9a54ebb 100644 (file)
@@ -93,15 +93,6 @@ SEE ALSO
 --------
 linkgit:git-write-tree[1]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 8f89f6f08c57335ea6606dd1eaddde98477e9c9e..d0534b8c05c5780a7f9debc664dd21af6739a3ec 100644 (file)
@@ -84,9 +84,10 @@ OPTIONS
        linkgit:git-rebase[1] for details.
 
 --reset-author::
-       When used with -C/-c/--amend options, declare that the
-       authorship of the resulting commit now belongs of the committer.
-       This also renews the author timestamp.
+       When used with -C/-c/--amend options, or when committing after a
+       a conflicting cherry-pick, declare that the authorship of the
+       resulting commit now belongs of the committer. This also renews
+       the author timestamp.
 
 --short::
        When doing a dry-run, give the output in the short-format. See
@@ -396,12 +397,6 @@ linkgit:git-mv[1],
 linkgit:git-merge[1],
 linkgit:git-commit-tree[1]
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org> and
-Junio C Hamano <gitster@pobox.com>
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 543dd64a468a8e96daf7c97d9c52264ce426db65..8804de327fd5973ae5d36bff18cfcac3e738763d 100644 (file)
@@ -336,15 +336,6 @@ echo "${WS}your whitespace color or blue reverse${RESET}"
 
 include::config.txt[]
 
-
-Author
-------
-Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>
-
-Documentation
---------------
-Documentation by Johannes Schindelin, Petr Baudis and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 6bc1c21e6283284e2eae16d7ec4cb8183d8e0851..a73933a931161ba81d6bf8dfaa9f2fe4287e0331 100644 (file)
@@ -25,15 +25,6 @@ OPTIONS
        and number of objects that can be removed by running
        `git prune-packed`.
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index d25661eb215c8bd2002933a48dd6ad5ea360459a..ad93a3e84e732291bbd1e4de196ddb8ce23eea32 100644 (file)
@@ -112,14 +112,6 @@ $ cd ~/project_cvs_checkout
 $ git cherry cvshead myhead | sed -n 's/^+ //p' | xargs -l1 git cvsexportcommit -c -p -v
 ------------
 
-Author
-------
-Written by Martin Langhoff <martin@laptop.org> and others.
-
-Documentation
---------------
-Documentation by Martin Langhoff <martin@laptop.org> and others.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 608cd63fc359d591e2aafbb8bd2fbae9b868b68b..6695ab3b4b93aa7c5829f89ceff936de48e9bc78 100644 (file)
@@ -217,15 +217,6 @@ more stable in practice:
 * cvs2git (part of cvs2svn), `http://cvs2svn.tigris.org`
 * parsecvs, `http://cgit.freedesktop.org/~keithp/parsecvs`
 
-Author
-------
-Written by Matthias Urlichs <smurf@smurf.noris.de>, with help from
-various participants of the git-list <git@vger.kernel.org>.
-
-Documentation
---------------
-Documentation by Matthias Urlichs <smurf@smurf.noris.de>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 70cbb2cae7b60a5c6514d0990da91ed5b23e0827..88d814af0e050eb3b31f5763cbf12f03a5f6cbc3 100644 (file)
@@ -391,22 +391,6 @@ Dependencies
 ------------
 'git-cvsserver' depends on DBD::SQLite.
 
-Copyright and Authors
----------------------
-
-This program is copyright The Open University UK - 2006.
-
-Authors:
-
-- Martyn Smith    <martyn@catalyst.net.nz>
-- Martin Langhoff <martin@laptop.org>
-
-with ideas and patches from participants of the git-list <git@vger.kernel.org>.
-
-Documentation
---------------
-Documentation by Martyn Smith <martyn@catalyst.net.nz>, Martin Langhoff <martin@laptop.org>, and Matthias Urlichs <smurf@smurf.noris.de>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index d15cb6a845645d7fe76e7782ce580b3678bd25e4..ebd13be72e58cf0d0a66ddd0105117747ac900be 100644 (file)
@@ -279,17 +279,6 @@ that connected to it, if the IP address is available. REMOTE_ADDR will
 be available in the environment of hooks called when
 services are performed.
 
-
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki
-<yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 02e015ad9c41e760b3ab37d2c5a9e4ef9ef0c4f5..039cce2e98367fdbff6f7c0ea68f8f4f77b8a107 100644 (file)
@@ -156,17 +156,6 @@ selected and output.  Here fewest commits different is defined as
 the number of commits which would be shown by `git log tag..input`
 will be the smallest number of commits possible.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>, but somewhat
-butchered by Junio C Hamano <gitster@pobox.com>.  Later significantly
-updated by Shawn Pearce <spearce@spearce.org>.
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 9cd8ccef37f131d7913926ef9b5b7b49fe6d3463..8d481948bd9b29393c8884abfef9d0a76c922c2d 100644 (file)
@@ -46,15 +46,6 @@ omit diff output for unmerged entries and just show "Unmerged".
 
 include::diff-format.txt[]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 162cb741b3052560351d2dd3f53c56ece5e51e95..6d184864022cef90e284113a627103db99327052 100644 (file)
@@ -116,15 +116,6 @@ tell which file is in which state, since the "has been updated" ones
 show a valid sha1, and the "not in sync with the index" ones will
 always have the special all-zero sha1.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index a7e37b875fdf4bd25ce9adcb3296e2f2066f7130..4e5f127efa634dd4ea68bb73508c59bd1cad32e5 100644 (file)
@@ -162,15 +162,6 @@ in case you care).
 
 include::diff-format.txt[]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 49105102dbf899c62833572fdda51cefaed53476..f8d0819113c52ac7c6388ec27eb96083a8c86d4a 100644 (file)
@@ -174,14 +174,6 @@ linkgit:gitdiffcore[7],
 linkgit:git-format-patch[1],
 linkgit:git-apply[1]
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index db87f1d42382e32d7e3ee94e5c3d0a032b7430e2..590f410abf0b902160eca0e92888191a2e2a0b89 100644 (file)
@@ -31,8 +31,8 @@ OPTIONS
 --tool=<tool>::
        Use the diff tool specified by <tool>.
        Valid merge tools are:
-       kdiff3, kompare, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff,
-       ecmerge, diffuse, opendiff, p4merge and araxis.
+       araxis, bc3, diffuse, emerge, ecmerge, gvimdiff, kdiff3,
+       kompare, meld, opendiff, p4merge, tkdiff, vimdiff and xxdiff.
 +
 If a diff tool is not specified, 'git difftool'
 will use the configuration variable `diff.tool`.  If the
@@ -109,15 +109,6 @@ linkgit:git-mergetool[1]::
 linkgit:git-config[1]::
         Get and set repository or global options
 
-
-AUTHOR
-------
-Written by David Aguilar <davvid@gmail.com>.
-
-Documentation
---------------
-Documentation by David Aguilar and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index e05b686b1e4784290e40993469a2c5fab9b4ce5d..781bd6edc3cce9d1488bf793231d08119e142948 100644 (file)
@@ -135,15 +135,6 @@ Since 'git fast-import' cannot tag trees, you will not be
 able to export the linux-2.6.git repository completely, as it contains
 a tag referencing a tree instead of a commit.
 
-
-Author
-------
-Written by Johannes E. Schindelin <johannes.schindelin@gmx.de>.
-
-Documentation
---------------
-Documentation by Johannes E. Schindelin <johannes.schindelin@gmx.de>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 02bb49886cc5f8415cec8786282681b4114a6380..2c2ea12c5c4e19907674609c228997062d305983 100644 (file)
@@ -78,6 +78,10 @@ OPTIONS
        set of marks.  If a mark is defined to different values,
        the last file wins.
 
+--import-marks-if-exists=<file>::
+       Like --import-marks but instead of erroring out, silently
+       skips the file if it does not exist.
+
 --relative-marks::
        After specifying --relative-marks= the paths specified
        with --import-marks= and --export-marks= are relative
@@ -192,7 +196,8 @@ especially when a higher level language such as Perl, Python or
 Ruby is being used.
 
 fast-import is very strict about its input.  Where we say SP below we mean
-*exactly* one space.  Likewise LF means one (and only one) linefeed.
+*exactly* one space.  Likewise LF means one (and only one) linefeed
+and HT one (and only one) horizontal tab.
 Supplying additional whitespace characters will cause unexpected
 results, such as branch names or file names with leading or trailing
 spaces in their name, or early termination of fast-import when it encounters
@@ -330,6 +335,11 @@ and control the current import process.  More detailed discussion
        format to the file descriptor set with `--cat-blob-fd` or
        `stdout` if unspecified.
 
+`ls`::
+       Causes fast-import to print a line describing a directory
+       entry in 'ls-tree' format to the file descriptor set with
+       `--cat-blob-fd` or `stdout` if unspecified.
+
 `feature`::
        Require that fast-import supports the specified feature, or
        abort if it does not.
@@ -915,6 +925,55 @@ This command can be used anywhere in the stream that comments are
 accepted.  In particular, the `cat-blob` command can be used in the
 middle of a commit but not in the middle of a `data` command.
 
+`ls`
+~~~~
+Prints information about the object at a path to a file descriptor
+previously arranged with the `--cat-blob-fd` argument.  This allows
+printing a blob from the active commit (with `cat-blob`) or copying a
+blob or tree from a previous commit for use in the current one (with
+`filemodify`).
+
+The `ls` command can be used anywhere in the stream that comments are
+accepted, including the middle of a commit.
+
+Reading from the active commit::
+       This form can only be used in the middle of a `commit`.
+       The path names a directory entry within fast-import's
+       active commit.  The path must be quoted in this case.
++
+....
+       'ls' SP <path> LF
+....
+
+Reading from a named tree::
+       The `<dataref>` can be a mark reference (`:<idnum>`) or the
+       full 40-byte SHA-1 of a Git tag, commit, or tree object,
+       preexisting or waiting to be written.
+       The path is relative to the top level of the tree
+       named by `<dataref>`.
++
+....
+       'ls' SP <dataref> SP <path> LF
+....
+
+See `filemodify` above for a detailed description of `<path>`.
+
+Output uses the same format as `git ls-tree <tree> {litdd} <path>`:
+
+====
+       <mode> SP ('blob' | 'tree' | 'commit') SP <dataref> HT <path> LF
+====
+
+The <dataref> represents the blob, tree, or commit object at <path>
+and can be used in later 'cat-blob', 'filemodify', or 'ls' commands.
+
+If there is no file or subtree at that path, 'git fast-import' will
+instead report
+
+====
+       missing SP <path> LF
+====
+
 `feature`
 ~~~~~~~~~
 Require that fast-import supports the specified feature, or abort if
@@ -942,8 +1001,10 @@ import-marks::
        any "feature import-marks" command in the stream.
 
 cat-blob::
-       Ignored.  Versions of fast-import not supporting the
-       "cat-blob" command will exit with a message indicating so.
+ls::
+       Require that the backend support the 'cat-blob' or 'ls' command.
+       Versions of fast-import not supporting the specified command
+       will exit with a message indicating so.
        This lets the import error out early with a clear message,
        rather than wasting time on the early part of an import
        before the unsupported command is detected.
@@ -1289,14 +1350,6 @@ operator can use this facility to peek at the objects and refs from an
 import in progress, at the cost of some added running time and worse
 compression.
 
-Author
-------
-Written by Shawn O. Pearce <spearce@spearce.org>.
-
-Documentation
---------------
-Documentation by Shawn O. Pearce <spearce@spearce.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 4a8487c1547abc156c8fad9e7cafe4d3c5a535f6..48d4bf6d68fd51d9374f896ac839351936580e31 100644 (file)
@@ -90,15 +90,6 @@ OPTIONS
        $GIT_DIR (e.g. "HEAD", "refs/heads/master").  When
        unspecified, update from all heads the remote side has.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index c76e313923f6a6655ad69209070e8333ca360678..7146f6ba0b3d531f788693cf78590565a0645144 100644 (file)
@@ -80,16 +80,6 @@ SEE ALSO
 --------
 linkgit:git-pull[1]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org> and
-Junio C Hamano <gitster@pobox.com>
-
-Documentation
--------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 796e7489ff7ee573a65647f4de33df932bd1bea1..9dc1f2a94708d40daf428a427dd2ea4256cc172a 100644 (file)
@@ -361,7 +361,7 @@ git filter-branch --index-filter \
        'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
                GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
                        git update-index --index-info &&
-        mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
+        mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD
 ---------------------------------------------------------------
 
 
@@ -405,16 +405,6 @@ warned.
   (or if your git-gc is not new enough to support arguments to
   `\--prune`, use `git repack -ad; git prune` instead).
 
-
-Author
-------
-Written by Petr "Pasky" Baudis <pasky@suse.cz>,
-and the git list <git@vger.kernel.org>
-
-Documentation
---------------
-Documentation by Petr Baudis and the git list.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 75adf7a502e18aa11e7a8424acf217b4bf6be64c..32aff954a2b2f95a61b39b8d08fb0482724400bb 100644 (file)
@@ -67,15 +67,6 @@ SEE ALSO
 --------
 linkgit:git-merge[1]
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Petr Baudis, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 9dcafc6d4442b6db66df642e92336537395b9919..a5525e9aa87e8c2c724542bc9e54dfa7e34548fd 100644 (file)
@@ -278,15 +278,6 @@ SEE ALSO
 --------
 linkgit:git-am[1], linkgit:git-send-email[1]
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 965a8279c1b17df6fbf82f4fbcadbd254049a7d5..90ebb8a59401ddd16622533cc998bbb218137e34 100644 (file)
@@ -15,3 +15,7 @@ DESCRIPTION
 
 This is a synonym for linkgit:git-fsck[1].  Please refer to the
 documentation of that command.
+
+GIT
+---
+Part of the linkgit:git[1] suite
index 86f9b2bf91f604cbfd175a4e241fc14fcb5828d5..c9ede794b03460ec2911b6ceddc781ab08fb8ded 100644 (file)
@@ -140,14 +140,6 @@ GIT_INDEX_FILE::
 GIT_ALTERNATE_OBJECT_DIRECTORIES::
        used to specify additional object database roots (usually unset)
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 26632414b2646ba80a17fa861d422a9c8c957810..4966cb57846412b097bbc8ba15d09005f4019340 100644 (file)
@@ -151,10 +151,6 @@ linkgit:git-reflog[1]
 linkgit:git-repack[1]
 linkgit:git-rerere[1]
 
-Author
-------
-Written by Shawn O. Pearce <spearce@spearce.org>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 790af9573b02d643aa6dae117f8b50f7cb565b9b..8035736c9682d5615c98dc83eaff6cf389d6c463 100644 (file)
@@ -22,15 +22,6 @@ return code of 1.  This can happen if <tarfile> had not been created
 using 'git archive' or if the first parameter of 'git archive' had been
 a tree ID instead of a commit ID or tag.
 
-
-Author
-------
-Written by Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 791d4d4871b6a285878f8c43b3b0a76c7f63f57c..d7523b3e45ff06bd7a8abf4ff466fe619c8268e7 100644 (file)
@@ -31,6 +31,16 @@ Look for specified patterns in the tracked files in the work tree, blobs
 registered in the index file, or blobs in given tree objects.
 
 
+CONFIGURATION
+-------------
+
+grep.lineNumber::
+       If set to true, enable '-n' option by default.
+
+grep.extendedRegexp::
+       If set to true, enable '--extended-regexp' option by default.
+
+
 OPTIONS
 -------
 --cached::
@@ -204,16 +214,6 @@ git grep --all-match -e NODE -e Unexpected::
        Looks for a line that has `NODE` or `Unexpected` in
        files that have lines that match both.
 
-Author
-------
-Originally written by Linus Torvalds <torvalds@osdl.org>, later
-revamped by Junio C Hamano.
-
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 2563710b56bf441125bda6766365eb2a2b5eb46a..32a833e0ae522f034b9b7c9115c486aa68658b2c 100644 (file)
@@ -121,14 +121,6 @@ or
 
 or browsed online at http://repo.or.cz/w/git-gui.git/[].
 
-Author
-------
-Written by Shawn O. Pearce <spearce@spearce.org>.
-
-Documentation
---------------
-Documentation by Shawn O. Pearce <spearce@spearce.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 51edeecbe5b546c6fbbbe117f39b51f352cb6bc8..4b0a502e8ef92ac989cce308f87e1f269a8a69be 100644 (file)
@@ -53,14 +53,6 @@ OPTIONS
        conversion. If the file is read from standard input then this
        is always implied, unless the --path option is given.
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index eccd0ffd384bf90f1846bf4cfeb7670dbd64cb6e..42aa2b0c012aaa559162517ee8913ba8bbe72212 100644 (file)
@@ -171,17 +171,6 @@ $ git config --global web.browser firefox
 as they are probably more user specific than repository specific.
 See linkgit:git-config[1] for more information about this.
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com> and the git-list
-<git@vger.kernel.org>.
-
-Documentation
--------------
-Initial documentation was part of the linkgit:git[1] man page.
-Christian Couder <chriscool@tuxfamily.org> extracted and rewrote it a
-little. Maintenance is done by the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index d91cb7ff85b8c05a39cd18757bc66a16662c5150..fefa75219822331f7c7bc426a1224978a5da6795 100644 (file)
@@ -43,14 +43,6 @@ commit-id::
        Verify that everything reachable from target is fetched.  Used after
        an earlier fetch is interrupted.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index ddf7a18dc42ef4d5f8ad44aed89ee5b17bb0e9a6..82ae34b9b80d8f3fd8605d5c06cc37c7a203f758 100644 (file)
@@ -91,15 +91,6 @@ With '--force', the fast-forward check is disabled for all refs.
 Optionally, a <ref> parameter can be prefixed with a plus '+' sign
 to disable the fast-forward check only on that ref.
 
-
-Author
-------
-Written by Nick Hengeveld <nickh@reactrix.com>
-
-Documentation
---------------
-Documentation by Nick Hengeveld
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 57aba42e6654e3d32617c3c7b17d18e8dd85852b..d3013d6a29f2696e05e3c77b0d6f0159d0a98a76 100644 (file)
@@ -124,14 +124,6 @@ Thunderbird in particular is known to be problematic.  Thunderbird
 users may wish to visit this web page for more information:
   http://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
 
-Author
-------
-Derived from isync 1.0.1 by Mike McCormack.
-
-Documentation
---------------
-Documentation by Mike McCormack
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index c2bb81042c80dbf93b7a651c47fc177358132f97..909687fed4269d8ad2e02b90d5a1f56fbcfde40e 100644 (file)
@@ -85,15 +85,6 @@ new .keep file was successfully created. This is useful to remove a
 .keep file used as a lock to prevent the race with 'git repack'
 mentioned above.
 
-
-Author
-------
-Written by Sergey Vlasov <vsu@altlinux.ru>
-
-Documentation
--------------
-Documentation by Sergey Vlasov
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index eba3cb4998b2732a22551aaf962ae1a742d221de..2c4c716f33f9dd3f0b876a013e22ac115ac3c936 100644 (file)
@@ -16,3 +16,7 @@ DESCRIPTION
 
 This is a synonym for linkgit:git-init[1].  Please refer to the
 documentation of that command.
+
+GIT
+---
+Part of the linkgit:git[1] suite
index 00d4a124c918e7548628140646f698b9e37ab87a..58cd01145ab8605d30a9c670ee70391b9d974a32 100644 (file)
@@ -8,9 +8,32 @@ git-init - Create an empty git repository or reinitialize an existing one
 
 SYNOPSIS
 --------
-'git init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]] [directory]
+'git init' [-q | --quiet] [--bare] [--template=<template_directory>]
+         [--separate-git-dir|-L <git dir>]
+         [--shared[=<permissions>]] [directory]
 
 
+DESCRIPTION
+-----------
+
+This command creates an empty git repository - basically a `.git`
+directory with subdirectories for `objects`, `refs/heads`,
+`refs/tags`, and template files.  An initial `HEAD` file that
+references the HEAD of the master branch is also created.
+
+If the `$GIT_DIR` environment variable is set then it specifies a path
+to use instead of `./.git` for the base of the repository.
+
+If the object storage directory is specified via the
+`$GIT_OBJECT_DIRECTORY` environment variable then the sha1 directories
+are created underneath - otherwise the default `$GIT_DIR/objects`
+directory is used.
+
+Running 'git init' in an existing repository is safe. It will not
+overwrite things that are already there. The primary reason for
+rerunning 'git init' is to pick up newly added templates (or to move
+the repository to another place if --separate-git-dir is given).
+
 OPTIONS
 -------
 
@@ -31,6 +54,16 @@ current working directory.
 Specify the directory from which templates will be used.  (See the "TEMPLATE
 DIRECTORY" section below.)
 
+-L=<git dir>::
+--separate-git-dir=<git dir>::
+
+Instead of initializing the repository where it is supposed to be,
+place a filesytem-agnostic git symbolic link there, pointing to the
+specified git path, and initialize a git repository at the path. The
+result is git repository can be separated from working tree. If this
+is reinitialization, the repository will be moved to the specified
+path.
+
 --shared[=(false|true|umask|group|all|world|everybody|0xxx)]::
 
 Specify that the git repository is to be shared amongst several users.  This
@@ -74,32 +107,6 @@ line, the command is run inside the directory (possibly after creating it).
 --
 
 
-DESCRIPTION
------------
-This command creates an empty git repository - basically a `.git` directory
-with subdirectories for `objects`, `refs/heads`, `refs/tags`, and
-template files.
-An initial `HEAD` file that references the HEAD of the master branch
-is also created.
-
-If the `$GIT_DIR` environment variable is set then it specifies a path
-to use instead of `./.git` for the base of the repository.
-
-If the object storage directory is specified via the `$GIT_OBJECT_DIRECTORY`
-environment variable then the sha1 directories are created underneath -
-otherwise the default `$GIT_DIR/objects` directory is used.
-
-Running 'git init' in an existing repository is safe. It will not overwrite
-things that are already there. The primary reason for rerunning 'git init'
-is to pick up newly added templates.
-
-Note that 'git init' is the same as 'git init-db'.  The command
-was primarily meant to initialize the object database, but over
-time it has become responsible for setting up the other aspects
-of the repository, such as installing the default hooks and
-setting the configuration variables.  The old name is retained
-for backward compatibility reasons.
-
 TEMPLATE DIRECTORY
 ------------------
 
@@ -134,15 +141,6 @@ $ git add .     <2>
 <1> prepare /path/to/my/codebase/.git directory
 <2> add all existing file to the index
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 7477ce8fa8e5185cfbd74a31b8d5accd18216a1b..08f85ba046598070432e9d9cd45052ae20484402 100644 (file)
@@ -84,14 +84,6 @@ If the configuration variable 'instaweb.browser' is not set,
 'web.browser' will be used instead if it is defined. See
 linkgit:git-web{litdd}browse[1] for more information about this.
 
-Author
-------
-Written by Eric Wong <normalperson@yhbt.net>
-
-Documentation
---------------
-Documentation by Eric Wong <normalperson@yhbt.net>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index ff41784c60b04a276931fc90ab54a22a67024a1e..2c84028838d566d424082efc71516f565b0ebbd2 100644 (file)
@@ -25,6 +25,7 @@ OPTIONS
 
 -<n>::
        Limits the number of commits to show.
+       Note that this is a commit limiting option, see below.
 
 <since>..<until>::
        Show only commits between the named two commits.  When
@@ -72,16 +73,16 @@ produced by --stat etc.
        to be prefixed with "\-- " to separate them from options or
        refnames.
 
+include::rev-list-options.txt[]
+
+include::pretty-formats.txt[]
+
 Common diff options
-~~~~~~~~~~~~~~~~~~~
+-------------------
 
 :git-log: 1
 include::diff-options.txt[]
 
-include::rev-list-options.txt[]
-
-include::pretty-formats.txt[]
-
 include::diff-generate-patch.txt[]
 
 Examples
@@ -181,14 +182,6 @@ This setting can be disabled by the `--no-standard-notes` option,
 overridden by the 'GIT_NOTES_DISPLAY_REF' environment variable,
 and supplemented by the `--show-notes` option.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 602b8d5d4de8f7649cb88e6622108c012f484933..adf7e1c0557b3dab145403d73687f5e125ae73f4 100644 (file)
@@ -67,15 +67,6 @@ $ git rev-parse not-lost-anymore
 1ef2b196d909eed523d4f3c9bf54b78cdd6843c6
 ------------
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 86abd1345178d4c5d2362509fc075de80d2fc7e3..4b28292811ce019fc94259849f8c5ad6d514b686 100644 (file)
@@ -209,15 +209,6 @@ SEE ALSO
 --------
 linkgit:git-read-tree[1], linkgit:gitignore[5]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano, Josh Triplett, and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 3422765827985ed86402e2a271642b3e9714c1b2..c3df8c0ebe48af7192f7d593c13af69825b6560f 100644 (file)
@@ -67,10 +67,6 @@ EXAMPLES
        c5db5456ae3b0873fc659c19fafdde22313cc441        refs/tags/v0.99.2
        7ceca275d047c90c0c7d5afb13ab97efdf51bd6e        refs/tags/v0.99.3
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 76ed625e7b2fe503d3fb2262371ecd4de006411f..16e87fd6dd548d462715d394df0586bd9cb5d3ec 100644 (file)
@@ -95,18 +95,6 @@ Object size identified by <object> is given in bytes, and right-justified
 with minimum width of 7 characters.  Object size is given only for blobs
 (file) entries; for other entries `-` character is used in place of size.
 
-
-Author
-------
-Written by Petr Baudis <pasky@suse.cz>
-Completely rewritten from scratch by Junio C Hamano <gitster@pobox.com>,
-another major rewrite by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list
-<git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 3ea5aad56c5e1cec7fc2ca01ba9b5ea6badebe2f..ed45662cc9bb0ef93c6748d02e3791ac915830f9 100644 (file)
@@ -80,17 +80,6 @@ This can enabled by default with the configuration option mailinfo.scissors.
 <patch>::
        The patch extracted from e-mail.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org> and
-Junio C Hamano <gitster@pobox.com>
-
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 71912a19a4dcda5f2b76d1c06b4c9ef5051265e3..9b2049d674a5d0b71a9454b2ce4afbfa59e2db34 100644 (file)
@@ -46,16 +46,6 @@ OPTIONS
 --keep-cr::
        Do not remove `\r` from lines ending with `\r\n`.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-and Junio C Hamano <gitster@pobox.com>
-
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index eedef1bb1a14591d23b1fe6e93da1e3c2be2786b..ba36ec04f4b9fa4733b6e0a4c7e41aa3e43327a0 100644 (file)
@@ -102,14 +102,6 @@ both '1' and '2' are merge-bases of A and B.  Neither one is better than
 the other (both are 'best' merge bases).  When the `--all` option is not given,
 it is unspecified which best one is output.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 See also
 --------
 linkgit:git-rev-list[1],
index f334d694e0160df91d197293e5b76cc0bfaac187..635c66956e90452c58938f2d48e84454983f22e6 100644 (file)
@@ -86,17 +86,6 @@ git merge-file -L a -L b -L c tmp/a123 tmp/b234 tmp/c345::
        merges tmp/a123 and tmp/c345 with the base tmp/b234, but uses labels
        `a` and `c` instead of `tmp/a123` and `tmp/c345`.
 
-
-Author
-------
-Written by Johannes Schindelin <johannes.schindelin@gmx.de>
-
-
-Documentation
---------------
-Documentation by Johannes Schindelin and the git-list <git@vger.kernel.org>,
-with parts copied from the original documentation of RCS 'merge'.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 921b38f18374c20d1f94c0907a629425acb38aa4..6ce54673b0c239a04503ce9da231826c61470bd1 100644 (file)
@@ -73,15 +73,6 @@ merge once anything has returned an error (i.e., `cat` returned an error
 for the AA file, because it didn't exist in the original, and thus
 'git merge-index' didn't even try to merge the MM thing).
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-One-shot merge by Petr Baudis <pasky@ucw.cz>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index a163cfca6993b61b3f3d198bd0980bd1fed37e52..ee059def79f85e770b23b34bce1dfc293434aa8b 100644 (file)
@@ -15,15 +15,6 @@ DESCRIPTION
 This is the standard helper program to use with 'git merge-index'
 to resolve a merge after the trivial merge done with 'git read-tree -m'.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>,
-Junio C Hamano <gitster@pobox.com> and Petr Baudis <pasky@suse.cz>.
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index f869a7f00fa812bed068f5b60bd970d4dcac0655..3bfa7b422026181f675a7398d41e1153fdfbd837 100644 (file)
@@ -23,14 +23,6 @@ merge results outside of the index, and stuff the results back into the
 index.  For this reason, the output from the command omits
 entries that match the <branch1> tree.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index c1efaaa5c52cd93e90a1a7427125e470f771146a..e2e6aba17e7bde2bacb7f29ec4c54e5f9587dac6 100644 (file)
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git merge' [-n] [--stat] [--no-commit] [--squash]
        [-s <strategy>] [-X <strategy-option>]
-       [--[no-]rerere-autoupdate] [-m <msg>] <commit>...
+       [--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
 'git merge' <msg> HEAD <commit>...
 'git merge' --abort
 
@@ -95,8 +95,13 @@ commit or stash your changes before running 'git merge'.
 
 <commit>...::
        Commits, usually other branch heads, to merge into our branch.
-       You need at least one <commit>.  Specifying more than one
-       <commit> obviously means you are trying an Octopus.
+       Specifying more than one commit will create a merge with
+       more than two parents (affectionately called an Octopus merge).
++
+If no commit is given from the command line, and if `merge.defaultToUpstream`
+configuration variable is set, merge the remote tracking branches
+that the current branch is configured to use as its upstream.
+See also the configuration section of this manual page.
 
 
 PRE-MERGE CHECKS
@@ -312,15 +317,6 @@ linkgit:git-diff[1], linkgit:git-ls-files[1],
 linkgit:git-add[1], linkgit:git-rm[1],
 linkgit:git-mergetool[1]
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index d8df55362ce653516006b02df2950c325f1176b7..63ededec1d7099bb2156461895f32dcf008dedcc 100644 (file)
@@ -41,14 +41,6 @@ run_merge_tool::
        '$MERGED', '$LOCAL', '$REMOTE', and '$BASE' must be defined
        for use by the merge tool.
 
-Author
-------
-Written by David Aguilar <davvid@gmail.com>
-
-Documentation
---------------
-Documentation by David Aguilar and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 1f75a848ba36728eeaa67e5cbbc209075393193b..8c79ae8d2a610bf4f1dea1a840bfc52e85d90fd9 100644 (file)
@@ -26,8 +26,8 @@ OPTIONS
 --tool=<tool>::
        Use the merge resolution program specified by <tool>.
        Valid merge tools are:
-       kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge,
-       diffuse, tortoisemerge, opendiff, p4merge and araxis.
+       araxis, bc3, diffuse, ecmerge, emerge, gvimdiff, kdiff3,
+       meld, opendiff, p4merge, tkdiff, tortoisemerge, vimdiff and xxdiff.
 +
 If a merge resolution program is not specified, 'git mergetool'
 will use the configuration variable `merge.tool`.  If the
@@ -82,14 +82,6 @@ Setting the `mergetool.keepBackup` configuration variable to `false`
 causes `git mergetool` to automatically remove the backup as files
 are successfully merged.
 
-Author
-------
-Written by Theodore Y Ts'o <tytso@mit.edu>
-
-Documentation
---------------
-Documentation by Theodore Y Ts'o.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 8bcc11443dce7322ac5b0fa70e07b2465f762615..037ab1045d91b730e5cae9073226bd09ebe67b9a 100644 (file)
@@ -32,15 +32,6 @@ exists, is separated by a blank line from the header.  The
 message part may contain a signature that git itself doesn't
 care about, but that can be verified with gpg.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 81e3326772d94464708cc2037715e1e62eae5f11..afe21be64dfa9ea2540f9c4fc24d97413643879f 100644 (file)
@@ -34,14 +34,6 @@ OPTIONS
        optional.  Note - if the '-z' option is used, lines are terminated
        with NUL.
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index bdcb58526ec2e838949e079891a420802df477db..db0e030d69f92a1f52cd7c98de99504e850ab2db 100644 (file)
@@ -39,17 +39,6 @@ OPTIONS
 --dry-run::
        Do nothing; only show what would happen
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-Rewritten by Ryan Anderson <ryan@michonline.com>
-Move functionality added by Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 2108237c36cead52b14cd9a593c1398ea717a231..ad1d1468c9936d206701d379003177e7457c884e 100644 (file)
@@ -70,15 +70,6 @@ Another nice thing you can do is:
 % git log | git name-rev --stdin
 ------------
 
-
-Author
-------
-Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>
-
-Documentation
---------------
-Documentation by Johannes Schindelin.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index a9c373c7b514fd01064dbf05557ddbfc04b3c1ee..08c89d221cef9215806e4ef4dfda97898fe44942 100644 (file)
@@ -192,13 +192,18 @@ self-contained. Use `git index-pack --fix-thin`
 --delta-base-offset::
        A packed archive can express the base object of a delta as
        either a 20-byte object name or as an offset in the
-       stream, but older versions of git don't understand the
+       stream, but ancient versions of git don't understand the
        latter.  By default, 'git pack-objects' only uses the
        former format for better compatibility.  This option
        allows the command to use the latter format for
        compactness.  Depending on the average delta chain
        length, this option typically shrinks the resulting
        packfile by 3-5 per-cent.
++
+Note: Porcelain commands such as `git gc` (see linkgit:git-gc[1]),
+`git repack` (see linkgit:git-repack[1]) pass this option by default
+in modern git when they put objects in your repository into pack files.
+So does `git bundle` (see linkgit:git-bundle[1]) when it creates a bundle.
 
 --threads=<n>::
        Specifies the number of threads to spawn when searching for best
@@ -219,15 +224,6 @@ self-contained. Use `git index-pack --fix-thin`
        With this option, parents that are hidden by grafts are packed
        nevertheless.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
--------------
-Documentation by Junio C Hamano
-
 SEE ALSO
 --------
 linkgit:git-rev-list[1]
index d0607879db7ffc125e3a3aad2046b5e77730dcd6..db9f0f70554d997fab9d8441f78c10e523dda178 100644 (file)
@@ -38,14 +38,6 @@ OPTIONS
 --verbose::
        Outputs some statistics to stderr. Has a small performance penalty.
 
-Author
-------
-Written by Lukas Sandström <lukass@etek.chalmers.se>
-
-Documentation
---------------
-Documentation by Lukas Sandström <lukass@etek.chalmers.se>
-
 SEE ALSO
 --------
 linkgit:git-pack-objects[1]
index 1ee99c208ce4893d2fa2367544b22ed0c8b18044..54b92534ceb7895dadf1bec22782af3d09f1ef78 100644 (file)
@@ -56,11 +56,6 @@ a repository with many branches of historical interests.
 The command usually removes loose refs under `$GIT_DIR/refs`
 hierarchy after packing them.  This option tells it not to.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 39d9daa7e00b97ddcca8f3d25d7376234c57c246..02217f6ba2007bb7bc55c577b77773dfcce93225 100644 (file)
@@ -17,14 +17,6 @@ routines to parse files under $GIT_DIR/remotes/ and
 $GIT_DIR/branches/ and configuration variables that are related
 to fetching, pulling and pushing.
 
-Author
-------
-Written by Junio C Hamano.
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 4dae1390a5c663867b93e1dce6cd4d2bf59e84ab..50e26f43c1cd9fde593760d1557ac57b3695ae5c 100644 (file)
@@ -29,14 +29,6 @@ OPTIONS
 <patch>::
        The diff to create the ID of.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 87dacd797f6e36d47024bc0d2ebc82bb0b5bb387..a34d62f0daa3ada5c5287008b05d989eb52cc8f0 100644 (file)
@@ -37,14 +37,6 @@ OPTIONS
        The repository to sync from.
 
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index abfc6b6ead534311d8a29696c497ecf94ce4fd1a..9e6202cdffd01fc685a78d1bd2c56128a8b8b73a 100644 (file)
@@ -36,14 +36,6 @@ OPTIONS
 --quiet::
        Squelch the progress indicator.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Ryan Anderson <ryan@michonline.com>
-
 SEE ALSO
 --------
 linkgit:git-pack-objects[1]
index 4d673a56864ca88de0e98f54a6de469e99ea0f44..f616a739efdab16a58c33e9c2671e8afbaf13b98 100644 (file)
@@ -78,14 +78,6 @@ linkgit:git-fsck[1],
 linkgit:git-gc[1],
 linkgit:git-reflog[1]
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index b33e6be872508778faa59f478229cd6e16bddad7..c2a7f103ee5bf4495d39b3034752be564b119766 100644 (file)
@@ -224,18 +224,6 @@ SEE ALSO
 --------
 linkgit:git-fetch[1], linkgit:git-merge[1], linkgit:git-config[1]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-and Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Jon Loeliger,
-David Greaves,
-Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index e11660a2e651b385251bef4f45dc36f212fa58bf..88acfcd4cc8e0eeafc809df0d72b37daded6f8a6 100644 (file)
@@ -406,16 +406,6 @@ Commits A and B would no longer belong to a branch with a symbolic name,
 and so would be unreachable.  As such, these commits would be removed by
 a `git gc` command on the origin repository.
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>, later rewritten in C
-by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 579e8d2f3ba54e393a60a8b4d8a4ad6a95cb79f1..7f112f3dcd87490dcf50fc74e45cace5736c599f 100644 (file)
@@ -49,14 +49,6 @@ The default for the patch directory is patches
 or the value of the $QUILT_PATCHES environment
 variable.
 
-Author
-------
-Written by Eric Biederman <ebiederm@lnxi.com>
-
-Documentation
---------------
-Documentation by Eric Biederman <ebiederm@lnxi.com>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 634423a69ee6a4f2e9c7dd3941fd5160fbf6c99f..26fdadc642a3534c4005488cb9ca2b2a47a495a1 100644 (file)
@@ -421,15 +421,6 @@ SEE ALSO
 linkgit:git-write-tree[1]; linkgit:git-ls-files[1];
 linkgit:gitignore[5]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 96680c84561c434c4cf3a00cfe958b21f18a3d8d..620d50e71f1a04f587079180ff2d987521d38786 100644 (file)
@@ -66,8 +66,9 @@ would be:
     D---E---F---G master
 ------------
 
-The latter form is just a short-hand of `git checkout topic`
-followed by `git rebase master`.
+*NOTE:* The latter form is just a short-hand of `git checkout topic`
+followed by `git rebase master`. When rebase exits `topic` will
+remain the checked-out branch.
 
 If the upstream branch already contains a change you have made (e.g.,
 because you mailed a patch which was applied upstream), then that commit
@@ -658,7 +659,6 @@ The ripple effect of a "hard case" recovery is especially bad:
 'everyone' downstream from 'topic' will now have to perform a "hard
 case" recovery too!
 
-
 BUGS
 ----
 The todo list presented by `--preserve-merges --interactive` does not
@@ -681,15 +681,6 @@ by moving the "pick 4" line will result in the following history:
 1 --- 2 --- 4 --- 5
 ------------
 
-Authors
-------
-Written by Junio C Hamano <gitster@pobox.com> and
-Johannes E. Schindelin <johannes.schindelin@gmx.de>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 2790eebaff3b9dd9a56358cc470396f36eb87085..f34e0ae1bd4bf9f3d0fa5de1e8b0eba47637f7a6 100644 (file)
@@ -151,15 +151,6 @@ SEE ALSO
 --------
 linkgit:git-send-pack[1]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index e50bd9b68d80e9be997de80252dec5afbb7452b4..09057bf90cbea3a360cf65c212c358d9c848f11a 100644 (file)
@@ -90,14 +90,6 @@ them.
 --verbose::
        Print extra information on screen.
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 8fc809f82b2fae71f5cf6315dec707b649931382..98933764870fa73d693c636e713fd1f08eb8244d 100644 (file)
@@ -24,14 +24,6 @@ OPTIONS
 <dir>::
        Directories containing a .git/objects/ subdirectory.
 
-Author
-------
-Written by Ryan Anderson <ryan@michonline.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 51de895822d6d79f970012c835d68b2cd8c8e136..87cd11f2c47b66387d31c38f648c02f4c2734955 100644 (file)
@@ -239,10 +239,6 @@ SEE ALSO
 --------
 linkgit:git-remote[1]
 
-Documentation
--------------
-Documentation by Daniel Barkalow and Ilari Liusvaara
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index c258ea48dbb8889a48f3075ab171ebddfd7fda3b..37bd3e538894206b7b79022a58c72e9a75263513 100644 (file)
@@ -214,16 +214,6 @@ linkgit:git-fetch[1]
 linkgit:git-branch[1]
 linkgit:git-config[1]
 
-Author
-------
-Written by Junio Hamano
-
-
-Documentation
---------------
-Documentation by J. Bruce Fields and the git-list <git@vger.kernel.org>.
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 27f7865b061cc96398f7aa052d162723e1f9255e..0decee240bfbad5c924de36e1867edca9975f39c 100644 (file)
@@ -123,15 +123,6 @@ need to set the configuration variable `repack.UseDeltaBaseOffset` to
 is unaffected by this option as the conversion is performed on the fly
 as needed in that case.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Ryan Anderson <ryan@michonline.com>
-
 SEE ALSO
 --------
 linkgit:git-pack-objects[1]
index fde209258234edd221dea2f5b096c78f1978eeb4..17df525275493f5bdcdd912ad56581ffa8a97fa2 100644 (file)
@@ -80,17 +80,6 @@ linkgit:git-tag[1]
 linkgit:git-branch[1]
 linkgit:git[1]
 
-Author
-------
-Written by Christian Couder <chriscool@tuxfamily.org> and Junio C
-Hamano <gitster@pobox.com>, based on 'git tag' by Kristian Hogsberg
-<krh@redhat.com> and Carlos Rica <jasampler@gmail.com>.
-
-Documentation
---------------
-Documentation by Christian Couder <chriscool@tuxfamily.org> and the
-git-list <git@vger.kernel.org>, based on 'git tag' documentation.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index e5bdb5533e61687874ad36d30534b2ac9e58d7cb..a0d1fa6594cc4fed65c7ce68a4957e5e611cfa78 100644 (file)
@@ -16,3 +16,7 @@ DESCRIPTION
 
 This is a synonym for linkgit:git-config[1].  Please refer to the
 documentation of that command.
+
+GIT
+---
+Part of the linkgit:git[1] suite
index 400f61f6e24947525e51b7e5d808378819945205..3521d8e3c88c97f85ab95d82d416256d0debc94c 100644 (file)
@@ -29,14 +29,6 @@ OPTIONS
 <end>::
        Commit to end at; defaults to HEAD.
 
-Author
-------
-Written by Ryan Anderson <ryan@michonline.com> and Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index db99d4786e06df1cd2c9352c877c45efcbfb10cc..52db1d80cfe068f39ae5996a88e95bbfcf095a36 100644 (file)
@@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolution of conflicted merges
 
 SYNOPSIS
 --------
-'git rerere' ['clear'|'forget' [<pathspec>]|'diff'|'status'|'gc']
+'git rerere' ['clear'|'forget' <pathspec>|'diff'|'status'|'gc']
 
 DESCRIPTION
 -----------
@@ -43,7 +43,7 @@ will automatically invoke this command.
 'forget' <pathspec>::
 
 This resets the conflict resolutions which rerere has recorded for the current
-conflict in <pathspec>.  The <pathspec> is optional.
+conflict in <pathspec>.
 
 'diff'::
 
@@ -205,11 +205,6 @@ would conflict the same way as the test merge you resolved earlier.
 'git rerere' will be run by 'git rebase' to help you resolve this
 conflict.
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 927ecee2f26cdf0bd30457d5016b654c01a23a14..8481f9db746b70c10a2f20a97a8ef4a68cb56d75 100644 (file)
@@ -397,15 +397,6 @@ entries:
 
 X means any state and U means an unmerged index.
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com> and Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 8e1e32908c31ddb8cb07046a25bcdb6dd38d74f5..415f4f0b303da22e9eec19c1b9e24732a74ecf67 100644 (file)
@@ -16,6 +16,10 @@ SYNOPSIS
             [ \--sparse ]
             [ \--merges ]
             [ \--no-merges ]
+            [ \--min-parents=<number> ]
+            [ \--no-min-parents ]
+            [ \--max-parents=<number> ]
+            [ \--no-max-parents ]
             [ \--first-parent ]
             [ \--remove-empty ]
             [ \--full-history ]
@@ -31,6 +35,9 @@ SYNOPSIS
             [ \--parents ]
             [ \--timestamp ]
             [ \--left-right ]
+            [ \--left-only ]
+            [ \--right-only ]
+            [ \--cherry-mark ]
             [ \--cherry-pick ]
             [ \--encoding[=<encoding>] ]
             [ \--(author|committer|grep)=<pattern> ]
@@ -105,16 +112,6 @@ include::rev-list-options.txt[]
 
 include::pretty-formats.txt[]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano, Jonas Fonseca
-and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index ff23cb0219d602803a83da273195fcc4ca71b5f5..02c44c999f361cd7c40a504ae4ccdc2d8b1a18fe 100644 (file)
@@ -308,16 +308,6 @@ $ git rev-parse --default master --verify $REV
 +
 but if $REV is empty, the commit object name from master will be printed.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org> .
-Junio C Hamano <gitster@pobox.com> and Pierre Habouzit <madcoder@debian.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 752fc88e768e4b8e1afddad4bdd7833cf20978c7..ac10cfbb14aba460973019d712ee90e8804de34d 100644 (file)
@@ -80,6 +80,16 @@ effect to your index in a row.
 --signoff::
        Add Signed-off-by line at the end of the commit message.
 
+--strategy=<strategy>::
+       Use the given merge strategy.  Should only be used once.
+       See the MERGE STRATEGIES section in linkgit:git-merge[1]
+       for details.
+
+-X<option>::
+--strategy-option=<option>::
+       Pass the merge strategy-specific option through to the
+       merge strategy.  See linkgit:git-merge[1] for details.
+
 EXAMPLES
 --------
 git revert HEAD~3::
@@ -95,14 +105,6 @@ git revert -n master{tilde}5..master{tilde}2::
        changes. The revert only modifies the working tree and the
        index.
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 SEE ALSO
 --------
 linkgit:git-cherry-pick[1]
index 0adbe8b1f8e6e992a1f991fbdba4deffbd6e15b0..8c0554f9716c0d3ca7570a8f893f48189ea0c6f8 100644 (file)
@@ -153,14 +153,6 @@ SEE ALSO
 --------
 linkgit:git-add[1]
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 7ec9dabe6815f2b8ff03048043e1cfd81cd19fcc..ee14f74fd3af8dd6cfd9e52002993355d63b97c8 100644 (file)
@@ -348,7 +348,6 @@ sendemail.confirm::
        one of 'always', 'never', 'cc', 'compose', or 'auto'. See '--confirm'
        in the previous section for the meaning of these values.
 
-
 Use gmail as the smtp server
 ----------------------------
 
@@ -363,20 +362,6 @@ Add the following section to the config file:
 Note: the following perl modules are required
       Net::SMTP::SSL, MIME::Base64 and Authen::SASL
 
-
-Author
-------
-Written by Ryan Anderson <ryan@michonline.com>
-
-git-send-email is originally based upon
-send_lots_of_email.pl by Greg Kroah-Hartman.
-
-
-Documentation
---------------
-Documentation by Ryan Anderson
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index deaa7d9654f5938fabad3e1eae29ae7c7803d2ec..17f8f5552646cc063fdcc3674c0b133ed070aec9 100644 (file)
@@ -114,15 +114,6 @@ With '--force', the fast-forward check is disabled for all refs.
 Optionally, a <ref> parameter can be prefixed with a plus '+' sign
 to disable the fast-forward check only on that ref.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 3da241304b0d2fdaa376bca740beb024a36b2cb6..053df505bc3aaa5e74c3a9266858eef0de1c2bd2 100644 (file)
@@ -66,15 +66,6 @@ get_author_ident_from_commit::
        outputs code for use with eval to set the GIT_AUTHOR_NAME,
        GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 6403126a029bf43acaa219296353f7ab1f2040a0..d7d4b92894d143daaf1f0e27fa4bdbcf35aba10d 100644 (file)
@@ -28,14 +28,6 @@ read and execute permissions to the directory in order to execute the
 programs in it. The programs are executed with a cwd of $HOME, and
 <argument> is parsed as a command-line string.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Petr Baudis and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 5cc3baf48dcbf86e976d5d4407831a6d0ceb108f..ff3755b4c72a52595be805e92a9f3b62d1477af2 100644 (file)
@@ -68,15 +68,6 @@ spelled differently.
 
 include::mailmap.txt[]
 
-
-Author
-------
-Written by Jeff Garzik <jgarzik@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 3b0c88271a80ad9dfc989dcb44247479f09431bf..ee4559b6f20d6cfe399c2b7e1b8dd9a1e2aafc7a 100644 (file)
@@ -200,17 +200,6 @@ shows 10 reflog entries going back from the tip as of 1 hour ago.
 Without `--list`, the output also shows how these tips are
 topologically related with each other.
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-
-Documentation
---------------
-Documentation by Junio C Hamano.
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 8382fbe0ec5e59545e265317bdff38bfa098e0ed..c4d99f10281599ae52f95da455372e8ed759cfe7 100644 (file)
@@ -20,15 +20,6 @@ The information it outputs is subset of what you can get from
 'git verify-pack -v'; this command only shows the packfile
 offset and SHA1 of each object.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index be0ec189af45e1006134e5607bb76a7b6ad20699..3c4589529960e013df364c68e4480caa09b744c6 100644 (file)
@@ -177,11 +177,6 @@ linkgit:git-ls-remote[1],
 linkgit:git-update-ref[1],
 linkgit:gitrepository-layout[5]
 
-AUTHORS
--------
-Written by Linus Torvalds <torvalds@osdl.org>.
-Man page by Jonas Fonseca <fonseca@diku.dk>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index f0a8a1aff3694cf00587d8670a8fe9962fe98af3..7f075e84f54e3abc5c16b7cae57af831bd2b5bd7 100644 (file)
@@ -72,17 +72,6 @@ Discussion
 
 include::i18n.txt[]
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org> and
-Junio C Hamano <gitster@pobox.com>.  Significantly enhanced by
-Johannes Schindelin <Johannes.Schindelin@gmx.de>.
-
-
-Documentation
--------------
-Documentation by David Greaves, Petr Baudis and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 7f251a58656e9fe30fc9f74a02d6a48adc01b860..ba3fe0d7f59b1ae4c9ae9e3d32675d2e281ccf13 100644 (file)
@@ -17,3 +17,7 @@ DESCRIPTION
 
 This is a synonym for linkgit:git-add[1].  Please refer to the
 documentation of that command.
+
+GIT
+---
+Part of the linkgit:git[1] suite
index 8728f7a5142284d036594628cbb99da677c16651..79abc38e50a9a82243085383401b2d93468efaf3 100644 (file)
@@ -257,10 +257,6 @@ linkgit:git-commit[1],
 linkgit:git-reflog[1],
 linkgit:git-reset[1]
 
-AUTHOR
-------
-Written by Nanako Shiraishi <nanako3@bluebottle.com>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 5102a23f8ee30fcff2a6e67d098495329a2fca1d..00b699fef71b45c78e298fa48609b553a32fd175 100644 (file)
@@ -174,14 +174,6 @@ SEE ALSO
 --------
 linkgit:gitignore[5]
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>.
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 7508c0e42d2cd50ac522fc80a3a866411b7b51c5..10509cc450d47de35387a547cb79e30177f6304c 100644 (file)
@@ -23,14 +23,6 @@ OPTIONS
 <stream>::
        Byte stream to act on.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index e8ed2f2c0f440455443521d35989be7d7ff53c10..1a16ff60448a72bebcba2daff7dbabc5feed8a4c 100644 (file)
@@ -258,11 +258,6 @@ This file should be formatted in the same way as `$GIT_DIR/config`. The key
 to each submodule url is "submodule.$name.url".  See linkgit:gitmodules[5]
 for details.
 
-
-AUTHOR
-------
-Written by Lars Hjemli <hjemli@gmail.com>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index e161a40a73cb57557435e94c9444935da0828f1c..ea8fafd18a7e5f79a017f0f6ea0bbfdbf947461b 100644 (file)
@@ -878,10 +878,6 @@ SEE ALSO
 --------
 linkgit:git-rebase[1]
 
-Author
-------
-Written by Eric Wong <normalperson@yhbt.net>.
-
-Documentation
--------------
-Written by Eric Wong <normalperson@yhbt.net>.
+GIT
+---
+Part of the linkgit:git[1] suite
index 33a15362949bed9e23debb7ac50db35585ed23ce..d7795ed65777c18e648ba1b23b1b63330b78c9ce 100644 (file)
@@ -53,10 +53,6 @@ and symbolic refs are used by default.
 symbolic ref were printed correctly, with status 1 if the requested
 name is not a symbolic ref, or 128 if another error occurs.
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index fa7ac12a3db2aeed7d35ab5e460b1c204c3bec37..d82f62120a21059a31d9c708c39d93b2a630d590 100644 (file)
@@ -262,15 +262,6 @@ SEE ALSO
 --------
 linkgit:git-check-ref-format[1].
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>,
-Junio C Hamano <gitster@pobox.com> and Chris Wright <chrisw@osdl.org>.
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 3c786bd283ce839ca9339f0a8ac7412a1f985d3a..5f1575425743118ffb13567472ae81be56698566 100644 (file)
@@ -76,14 +76,6 @@ git tar-tree HEAD:Documentation/ git-docs > git-1.4.0-docs.tar::
        Put everything in the current head's Documentation/ directory
        into 'git-1.4.0-docs.tar', with the prefix 'git-docs/'.
 
-Author
-------
-Written by Rene Scharfe.
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 995db9feadf68df6f22de745d90790a145128e44..c49d727f7463446c4182807cbd9077db5e34007f 100644 (file)
@@ -22,14 +22,6 @@ OPTIONS
 <blob>::
        Must be a blob id
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 36d1038056101a459a33e32b6729d75e03f127ce..dd7799095b4dd26a1625015f3fe0fcbd89dd0e70 100644 (file)
@@ -43,15 +43,6 @@ OPTIONS
 --strict::
        Don't write objects with broken content or links.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
--------------
-Documentation by Junio C Hamano
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 1ca56c85aa66b96dc1774b77ba1e117d93847033..d3931294d174e5c06adb81e428e31e00fbfa3b5e 100644 (file)
@@ -365,15 +365,6 @@ SEE ALSO
 linkgit:git-config[1],
 linkgit:git-add[1]
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 9639f705afafab6fcf0cd21ad2693627ab42f66d..e25a65a80fafb7143957247e2fd85d64a701ddf5 100644 (file)
@@ -84,10 +84,6 @@ An update will fail (without changing <ref>) if the current user is
 unable to create a new log file, append to the existing log file
 or does not have committer information available.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 035cc3018f22a9e2669c94f10475624d02f4098a..775024da3ed6ed50e8aa587dc31eb79f00030e84 100644 (file)
@@ -38,15 +38,6 @@ what they are for:
 
 * info/refs
 
-
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index f5f2b3908b2a1550f44ad6615d9335d40e264112..acbf634f85c72d70bbb7dd7653aded63d67dcbf6 100644 (file)
@@ -24,14 +24,6 @@ OPTIONS
 <directory>::
        The repository to get a tar archive from.
 
-Author
-------
-Written by Franck Bui-Huu.
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 71ca4ef442e08acad27b4d7873a7f153dc4c79dc..4c0ca9ded25a27c11636ef9af5f7c1f2e6970c12 100644 (file)
@@ -33,14 +33,6 @@ OPTIONS
 <directory>::
        The repository to sync from.
 
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by Junio C Hamano.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 458f3e2755fcc6431757af6178942ef756f6a5bd..6498f7cb69be3d3fcece285a714679ac7f4f6454 100644 (file)
@@ -65,14 +65,6 @@ linkgit:git-commit-tree[1]
 linkgit:git-tag[1]
 linkgit:git-config[1]
 
-Author
-------
-Written by Eric Biederman <ebiederm@xmission.com>
-
-Documentation
---------------
-Documentation by Eric Biederman and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 0f848de8b29dd32aebf0ab9b21ddddce0b06a5b2..7c2428d5692ce7e3961821c865c9539c30dca113 100644 (file)
@@ -47,14 +47,6 @@ for objects that are not deltified in the pack, and
 
 for objects that are deltified.
 
-Author
-------
-Written by Junio C Hamano <gitster@pobox.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 711219749cac76ff1363ce5f27e28da9a7ecba57..8c9a71865b45120700c21a52d1e06aad45f3221f 100644 (file)
@@ -22,14 +22,6 @@ OPTIONS
 <tag>...::
        SHA1 identifiers of git tag objects.
 
-Author
-------
-Written by Jan Harkes <jaharkes@cs.cmu.edu> and Eric W. Biederman <ebiederm@xmission.com>
-
-Documentation
---------------
-Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index c0416e5e1a5243ef228173a3a45bb47bf1f3a840..69d92fa00ef91dff0346925ba1c50857132e9c03 100644 (file)
@@ -116,16 +116,6 @@ $ git config --global web.browser firefox
 as they are probably more user specific than repository specific.
 See linkgit:git-config[1] for more information about this.
 
-Author
-------
-Written by Christian Couder <chriscool@tuxfamily.org> and the git-list
-<git@vger.kernel.org>, based on 'git mergetool' by Theodore Y. Ts'o.
-
-Documentation
--------------
-Documentation by Christian Couder <chriscool@tuxfamily.org> and the
-git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index ea753cdafce66c33a0a0e8d9a52d75c974194ad5..31f3663ae7fe2cc97d6e61b85181a02424323fb2 100644 (file)
@@ -63,17 +63,6 @@ git whatchanged --since="2 weeks ago" \-- gitk::
        The "--" is necessary to avoid confusion with the *branch* named
        'gitk'
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org> and
-Junio C Hamano <gitster@pobox.com>
-
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index bfceacacb34262b73507a87fa23995d1183a3edc..e8c94c1352a8f1a889225ee063b4c59799cbb7e6 100644 (file)
@@ -36,15 +36,6 @@ OPTIONS
        `<prefix>`.  This can be used to write the tree object
        for a subproject that is in the named subdirectory.
 
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 0c32d45248c99e9e4b51f168ba03c829ad96423f..78499db81bd130fcf64a5a5e7adf85e1b522d230 100644 (file)
@@ -44,9 +44,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.7.4.1/git.html[documentation for release 1.7.4.1]
+* link:v1.7.4.3/git.html[documentation for release 1.7.4.3]
 
 * release notes for
+  link:RelNotes/1.7.4.3.txt[1.7.4.3],
+  link:RelNotes/1.7.4.2.txt[1.7.4.2],
   link:RelNotes/1.7.4.1.txt[1.7.4.1],
   link:RelNotes/1.7.4.txt[1.7.4].
 
@@ -745,16 +747,12 @@ unmerged version of a file when a merge is in progress.
 
 Authors
 -------
-* git's founding father is Linus Torvalds <torvalds@osdl.org>.
-* The current git nurse is Junio C Hamano <gitster@pobox.com>.
-* The git potty was written by Andreas Ericsson <ae@op5.se>.
-* General upbringing is handled by the git-list <git@vger.kernel.org>.
-
-Documentation
---------------
-The documentation for git suite was started by David Greaves
-<david@dgreaves.com>, and later enhanced greatly by the
-contributors on the git-list <git@vger.kernel.org>.
+Git was started by Linus Torvalds, and is currently maintained by Junio
+C Hamano. Numerous contributions have come from the git mailing list
+<git@vger.kernel.org>. For a more complete list of contributors, see
+http://git-scm.com/about. If you have a clone of git.git itself, the
+output of linkgit:git-shortlog[1] and linkgit:git-blame[1] can show you
+the authors for specific parts of the project.
 
 Reporting Bugs
 --------------
index 6928724a05f304c430e8d7f60cc35d22e4873bca..f734f97b8e1b64f2d3bfc926e92e9226ba716289 100644 (file)
@@ -169,10 +169,6 @@ See also http://marc.info/?l=git&m=116563135620359 and
 http://marc.info/?l=git&m=119150393620273 for further
 information.
 
-Documentation
--------------
-Documentation by Pierre Habouzit and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 8416f3445a5e5d3b583733136d4211b8d0bd4084..2e7328b8306f4e949e22456b33d495226c1f014b 100644 (file)
@@ -156,11 +156,6 @@ SEE ALSO
 linkgit:git-rm[1], linkgit:git-update-index[1],
 linkgit:gitrepository-layout[5]
 
-Documentation
--------------
-Documentation by David Greaves, Junio C Hamano, Josh Triplett,
-Frank Lichtenheld, and the git-list <git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index e21bac4f3f16a6d0c0b1ff6d3062e8464e182e7f..e10ac58cae4f0a825f391a5fa1eab8114aa27a18 100644 (file)
@@ -113,15 +113,6 @@ SEE ALSO
        A minimal repository browser and git tool output highlighter written
        in C using Ncurses.
 
-Author
-------
-Written by Paul Mackerras <paulus@samba.org>.
-
-Documentation
---------------
-Documentation by Junio C Hamano, Jonas Fonseca, and the git-list
-<git@vger.kernel.org>.
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index 68977943e7bba092f5e55e6ad1b9ede83f4c2b67..15a218655970de61781e1b2793576a05b0fac7b2 100644 (file)
@@ -90,10 +90,6 @@ SEE ALSO
 --------
 linkgit:git-submodule[1] linkgit:git-config[1]
 
-DOCUMENTATION
--------------
-Documentation by Lars Hjemli <hjemli@gmail.com>
-
 GIT
 ---
 Part of the linkgit:git[1] suite
index f04b48ef0d482f03f186d749768da246aabcd1db..33716a31d0c60093c14f894ef07a87bee73fafc9 100644 (file)
@@ -273,6 +273,29 @@ This commit is referred to as a "merge commit", or sometimes just a
        <<def_pack,pack>>, to assist in efficiently accessing the contents of a
        pack.
 
+[[def_pathspec]]pathspec::
+       Pattern used to specify paths.
++
+Pathspecs are used on the command line of "git ls-files", "git
+ls-tree", "git grep", "git checkout", and many other commands to
+limit the scope of operations to some subset of the tree or
+worktree.  See the documentation of each command for whether
+paths are relative to the current directory or toplevel.  The
+pathspec syntax is as follows:
+
+* any path matches itself
+* the pathspec up to the last slash represents a
+  directory prefix.  The scope of that pathspec is
+  limited to that subtree.
+* the rest of the pathspec is a pattern for the remainder
+  of the pathname.  Paths relative to the directory
+  prefix will be matched against that pattern using fnmatch(3);
+  in particular, '*' and '?' _can_ match directory separators.
++
+For example, Documentation/*.jpg will match all .jpg files
+in the Documentation subtree,
+including Documentation/chapter_1/figure_1.jpg.
+
 [[def_parent]]parent::
        A <<def_commit_object,commit object>> contains a (possibly empty) list
        of the logical predecessor(s) in the line of development, i.e. its
index 1e5c22c5e5c19dab5d5c35ec2401870237830a5d..8920258baa515b048555be3448edea0403ce05be 100644 (file)
@@ -6,6 +6,16 @@ merge.conflictstyle::
        a `>>>>>>>` marker.  An alternate style, "diff3", adds a `|||||||`
        marker and the original text before the `=======` marker.
 
+merge.defaultToUpstream::
+       If merge is called without any commit argument, merge the upstream
+       branches configured for the current branch by using their last
+       observed values stored in their remote tracking branches.
+       The values of the `branch.<current branch>.merge` that name the
+       branches at the remote named by `branch.<current branch>.remote`
+       are consulted, and then they are mapped via `remote.<remote>.fetch`
+       to their corresponding remote tracking branches, and the tips of
+       these tracking branches are merged.
+
 merge.log::
        In addition to branch names, populate the log message with at
        most the specified number of one-line descriptions from the
@@ -33,10 +43,10 @@ merge.stat::
 
 merge.tool::
        Controls which merge resolution program is used by
-       linkgit:git-mergetool[1].  Valid built-in values are: "kdiff3",
-       "tkdiff", "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff",
-       "diffuse", "ecmerge", "tortoisemerge", "p4merge", "araxis" and
-       "opendiff".  Any other value is treated is custom merge tool
+       linkgit:git-mergetool[1].  Valid built-in values are: "araxis",
+       "bc3", "diffuse", "ecmerge", "emerge", "gvimdiff", "kdiff3", "meld",
+       "opendiff", "p4merge", "tkdiff", "tortoisemerge", "vimdiff"
+       and "xxdiff".  Any other value is treated is custom merge tool
        and there must be a corresponding mergetool.<tool>.cmd option.
 
 merge.verbosity::
index e33e0f8e110879a0cd6fe81d97ee6044290e5cfa..b613d4ed083d080797f7da90fc92212f98611d07 100644 (file)
@@ -75,9 +75,17 @@ option can be used to override --squash.
 ifndef::git-pull[]
 -q::
 --quiet::
-       Operate quietly.
+       Operate quietly. Implies --no-progress.
 
 -v::
 --verbose::
        Be verbose.
+
+--progress::
+--no-progress::
+       Turn progress on/off explicitly. If neither is specified,
+       progress is shown if standard error is connected to a terminal.
+       Note that not all merge strategies may support progress
+       reporting.
+
 endif::git-pull[]
index 9c47ad885bd7565b45b9ac4e5e4a0798653d75e8..ea5c6c49bd1b673aba48c057add1b5d15ae840a0 100644 (file)
-Commit Formatting
-~~~~~~~~~~~~~~~~~
-
-ifdef::git-rev-list[]
-Using these options, linkgit:git-rev-list[1] will act similar to the
-more specialized family of commit log tools: linkgit:git-log[1],
-linkgit:git-show[1], and linkgit:git-whatchanged[1]
-endif::git-rev-list[]
-
-include::pretty-options.txt[]
-
---relative-date::
-
-       Synonym for `--date=relative`.
-
---date=(relative|local|default|iso|rfc|short|raw)::
-
-       Only takes effect for dates shown in human-readable format, such
-       as when using "--pretty". `log.date` config variable sets a default
-       value for log command's --date option.
-+
-`--date=relative` shows dates relative to the current time,
-e.g. "2 hours ago".
-+
-`--date=local` shows timestamps in user's local timezone.
-+
-`--date=iso` (or `--date=iso8601`) shows timestamps in ISO 8601 format.
-+
-`--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822
-format, often found in E-mail messages.
-+
-`--date=short` shows only date but not time, in `YYYY-MM-DD` format.
-+
-`--date=raw` shows the date in the internal raw git format `%s %z` format.
-+
-`--date=default` shows timestamps in the original timezone
-(either committer's or author's).
-
-ifdef::git-rev-list[]
---header::
-
-       Print the contents of the commit in raw-format; each record is
-       separated with a NUL character.
-endif::git-rev-list[]
-
---parents::
-
-       Print also the parents of the commit (in the form "commit parent...").
-       Also enables parent rewriting, see 'History Simplification' below.
-
---children::
-
-       Print also the children of the commit (in the form "commit child...").
-       Also enables parent rewriting, see 'History Simplification' below.
-
-ifdef::git-rev-list[]
---timestamp::
-       Print the raw commit timestamp.
-endif::git-rev-list[]
-
---left-right::
-
-       Mark which side of a symmetric diff a commit is reachable from.
-       Commits from the left side are prefixed with `<` and those from
-       the right with `>`.  If combined with `--boundary`, those
-       commits are prefixed with `-`.
-+
-For example, if you have this topology:
-+
------------------------------------------------------------------------
-             y---b---b  branch B
-            / \ /
-           /   .
-          /   / \
-         o---x---a---a  branch A
------------------------------------------------------------------------
-+
-you would get an output like this:
-+
------------------------------------------------------------------------
-       $ git rev-list --left-right --boundary --pretty=oneline A...B
-
-       >bbbbbbb... 3rd on b
-       >bbbbbbb... 2nd on b
-       <aaaaaaa... 3rd on a
-       <aaaaaaa... 2nd on a
-       -yyyyyyy... 1st on b
-       -xxxxxxx... 1st on a
------------------------------------------------------------------------
-
---graph::
-
-       Draw a text-based graphical representation of the commit history
-       on the left hand side of the output.  This may cause extra lines
-       to be printed in between commits, in order for the graph history
-       to be drawn properly.
-+
-This enables parent rewriting, see 'History Simplification' below.
-+
-This implies the '--topo-order' option by default, but the
-'--date-order' option may also be specified.
-
-ifdef::git-rev-list[]
---count::
-       Print a number stating how many commits would have been
-       listed, and suppress all other output.  When used together
-       with '--left-right', instead print the counts for left and
-       right commits, separated by a tab.
-endif::git-rev-list[]
-
-
-ifndef::git-rev-list[]
-Diff Formatting
-~~~~~~~~~~~~~~~
-
-Below are listed options that control the formatting of diff output.
-Some of them are specific to linkgit:git-rev-list[1], however other diff
-options may be given. See linkgit:git-diff-files[1] for more options.
-
--c::
-
-       With this option, diff output for a merge commit
-       shows the differences from each of the parents to the merge result
-       simultaneously instead of showing pairwise diff between a parent
-       and the result one at a time. Furthermore, it lists only files
-       which were modified from all parents.
-
---cc::
-
-       This flag implies the '-c' options and further compresses the
-       patch output by omitting uninteresting hunks whose contents in
-       the parents have only two variants and the merge result picks
-       one of them without modification.
-
--m::
-
-       This flag makes the merge commits show the full diff like
-       regular commits; for each merge parent, a separate log entry
-       and diff is generated. An exception is that only diff against
-       the first parent is shown when '--first-parent' option is given;
-       in that case, the output represents the changes the merge
-       brought _into_ the then-current branch.
-
--r::
-
-       Show recursive diffs.
-
--t::
-
-       Show the tree objects in the diff output. This implies '-r'.
-
--s::
-       Suppress diff output.
-endif::git-rev-list[]
-
 Commit Limiting
 ~~~~~~~~~~~~~~~
 
 Besides specifying a range of commits that should be listed using the
 special notations explained in the description, additional commit
-limiting may be applied.
+limiting may be applied. Note that they are applied before commit
+ordering and formatting options, such as '--reverse'.
 
 --
 
@@ -226,11 +72,26 @@ endif::git-rev-list[]
 
 --merges::
 
-       Print only merge commits.
+       Print only merge commits. This is exactly the same as `--min-parents=2`.
 
 --no-merges::
 
-       Do not print commits with more than one parent.
+       Do not print commits with more than one parent. This is
+       exactly the same as `--max-parents=1`.
+
+--min-parents=<number>::
+--max-parents=<number>::
+--no-min-parents::
+--no-max-parents::
+
+       Show only commits which have at least (or at most) that many
+       commits. In particular, `--max-parents=1` is the same as `--no-merges`,
+       `--min-parents=2` is the same as `--merges`.  `--max-parents=0`
+       gives all root commits and `--min-parents=3` all octopus merges.
++
+`--no-min-parents` and `--no-max-parents` reset these limits (to no limit)
+again.  Equivalent forms are `--min-parents=0` (any commit has 0 or more
+parents) and `--max-parents=-1` (negative numbers denote no upper limit).
 
 --first-parent::
        Follow only the first parent commit upon seeing a merge
@@ -305,6 +166,11 @@ ifdef::git-rev-list[]
        to /dev/null as the output does not have to be formatted.
 endif::git-rev-list[]
 
+--cherry-mark::
+
+       Like `--cherry-pick` (see below) but mark equivalent commits
+       with `=` rather than omitting them, and inequivalent ones with `+`.
+
 --cherry-pick::
 
        Omit any commit that introduces the same change as
@@ -319,6 +185,27 @@ from the other branch (for example, "3rd on b" may be cherry-picked
 from branch A).  With this option, such pairs of commits are
 excluded from the output.
 
+--left-only::
+--right-only::
+
+       List only commits on the respective side of a symmetric range,
+       i.e. only those which would be marked `<` resp. `>` by
+       `--left-right`.
++
+For example, `--cherry-pick --right-only A...B` omits those
+commits from `B` which are in `A` or are patch-equivalent to a commit in
+`A`. In other words, this lists the `{plus}` commits from `git cherry A B`.
+More precisely, `--cherry-pick --right-only --no-merges` gives the exact
+list.
+
+--cherry::
+
+       A synonym for `--right-only --cherry-mark --no-merges`; useful to
+       limit the output to the commits on our side and mark those that
+       have been applied to the other side of a forked history with
+       `git log --cherry upstream...mybranch`, similar to
+       `git cherry upstream mybranch`.
+
 -g::
 --walk-reflogs::
 
@@ -735,3 +622,158 @@ These options are mostly targeted for packing of git repositories.
 --do-walk::
 
        Overrides a previous --no-walk.
+
+Commit Formatting
+~~~~~~~~~~~~~~~~~
+
+ifdef::git-rev-list[]
+Using these options, linkgit:git-rev-list[1] will act similar to the
+more specialized family of commit log tools: linkgit:git-log[1],
+linkgit:git-show[1], and linkgit:git-whatchanged[1]
+endif::git-rev-list[]
+
+include::pretty-options.txt[]
+
+--relative-date::
+
+       Synonym for `--date=relative`.
+
+--date=(relative|local|default|iso|rfc|short|raw)::
+
+       Only takes effect for dates shown in human-readable format, such
+       as when using "--pretty". `log.date` config variable sets a default
+       value for log command's --date option.
++
+`--date=relative` shows dates relative to the current time,
+e.g. "2 hours ago".
++
+`--date=local` shows timestamps in user's local timezone.
++
+`--date=iso` (or `--date=iso8601`) shows timestamps in ISO 8601 format.
++
+`--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822
+format, often found in E-mail messages.
++
+`--date=short` shows only date but not time, in `YYYY-MM-DD` format.
++
+`--date=raw` shows the date in the internal raw git format `%s %z` format.
++
+`--date=default` shows timestamps in the original timezone
+(either committer's or author's).
+
+ifdef::git-rev-list[]
+--header::
+
+       Print the contents of the commit in raw-format; each record is
+       separated with a NUL character.
+endif::git-rev-list[]
+
+--parents::
+
+       Print also the parents of the commit (in the form "commit parent...").
+       Also enables parent rewriting, see 'History Simplification' below.
+
+--children::
+
+       Print also the children of the commit (in the form "commit child...").
+       Also enables parent rewriting, see 'History Simplification' below.
+
+ifdef::git-rev-list[]
+--timestamp::
+       Print the raw commit timestamp.
+endif::git-rev-list[]
+
+--left-right::
+
+       Mark which side of a symmetric diff a commit is reachable from.
+       Commits from the left side are prefixed with `<` and those from
+       the right with `>`.  If combined with `--boundary`, those
+       commits are prefixed with `-`.
++
+For example, if you have this topology:
++
+-----------------------------------------------------------------------
+            y---b---b  branch B
+           / \ /
+          /   .
+         /   / \
+        o---x---a---a  branch A
+-----------------------------------------------------------------------
++
+you would get an output like this:
++
+-----------------------------------------------------------------------
+       $ git rev-list --left-right --boundary --pretty=oneline A...B
+
+       >bbbbbbb... 3rd on b
+       >bbbbbbb... 2nd on b
+       <aaaaaaa... 3rd on a
+       <aaaaaaa... 2nd on a
+       -yyyyyyy... 1st on b
+       -xxxxxxx... 1st on a
+-----------------------------------------------------------------------
+
+--graph::
+
+       Draw a text-based graphical representation of the commit history
+       on the left hand side of the output.  This may cause extra lines
+       to be printed in between commits, in order for the graph history
+       to be drawn properly.
++
+This enables parent rewriting, see 'History Simplification' below.
++
+This implies the '--topo-order' option by default, but the
+'--date-order' option may also be specified.
+
+ifdef::git-rev-list[]
+--count::
+       Print a number stating how many commits would have been
+       listed, and suppress all other output.  When used together
+       with '--left-right', instead print the counts for left and
+       right commits, separated by a tab.
+endif::git-rev-list[]
+
+
+ifndef::git-rev-list[]
+Diff Formatting
+~~~~~~~~~~~~~~~
+
+Below are listed options that control the formatting of diff output.
+Some of them are specific to linkgit:git-rev-list[1], however other diff
+options may be given. See linkgit:git-diff-files[1] for more options.
+
+-c::
+
+       With this option, diff output for a merge commit
+       shows the differences from each of the parents to the merge result
+       simultaneously instead of showing pairwise diff between a parent
+       and the result one at a time. Furthermore, it lists only files
+       which were modified from all parents.
+
+--cc::
+
+       This flag implies the '-c' options and further compresses the
+       patch output by omitting uninteresting hunks whose contents in
+       the parents have only two variants and the merge result picks
+       one of them without modification.
+
+-m::
+
+       This flag makes the merge commits show the full diff like
+       regular commits; for each merge parent, a separate log entry
+       and diff is generated. An exception is that only diff against
+       the first parent is shown when '--first-parent' option is given;
+       in that case, the output represents the changes the merge
+       brought _into_ the then-current branch.
+
+-r::
+
+       Show recursive diffs.
+
+-t::
+
+       Show the tree objects in the diff output. This implies '-r'.
+
+-s::
+       Suppress diff output.
+endif::git-rev-list[]
index 9e92734bc1b308c47e5f5726c704a3ddffa5beb9..04fceee2535d91b9cec9157e5219a81fc63a5dce 100644 (file)
@@ -25,7 +25,8 @@ blobs contained in a commit.
   first match in the following rules:
 
   . if `$GIT_DIR/<name>` exists, that is what you mean (this is usually
-    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD` and `MERGE_HEAD`);
+    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`
+    and `CHERRY_PICK_HEAD`);
 
   . otherwise, `refs/<name>` if exists;
 
@@ -46,6 +47,8 @@ you can change the tip of the branch back to the state before you ran
 them easily.
 MERGE_HEAD records the commit(s) you are merging into your branch
 when you run 'git merge'.
+CHERRY_PICK_HEAD records the commit you are cherry-picking
+when you run 'git cherry-pick'.
 +
 Note that any of the `refs/*` cases above may come either from
 the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.
diff --git a/Documentation/technical/index-format.txt b/Documentation/technical/index-format.txt
new file mode 100644 (file)
index 0000000..7b233ca
--- /dev/null
@@ -0,0 +1,185 @@
+GIT index format
+================
+
+= The git index file has the following format
+
+  All binary numbers are in network byte order. Version 2 is described
+  here unless stated otherwise.
+
+   - A 12-byte header consisting of
+
+     4-byte signature:
+       The signature is { 'D', 'I', 'R', 'C' } (stands for "dircache")
+
+     4-byte version number:
+       The current supported versions are 2 and 3.
+
+     32-bit number of index entries.
+
+   - A number of sorted index entries (see below).
+
+   - Extensions
+
+     Extensions are identified by signature. Optional extensions can
+     be ignored if GIT does not understand them.
+
+     GIT currently supports cached tree and resolve undo extensions.
+
+     4-byte extension signature. If the first byte is 'A'..'Z' the
+     extension is optional and can be ignored.
+
+     32-bit size of the extension
+
+     Extension data
+
+   - 160-bit SHA-1 over the content of the index file before this
+     checksum.
+
+== Index entry
+
+  Index entries are sorted in ascending order on the name field,
+  interpreted as a string of unsigned bytes (i.e. memcmp() order, no
+  localization, no special casing of directory separator '/'). Entries
+  with the same name are sorted by their stage field.
+
+  32-bit ctime seconds, the last time a file's metadata changed
+    this is stat(2) data
+
+  32-bit ctime nanosecond fractions
+    this is stat(2) data
+
+  32-bit mtime seconds, the last time a file's data changed
+    this is stat(2) data
+
+  32-bit mtime nanosecond fractions
+    this is stat(2) data
+
+  32-bit dev
+    this is stat(2) data
+
+  32-bit ino
+    this is stat(2) data
+
+  32-bit mode, split into (high to low bits)
+
+    4-bit object type
+      valid values in binary are 1000 (regular file), 1010 (symbolic link)
+      and 1110 (gitlink)
+
+    3-bit unused
+
+    9-bit unix permission. Only 0755 and 0644 are valid for regular files.
+    Symbolic links and gitlinks have value 0 in this field.
+
+  32-bit uid
+    this is stat(2) data
+
+  32-bit gid
+    this is stat(2) data
+
+  32-bit file size
+    This is the on-disk size from stat(2), truncated to 32-bit.
+
+  160-bit SHA-1 for the represented object
+
+  A 16-bit 'flags' field split into (high to low bits)
+
+    1-bit assume-valid flag
+
+    1-bit extended flag (must be zero in version 2)
+
+    2-bit stage (during merge)
+
+    12-bit name length if the length is less than 0xFFF; otherwise 0xFFF
+    is stored in this field.
+
+  (Version 3) A 16-bit field, only applicable if the "extended flag"
+  above is 1, split into (high to low bits).
+
+    1-bit reserved for future
+
+    1-bit skip-worktree flag (used by sparse checkout)
+
+    1-bit intent-to-add flag (used by "git add -N")
+
+    13-bit unused, must be zero
+
+  Entry path name (variable length) relative to top level directory
+    (without leading slash). '/' is used as path separator. The special
+    path components ".", ".." and ".git" (without quotes) are disallowed.
+    Trailing slash is also disallowed.
+
+    The exact encoding is undefined, but the '.' and '/' characters
+    are encoded in 7-bit ASCII and the encoding cannot contain a NUL
+    byte (iow, this is a UNIX pathname).
+
+  1-8 nul bytes as necessary to pad the entry to a multiple of eight bytes
+  while keeping the name NUL-terminated.
+
+== Extensions
+
+=== Cached tree
+
+  Cached tree extension contains pre-computed hashes for trees that can
+  be derived from the index. It helps speed up tree object generation
+  from index for a new commit.
+
+  When a path is updated in index, the path must be invalidated and
+  removed from tree cache.
+
+  The signature for this extension is { 'T', 'R', 'E', 'E' }.
+
+  A series of entries fill the entire extension; each of which
+  consists of:
+
+  - NUL-terminated path component (relative to its parent directory);
+
+  - ASCII decimal number of entries in the index that is covered by the
+    tree this entry represents (entry_count);
+
+  - A space (ASCII 32);
+
+  - ASCII decimal number that represents the number of subtrees this
+    tree has;
+
+  - A newline (ASCII 10); and
+
+  - 160-bit object name for the object that would result from writing
+    this span of index as a tree.
+
+  An entry can be in an invalidated state and is represented by having -1
+  in the entry_count field.
+
+  The entries are written out in the top-down, depth-first order.  The
+  first entry represents the root level of the repository, followed by the
+  first subtree---let's call this A---of the root level (with its name
+  relative to the root level), followed by the first subtree of A (with
+  its name relative to A), ...
+
+=== Resolve undo
+
+  A conflict is represented in the index as a set of higher stage entries.
+  When a conflict is resolved (e.g. with "git add path"), these higher
+  stage entries will be removed and a stage-0 entry with proper resoluton
+  is added.
+
+  When these higher stage entries are removed, they are saved in the
+  resolve undo extension, so that conflicts can be recreated (e.g. with
+  "git checkout -m"), in case users want to redo a conflict resolution
+  from scratch.
+
+  The signature for this extension is { 'R', 'E', 'U', 'C' }.
+
+  A series of entries fill the entire extension; each of which
+  consists of:
+
+  - NUL-terminated pathname the entry describes (relative to the root of
+    the repository, i.e. full pathname);
+
+  - Three NUL-terminated ASCII octal numbers, entry mode of entries in
+    stage 1 to 3 (a missing stage is represented by "0" in this field);
+    and
+
+  - At most three 160-bit object names of the entry in stages from 1 to 3
+    (nothing is written for a missing stage).
+
index 0b4e960d986724bb5a0fc806371fce3fb89e2dd3..35848df0346aef1c2f91fb81cecd8751590db196 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.7.4.2
+DEF_VER=v1.7.5-rc0
 
 LF='
 '
index 5c2b797554a25d5cecee28aa6d18fc885aa0b3e8..92c1c5e23b96f8bed1b1ac2dbff6c05580ecf678 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,11 +45,6 @@ all::
 # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
 # d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
 #
-# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
-# do not support the 'size specifiers' introduced by C99, namely ll, hh,
-# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
-# some C compilers supported these specifiers prior to C99 as an extension.
-#
 # Define NO_STRCASESTR if you don't have strcasestr.
 #
 # Define NO_MEMMEM if you don't have memmem.
@@ -216,6 +211,11 @@ all::
 #
 # Define NO_REGEX if you have no or inferior regex support in your C library.
 #
+# Define GETTEXT_POISON if you are debugging the choice of strings marked
+# for translation.  In a GETTEXT_POISON build, you can turn all strings marked
+# for translation into gibberish by setting the GIT_GETTEXT_POISON variable
+# (to any value) in your environment.
+#
 # Define JSMIN to point to JavaScript minifier that functions as
 # a filter to have gitweb.js minified.
 #
@@ -316,6 +316,7 @@ INSTALL = install
 RPMBUILD = rpmbuild
 TCL_PATH = tclsh
 TCLTK_PATH = wish
+XGETTEXT = xgettext
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
 GCOV = gcov
@@ -515,6 +516,7 @@ LIB_H += diff.h
 LIB_H += dir.h
 LIB_H += exec_cmd.h
 LIB_H += fsck.h
+LIB_H += gettext.h
 LIB_H += git-compat-util.h
 LIB_H += graph.h
 LIB_H += grep.h
@@ -871,7 +873,6 @@ ifeq ($(uname_S),SunOS)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
                NO_STRLCPY = YesPlease
-               NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
                GIT_TEST_CMP = cmp
        endif
@@ -882,21 +883,18 @@ ifeq ($(uname_S),SunOS)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
                NO_STRLCPY = YesPlease
-               NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
                GIT_TEST_CMP = cmp
        endif
        ifeq ($(uname_R),5.8)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
-               NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
                GIT_TEST_CMP = cmp
        endif
        ifeq ($(uname_R),5.9)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
-               NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
                GIT_TEST_CMP = cmp
        endif
@@ -1076,7 +1074,6 @@ ifeq ($(uname_S),Windows)
        NO_MEMMEM = YesPlease
        # NEEDS_LIBICONV = YesPlease
        NO_ICONV = YesPlease
-       NO_C99_FORMAT = YesPlease
        NO_STRTOUMAX = YesPlease
        NO_STRTOULL = YesPlease
        NO_MKDTEMP = YesPlease
@@ -1153,7 +1150,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
        NO_MEMMEM = YesPlease
        NEEDS_LIBICONV = YesPlease
        OLD_ICONV = YesPlease
-       NO_C99_FORMAT = YesPlease
        NO_STRTOUMAX = YesPlease
        NO_MKDTEMP = YesPlease
        NO_MKSTEMPS = YesPlease
@@ -1356,9 +1352,6 @@ endif
 ifdef NO_NSEC
        BASIC_CFLAGS += -DNO_NSEC
 endif
-ifdef NO_C99_FORMAT
-       BASIC_CFLAGS += -DNO_C99_FORMAT
-endif
 ifdef SNPRINTF_RETURNS_BOGUS
        COMPAT_CFLAGS += -DSNPRINTF_RETURNS_BOGUS
        COMPAT_OBJS += compat/snprintf.o
@@ -1370,6 +1363,10 @@ endif
 ifdef NO_SYMLINK_HEAD
        BASIC_CFLAGS += -DNO_SYMLINK_HEAD
 endif
+ifdef GETTEXT_POISON
+       LIB_OBJS += gettext.o
+       BASIC_CFLAGS += -DGETTEXT_POISON
+endif
 ifdef NO_STRCASESTR
        COMPAT_CFLAGS += -DNO_STRCASESTR
        COMPAT_OBJS += compat/strcasestr.o
@@ -1581,6 +1578,7 @@ ifndef V
        QUIET_BUILT_IN = @echo '   ' BUILTIN $@;
        QUIET_GEN      = @echo '   ' GEN $@;
        QUIET_LNCP     = @echo '   ' LN/CP $@;
+       QUIET_XGETTEXT = @echo '   ' XGETTEXT $@;
        QUIET_GCOV     = @echo '   ' GCOV $@;
        QUIET_SUBDIR0  = +@subdir=
        QUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \
@@ -2048,6 +2046,20 @@ info:
 pdf:
        $(MAKE) -C Documentation pdf
 
+XGETTEXT_FLAGS = \
+       --force-po \
+       --add-comments \
+       --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
+       --from-code=UTF-8
+XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --keyword=_ --keyword=N_ --language=C
+LOCALIZED_C := $(C_OBJ:o=c)
+
+po/git.pot: $(LOCALIZED_C)
+       $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) && \
+       mv $@+ $@
+
+pot: po/git.pot
+
 $(ETAGS_TARGET): FORCE
        $(RM) $(ETAGS_TARGET)
        $(FIND) . -name '*.[hcS]' -print | xargs etags -a -o $(ETAGS_TARGET)
@@ -2089,6 +2101,7 @@ endif
 ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
        @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
 endif
+       @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
 
 ### Detect Tck/Tk interpreter path changes
 ifndef NO_TCLTK
@@ -2149,7 +2162,7 @@ check-sha1:: test-sha1$X
 check: common-cmds.h
        if sparse; \
        then \
-               for i in *.c; \
+               for i in $(patsubst %.o, %.c, $(GIT_OBJS)); \
                do \
                        sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
                done; \
@@ -2314,6 +2327,7 @@ dist-doc:
 
 distclean: clean
        $(RM) configure
+       $(RM) po/git.pot
 
 clean:
        $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
index 9a749551266dbe523bb3699ceea5261457f6a518..540b756d2f64d8c8ebf927a707b9b2cc0a4c6151 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/1.7.4.2.txt
\ No newline at end of file
+Documentation/RelNotes/1.7.5.txt
\ No newline at end of file
index ff140689ed2453809e7c3794c9989918e90df392..3005aedde68b48297aacd2082797b2e2f249b094 100644 (file)
--- a/abspath.c
+++ b/abspath.c
@@ -14,7 +14,14 @@ int is_directory(const char *path)
 /* We allow "recursive" symbolic links. Only within reason, though. */
 #define MAXDEPTH 5
 
-const char *make_absolute_path(const char *path)
+/*
+ * Use this to get the real path, i.e. resolve links. If you want an
+ * absolute path but don't mind links, use absolute_path.
+ *
+ * If path is our buffer, then return path, as it's already what the
+ * user wants.
+ */
+const char *real_path(const char *path)
 {
        static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];
        char cwd[1024] = "";
@@ -104,7 +111,14 @@ static const char *get_pwd_cwd(void)
        return cwd;
 }
 
-const char *make_nonrelative_path(const char *path)
+/*
+ * Use this to get an absolute path from a relative one. If you want
+ * to resolve links, you should use real_path.
+ *
+ * If the path is already absolute, then return path. As the user is
+ * never meant to free the return value, we're safe.
+ */
+const char *absolute_path(const char *path)
 {
        static char buf[PATH_MAX + 1];
 
diff --git a/alloc.c b/alloc.c
index 6ef6753d180afad29bc335854150c824b9de8a18..aeae55c976802264d714282218e58a858a9c68b5 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -51,19 +51,12 @@ DEFINE_ALLOCATOR(commit, struct commit)
 DEFINE_ALLOCATOR(tag, struct tag)
 DEFINE_ALLOCATOR(object, union any_object)
 
-#ifdef NO_C99_FORMAT
-#define SZ_FMT "%u"
-#else
-#define SZ_FMT "%zu"
-#endif
-
 static void report(const char *name, unsigned int count, size_t size)
 {
-    fprintf(stderr, "%10s: %8u (" SZ_FMT " kB)\n", name, count, size);
+       fprintf(stderr, "%10s: %8u (%"PRIuMAX" kB)\n",
+                       name, count, (uintmax_t) size);
 }
 
-#undef SZ_FMT
-
 #define REPORT(name)   \
     report(#name, name##_allocs, name##_allocs*sizeof(struct name) >> 10)
 
diff --git a/attr.c b/attr.c
index 6aff6951d38d7f672aeb9851eca88c6e5a26b950..0e28ba871f9ba0da129610019cd0d0246f3a15f0 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -478,11 +478,6 @@ int git_attr_system(void)
        return !git_env_bool("GIT_ATTR_NOSYSTEM", 0);
 }
 
-int git_attr_global(void)
-{
-       return !git_env_bool("GIT_ATTR_NOGLOBAL", 0);
-}
-
 static int git_attr_config(const char *var, const char *value, void *dummy)
 {
        if (!strcmp(var, "core.attributesfile"))
@@ -511,7 +506,7 @@ static void bootstrap_attr_stack(void)
                }
 
                git_config(git_attr_config, NULL);
-               if (git_attr_global() && attributes_file) {
+               if (attributes_file) {
                        elem = read_attr_from_file(attributes_file, 1);
                        if (elem) {
                                elem->origin = NULL;
index 93dc866f8c09a2da2308c4fd677178b043f2d4d5..c0c865a4b1b0fca038f32b77f2239d7987438ff5 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -175,9 +175,14 @@ void create_branch(const char *head,
                        die("Cannot setup tracking information; starting point is not a branch.");
                break;
        case 1:
-               /* Unique completion -- good, only if it is a real ref */
-               if (explicit_tracking && !strcmp(real_ref, "HEAD"))
-                       die("Cannot setup tracking information; starting point is not a branch.");
+               /* Unique completion -- good, only if it is a real branch */
+               if (prefixcmp(real_ref, "refs/heads/") &&
+                   prefixcmp(real_ref, "refs/remotes/")) {
+                       if (explicit_tracking)
+                               die("Cannot setup tracking information; starting point is not a branch.");
+                       else
+                               real_ref = NULL;
+               }
                break;
        default:
                die("Ambiguous object name: '%s'.", start_name);
@@ -217,6 +222,7 @@ void create_branch(const char *head,
 
 void remove_branch_state(void)
 {
+       unlink(git_path("CHERRY_PICK_HEAD"));
        unlink(git_path("MERGE_HEAD"));
        unlink(git_path("MERGE_RR"));
        unlink(git_path("MERGE_MSG"));
index 904e067a88f242b42f16b715d2b67b45a101e468..0e9da9083491eb3c18464b730f481cf74ee82430 100644 (file)
--- a/builtin.h
+++ b/builtin.h
@@ -57,6 +57,7 @@ extern int cmd_clone(int argc, const char **argv, const char *prefix);
 extern int cmd_clean(int argc, const char **argv, const char *prefix);
 extern int cmd_commit(int argc, const char **argv, const char *prefix);
 extern int cmd_commit_tree(int argc, const char **argv, const char *prefix);
+extern int cmd_config(int argc, const char **argv, const char *prefix);
 extern int cmd_count_objects(int argc, const char **argv, const char *prefix);
 extern int cmd_describe(int argc, const char **argv, const char *prefix);
 extern int cmd_diff_files(int argc, const char **argv, const char *prefix);
@@ -110,7 +111,7 @@ extern int cmd_reflog(int argc, const char **argv, const char *prefix);
 extern int cmd_remote(int argc, const char **argv, const char *prefix);
 extern int cmd_remote_ext(int argc, const char **argv, const char *prefix);
 extern int cmd_remote_fd(int argc, const char **argv, const char *prefix);
-extern int cmd_config(int argc, const char **argv, const char *prefix);
+extern int cmd_repo_config(int argc, const char **argv, const char *prefix);
 extern int cmd_rerere(int argc, const char **argv, const char *prefix);
 extern int cmd_reset(int argc, const char **argv, const char *prefix);
 extern int cmd_rev_list(int argc, const char **argv, const char *prefix);
index 1d74763f58d893619501427bcee0cc04c2878a02..d39a6ab930adf2e3cd716d3e9925350befed8947 100644 (file)
@@ -37,7 +37,7 @@ static void update_callback(struct diff_queue_struct *q,
                const char *path = p->one->path;
                switch (p->status) {
                default:
-                       die("unexpected diff status %c", p->status);
+                       die(_("unexpected diff status %c"), p->status);
                case DIFF_STATUS_UNMERGED:
                        /*
                         * ADD_CACHE_IGNORE_REMOVAL is unset if "git
@@ -63,7 +63,7 @@ static void update_callback(struct diff_queue_struct *q,
                case DIFF_STATUS_TYPE_CHANGED:
                        if (add_file_to_index(&the_index, path, data->flags)) {
                                if (!(data->flags & ADD_CACHE_IGNORE_ERRORS))
-                                       die("updating files failed");
+                                       die(_("updating files failed"));
                                data->add_errors++;
                        }
                        break;
@@ -73,7 +73,7 @@ static void update_callback(struct diff_queue_struct *q,
                        if (!(data->flags & ADD_CACHE_PRETEND))
                                remove_file_from_index(&the_index, path);
                        if (data->flags & (ADD_CACHE_PRETEND|ADD_CACHE_VERBOSE))
-                               printf("remove '%s'\n", path);
+                               printf(_("remove '%s'\n"), path);
                        break;
                }
        }
@@ -85,7 +85,7 @@ int add_files_to_cache(const char *prefix, const char **pathspec, int flags)
        struct rev_info rev;
        init_revisions(&rev, prefix);
        setup_revisions(0, NULL, &rev, NULL);
-       rev.prune_data = pathspec;
+       init_pathspec(&rev.prune_data, pathspec);
        rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
        rev.diffopt.format_callback = update_callback;
        data.flags = flags;
@@ -171,7 +171,7 @@ static void treat_gitlinks(const char **pathspec)
                                        /* strip trailing slash */
                                        pathspec[j] = xstrndup(ce->name, len);
                                else
-                                       die ("Path '%s' is in submodule '%.*s'",
+                                       die (_("Path '%s' is in submodule '%.*s'"),
                                                pathspec[j], len, ce->name);
                        }
                }
@@ -187,10 +187,10 @@ static void refresh(int verbose, const char **pathspec)
                /* nothing */;
        seen = xcalloc(specs, 1);
        refresh_index(&the_index, verbose ? REFRESH_IN_PORCELAIN : REFRESH_QUIET,
-                     pathspec, seen, "Unstaged changes after refreshing the index:");
+                     pathspec, seen, _("Unstaged changes after refreshing the index:"));
        for (i = 0; i < specs; i++) {
                if (!seen[i])
-                       die("pathspec '%s' did not match any files", pathspec[i]);
+                       die(_("pathspec '%s' did not match any files"), pathspec[i]);
        }
         free(seen);
 }
@@ -204,7 +204,7 @@ static const char **validate_pathspec(int argc, const char **argv, const char *p
                for (p = pathspec; *p; p++) {
                        if (has_symlink_leading_path(*p, strlen(*p))) {
                                int len = prefix ? strlen(prefix) : 0;
-                               die("'%s' is beyond a symbolic link", *p + len);
+                               die(_("'%s' is beyond a symbolic link"), *p + len);
                        }
                }
        }
@@ -271,7 +271,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
        git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
 
        if (read_cache() < 0)
-               die ("Could not read the index");
+               die (_("Could not read the index"));
 
        init_revisions(&rev, prefix);
        rev.diffopt.context = 7;
@@ -280,24 +280,24 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
        rev.diffopt.output_format = DIFF_FORMAT_PATCH;
        out = open(file, O_CREAT | O_WRONLY, 0644);
        if (out < 0)
-               die ("Could not open '%s' for writing.", file);
+               die (_("Could not open '%s' for writing."), file);
        rev.diffopt.file = xfdopen(out, "w");
        rev.diffopt.close_file = 1;
        if (run_diff_files(&rev, 0))
-               die ("Could not write patch");
+               die (_("Could not write patch"));
 
        launch_editor(file, NULL, NULL);
 
        if (stat(file, &st))
-               die_errno("Could not stat '%s'", file);
+               die_errno(_("Could not stat '%s'"), file);
        if (!st.st_size)
-               die("Empty patch. Aborted.");
+               die(_("Empty patch. Aborted."));
 
        memset(&child, 0, sizeof(child));
        child.git_cmd = 1;
        child.argv = apply_argv;
        if (run_command(&child))
-               die ("Could not apply '%s'", file);
+               die (_("Could not apply '%s'"), file);
 
        unlink(file);
        return 0;
@@ -306,7 +306,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
 static struct lock_file lock_file;
 
 static const char ignore_error[] =
-"The following paths are ignored by one of your .gitignore files:\n";
+N_("The following paths are ignored by one of your .gitignore files:\n");
 
 static int verbose = 0, show_only = 0, ignored_too = 0, refresh_only = 0;
 static int ignore_add_errors, addremove, intent_to_add, ignore_missing = 0;
@@ -321,7 +321,7 @@ static struct option builtin_add_options[] = {
        OPT__FORCE(&ignored_too, "allow adding otherwise ignored files"),
        OPT_BOOLEAN('u', "update", &take_worktree_changes, "update tracked files"),
        OPT_BOOLEAN('N', "intent-to-add", &intent_to_add, "record only the fact that the path will be added later"),
-       OPT_BOOLEAN('A', "all", &addremove, "add all, noticing removal of tracked files"),
+       OPT_BOOLEAN('A', "all", &addremove, "add changes from all tracked and untracked files"),
        OPT_BOOLEAN( 0 , "refresh", &refresh_only, "don't add, only refresh the index"),
        OPT_BOOLEAN( 0 , "ignore-errors", &ignore_add_errors, "just skip files which cannot be added because of errors"),
        OPT_BOOLEAN( 0 , "ignore-missing", &ignore_missing, "check if - even missing - files are ignored in dry run"),
@@ -343,17 +343,17 @@ static int add_files(struct dir_struct *dir, int flags)
        int i, exit_status = 0;
 
        if (dir->ignored_nr) {
-               fprintf(stderr, ignore_error);
+               fprintf(stderr, _(ignore_error));
                for (i = 0; i < dir->ignored_nr; i++)
                        fprintf(stderr, "%s\n", dir->ignored[i]->name);
-               fprintf(stderr, "Use -f if you really want to add them.\n");
-               die("no files added");
+               fprintf(stderr, _("Use -f if you really want to add them.\n"));
+               die(_("no files added"));
        }
 
        for (i = 0; i < dir->nr; i++)
                if (add_file_to_cache(dir->entries[i]->name, flags)) {
                        if (!ignore_add_errors)
-                               die("adding files failed");
+                               die(_("adding files failed"));
                        exit_status = 1;
                }
        return exit_status;
@@ -385,9 +385,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
        argv++;
 
        if (addremove && take_worktree_changes)
-               die("-A and -u are mutually incompatible");
+               die(_("-A and -u are mutually incompatible"));
        if (!show_only && ignore_missing)
-               die("Option --ignore-missing can only be used together with --dry-run");
+               die(_("Option --ignore-missing can only be used together with --dry-run"));
        if ((addremove || take_worktree_changes) && !argc) {
                static const char *here[2] = { ".", NULL };
                argc = 1;
@@ -407,14 +407,14 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                  ? ADD_CACHE_IGNORE_REMOVAL : 0));
 
        if (require_pathspec && argc == 0) {
-               fprintf(stderr, "Nothing specified, nothing added.\n");
-               fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
+               fprintf(stderr, _("Nothing specified, nothing added.\n"));
+               fprintf(stderr, _("Maybe you wanted to say 'git add .'?\n"));
                return 0;
        }
        pathspec = validate_pathspec(argc, argv, prefix);
 
        if (read_cache() < 0)
-               die("index file corrupt");
+               die(_("index file corrupt"));
        treat_gitlinks(pathspec);
 
        if (add_new_files) {
@@ -450,7 +450,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                                        if (excluded(&dir, pathspec[i], &dtype))
                                                dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));
                                } else
-                                       die("pathspec '%s' did not match any files",
+                                       die(_("pathspec '%s' did not match any files"),
                                            pathspec[i]);
                        }
                }
@@ -466,7 +466,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
        if (active_cache_changed) {
                if (write_cache(newfd, active_cache, active_nr) ||
                    commit_locked_index(&lock_file))
-                       die("Unable to write new index file");
+                       die(_("Unable to write new index file"));
        }
 
        return exit_status;
index 14951daedffa9e8a8a913eee5e8423220e86e291..36e150768ba88e427e6257900d7ec4c67c8303c1 100644 (file)
@@ -204,6 +204,7 @@ struct line {
        unsigned hash : 24;
        unsigned flag : 8;
 #define LINE_COMMON     1
+#define LINE_PATCHED   2
 };
 
 /*
@@ -2085,7 +2086,8 @@ static int match_fragment(struct image *img,
 
        /* Quick hash check */
        for (i = 0; i < preimage_limit; i++)
-               if (preimage->line[i].hash != img->line[try_lno + i].hash)
+               if ((img->line[try_lno + i].flag & LINE_PATCHED) ||
+                   (preimage->line[i].hash != img->line[try_lno + i].hash))
                        return 0;
 
        if (preimage_limit == preimage->nr) {
@@ -2428,11 +2430,15 @@ static void update_image(struct image *img,
        memcpy(img->line + applied_pos,
               postimage->line,
               postimage->nr * sizeof(*img->line));
+       for (i = 0; i < postimage->nr; i++)
+               img->line[applied_pos + i].flag |= LINE_PATCHED;
+
        img->nr = nr;
 }
 
 static int apply_one_fragment(struct image *img, struct fragment *frag,
-                             int inaccurate_eof, unsigned ws_rule)
+                             int inaccurate_eof, unsigned ws_rule,
+                             int nth_fragment)
 {
        int match_beginning, match_end;
        const char *patch = frag->patch;
@@ -2638,6 +2644,15 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
                                apply = 0;
                }
 
+               if (apply_verbosely && applied_pos != pos) {
+                       int offset = applied_pos - pos;
+                       if (apply_in_reverse)
+                               offset = 0 - offset;
+                       fprintf(stderr,
+                               "Hunk #%d succeeded at %d (offset %d lines).\n",
+                               nth_fragment, applied_pos + 1, offset);
+               }
+
                /*
                 * Warn if it was necessary to reduce the number
                 * of context lines.
@@ -2785,12 +2800,14 @@ static int apply_fragments(struct image *img, struct patch *patch)
        const char *name = patch->old_name ? patch->old_name : patch->new_name;
        unsigned ws_rule = patch->ws_rule;
        unsigned inaccurate_eof = patch->inaccurate_eof;
+       int nth = 0;
 
        if (patch->is_binary)
                return apply_binary(img, patch);
 
        while (frag) {
-               if (apply_one_fragment(img, frag, inaccurate_eof, ws_rule)) {
+               nth++;
+               if (apply_one_fragment(img, frag, inaccurate_eof, ws_rule, nth)) {
                        error("patch failed: %s:%ld", name, frag->oldpos);
                        if (!apply_with_reject)
                                return -1;
index 6a887f5a9d785d23f1be76fd86fc17896b2b48d7..b14eaba1594bad060e0c881326368b9b2be3b158 100644 (file)
@@ -14,10 +14,10 @@ static void create_output_file(const char *output_file)
 {
        int output_fd = open(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);
        if (output_fd < 0)
-               die_errno("could not create archive file '%s'", output_file);
+               die_errno(_("could not create archive file '%s'"), output_file);
        if (output_fd != 1) {
                if (dup2(output_fd, 1) < 0)
-                       die_errno("could not redirect output");
+                       die_errno(_("could not redirect output"));
                else
                        close(output_fd);
        }
@@ -33,7 +33,7 @@ static int run_remote_archiver(int argc, const char **argv,
 
        _remote = remote_get(remote);
        if (!_remote->url[0])
-               die("git archive: Remote with no URL");
+               die(_("git archive: Remote with no URL"));
        transport = transport_get(_remote, _remote->url[0]);
        transport_connect(transport, "git-upload-archive", exec, fd);
 
@@ -43,18 +43,18 @@ static int run_remote_archiver(int argc, const char **argv,
 
        len = packet_read_line(fd[0], buf, sizeof(buf));
        if (!len)
-               die("git archive: expected ACK/NAK, got EOF");
+               die(_("git archive: expected ACK/NAK, got EOF"));
        if (buf[len-1] == '\n')
                buf[--len] = 0;
        if (strcmp(buf, "ACK")) {
                if (len > 5 && !prefixcmp(buf, "NACK "))
-                       die("git archive: NACK %s", buf + 5);
-               die("git archive: protocol error");
+                       die(_("git archive: NACK %s"), buf + 5);
+               die(_("git archive: protocol error"));
        }
 
        len = packet_read_line(fd[0], buf, sizeof(buf));
        if (len)
-               die("git archive: expected a flush");
+               die(_("git archive: expected a flush"));
 
        /* Now, start reading from fd[0] and spit it out to stdout */
        rv = recv_sideband("archive", fd[0], 1);
index b9ba011f7b3f37a9448afae909d743249c3d8e1f..9cca1b9afc20caf6333d0269386249f41fa8746f 100644 (file)
@@ -133,12 +133,12 @@ static int branch_merged(int kind, const char *name,
        if ((head_rev != reference_rev) &&
            in_merge_bases(rev, &head_rev, 1) != merged) {
                if (merged)
-                       warning("deleting branch '%s' that has been merged to\n"
-                               "         '%s', but not yet been merged to HEAD.",
+                       warning(_("deleting branch '%s' that has been merged to\n"
+                               "         '%s', but not yet merged to HEAD."),
                                name, reference_name);
                else
-                       warning("not deleting branch '%s' that is not yet merged to\n"
-                               "         '%s', even though it is merged to HEAD.",
+                       warning(_("not deleting branch '%s' that is not yet merged to\n"
+                               "         '%s', even though it is merged to HEAD."),
                                name, reference_name);
        }
        return merged;
@@ -157,7 +157,8 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
        switch (kinds) {
        case REF_REMOTE_BRANCH:
                fmt = "refs/remotes/%s";
-               remote = "remote ";
+               /* TRANSLATORS: This is "remote " in "remote branch '%s' not found" */
+               remote = _("remote ");
                force = 1;
                break;
        case REF_LOCAL_BRANCH:
@@ -165,19 +166,19 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
                remote = "";
                break;
        default:
-               die("cannot use -a with -d");
+               die(_("cannot use -a with -d"));
        }
 
        if (!force) {
                head_rev = lookup_commit_reference(head_sha1);
                if (!head_rev)
-                       die("Couldn't look up commit object for HEAD");
+                       die(_("Couldn't look up commit object for HEAD"));
        }
        for (i = 0; i < argc; i++, strbuf_release(&bname)) {
                strbuf_branchname(&bname, argv[i]);
                if (kinds == REF_LOCAL_BRANCH && !strcmp(head, bname.buf)) {
-                       error("Cannot delete the branch '%s' "
-                             "which you are currently on.", bname.buf);
+                       error(_("Cannot delete the branch '%s' "
+                             "which you are currently on."), bname.buf);
                        ret = 1;
                        continue;
                }
@@ -186,7 +187,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 
                name = xstrdup(mkpath(fmt, bname.buf));
                if (!resolve_ref(name, sha1, 1, NULL)) {
-                       error("%sbranch '%s' not found.",
+                       error(_("%sbranch '%s' not found."),
                                        remote, bname.buf);
                        ret = 1;
                        continue;
@@ -194,31 +195,31 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 
                rev = lookup_commit_reference(sha1);
                if (!rev) {
-                       error("Couldn't look up commit object for '%s'", name);
+                       error(_("Couldn't look up commit object for '%s'"), name);
                        ret = 1;
                        continue;
                }
 
                if (!force && !branch_merged(kinds, bname.buf, rev, head_rev)) {
-                       error("The branch '%s' is not fully merged.\n"
+                       error(_("The branch '%s' is not fully merged.\n"
                              "If you are sure you want to delete it, "
-                             "run 'git branch -D %s'.", bname.buf, bname.buf);
+                             "run 'git branch -D %s'."), bname.buf, bname.buf);
                        ret = 1;
                        continue;
                }
 
                if (delete_ref(name, sha1, 0)) {
-                       error("Error deleting %sbranch '%s'", remote,
+                       error(_("Error deleting %sbranch '%s'"), remote,
                              bname.buf);
                        ret = 1;
                } else {
                        struct strbuf buf = STRBUF_INIT;
-                       printf("Deleted %sbranch %s (was %s).\n", remote,
+                       printf(_("Deleted %sbranch %s (was %s).\n"), remote,
                               bname.buf,
                               find_unique_abbrev(sha1, DEFAULT_ABBREV));
                        strbuf_addf(&buf, "branch.%s", bname.buf);
                        if (git_config_rename_section(buf.buf, NULL) < 0)
-                               warning("Update of config-file failed");
+                               warning(_("Update of config-file failed"));
                        strbuf_release(&buf);
                }
        }
@@ -300,7 +301,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
        if (ref_list->verbose || ref_list->with_commit || merge_filter != NO_FILTER) {
                commit = lookup_commit_reference_gently(sha1, 1);
                if (!commit) {
-                       cb->ret = error("branch '%s' does not point at a commit", refname);
+                       cb->ret = error(_("branch '%s' does not point at a commit"), refname);
                        return 0;
                }
 
@@ -372,11 +373,11 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
                strbuf_addf(stat, "%s: ",
                        shorten_unambiguous_ref(branch->merge[0]->dst, 0));
        if (!ours)
-               strbuf_addf(stat, "behind %d] ", theirs);
+               strbuf_addf(stat, _("behind %d] "), theirs);
        else if (!theirs)
-               strbuf_addf(stat, "ahead %d] ", ours);
+               strbuf_addf(stat, _("ahead %d] "), ours);
        else
-               strbuf_addf(stat, "ahead %d, behind %d] ", ours, theirs);
+               strbuf_addf(stat, _("ahead %d, behind %d] "), ours, theirs);
 }
 
 static int matches_merge_filter(struct commit *commit)
@@ -481,7 +482,7 @@ static void show_detached(struct ref_list *ref_list)
 
        if (head_commit && is_descendant_of(head_commit, ref_list->with_commit)) {
                struct ref_item item;
-               item.name = xstrdup("(no branch)");
+               item.name = xstrdup(_("(no branch)"));
                item.len = strlen(item.name);
                item.kind = REF_LOCAL_BRANCH;
                item.dest = NULL;
@@ -541,7 +542,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
        free_ref_list(&ref_list);
 
        if (cb.ret)
-               error("some refs could not be read");
+               error(_("some refs could not be read"));
 
        return cb.ret;
 }
@@ -554,7 +555,7 @@ static void rename_branch(const char *oldname, const char *newname, int force)
        int recovery = 0;
 
        if (!oldname)
-               die("cannot rename the current branch while not on any.");
+               die(_("cannot rename the current branch while not on any."));
 
        if (strbuf_check_branch_ref(&oldref, oldname)) {
                /*
@@ -564,35 +565,35 @@ static void rename_branch(const char *oldname, const char *newname, int force)
                if (resolve_ref(oldref.buf, sha1, 1, NULL))
                        recovery = 1;
                else
-                       die("Invalid branch name: '%s'", oldname);
+                       die(_("Invalid branch name: '%s'"), oldname);
        }
 
        if (strbuf_check_branch_ref(&newref, newname))
-               die("Invalid branch name: '%s'", newname);
+               die(_("Invalid branch name: '%s'"), newname);
 
        if (resolve_ref(newref.buf, sha1, 1, NULL) && !force)
-               die("A branch named '%s' already exists.", newref.buf + 11);
+               die(_("A branch named '%s' already exists."), newref.buf + 11);
 
        strbuf_addf(&logmsg, "Branch: renamed %s to %s",
                 oldref.buf, newref.buf);
 
        if (rename_ref(oldref.buf, newref.buf, logmsg.buf))
-               die("Branch rename failed");
+               die(_("Branch rename failed"));
        strbuf_release(&logmsg);
 
        if (recovery)
-               warning("Renamed a misnamed branch '%s' away", oldref.buf + 11);
+               warning(_("Renamed a misnamed branch '%s' away"), oldref.buf + 11);
 
        /* no need to pass logmsg here as HEAD didn't really move */
        if (!strcmp(oldname, head) && create_symref("HEAD", newref.buf, NULL))
-               die("Branch renamed to %s, but HEAD is not updated!", newname);
+               die(_("Branch renamed to %s, but HEAD is not updated!"), newname);
 
        strbuf_addf(&oldsection, "branch.%s", oldref.buf + 11);
        strbuf_release(&oldref);
        strbuf_addf(&newsection, "branch.%s", newref.buf + 11);
        strbuf_release(&newref);
        if (git_config_rename_section(oldsection.buf, newsection.buf) < 0)
-               die("Branch is renamed, but update of config-file failed");
+               die(_("Branch is renamed, but update of config-file failed"));
        strbuf_release(&oldsection);
        strbuf_release(&newsection);
 }
@@ -607,7 +608,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int
        if (!arg)
                arg = "HEAD";
        if (get_sha1(arg, merge_filter_ref))
-               die("malformed object name %s", arg);
+               die(_("malformed object name %s"), arg);
        return 0;
 }
 
@@ -681,13 +682,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 
        head = resolve_ref("HEAD", head_sha1, 0, NULL);
        if (!head)
-               die("Failed to resolve HEAD as a valid ref.");
+               die(_("Failed to resolve HEAD as a valid ref."));
        head = xstrdup(head);
        if (!strcmp(head, "HEAD")) {
                detached = 1;
        } else {
                if (prefixcmp(head, "refs/heads/"))
-                       die("HEAD not found below refs/heads!");
+                       die(_("HEAD not found below refs/heads!"));
                head += 11;
        }
        hashcpy(merge_filter_ref, head_sha1);
@@ -707,7 +708,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                rename_branch(argv[0], argv[1], rename > 1);
        else if (argc <= 2) {
                if (kinds != REF_LOCAL_BRANCH)
-                       die("-a and -r options to 'git branch' do not make sense with a branch name");
+                       die(_("-a and -r options to 'git branch' do not make sense with a branch name"));
                create_branch(head, argv[0], (argc == 2) ? argv[1] : head,
                              force_create, reflog, track);
        } else
index 9b87fb9ac2505e746ae34db34740cdfb3cfde127..81046a9cb870aab59a56492e175a51c032ad96ce 100644 (file)
@@ -44,7 +44,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
                close(bundle_fd);
                if (verify_bundle(&header, 1))
                        return 1;
-               fprintf(stderr, "%s is okay\n", bundle_file);
+               fprintf(stderr, _("%s is okay\n"), bundle_file);
                return 0;
        }
        if (!strcmp(cmd, "list-heads")) {
@@ -53,11 +53,11 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
        }
        if (!strcmp(cmd, "create")) {
                if (!startup_info->have_repository)
-                       die("Need a repository to create a bundle.");
+                       die(_("Need a repository to create a bundle."));
                return !!create_bundle(&header, bundle_file, argc, argv);
        } else if (!strcmp(cmd, "unbundle")) {
                if (!startup_info->have_repository)
-                       die("Need a repository to unbundle.");
+                       die(_("Need a repository to unbundle."));
                return !!unbundle(&header, bundle_fd) ||
                        list_bundle_refs(&header, argc, argv);
        } else
index cd7f56e6c4b6e1b1059ffa0eae91b46e579b9e97..eece5d6ac0f48ae76dc76c0f2ebda633cc0ded58 100644 (file)
@@ -30,6 +30,7 @@ struct checkout_opts {
        int quiet;
        int merge;
        int force;
+       int force_detach;
        int writeout_stage;
        int writeout_error;
 
@@ -103,9 +104,10 @@ static int check_stage(int stage, struct cache_entry *ce, int pos)
                        return 0;
                pos++;
        }
-       return error("path '%s' does not have %s version",
-                    ce->name,
-                    (stage == 2) ? "our" : "their");
+       if (stage == 2)
+               return error(_("path '%s' does not have our version"), ce->name);
+       else
+               return error(_("path '%s' does not have their version"), ce->name);
 }
 
 static int check_all_stages(struct cache_entry *ce, int pos)
@@ -116,7 +118,7 @@ static int check_all_stages(struct cache_entry *ce, int pos)
            ce_stage(active_cache[pos+1]) != 2 ||
            strcmp(active_cache[pos+2]->name, ce->name) ||
            ce_stage(active_cache[pos+2]) != 3)
-               return error("path '%s' does not have all three versions",
+               return error(_("path '%s' does not have all three versions"),
                             ce->name);
        return 0;
 }
@@ -130,9 +132,10 @@ static int checkout_stage(int stage, struct cache_entry *ce, int pos,
                        return checkout_entry(active_cache[pos], state, NULL);
                pos++;
        }
-       return error("path '%s' does not have %s version",
-                    ce->name,
-                    (stage == 2) ? "our" : "their");
+       if (stage == 2)
+               return error(_("path '%s' does not have our version"), ce->name);
+       else
+               return error(_("path '%s' does not have their version"), ce->name);
 }
 
 static int checkout_merged(int pos, struct checkout *state)
@@ -150,7 +153,7 @@ static int checkout_merged(int pos, struct checkout *state)
            ce_stage(active_cache[pos+1]) != 2 ||
            strcmp(active_cache[pos+2]->name, path) ||
            ce_stage(active_cache[pos+2]) != 3)
-               return error("path '%s' does not have all 3 versions", path);
+               return error(_("path '%s' does not have all 3 versions"), path);
 
        read_mmblob(&ancestor, active_cache[pos]->sha1);
        read_mmblob(&ours, active_cache[pos+1]->sha1);
@@ -167,7 +170,7 @@ static int checkout_merged(int pos, struct checkout *state)
        free(theirs.ptr);
        if (status < 0 || !result_buf.ptr) {
                free(result_buf.ptr);
-               return error("path '%s': cannot merge", path);
+               return error(_("path '%s': cannot merge"), path);
        }
 
        /*
@@ -184,12 +187,12 @@ static int checkout_merged(int pos, struct checkout *state)
         */
        if (write_sha1_file(result_buf.ptr, result_buf.size,
                            blob_type, sha1))
-               die("Unable to add merge result for '%s'", path);
+               die(_("Unable to add merge result for '%s'"), path);
        ce = make_cache_entry(create_ce_mode(active_cache[pos+1]->ce_mode),
                              sha1,
                              path, 2, 0);
        if (!ce)
-               die("make_cache_entry failed for path '%s'", path);
+               die(_("make_cache_entry failed for path '%s'"), path);
        status = checkout_entry(ce, state, NULL);
        return status;
 }
@@ -211,7 +214,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
 
        newfd = hold_locked_index(lock_file, 1);
        if (read_cache_preload(pathspec) < 0)
-               return error("corrupt index file");
+               return error(_("corrupt index file"));
 
        if (source_tree)
                read_tree_some(source_tree, pathspec);
@@ -239,14 +242,14 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
                        if (!ce_stage(ce))
                                continue;
                        if (opts->force) {
-                               warning("path '%s' is unmerged", ce->name);
+                               warning(_("path '%s' is unmerged"), ce->name);
                        } else if (stage) {
                                errs |= check_stage(stage, ce, pos);
                        } else if (opts->merge) {
                                errs |= check_all_stages(ce, pos);
                        } else {
                                errs = 1;
-                               error("path '%s' is unmerged", ce->name);
+                               error(_("path '%s' is unmerged"), ce->name);
                        }
                        pos = skip_same_name(ce, pos) - 1;
                }
@@ -275,7 +278,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
 
        if (write_cache(newfd, active_cache, active_nr) ||
            commit_locked_index(lock_file))
-               die("unable to write new index file");
+               die(_("unable to write new index file"));
 
        resolve_ref("HEAD", rev, 0, &flag);
        head = lookup_commit_reference_gently(rev, 1);
@@ -292,12 +295,12 @@ static void show_local_changes(struct object *head, struct diff_options *opts)
        rev.diffopt.flags = opts->flags;
        rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS;
        if (diff_setup_done(&rev.diffopt) < 0)
-               die("diff_setup_done failed");
+               die(_("diff_setup_done failed"));
        add_pending_object(&rev, head, NULL);
        run_diff_index(&rev, 0);
 }
 
-static void describe_detached_head(char *msg, struct commit *commit)
+static void describe_detached_head(const char *msg, struct commit *commit)
 {
        struct strbuf sb = STRBUF_INIT;
        struct pretty_print_context ctx = {0};
@@ -366,7 +369,7 @@ static int merge_working_tree(struct checkout_opts *opts,
        int newfd = hold_locked_index(lock_file, 1);
 
        if (read_cache_preload(NULL) < 0)
-               return error("corrupt index file");
+               return error(_("corrupt index file"));
 
        resolve_undo_clear();
        if (opts->force) {
@@ -388,7 +391,7 @@ static int merge_working_tree(struct checkout_opts *opts,
                refresh_cache(REFRESH_QUIET);
 
                if (unmerged_cache()) {
-                       error("you need to resolve your current index first");
+                       error(_("you need to resolve your current index first"));
                        return 1;
                }
 
@@ -470,7 +473,7 @@ static int merge_working_tree(struct checkout_opts *opts,
 
        if (write_cache(newfd, active_cache, active_nr) ||
            commit_locked_index(lock_file))
-               die("unable to write new index file");
+               die(_("unable to write new index file"));
 
        if (!opts->force && !opts->quiet)
                show_local_changes(&new->commit->object, &opts->diff_options);
@@ -519,7 +522,7 @@ static void update_refs_for_switch(struct checkout_opts *opts,
                                temp = log_all_ref_updates;
                                log_all_ref_updates = 1;
                                if (log_ref_setup(ref_name, log_file, sizeof(log_file))) {
-                                       fprintf(stderr, "Can not do reflog for '%s'\n",
+                                       fprintf(stderr, _("Can not do reflog for '%s'\n"),
                                            opts->new_orphan_branch);
                                        log_all_ref_updates = temp;
                                        return;
@@ -541,19 +544,31 @@ static void update_refs_for_switch(struct checkout_opts *opts,
        strbuf_addf(&msg, "checkout: moving from %s to %s",
                    old_desc ? old_desc : "(invalid)", new->name);
 
-       if (new->path) {
+       if (!strcmp(new->name, "HEAD") && !new->path && !opts->force_detach) {
+               /* Nothing to do. */
+       } else if (opts->force_detach || !new->path) {  /* No longer on any branch. */
+               update_ref(msg.buf, "HEAD", new->commit->object.sha1, NULL,
+                          REF_NODEREF, DIE_ON_ERR);
+               if (!opts->quiet) {
+                       if (old->path && advice_detached_head)
+                               detach_advice(old->path, new->name);
+                       describe_detached_head(_("HEAD is now at"), new->commit);
+               }
+       } else if (new->path) { /* Switch branches. */
                create_symref("HEAD", new->path, msg.buf);
                if (!opts->quiet) {
-                       if (old->path && !strcmp(new->path, old->path))
-                               fprintf(stderr, "Already on '%s'\n",
-                                       new->name);
-                       else if (opts->new_branch)
-                               fprintf(stderr, "Switched to%s branch '%s'\n",
-                                       opts->branch_exists ? " and reset" : " a new",
+                       if (old->path && !strcmp(new->path, old->path)) {
+                               fprintf(stderr, _("Already on '%s'\n"),
                                        new->name);
-                       else
-                               fprintf(stderr, "Switched to branch '%s'\n",
+                       } else if (opts->new_branch) {
+                               if (opts->branch_exists)
+                                       fprintf(stderr, _("Switched to and reset branch '%s'\n"), new->name);
+                               else
+                                       fprintf(stderr, _("Switched to a new branch '%s'\n"), new->name);
+                       } else {
+                               fprintf(stderr, _("Switched to branch '%s'\n"),
                                        new->name);
+                       }
                }
                if (old->path && old->name) {
                        char log_file[PATH_MAX], ref_file[PATH_MAX];
@@ -563,21 +578,124 @@ static void update_refs_for_switch(struct checkout_opts *opts,
                        if (!file_exists(ref_file) && file_exists(log_file))
                                remove_path(log_file);
                }
-       } else if (strcmp(new->name, "HEAD")) {
-               update_ref(msg.buf, "HEAD", new->commit->object.sha1, NULL,
-                          REF_NODEREF, DIE_ON_ERR);
-               if (!opts->quiet) {
-                       if (old->path && advice_detached_head)
-                               detach_advice(old->path, new->name);
-                       describe_detached_head("HEAD is now at", new->commit);
-               }
        }
        remove_branch_state();
        strbuf_release(&msg);
-       if (!opts->quiet && (new->path || !strcmp(new->name, "HEAD")))
+       if (!opts->quiet &&
+           (new->path || (!opts->force_detach && !strcmp(new->name, "HEAD"))))
                report_tracking(new);
 }
 
+struct rev_list_args {
+       int argc;
+       int alloc;
+       const char **argv;
+};
+
+static void add_one_rev_list_arg(struct rev_list_args *args, const char *s)
+{
+       ALLOC_GROW(args->argv, args->argc + 1, args->alloc);
+       args->argv[args->argc++] = s;
+}
+
+static int add_one_ref_to_rev_list_arg(const char *refname,
+                                      const unsigned char *sha1,
+                                      int flags,
+                                      void *cb_data)
+{
+       add_one_rev_list_arg(cb_data, refname);
+       return 0;
+}
+
+static int clear_commit_marks_from_one_ref(const char *refname,
+                                     const unsigned char *sha1,
+                                     int flags,
+                                     void *cb_data)
+{
+       struct commit *commit = lookup_commit_reference_gently(sha1, 1);
+       if (commit)
+               clear_commit_marks(commit, -1);
+       return 0;
+}
+
+static void describe_one_orphan(struct strbuf *sb, struct commit *commit)
+{
+       struct pretty_print_context ctx = { 0 };
+
+       parse_commit(commit);
+       strbuf_addstr(sb, "  ");
+       strbuf_addstr(sb,
+               find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
+       strbuf_addch(sb, ' ');
+       pretty_print_commit(CMIT_FMT_ONELINE, commit, sb, &ctx);
+       strbuf_addch(sb, '\n');
+}
+
+#define ORPHAN_CUTOFF 4
+static void suggest_reattach(struct commit *commit, struct rev_info *revs)
+{
+       struct commit *c, *last = NULL;
+       struct strbuf sb = STRBUF_INIT;
+       int lost = 0;
+       while ((c = get_revision(revs)) != NULL) {
+               if (lost < ORPHAN_CUTOFF)
+                       describe_one_orphan(&sb, c);
+               last = c;
+               lost++;
+       }
+       if (ORPHAN_CUTOFF < lost) {
+               int more = lost - ORPHAN_CUTOFF;
+               if (more == 1)
+                       describe_one_orphan(&sb, last);
+               else
+                       strbuf_addf(&sb, " ... and %d more.\n", more);
+       }
+
+       fprintf(stderr,
+               "Warning: you are leaving %d commit%s behind, "
+               "not connected to\n"
+               "any of your branches:\n\n"
+               "%s\n"
+               "If you want to keep them by creating a new branch, "
+               "this may be a good time\nto do so with:\n\n"
+               " git branch new_branch_name %s\n\n",
+               lost, ((1 < lost) ? "s" : ""),
+               sb.buf,
+               sha1_to_hex(commit->object.sha1));
+       strbuf_release(&sb);
+}
+
+/*
+ * We are about to leave commit that was at the tip of a detached
+ * HEAD.  If it is not reachable from any ref, this is the last chance
+ * for the user to do so without resorting to reflog.
+ */
+static void orphaned_commit_warning(struct commit *commit)
+{
+       struct rev_list_args args = { 0, 0, NULL };
+       struct rev_info revs;
+
+       add_one_rev_list_arg(&args, "(internal)");
+       add_one_rev_list_arg(&args, sha1_to_hex(commit->object.sha1));
+       add_one_rev_list_arg(&args, "--not");
+       for_each_ref(add_one_ref_to_rev_list_arg, &args);
+       add_one_rev_list_arg(&args, "--");
+       add_one_rev_list_arg(&args, NULL);
+
+       init_revisions(&revs, NULL);
+       if (setup_revisions(args.argc - 1, args.argv, &revs, NULL) != 1)
+               die(_("internal error: only -- alone should have been left"));
+       if (prepare_revision_walk(&revs))
+               die(_("internal error in revision walk"));
+       if (!(commit->object.flags & UNINTERESTING))
+               suggest_reattach(commit, &revs);
+       else
+               describe_detached_head(_("Previous HEAD position was"), commit);
+
+       clear_commit_marks(commit, -1);
+       for_each_ref(clear_commit_marks_from_one_ref, NULL);
+}
+
 static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
 {
        int ret = 0;
@@ -597,7 +715,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
                new->name = "HEAD";
                new->commit = old.commit;
                if (!new->commit)
-                       die("You are on a branch yet to be born");
+                       die(_("You are on a branch yet to be born"));
                parse_commit(new->commit);
        }
 
@@ -605,13 +723,8 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
        if (ret)
                return ret;
 
-       /*
-        * If we were on a detached HEAD, but have now moved to
-        * a new commit, we want to mention the old commit once more
-        * to remind the user that it might be lost.
-        */
        if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
-               describe_detached_head("Previous HEAD position was", old.commit);
+               orphaned_commit_warning(old.commit);
 
        update_refs_for_switch(opts, &old, new);
 
@@ -675,11 +788,123 @@ static const char *unique_tracking_name(const char *name)
        return NULL;
 }
 
+static int parse_branchname_arg(int argc, const char **argv,
+                               int dwim_new_local_branch_ok,
+                               struct branch_info *new,
+                               struct tree **source_tree,
+                               unsigned char rev[20],
+                               const char **new_branch)
+{
+       int argcount = 0;
+       unsigned char branch_rev[20];
+       const char *arg;
+       int has_dash_dash;
+
+       /*
+        * case 1: git checkout <ref> -- [<paths>]
+        *
+        *   <ref> must be a valid tree, everything after the '--' must be
+        *   a path.
+        *
+        * case 2: git checkout -- [<paths>]
+        *
+        *   everything after the '--' must be paths.
+        *
+        * case 3: git checkout <something> [<paths>]
+        *
+        *   With no paths, if <something> is a commit, that is to
+        *   switch to the branch or detach HEAD at it.  As a special case,
+        *   if <something> is A...B (missing A or B means HEAD but you can
+        *   omit at most one side), and if there is a unique merge base
+        *   between A and B, A...B names that merge base.
+        *
+        *   With no paths, if <something> is _not_ a commit, no -t nor -b
+        *   was given, and there is a tracking branch whose name is
+        *   <something> in one and only one remote, then this is a short-hand
+        *   to fork local <something> from that remote-tracking branch.
+        *
+        *   Otherwise <something> shall not be ambiguous.
+        *   - If it's *only* a reference, treat it like case (1).
+        *   - If it's only a path, treat it like case (2).
+        *   - else: fail.
+        *
+        */
+       if (!argc)
+               return 0;
+
+       if (!strcmp(argv[0], "--"))     /* case (2) */
+               return 1;
+
+       arg = argv[0];
+       has_dash_dash = (argc > 1) && !strcmp(argv[1], "--");
+
+       if (!strcmp(arg, "-"))
+               arg = "@{-1}";
+
+       if (get_sha1_mb(arg, rev)) {
+               if (has_dash_dash)          /* case (1) */
+                       die(_("invalid reference: %s"), arg);
+               if (dwim_new_local_branch_ok &&
+                   !check_filename(NULL, arg) &&
+                   argc == 1) {
+                       const char *remote = unique_tracking_name(arg);
+                       if (!remote || get_sha1(remote, rev))
+                               return argcount;
+                       *new_branch = arg;
+                       arg = remote;
+                       /* DWIMmed to create local branch */
+               } else {
+                       return argcount;
+               }
+       }
+
+       /* we can't end up being in (2) anymore, eat the argument */
+       argcount++;
+       argv++;
+       argc--;
+
+       new->name = arg;
+       setup_branch_path(new);
+
+       if (check_ref_format(new->path) == CHECK_REF_FORMAT_OK &&
+           resolve_ref(new->path, branch_rev, 1, NULL))
+               hashcpy(rev, branch_rev);
+       else
+               new->path = NULL; /* not an existing branch */
+
+       new->commit = lookup_commit_reference_gently(rev, 1);
+       if (!new->commit) {
+               /* not a commit */
+               *source_tree = parse_tree_indirect(rev);
+       } else {
+               parse_commit(new->commit);
+               *source_tree = new->commit->tree;
+       }
+
+       if (!*source_tree)                   /* case (1): want a tree */
+               die(_("reference is not a tree: %s"), arg);
+       if (!has_dash_dash) {/* case (3 -> 1) */
+               /*
+                * Do not complain the most common case
+                *      git checkout branch
+                * even if there happen to be a file called 'branch';
+                * it would be extremely annoying.
+                */
+               if (argc)
+                       verify_non_filename(NULL, arg);
+       } else {
+               argcount++;
+               argv++;
+               argc--;
+       }
+
+       return argcount;
+}
+
 int cmd_checkout(int argc, const char **argv, const char *prefix)
 {
        struct checkout_opts opts;
        unsigned char rev[20];
-       const char *arg;
        struct branch_info new;
        struct tree *source_tree = NULL;
        char *conflict_style = NULL;
@@ -692,6 +917,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                OPT_STRING('B', NULL, &opts.new_branch_force, "branch",
                           "create/reset and checkout a branch"),
                OPT_BOOLEAN('l', NULL, &opts.new_branch_log, "create reflog for new branch"),
+               OPT_BOOLEAN(0, "detach", &opts.force_detach, "detach the HEAD at named commit"),
                OPT_SET_INT('t', "track",  &opts.track, "set upstream info for new branch",
                        BRANCH_TRACK_EXPLICIT),
                OPT_STRING(0, "orphan", &opts.new_orphan_branch, "new branch", "new unparented branch"),
@@ -709,7 +935,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
                OPT_END(),
        };
-       int has_dash_dash;
 
        memset(&opts, 0, sizeof(opts));
        memset(&new, 0, sizeof(new));
@@ -724,36 +949,42 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 
        /* we can assume from now on new_branch = !new_branch_force */
        if (opts.new_branch && opts.new_branch_force)
-               die("-B cannot be used with -b");
+               die(_("-B cannot be used with -b"));
 
        /* copy -B over to -b, so that we can just check the latter */
        if (opts.new_branch_force)
                opts.new_branch = opts.new_branch_force;
 
        if (patch_mode && (opts.track > 0 || opts.new_branch
-                          || opts.new_branch_log || opts.merge || opts.force))
-               die ("--patch is incompatible with all other options");
+                          || opts.new_branch_log || opts.merge || opts.force
+                          || opts.force_detach))
+               die (_("--patch is incompatible with all other options"));
+
+       if (opts.force_detach && (opts.new_branch || opts.new_orphan_branch))
+               die("--detach cannot be used with -b/-B/--orphan");
+       if (opts.force_detach && 0 < opts.track)
+               die("--detach cannot be used with -t");
 
        /* --track without -b should DWIM */
        if (0 < opts.track && !opts.new_branch) {
                const char *argv0 = argv[0];
                if (!argc || !strcmp(argv0, "--"))
-                       die ("--track needs a branch name");
+                       die (_("--track needs a branch name"));
                if (!prefixcmp(argv0, "refs/"))
                        argv0 += 5;
                if (!prefixcmp(argv0, "remotes/"))
                        argv0 += 8;
                argv0 = strchr(argv0, '/');
                if (!argv0 || !argv0[1])
-                       die ("Missing branch name; try -b");
+                       die (_("Missing branch name; try -b"));
                opts.new_branch = argv0 + 1;
        }
 
        if (opts.new_orphan_branch) {
                if (opts.new_branch)
-                       die("--orphan and -b|-B are mutually exclusive");
+                       die(_("--orphan and -b|-B are mutually exclusive"));
                if (opts.track > 0)
-                       die("--orphan cannot be used with -t");
+                       die(_("--orphan cannot be used with -t"));
                opts.new_branch = opts.new_orphan_branch;
        }
 
@@ -763,108 +994,33 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
        }
 
        if (opts.force && opts.merge)
-               die("git checkout: -f and -m are incompatible");
+               die(_("git checkout: -f and -m are incompatible"));
 
        /*
-        * case 1: git checkout <ref> -- [<paths>]
+        * Extract branch name from command line arguments, so
+        * all that is left is pathspecs.
         *
-        *   <ref> must be a valid tree, everything after the '--' must be
-        *   a path.
-        *
-        * case 2: git checkout -- [<paths>]
-        *
-        *   everything after the '--' must be paths.
-        *
-        * case 3: git checkout <something> [<paths>]
-        *
-        *   With no paths, if <something> is a commit, that is to
-        *   switch to the branch or detach HEAD at it.  As a special case,
-        *   if <something> is A...B (missing A or B means HEAD but you can
-        *   omit at most one side), and if there is a unique merge base
-        *   between A and B, A...B names that merge base.
+        * Handle
         *
-        *   With no paths, if <something> is _not_ a commit, no -t nor -b
-        *   was given, and there is a remote-tracking branch whose name is
-        *   <something> in one and only one remote, then this is a short-hand
-        *   to fork local <something> from that remote-tracking branch.
-        *
-        *   Otherwise <something> shall not be ambiguous.
-        *   - If it's *only* a reference, treat it like case (1).
-        *   - If it's only a path, treat it like case (2).
-        *   - else: fail.
+        *  1) git checkout <tree> -- [<paths>]
+        *  2) git checkout -- [<paths>]
+        *  3) git checkout <something> [<paths>]
         *
+        * including "last branch" syntax and DWIM-ery for names of
+        * remote branches, erroring out for invalid or ambiguous cases.
         */
        if (argc) {
-               if (!strcmp(argv[0], "--")) {       /* case (2) */
-                       argv++;
-                       argc--;
-                       goto no_reference;
-               }
-
-               arg = argv[0];
-               has_dash_dash = (argc > 1) && !strcmp(argv[1], "--");
-
-               if (!strcmp(arg, "-"))
-                       arg = "@{-1}";
-
-               if (get_sha1_mb(arg, rev)) {
-                       if (has_dash_dash)          /* case (1) */
-                               die("invalid reference: %s", arg);
-                       if (!patch_mode &&
-                           dwim_new_local_branch &&
-                           opts.track == BRANCH_TRACK_UNSPECIFIED &&
-                           !opts.new_branch &&
-                           !check_filename(NULL, arg) &&
-                           argc == 1) {
-                               const char *remote = unique_tracking_name(arg);
-                               if (!remote || get_sha1(remote, rev))
-                                       goto no_reference;
-                               opts.new_branch = arg;
-                               arg = remote;
-                               /* DWIMmed to create local branch */
-                       }
-                       else
-                               goto no_reference;
-               }
-
-               /* we can't end up being in (2) anymore, eat the argument */
-               argv++;
-               argc--;
-
-               new.name = arg;
-               if ((new.commit = lookup_commit_reference_gently(rev, 1))) {
-                       setup_branch_path(&new);
-
-                       if ((check_ref_format(new.path) == CHECK_REF_FORMAT_OK) &&
-                           resolve_ref(new.path, rev, 1, NULL))
-                               ;
-                       else
-                               new.path = NULL;
-                       parse_commit(new.commit);
-                       source_tree = new.commit->tree;
-               } else
-                       source_tree = parse_tree_indirect(rev);
-
-               if (!source_tree)                   /* case (1): want a tree */
-                       die("reference is not a tree: %s", arg);
-               if (!has_dash_dash) {/* case (3 -> 1) */
-                       /*
-                        * Do not complain the most common case
-                        *      git checkout branch
-                        * even if there happen to be a file called 'branch';
-                        * it would be extremely annoying.
-                        */
-                       if (argc)
-                               verify_non_filename(NULL, arg);
-               }
-               else {
-                       argv++;
-                       argc--;
-               }
+               int dwim_ok =
+                       !patch_mode &&
+                       dwim_new_local_branch &&
+                       opts.track == BRANCH_TRACK_UNSPECIFIED &&
+                       !opts.new_branch;
+               int n = parse_branchname_arg(argc, argv, dwim_ok,
+                               &new, &source_tree, rev, &opts.new_branch);
+               argv += n;
+               argc -= n;
        }
 
-no_reference:
-
        if (opts.track == BRANCH_TRACK_UNSPECIFIED)
                opts.track = git_branch_track;
 
@@ -872,7 +1028,7 @@ no_reference:
                const char **pathspec = get_pathspec(prefix, argv);
 
                if (!pathspec)
-                       die("invalid path specification");
+                       die(_("invalid path specification"));
 
                if (patch_mode)
                        return interactive_checkout(new.name, pathspec, &opts);
@@ -880,14 +1036,17 @@ no_reference:
                /* Checkout paths */
                if (opts.new_branch) {
                        if (argc == 1) {
-                               die("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?", argv[0]);
+                               die(_("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?"), argv[0]);
                        } else {
-                               die("git checkout: updating paths is incompatible with switching branches.");
+                               die(_("git checkout: updating paths is incompatible with switching branches."));
                        }
                }
 
+               if (opts.force_detach)
+                       die("git checkout: --detach does not take a path argument");
+
                if (1 < !!opts.writeout_stage + !!opts.force + !!opts.merge)
-                       die("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index.");
+                       die(_("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index."));
 
                return checkout_paths(source_tree, pathspec, &opts);
        }
@@ -898,22 +1057,22 @@ no_reference:
        if (opts.new_branch) {
                struct strbuf buf = STRBUF_INIT;
                if (strbuf_check_branch_ref(&buf, opts.new_branch))
-                       die("git checkout: we do not like '%s' as a branch name.",
+                       die(_("git checkout: we do not like '%s' as a branch name."),
                            opts.new_branch);
                if (!get_sha1(buf.buf, rev)) {
                        opts.branch_exists = 1;
                        if (!opts.new_branch_force)
-                               die("git checkout: branch %s already exists",
+                               die(_("git checkout: branch %s already exists"),
                                    opts.new_branch);
                }
                strbuf_release(&buf);
        }
 
        if (new.name && !new.commit) {
-               die("Cannot switch branch to a non-commit.");
+               die(_("Cannot switch branch to a non-commit."));
        }
        if (opts.writeout_stage)
-               die("--ours/--theirs is incompatible with switching branches.");
+               die(_("--ours/--theirs is incompatible with switching branches."));
 
        return switch_branches(&opts, &new);
 }
index 4a312abc6b3ecef5f174b2786ad31385ba058b44..75697f711116e42df1e21e608c21829f49549b08 100644 (file)
@@ -75,11 +75,16 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
                dir.flags |= DIR_SHOW_IGNORED;
 
        if (ignored && ignored_only)
-               die("-x and -X cannot be used together");
-
-       if (!show_only && !force)
-               die("clean.requireForce %s to true and neither -n nor -f given; "
-                   "refusing to clean", config_set ? "set" : "defaults");
+               die(_("-x and -X cannot be used together"));
+
+       if (!show_only && !force) {
+               if (config_set)
+                       die(_("clean.requireForce set to true and neither -n nor -f given; "
+                                 "refusing to clean"));
+               else
+                       die(_("clean.requireForce defaults to true and neither -n nor -f given; "
+                                 "refusing to clean"));
+       }
 
        if (force > 1)
                rm_flags = 0;
@@ -87,7 +92,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
        dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
 
        if (read_cache() < 0)
-               die("index file corrupt");
+               die(_("index file corrupt"));
 
        if (!ignored)
                setup_standard_excludes(&dir);
@@ -146,20 +151,20 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
                        qname = quote_path_relative(directory.buf, directory.len, &buf, prefix);
                        if (show_only && (remove_directories ||
                            (matches == MATCHED_EXACTLY))) {
-                               printf("Would remove %s\n", qname);
+                               printf(_("Would remove %s\n"), qname);
                        } else if (remove_directories ||
                                   (matches == MATCHED_EXACTLY)) {
                                if (!quiet)
-                                       printf("Removing %s\n", qname);
+                                       printf(_("Removing %s\n"), qname);
                                if (remove_dir_recursively(&directory,
                                                           rm_flags) != 0) {
-                                       warning("failed to remove %s", qname);
+                                       warning(_("failed to remove %s"), qname);
                                        errors++;
                                }
                        } else if (show_only) {
-                               printf("Would not remove %s\n", qname);
+                               printf(_("Would not remove %s\n"), qname);
                        } else {
-                               printf("Not removing %s\n", qname);
+                               printf(_("Not removing %s\n"), qname);
                        }
                        strbuf_reset(&directory);
                } else {
@@ -167,13 +172,13 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
                                continue;
                        qname = quote_path_relative(ent->name, -1, &buf, prefix);
                        if (show_only) {
-                               printf("Would remove %s\n", qname);
+                               printf(_("Would remove %s\n"), qname);
                                continue;
                        } else if (!quiet) {
-                               printf("Removing %s\n", qname);
+                               printf(_("Removing %s\n"), qname);
                        }
                        if (unlink(ent->name) != 0) {
-                               warning("failed to remove %s", qname);
+                               warning(_("failed to remove %s"), qname);
                                errors++;
                        }
                }
index 2ee1fa984620de4fad79ce94d4f993f5e83a053d..4144bcf5ca320057b5ef1f5dac9c2df19aba250b 100644 (file)
@@ -8,7 +8,7 @@
  * Clone a repository into a different directory that does not yet exist.
  */
 
-#include "cache.h"
+#include "builtin.h"
 #include "parse-options.h"
 #include "fetch-pack.h"
 #include "refs.h"
@@ -42,6 +42,7 @@ static int option_local, option_no_hardlinks, option_shared, option_recursive;
 static char *option_template, *option_reference, *option_depth;
 static char *option_origin = NULL;
 static char *option_branch = NULL;
+static const char *real_git_dir;
 static char *option_upload_pack = "git-upload-pack";
 static int option_verbosity;
 static int option_progress;
@@ -80,6 +81,8 @@ static struct option builtin_clone_options[] = {
                   "path to git-upload-pack on the remote"),
        OPT_STRING(0, "depth", &option_depth, "depth",
                    "create a shallow clone of that depth"),
+       OPT_STRING('L', "separate-git-dir", &real_git_dir, "gitdir",
+                  "separate git dir from working tree"),
 
        OPT_END()
 };
@@ -100,7 +103,7 @@ static char *get_repo_path(const char *repo, int *is_bundle)
                path = mkpath("%s%s", repo, suffix[i]);
                if (is_directory(path)) {
                        *is_bundle = 0;
-                       return xstrdup(make_nonrelative_path(path));
+                       return xstrdup(absolute_path(path));
                }
        }
 
@@ -109,7 +112,7 @@ static char *get_repo_path(const char *repo, int *is_bundle)
                path = mkpath("%s%s", repo, bundle_suffix[i]);
                if (!stat(path, &st) && S_ISREG(st.st_mode)) {
                        *is_bundle = 1;
-                       return xstrdup(make_nonrelative_path(path));
+                       return xstrdup(absolute_path(path));
                }
        }
 
@@ -203,12 +206,12 @@ static void setup_reference(const char *repo)
        struct transport *transport;
        const struct ref *extra;
 
-       ref_git = make_absolute_path(option_reference);
+       ref_git = real_path(option_reference);
 
        if (is_directory(mkpath("%s/.git/objects", ref_git)))
                ref_git = mkpath("%s/.git", ref_git);
        else if (!is_directory(mkpath("%s/objects", ref_git)))
-               die("reference repository '%s' is not a local directory.",
+               die(_("reference repository '%s' is not a local directory."),
                    option_reference);
 
        ref_git_copy = xstrdup(ref_git);
@@ -235,15 +238,15 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)
 
        dir = opendir(src->buf);
        if (!dir)
-               die_errno("failed to open '%s'", src->buf);
+               die_errno(_("failed to open '%s'"), src->buf);
 
        if (mkdir(dest->buf, 0777)) {
                if (errno != EEXIST)
-                       die_errno("failed to create directory '%s'", dest->buf);
+                       die_errno(_("failed to create directory '%s'"), dest->buf);
                else if (stat(dest->buf, &buf))
-                       die_errno("failed to stat '%s'", dest->buf);
+                       die_errno(_("failed to stat '%s'"), dest->buf);
                else if (!S_ISDIR(buf.st_mode))
-                       die("%s exists and is not a directory", dest->buf);
+                       die(_("%s exists and is not a directory"), dest->buf);
        }
 
        strbuf_addch(src, '/');
@@ -257,7 +260,7 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)
                strbuf_setlen(dest, dest_len);
                strbuf_addstr(dest, de->d_name);
                if (stat(src->buf, &buf)) {
-                       warning ("failed to stat %s\n", src->buf);
+                       warning (_("failed to stat %s\n"), src->buf);
                        continue;
                }
                if (S_ISDIR(buf.st_mode)) {
@@ -267,16 +270,16 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)
                }
 
                if (unlink(dest->buf) && errno != ENOENT)
-                       die_errno("failed to unlink '%s'", dest->buf);
+                       die_errno(_("failed to unlink '%s'"), dest->buf);
                if (!option_no_hardlinks) {
                        if (!link(src->buf, dest->buf))
                                continue;
                        if (option_local)
-                               die_errno("failed to create link '%s'", dest->buf);
+                               die_errno(_("failed to create link '%s'"), dest->buf);
                        option_no_hardlinks = 1;
                }
                if (copy_file_with_time(dest->buf, src->buf, 0666))
-                       die_errno("failed to copy file to '%s'", dest->buf);
+                       die_errno(_("failed to copy file to '%s'"), dest->buf);
        }
        closedir(dir);
 }
@@ -305,7 +308,7 @@ static const struct ref *clone_local(const char *src_repo,
        ret = transport_get_remote_refs(transport);
        transport_disconnect(transport);
        if (0 <= option_verbosity)
-               printf("done.\n");
+               printf(_("done.\n"));
        return ret;
 }
 
@@ -383,15 +386,16 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
        junk_pid = getpid();
 
+       packet_trace_identity("clone");
        argc = parse_options(argc, argv, prefix, builtin_clone_options,
                             builtin_clone_usage, 0);
 
        if (argc > 2)
-               usage_msg_opt("Too many arguments.",
+               usage_msg_opt(_("Too many arguments."),
                        builtin_clone_usage, builtin_clone_options);
 
        if (argc == 0)
-               usage_msg_opt("You must specify a repository to clone.",
+               usage_msg_opt(_("You must specify a repository to clone."),
                        builtin_clone_usage, builtin_clone_options);
 
        if (option_mirror)
@@ -399,7 +403,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
        if (option_bare) {
                if (option_origin)
-                       die("--bare and --origin %s options are incompatible.",
+                       die(_("--bare and --origin %s options are incompatible."),
                            option_origin);
                option_no_checkout = 1;
        }
@@ -411,14 +415,14 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
        path = get_repo_path(repo_name, &is_bundle);
        if (path)
-               repo = xstrdup(make_nonrelative_path(repo_name));
+               repo = xstrdup(absolute_path(repo_name));
        else if (!strchr(repo_name, ':'))
                die("repository '%s' does not exist", repo_name);
        else
                repo = repo_name;
        is_local = path && !is_bundle;
        if (is_local && option_depth)
-               warning("--depth is ignored in local clones; use file:// instead.");
+               warning(_("--depth is ignored in local clones; use file:// instead."));
 
        if (argc == 2)
                dir = xstrdup(argv[1]);
@@ -428,8 +432,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
        dest_exists = !stat(dir, &buf);
        if (dest_exists && !is_empty_dir(dir))
-               die("destination path '%s' already exists and is not "
-                       "an empty directory.", dir);
+               die(_("destination path '%s' already exists and is not "
+                       "an empty directory."), dir);
 
        strbuf_addf(&reflog_msg, "clone: from %s", repo);
 
@@ -438,7 +442,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        else {
                work_tree = getenv("GIT_WORK_TREE");
                if (work_tree && !stat(work_tree, &buf))
-                       die("working tree '%s' already exists.", work_tree);
+                       die(_("working tree '%s' already exists."), work_tree);
        }
 
        if (option_bare || work_tree)
@@ -451,10 +455,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        if (!option_bare) {
                junk_work_tree = work_tree;
                if (safe_create_leading_directories_const(work_tree) < 0)
-                       die_errno("could not create leading directories of '%s'",
+                       die_errno(_("could not create leading directories of '%s'"),
                                  work_tree);
                if (!dest_exists && mkdir(work_tree, 0755))
-                       die_errno("could not create work tree dir '%s'.",
+                       die_errno(_("could not create work tree dir '%s'."),
                                  work_tree);
                set_git_work_tree(work_tree);
        }
@@ -465,12 +469,18 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        setenv(CONFIG_ENVIRONMENT, mkpath("%s/config", git_dir), 1);
 
        if (safe_create_leading_directories_const(git_dir) < 0)
-               die("could not create leading directories of '%s'", git_dir);
-       set_git_dir(make_absolute_path(git_dir));
+               die(_("could not create leading directories of '%s'"), git_dir);
 
-       if (0 <= option_verbosity)
-               printf("Cloning into %s%s...\n",
-                      option_bare ? "bare repository " : "", dir);
+       set_git_dir_init(git_dir, real_git_dir, 0);
+       if (real_git_dir)
+               git_dir = real_git_dir;
+
+       if (0 <= option_verbosity) {
+               if (option_bare)
+                       printf(_("Cloning into bare repository %s...\n"), dir);
+               else
+                       printf(_("Cloning into %s...\n"), dir);
+       }
        init_db(option_template, INIT_DB_QUIET);
 
        /*
@@ -527,7 +537,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                transport = transport_get(remote, remote->url[0]);
 
                if (!transport->get_refs_list || !transport->fetch)
-                       die("Don't know how to clone %s", transport->url);
+                       die(_("Don't know how to clone %s"), transport->url);
 
                transport_set_option(transport, TRANS_OPT_KEEP, "yes");
 
@@ -566,8 +576,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                        strbuf_release(&head);
 
                        if (!our_head_points_at) {
-                               warning("Remote branch %s not found in "
-                                       "upstream %s, using HEAD instead",
+                               warning(_("Remote branch %s not found in "
+                                       "upstream %s, using HEAD instead"),
                                        option_branch, option_origin);
                                our_head_points_at = remote_head_points_at;
                        }
@@ -576,7 +586,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                        our_head_points_at = remote_head_points_at;
        }
        else {
-               warning("You appear to have cloned an empty repository.");
+               warning(_("You appear to have cloned an empty repository."));
                our_head_points_at = NULL;
                remote_head_points_at = NULL;
                remote_head = NULL;
@@ -618,8 +628,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        } else {
                /* Nothing to checkout out */
                if (!option_no_checkout)
-                       warning("remote HEAD refers to nonexistent ref, "
-                               "unable to checkout.\n");
+                       warning(_("remote HEAD refers to nonexistent ref, "
+                               "unable to checkout.\n"));
                option_no_checkout = 1;
        }
 
@@ -655,7 +665,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
                if (write_cache(fd, active_cache, active_nr) ||
                    commit_locked_index(lock_file))
-                       die("unable to write new index file");
+                       die(_("unable to write new index file"));
 
                err |= run_hook(NULL, "post-checkout", sha1_to_hex(null_sha1),
                                sha1_to_hex(our_head_points_at->old_sha1), "1",
index d71e1e0c9c27c4d03cd02b4deaacec67af33917a..67757e999fba514b62767d3351031e9eb6ef8c10 100644 (file)
@@ -38,7 +38,7 @@ static const char * const builtin_status_usage[] = {
 };
 
 static const char implicit_ident_advice[] =
-"Your name and email address were configured automatically based\n"
+N_("Your name and email address were configured automatically based\n"
 "on your username and hostname. Please check that they are accurate.\n"
 "You can suppress this message by setting them explicitly:\n"
 "\n"
@@ -47,16 +47,24 @@ static const char implicit_ident_advice[] =
 "\n"
 "After doing this, you may fix the identity used for this commit with:\n"
 "\n"
-"    git commit --amend --reset-author\n";
+"    git commit --amend --reset-author\n");
 
 static const char empty_amend_advice[] =
-"You asked to amend the most recent commit, but doing so would make\n"
+N_("You asked to amend the most recent commit, but doing so would make\n"
 "it empty. You can repeat your command with --allow-empty, or you can\n"
-"remove the commit entirely with \"git reset HEAD^\".\n";
+"remove the commit entirely with \"git reset HEAD^\".\n");
+
+static const char empty_cherry_pick_advice[] =
+N_("The previous cherry-pick is now empty, possibly due to conflict resolution.\n"
+"If you wish to commit it anyway, use:\n"
+"\n"
+"    git commit --allow-empty\n"
+"\n"
+"Otherwise, please use 'git reset'\n");
 
 static unsigned char head_sha1[20];
 
-static char *use_message_buffer;
+static const char *use_message_buffer;
 static const char commit_editmsg[] = "COMMIT_EDITMSG";
 static struct lock_file index_lock; /* real index */
 static struct lock_file false_lock; /* used only for partial commits */
@@ -68,6 +76,11 @@ static enum {
 
 static const char *logfile, *force_author;
 static const char *template_file;
+/*
+ * The _message variables are commit names from which to take
+ * the commit message and/or authorship.
+ */
+static const char *author_message, *author_message_buffer;
 static char *edit_message, *use_message;
 static char *fixup_message, *squash_message;
 static int all, edit_flag, also, interactive, only, amend, signoff;
@@ -88,7 +101,8 @@ static enum {
 } cleanup_mode;
 static char *cleanup_arg;
 
-static int use_editor = 1, initial_commit, in_merge, include_status = 1;
+static enum commit_whence whence;
+static int use_editor = 1, initial_commit, include_status = 1;
 static int show_ignored_in_status;
 static const char *only_include_assumed;
 static struct strbuf message;
@@ -163,6 +177,36 @@ static struct option builtin_commit_options[] = {
        OPT_END()
 };
 
+static void determine_whence(struct wt_status *s)
+{
+       if (file_exists(git_path("MERGE_HEAD")))
+               whence = FROM_MERGE;
+       else if (file_exists(git_path("CHERRY_PICK_HEAD")))
+               whence = FROM_CHERRY_PICK;
+       else
+               whence = FROM_COMMIT;
+       if (s)
+               s->whence = whence;
+}
+
+static const char *whence_s(void)
+{
+       char *s = "";
+
+       switch (whence) {
+       case FROM_COMMIT:
+               break;
+       case FROM_MERGE:
+               s = "merge";
+               break;
+       case FROM_CHERRY_PICK:
+               s = "cherry-pick";
+               break;
+       }
+
+       return s;
+}
+
 static void rollback_index_files(void)
 {
        switch (commit_style) {
@@ -243,7 +287,7 @@ static void add_remove_files(struct string_list *list)
 
                if (!lstat(p->string, &st)) {
                        if (add_to_cache(p->string, &st, 0))
-                               die("updating files failed");
+                               die(_("updating files failed"));
                } else
                        remove_file_from_cache(p->string);
        }
@@ -270,7 +314,7 @@ static void create_base_index(void)
        opts.fn = oneway_merge;
        tree = parse_tree_indirect(head_sha1);
        if (!tree)
-               die("failed to unpack HEAD tree object");
+               die(_("failed to unpack HEAD tree object"));
        parse_tree(tree);
        init_tree_desc(&t, tree->buffer, tree->size);
        if (unpack_trees(1, &t, &opts))
@@ -298,9 +342,9 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
                refresh_flags |= REFRESH_UNMERGED;
        if (interactive) {
                if (interactive_add(argc, argv, prefix) != 0)
-                       die("interactive add failed");
+                       die(_("interactive add failed"));
                if (read_cache_preload(NULL) < 0)
-                       die("index file corrupt");
+                       die(_("index file corrupt"));
                commit_style = COMMIT_AS_IS;
                return get_index_file();
        }
@@ -309,7 +353,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
                pathspec = get_pathspec(prefix, argv);
 
        if (read_cache_preload(pathspec) < 0)
-               die("index file corrupt");
+               die(_("index file corrupt"));
 
        /*
         * Non partial, non as-is commit.
@@ -329,7 +373,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
                refresh_cache_or_die(refresh_flags);
                if (write_cache(fd, active_cache, active_nr) ||
                    close_lock_file(&index_lock))
-                       die("unable to write new_index file");
+                       die(_("unable to write new_index file"));
                commit_style = COMMIT_NORMAL;
                return index_lock.filename;
        }
@@ -349,7 +393,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
                if (active_cache_changed) {
                        if (write_cache(fd, active_cache, active_nr) ||
                            commit_locked_index(&index_lock))
-                               die("unable to write new_index file");
+                               die(_("unable to write new_index file"));
                } else {
                        rollback_lock_file(&index_lock);
                }
@@ -378,8 +422,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
         */
        commit_style = COMMIT_PARTIAL;
 
-       if (in_merge)
-               die("cannot do a partial commit during a merge.");
+       if (whence != FROM_COMMIT)
+               die(_("cannot do a partial commit during a %s."), whence_s());
 
        memset(&partial, 0, sizeof(partial));
        partial.strdup_strings = 1;
@@ -388,14 +432,14 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 
        discard_cache();
        if (read_cache() < 0)
-               die("cannot read the index");
+               die(_("cannot read the index"));
 
        fd = hold_locked_index(&index_lock, 1);
        add_remove_files(&partial);
        refresh_cache(REFRESH_QUIET);
        if (write_cache(fd, active_cache, active_nr) ||
            close_lock_file(&index_lock))
-               die("unable to write new_index file");
+               die(_("unable to write new_index file"));
 
        fd = hold_lock_file_for_update(&false_lock,
                                       git_path("next-index-%"PRIuMAX,
@@ -408,7 +452,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 
        if (write_cache(fd, active_cache, active_nr) ||
            close_lock_file(&false_lock))
-               die("unable to write temporary index file");
+               die(_("unable to write temporary index file"));
 
        discard_cache();
        read_cache_from(false_lock.filename);
@@ -455,7 +499,7 @@ static int is_a_merge(const unsigned char *sha1)
 {
        struct commit *commit = lookup_commit(sha1);
        if (!commit || parse_commit(commit))
-               die("could not parse HEAD commit");
+               die(_("could not parse HEAD commit"));
        return !!(commit->parents && commit->parents->next);
 }
 
@@ -469,18 +513,18 @@ static void determine_author_info(struct strbuf *author_ident)
        email = getenv("GIT_AUTHOR_EMAIL");
        date = getenv("GIT_AUTHOR_DATE");
 
-       if (use_message && !renew_authorship) {
+       if (author_message) {
                const char *a, *lb, *rb, *eol;
 
-               a = strstr(use_message_buffer, "\nauthor ");
+               a = strstr(author_message_buffer, "\nauthor ");
                if (!a)
-                       die("invalid commit: %s", use_message);
+                       die(_("invalid commit: %s"), author_message);
 
                lb = strchrnul(a + strlen("\nauthor "), '<');
                rb = strchrnul(lb, '>');
                eol = strchrnul(rb, '\n');
                if (!*lb || !*rb || !*eol)
-                       die("invalid commit: %s", use_message);
+                       die(_("invalid commit: %s"), author_message);
 
                if (lb == a + strlen("\nauthor "))
                        /* \nauthor <foo@example.com> */
@@ -498,7 +542,7 @@ static void determine_author_info(struct strbuf *author_ident)
                const char *rb = strchr(force_author, '>');
 
                if (!lb || !rb)
-                       die("malformed --author parameter");
+                       die(_("malformed --author parameter"));
                name = xstrndup(force_author, lb - force_author);
                email = xstrndup(lb + 2, rb - (lb + 2));
        }
@@ -554,7 +598,7 @@ static char *cut_ident_timestamp_part(char *string)
 {
        char *ket = strrchr(string, '>');
        if (!ket || ket[1] != ' ')
-               die("Malformed ident string: '%s'", string);
+               die(_("Malformed ident string: '%s'"), string);
        *++ket = '\0';
        return ket;
 }
@@ -568,7 +612,6 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
        int commitable, saved_color_setting;
        struct strbuf sb = STRBUF_INIT;
        char *buffer;
-       FILE *fp;
        const char *hook_arg1 = NULL;
        const char *hook_arg2 = NULL;
        int ident_shown = 0;
@@ -588,7 +631,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                        struct commit *c;
                        c = lookup_commit_reference_by_name(squash_message);
                        if (!c)
-                               die("could not lookup commit %s", squash_message);
+                               die(_("could not lookup commit %s"), squash_message);
                        ctx.output_encoding = get_commit_output_encoding();
                        format_commit_message(c, "squash! %s\n\n", &sb,
                                              &ctx);
@@ -600,19 +643,19 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                hook_arg1 = "message";
        } else if (logfile && !strcmp(logfile, "-")) {
                if (isatty(0))
-                       fprintf(stderr, "(reading log message from standard input)\n");
+                       fprintf(stderr, _("(reading log message from standard input)\n"));
                if (strbuf_read(&sb, 0, 0) < 0)
-                       die_errno("could not read log from standard input");
+                       die_errno(_("could not read log from standard input"));
                hook_arg1 = "message";
        } else if (logfile) {
                if (strbuf_read_file(&sb, logfile, 0) < 0)
-                       die_errno("could not read log file '%s'",
+                       die_errno(_("could not read log file '%s'"),
                                  logfile);
                hook_arg1 = "message";
        } else if (use_message) {
                buffer = strstr(use_message_buffer, "\n\n");
                if (!buffer || buffer[2] == '\0')
-                       die("commit has empty message");
+                       die(_("commit has empty message"));
                strbuf_add(&sb, buffer + 2, strlen(buffer + 2));
                hook_arg1 = "commit";
                hook_arg2 = use_message;
@@ -621,31 +664,35 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                struct commit *commit;
                commit = lookup_commit_reference_by_name(fixup_message);
                if (!commit)
-                       die("could not lookup commit %s", fixup_message);
+                       die(_("could not lookup commit %s"), fixup_message);
                ctx.output_encoding = get_commit_output_encoding();
                format_commit_message(commit, "fixup! %s\n\n",
                                      &sb, &ctx);
                hook_arg1 = "message";
        } else if (!stat(git_path("MERGE_MSG"), &statbuf)) {
                if (strbuf_read_file(&sb, git_path("MERGE_MSG"), 0) < 0)
-                       die_errno("could not read MERGE_MSG");
+                       die_errno(_("could not read MERGE_MSG"));
                hook_arg1 = "merge";
        } else if (!stat(git_path("SQUASH_MSG"), &statbuf)) {
                if (strbuf_read_file(&sb, git_path("SQUASH_MSG"), 0) < 0)
-                       die_errno("could not read SQUASH_MSG");
+                       die_errno(_("could not read SQUASH_MSG"));
                hook_arg1 = "squash";
        } else if (template_file) {
                if (strbuf_read_file(&sb, template_file, 0) < 0)
-                       die_errno("could not read '%s'", template_file);
+                       die_errno(_("could not read '%s'"), template_file);
                hook_arg1 = "template";
        }
 
        /*
-        * This final case does not modify the template message,
-        * it just sets the argument to the prepare-commit-msg hook.
+        * The remaining cases don't modify the template message, but
+        * just set the argument(s) to the prepare-commit-msg hook.
         */
-       else if (in_merge)
+       else if (whence == FROM_MERGE)
                hook_arg1 = "merge";
+       else if (whence == FROM_CHERRY_PICK) {
+               hook_arg1 = "commit";
+               hook_arg2 = "CHERRY_PICK_HEAD";
+       }
 
        if (squash_message) {
                /*
@@ -657,9 +704,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                hook_arg2 = "";
        }
 
-       fp = fopen(git_path(commit_editmsg), "w");
-       if (fp == NULL)
-               die_errno("could not open '%s'", git_path(commit_editmsg));
+       s->fp = fopen(git_path(commit_editmsg), "w");
+       if (s->fp == NULL)
+               die_errno(_("could not open '%s'"), git_path(commit_editmsg));
 
        if (cleanup_mode != CLEANUP_NONE)
                stripspace(&sb, 0);
@@ -682,8 +729,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                strbuf_release(&sob);
        }
 
-       if (fwrite(sb.buf, 1, sb.len, fp) < sb.len)
-               die_errno("could not write commit template");
+       if (fwrite(sb.buf, 1, sb.len, s->fp) < sb.len)
+               die_errno(_("could not write commit template"));
 
        strbuf_release(&sb);
 
@@ -694,55 +741,59 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
        strbuf_addstr(&committer_ident, git_committer_info(0));
        if (use_editor && include_status) {
                char *ai_tmp, *ci_tmp;
-               if (in_merge)
-                       fprintf(fp,
-                               "#\n"
-                               "# It looks like you may be committing a MERGE.\n"
-                               "# If this is not correct, please remove the file\n"
-                               "#      %s\n"
-                               "# and try again.\n"
-                               "#\n",
-                               git_path("MERGE_HEAD"));
-
-               fprintf(fp,
-                       "\n"
-                       "# Please enter the commit message for your changes.");
+               if (whence != FROM_COMMIT)
+                       status_printf_ln(s, GIT_COLOR_NORMAL,
+                               _("\n"
+                               "It looks like you may be committing a %s.\n"
+                               "If this is not correct, please remove the file\n"
+                               "       %s\n"
+                               "and try again.\n"
+                               ""),
+                               whence_s(),
+                               git_path(whence == FROM_MERGE
+                                        ? "MERGE_HEAD"
+                                        : "CHERRY_PICK_HEAD"));
+
+               fprintf(s->fp, "\n");
+               status_printf(s, GIT_COLOR_NORMAL,
+                       _("Please enter the commit message for your changes."));
                if (cleanup_mode == CLEANUP_ALL)
-                       fprintf(fp,
-                               " Lines starting\n"
-                               "with '#' will be ignored, and an empty"
-                               " message aborts the commit.\n");
+                       status_printf_more(s, GIT_COLOR_NORMAL,
+                               _(" Lines starting\n"
+                               "with '#' will be ignored, and an empty"
+                               " message aborts the commit.\n"));
                else /* CLEANUP_SPACE, that is. */
-                       fprintf(fp,
-                               " Lines starting\n"
-                               "with '#' will be kept; you may remove them"
+                       status_printf_more(s, GIT_COLOR_NORMAL,
+                               _(" Lines starting\n"
+                               "with '#' will be kept; you may remove them"
                                " yourself if you want to.\n"
-                               "# An empty message aborts the commit.\n");
+                               "An empty message aborts the commit.\n"));
                if (only_include_assumed)
-                       fprintf(fp, "# %s\n", only_include_assumed);
+                       status_printf_ln(s, GIT_COLOR_NORMAL,
+                                       "%s", only_include_assumed);
 
                ai_tmp = cut_ident_timestamp_part(author_ident->buf);
                ci_tmp = cut_ident_timestamp_part(committer_ident.buf);
                if (strcmp(author_ident->buf, committer_ident.buf))
-                       fprintf(fp,
-                               "%s"
-                               "# Author:    %s\n",
-                               ident_shown++ ? "" : "#\n",
+                       status_printf_ln(s, GIT_COLOR_NORMAL,
+                               _("%s"
+                               "Author:    %s"),
+                               ident_shown++ ? "" : "\n",
                                author_ident->buf);
 
                if (!user_ident_sufficiently_given())
-                       fprintf(fp,
-                               "%s"
-                               "# Committer: %s\n",
-                               ident_shown++ ? "" : "#\n",
+                       status_printf_ln(s, GIT_COLOR_NORMAL,
+                               _("%s"
+                               "Committer: %s"),
+                               ident_shown++ ? "" : "\n",
                                committer_ident.buf);
 
                if (ident_shown)
-                       fprintf(fp, "#\n");
+                       status_printf_ln(s, GIT_COLOR_NORMAL, "");
 
                saved_color_setting = s->use_color;
                s->use_color = 0;
-               commitable = run_status(fp, index_file, prefix, 1, s);
+               commitable = run_status(s->fp, index_file, prefix, 1, s);
                s->use_color = saved_color_setting;
 
                *ai_tmp = ' ';
@@ -752,7 +803,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                const char *parent = "HEAD";
 
                if (!active_nr && read_cache() < 0)
-                       die("Cannot read index");
+                       die(_("Cannot read index"));
 
                if (amend)
                        parent = "HEAD^1";
@@ -764,13 +815,20 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
        }
        strbuf_release(&committer_ident);
 
-       fclose(fp);
+       fclose(s->fp);
 
-       if (!commitable && !in_merge && !allow_empty &&
+       /*
+        * Reject an attempt to record a non-merge empty commit without
+        * explicit --allow-empty. In the cherry-pick case, it may be
+        * empty due to conflict resolution, which the user should okay.
+        */
+       if (!commitable && whence != FROM_MERGE && !allow_empty &&
            !(amend && is_a_merge(head_sha1))) {
                run_status(stdout, index_file, prefix, 0, s);
                if (amend)
-                       fputs(empty_amend_advice, stderr);
+                       fputs(_(empty_amend_advice), stderr);
+               else if (whence == FROM_CHERRY_PICK)
+                       fputs(_(empty_cherry_pick_advice), stderr);
                return 0;
        }
 
@@ -785,7 +843,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                active_cache_tree = cache_tree();
        if (cache_tree_update(active_cache_tree,
                              active_cache, active_nr, 0, 0) < 0) {
-               error("Error building trees");
+               error(_("Error building trees"));
                return 0;
        }
 
@@ -800,7 +858,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
                if (launch_editor(git_path(commit_editmsg), NULL, env)) {
                        fprintf(stderr,
-                       "Please supply the message using either -m or -F option.\n");
+                       _("Please supply the message using either -m or -F option.\n"));
                        exit(1);
                }
        }
@@ -880,7 +938,7 @@ static const char *find_author_by_nickname(const char *name)
                format_commit_message(commit, "%an <%ae>", &buf, &ctx);
                return strbuf_detach(&buf, NULL);
        }
-       die("No existing author found with '%s'", name);
+       die(_("No existing author found with '%s'"), name);
 }
 
 
@@ -895,7 +953,29 @@ static void handle_untracked_files_arg(struct wt_status *s)
        else if (!strcmp(untracked_files_arg, "all"))
                s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
        else
-               die("Invalid untracked files mode '%s'", untracked_files_arg);
+               die(_("Invalid untracked files mode '%s'"), untracked_files_arg);
+}
+
+static const char *read_commit_message(const char *name)
+{
+       const char *out_enc, *out;
+       struct commit *commit;
+
+       commit = lookup_commit_reference_by_name(name);
+       if (!commit)
+               die(_("could not lookup commit %s"), name);
+       out_enc = get_commit_output_encoding();
+       out = logmsg_reencode(commit, out_enc);
+
+       /*
+        * If we failed to reencode the buffer, just copy it
+        * byte for byte so the user can try to fix it up.
+        * This also handles the case where input and output
+        * encodings are identical.
+        */
+       if (out == NULL)
+               out = xstrdup(commit->buffer);
+       return out;
 }
 
 static int parse_and_validate_options(int argc, const char *argv[],
@@ -912,7 +992,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
                force_author = find_author_by_nickname(force_author);
 
        if (force_author && renew_authorship)
-               die("Using both --reset-author and --author does not make sense");
+               die(_("Using both --reset-author and --author does not make sense"));
 
        if (logfile || message.len || use_message || fixup_message)
                use_editor = 0;
@@ -926,11 +1006,11 @@ static int parse_and_validate_options(int argc, const char *argv[],
 
        /* Sanity check options */
        if (amend && initial_commit)
-               die("You have nothing to amend.");
-       if (amend && in_merge)
-               die("You are in the middle of a merge -- cannot amend.");
+               die(_("You have nothing to amend."));
+       if (amend && whence != FROM_COMMIT)
+               die(_("You are in the middle of a %s -- cannot amend."), whence_s());
        if (fixup_message && squash_message)
-               die("Options --squash and --fixup cannot be used together");
+               die(_("Options --squash and --fixup cannot be used together"));
        if (use_message)
                f++;
        if (edit_message)
@@ -940,43 +1020,35 @@ static int parse_and_validate_options(int argc, const char *argv[],
        if (logfile)
                f++;
        if (f > 1)
-               die("Only one of -c/-C/-F/--fixup can be used.");
+               die(_("Only one of -c/-C/-F/--fixup can be used."));
        if (message.len && f > 0)
-               die("Option -m cannot be combined with -c/-C/-F/--fixup.");
+               die((_("Option -m cannot be combined with -c/-C/-F/--fixup.")));
        if (edit_message)
                use_message = edit_message;
        if (amend && !use_message && !fixup_message)
                use_message = "HEAD";
-       if (!use_message && renew_authorship)
-               die("--reset-author can be used only with -C, -c or --amend.");
+       if (!use_message && whence != FROM_CHERRY_PICK && renew_authorship)
+               die(_("--reset-author can be used only with -C, -c or --amend."));
        if (use_message) {
-               const char *out_enc;
-               struct commit *commit;
-
-               commit = lookup_commit_reference_by_name(use_message);
-               if (!commit)
-                       die("could not lookup commit %s", use_message);
-               out_enc = get_commit_output_encoding();
-               use_message_buffer = logmsg_reencode(commit, out_enc);
-
-               /*
-                * If we failed to reencode the buffer, just copy it
-                * byte for byte so the user can try to fix it up.
-                * This also handles the case where input and output
-                * encodings are identical.
-                */
-               if (use_message_buffer == NULL)
-                       use_message_buffer = xstrdup(commit->buffer);
+               use_message_buffer = read_commit_message(use_message);
+               if (!renew_authorship) {
+                       author_message = use_message;
+                       author_message_buffer = use_message_buffer;
+               }
+       }
+       if (whence == FROM_CHERRY_PICK && !renew_authorship) {
+               author_message = "CHERRY_PICK_HEAD";
+               author_message_buffer = read_commit_message(author_message);
        }
 
        if (!!also + !!only + !!all + !!interactive > 1)
-               die("Only one of --include/--only/--all/--interactive can be used.");
+               die(_("Only one of --include/--only/--all/--interactive can be used."));
        if (argc == 0 && (also || (only && !amend)))
-               die("No paths with --include/--only does not make sense.");
+               die(_("No paths with --include/--only does not make sense."));
        if (argc == 0 && only && amend)
-               only_include_assumed = "Clever... amending the last one with dirty index.";
+               only_include_assumed = _("Clever... amending the last one with dirty index.");
        if (argc > 0 && !also && !only)
-               only_include_assumed = "Explicit paths specified without -i nor -o; assuming --only paths...";
+               only_include_assumed = _("Explicit paths specified without -i nor -o; assuming --only paths...");
        if (!cleanup_arg || !strcmp(cleanup_arg, "default"))
                cleanup_mode = use_editor ? CLEANUP_ALL : CLEANUP_SPACE;
        else if (!strcmp(cleanup_arg, "verbatim"))
@@ -986,14 +1058,14 @@ static int parse_and_validate_options(int argc, const char *argv[],
        else if (!strcmp(cleanup_arg, "strip"))
                cleanup_mode = CLEANUP_ALL;
        else
-               die("Invalid cleanup mode %s", cleanup_arg);
+               die(_("Invalid cleanup mode %s"), cleanup_arg);
 
        handle_untracked_files_arg(s);
 
        if (all && argc > 0)
-               die("Paths with -a does not make sense.");
+               die(_("Paths with -a does not make sense."));
        else if (interactive && argc > 0)
-               die("Paths with --interactive does not make sense.");
+               die(_("Paths with --interactive does not make sense."));
 
        if (null_termination && status_format == STATUS_FORMAT_LONG)
                status_format = STATUS_FORMAT_PORCELAIN;
@@ -1074,7 +1146,7 @@ static int git_status_config(const char *k, const char *v, void *cb)
                else if (!strcmp(v, "all"))
                        s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
                else
-                       return error("Invalid untracked files mode '%s'", v);
+                       return error(_("Invalid untracked files mode '%s'"), v);
                return 0;
        }
        return git_diff_ui_config(k, v, NULL);
@@ -1117,7 +1189,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
        wt_status_prepare(&s);
        gitmodules_config();
        git_config(git_status_config, &s);
-       in_merge = file_exists(git_path("MERGE_HEAD"));
+       determine_whence(&s);
        argc = parse_options(argc, argv, prefix,
                             builtin_status_options,
                             builtin_status_usage, 0);
@@ -1131,16 +1203,10 @@ int cmd_status(int argc, const char **argv, const char *prefix)
        refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, s.pathspec, NULL, NULL);
 
        fd = hold_locked_index(&index_lock, 0);
-       if (0 <= fd) {
-               if (active_cache_changed &&
-                   !write_cache(fd, active_cache, active_nr))
-                       commit_locked_index(&index_lock);
-               else
-                       rollback_lock_file(&index_lock);
-       }
+       if (0 <= fd)
+               update_index_if_able(&the_index, &index_lock);
 
        s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
-       s.in_merge = in_merge;
        s.ignore_submodule_arg = ignore_submodule_arg;
        wt_status_collect(&s);
 
@@ -1180,9 +1246,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 
        commit = lookup_commit(sha1);
        if (!commit)
-               die("couldn't look up newly created commit");
+               die(_("couldn't look up newly created commit"));
        if (!commit || parse_commit(commit))
-               die("could not parse newly created commit");
+               die(_("could not parse newly created commit"));
 
        strbuf_addstr(&format, "format:%h] %s");
 
@@ -1197,7 +1263,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
                strbuf_addbuf_percentquote(&format, &committer_ident);
                if (advice_implicit_identity) {
                        strbuf_addch(&format, '\n');
-                       strbuf_addstr(&format, implicit_ident_advice);
+                       strbuf_addstr(&format, _(implicit_ident_advice));
                }
        }
        strbuf_release(&author_ident);
@@ -1215,7 +1281,6 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
        get_commit_format(format.buf, &rev);
        rev.always_show_header = 0;
        rev.diffopt.detect_rename = 1;
-       rev.diffopt.rename_limit = 100;
        rev.diffopt.break_opt = 0;
        diff_setup_done(&rev.diffopt);
 
@@ -1223,9 +1288,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
                !prefixcmp(head, "refs/heads/") ?
                        head + 11 :
                        !strcmp(head, "HEAD") ?
-                               "detached HEAD" :
+                               _("detached HEAD") :
                                head,
-               initial_commit ? " (root-commit)" : "");
+               initial_commit ? _(" (root-commit)") : "");
 
        if (!log_tree_commit(&rev, commit)) {
                rev.always_show_header = 1;
@@ -1302,8 +1367,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
        wt_status_prepare(&s);
        git_config(git_commit_config, &s);
-       in_merge = file_exists(git_path("MERGE_HEAD"));
-       s.in_merge = in_merge;
+       determine_whence(&s);
 
        if (s.use_color == -1)
                s.use_color = git_use_color_default;
@@ -1336,11 +1400,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                        reflog_msg = "commit (amend)";
                commit = lookup_commit(head_sha1);
                if (!commit || parse_commit(commit))
-                       die("could not parse HEAD commit");
+                       die(_("could not parse HEAD commit"));
 
                for (c = commit->parents; c; c = c->next)
                        pptr = &commit_list_insert(c->item, pptr)->next;
-       } else if (in_merge) {
+       } else if (whence == FROM_MERGE) {
                struct strbuf m = STRBUF_INIT;
                FILE *fp;
 
@@ -1349,19 +1413,19 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
                fp = fopen(git_path("MERGE_HEAD"), "r");
                if (fp == NULL)
-                       die_errno("could not open '%s' for reading",
+                       die_errno(_("could not open '%s' for reading"),
                                  git_path("MERGE_HEAD"));
                while (strbuf_getline(&m, fp, '\n') != EOF) {
                        unsigned char sha1[20];
                        if (get_sha1_hex(m.buf, sha1) < 0)
-                               die("Corrupt MERGE_HEAD file (%s)", m.buf);
+                               die(_("Corrupt MERGE_HEAD file (%s)"), m.buf);
                        pptr = &commit_list_insert(lookup_commit(sha1), pptr)->next;
                }
                fclose(fp);
                strbuf_release(&m);
                if (!stat(git_path("MERGE_MODE"), &statbuf)) {
                        if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 0)
-                               die_errno("could not read MERGE_MODE");
+                               die_errno(_("could not read MERGE_MODE"));
                        if (!strcmp(sb.buf, "no-ff"))
                                allow_fast_forward = 0;
                }
@@ -1369,7 +1433,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                        parents = reduce_heads(parents);
        } else {
                if (!reflog_msg)
-                       reflog_msg = "commit";
+                       reflog_msg = (whence == FROM_CHERRY_PICK)
+                                       ? "commit (cherry-pick)"
+                                       : "commit";
                pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
        }
 
@@ -1378,7 +1444,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
        if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
                int saved_errno = errno;
                rollback_index_files();
-               die("could not read commit message: %s", strerror(saved_errno));
+               die(_("could not read commit message: %s"), strerror(saved_errno));
        }
 
        /* Truncate the message just before the diff, if any. */
@@ -1392,14 +1458,14 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                stripspace(&sb, cleanup_mode == CLEANUP_ALL);
        if (message_is_empty(&sb) && !allow_empty_message) {
                rollback_index_files();
-               fprintf(stderr, "Aborting commit due to empty commit message.\n");
+               fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
                exit(1);
        }
 
        if (commit_tree(sb.buf, active_cache_tree->sha1, parents, commit_sha1,
                        author_ident.buf)) {
                rollback_index_files();
-               die("failed to write commit object");
+               die(_("failed to write commit object"));
        }
        strbuf_release(&author_ident);
 
@@ -1417,22 +1483,23 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
        if (!ref_lock) {
                rollback_index_files();
-               die("cannot lock HEAD ref");
+               die(_("cannot lock HEAD ref"));
        }
        if (write_ref_sha1(ref_lock, commit_sha1, sb.buf) < 0) {
                rollback_index_files();
-               die("cannot update HEAD ref");
+               die(_("cannot update HEAD ref"));
        }
 
+       unlink(git_path("CHERRY_PICK_HEAD"));
        unlink(git_path("MERGE_HEAD"));
        unlink(git_path("MERGE_MSG"));
        unlink(git_path("MERGE_MODE"));
        unlink(git_path("SQUASH_MSG"));
 
        if (commit_index_files())
-               die ("Repository has been updated, but unable to write\n"
+               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.");
+                    "not exceeded, and then \"git reset HEAD\" to recover."));
 
        rerere(0);
        run_hook(get_index_file(), "post-commit", NULL);
index b8b18e3c94b5730afb343089821e8e622a5b00ee..3e3c52849773348a568241f678b3e3ee2e8d123a 100644 (file)
@@ -153,7 +153,6 @@ static int show_config(const char *key_, const char *value_, void *cb)
 static int get_value(const char *key_, const char *regex_)
 {
        int ret = -1;
-       char *tl;
        char *global = NULL, *repo_config = NULL;
        const char *system_wide = NULL, *local;
 
@@ -161,24 +160,38 @@ static int get_value(const char *key_, const char *regex_)
        if (!local) {
                const char *home = getenv("HOME");
                local = repo_config = git_pathdup("config");
-               if (git_config_global() && home)
+               if (home)
                        global = xstrdup(mkpath("%s/.gitconfig", home));
                if (git_config_system())
                        system_wide = git_etc_gitconfig();
        }
 
-       key = xstrdup(key_);
-       for (tl=key+strlen(key)-1; tl >= key && *tl != '.'; --tl)
-               *tl = tolower(*tl);
-       for (tl=key; *tl && *tl != '.'; ++tl)
-               *tl = tolower(*tl);
-
        if (use_key_regexp) {
+               char *tl;
+
+               /*
+                * NEEDSWORK: this naive pattern lowercasing obviously does not
+                * work for more complex patterns like "^[^.]*Foo.*bar".
+                * Perhaps we should deprecate this altogether someday.
+                */
+
+               key = xstrdup(key_);
+               for (tl = key + strlen(key) - 1;
+                    tl >= key && *tl != '.';
+                    tl--)
+                       *tl = tolower(*tl);
+               for (tl = key; *tl && *tl != '.'; tl++)
+                       *tl = tolower(*tl);
+
                key_regexp = (regex_t*)xmalloc(sizeof(regex_t));
                if (regcomp(key_regexp, key, REG_EXTENDED)) {
                        fprintf(stderr, "Invalid key pattern: %s\n", key_);
+                       free(key);
                        goto free_strings;
                }
+       } else {
+               if (git_config_parse_key(key_, &key, NULL))
+                       goto free_strings;
        }
 
        if (regex_) {
@@ -500,3 +513,9 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 
        return 0;
 }
+
+int cmd_repo_config(int argc, const char **argv, const char *prefix)
+{
+       fprintf(stderr, "WARNING: git repo-config is deprecated in favor of git config.\n");
+       return cmd_config(argc, argv, prefix);
+}
index 3ba26dc8192d0a75d7e330d2f73d0d9841a6216c..66fc291c8a81de71dee7b597c9ab0dc9d70e8e29 100644 (file)
@@ -21,7 +21,7 @@ static int debug;     /* Display lots of verbose info */
 static int all;        /* Any valid ref can be used */
 static int tags;       /* Allow lightweight tags */
 static int longformat;
-static int abbrev = DEFAULT_ABBREV;
+static int abbrev = -1; /* unspecified */
 static int max_candidates = 10;
 static struct hash_table names;
 static int have_util;
@@ -231,13 +231,13 @@ static void display_name(struct commit_name *n)
        if (n->prio == 2 && !n->tag) {
                n->tag = lookup_tag(n->sha1);
                if (!n->tag || parse_tag(n->tag))
-                       die("annotated tag %s not available", n->path);
+                       die(_("annotated tag %s not available"), n->path);
        }
        if (n->tag && !n->name_checked) {
                if (!n->tag->tag)
-                       die("annotated tag %s has no embedded name", n->path);
+                       die(_("annotated tag %s has no embedded name"), n->path);
                if (strcmp(n->tag->tag, all ? n->path + 5 : n->path))
-                       warning("tag '%s' is really '%s' here", n->tag->tag, n->path);
+                       warning(_("tag '%s' is really '%s' here"), n->tag->tag, n->path);
                n->name_checked = 1;
        }
 
@@ -264,10 +264,10 @@ static void describe(const char *arg, int last_one)
        unsigned int unannotated_cnt = 0;
 
        if (get_sha1(arg, sha1))
-               die("Not a valid object name %s", arg);
+               die(_("Not a valid object name %s"), arg);
        cmit = lookup_commit_reference(sha1);
        if (!cmit)
-               die("%s is not a valid '%s' object", arg, commit_type);
+               die(_("%s is not a valid '%s' object"), arg, commit_type);
 
        n = find_commit_name(cmit->object.sha1);
        if (n && (tags || all || n->prio == 2)) {
@@ -284,9 +284,9 @@ static void describe(const char *arg, int last_one)
        }
 
        if (!max_candidates)
-               die("no tag exactly matches '%s'", sha1_to_hex(cmit->object.sha1));
+               die(_("no tag exactly matches '%s'"), sha1_to_hex(cmit->object.sha1));
        if (debug)
-               fprintf(stderr, "searching to describe %s\n", arg);
+               fprintf(stderr, _("searching to describe %s\n"), arg);
 
        if (!have_util) {
                for_each_hash(&names, set_util, NULL);
@@ -326,7 +326,7 @@ static void describe(const char *arg, int last_one)
                }
                if (annotated_cnt && !list) {
                        if (debug)
-                               fprintf(stderr, "finished search at %s\n",
+                               fprintf(stderr, _("finished search at %s\n"),
                                        sha1_to_hex(c->object.sha1));
                        break;
                }
@@ -350,12 +350,12 @@ static void describe(const char *arg, int last_one)
                        return;
                }
                if (unannotated_cnt)
-                       die("No annotated tags can describe '%s'.\n"
-                           "However, there were unannotated tags: try --tags.",
+                       die(_("No annotated tags can describe '%s'.\n"
+                           "However, there were unannotated tags: try --tags."),
                            sha1_to_hex(sha1));
                else
-                       die("No tags can describe '%s'.\n"
-                           "Try --always, or create some tags.",
+                       die(_("No tags can describe '%s'.\n"
+                           "Try --always, or create some tags."),
                            sha1_to_hex(sha1));
        }
 
@@ -375,11 +375,11 @@ static void describe(const char *arg, int last_one)
                                prio_names[t->name->prio],
                                t->depth, t->name->path);
                }
-               fprintf(stderr, "traversed %lu commits\n", seen_commits);
+               fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
                if (gave_up_on) {
                        fprintf(stderr,
-                               "more than %i tags found; listed %i most recent\n"
-                               "gave up search at %s\n",
+                               _("more than %i tags found; listed %i most recent\n"
+                               "gave up search at %s\n"),
                                max_candidates, max_candidates,
                                sha1_to_hex(gave_up_on->object.sha1));
                }
@@ -420,7 +420,11 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                OPT_END(),
        };
 
+       git_config(git_default_config, NULL);
        argc = parse_options(argc, argv, prefix, options, describe_usage, 0);
+       if (abbrev < 0)
+               abbrev = DEFAULT_ABBREV;
+
        if (max_candidates < 0)
                max_candidates = 0;
        else if (max_candidates > MAX_TAGS)
@@ -429,7 +433,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
        save_commit_buffer = 0;
 
        if (longformat && abbrev == 0)
-               die("--long is incompatible with --abbrev=0");
+               die(_("--long is incompatible with --abbrev=0"));
 
        if (contains) {
                const char **args = xmalloc((7 + argc) * sizeof(char *));
@@ -455,14 +459,14 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
        init_hash(&names);
        for_each_rawref(get_name, NULL);
        if (!names.nr && !always)
-               die("No names found, cannot describe anything.");
+               die(_("No names found, cannot describe anything."));
 
        if (argc == 0) {
                if (dirty && !cmd_diff_index(ARRAY_SIZE(diff_index_args) - 1, diff_index_args, prefix))
                        dirty = NULL;
                describe("HEAD", 1);
        } else if (dirty) {
-               die("--dirty is incompatible with committishes");
+               die(_("--dirty is incompatible with committishes"));
        } else {
                while (argc-- > 0) {
                        describe(*argv++, argc == 0);
index 951c7c8994704543fc1784c87a17a1aa47ede257..46085f862f937b005493319cea25b93bcb10c999 100644 (file)
@@ -61,7 +61,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
            (rev.diffopt.output_format & DIFF_FORMAT_PATCH))
                rev.combine_merges = rev.dense_combined_merges = 1;
 
-       if (read_cache_preload(rev.diffopt.paths) < 0) {
+       if (read_cache_preload(rev.diffopt.pathspec.raw) < 0) {
                perror("read_cache_preload");
                return -1;
        }
index 42822cd5374dbcf0e63c17078a55284c432ddc77..717fa1a3414e18cbdd4c6eb1e0785761687688d7 100644 (file)
@@ -71,9 +71,9 @@ static int builtin_diff_b_f(struct rev_info *revs,
                usage(builtin_diff_usage);
 
        if (lstat(path, &st))
-               die_errno("failed to stat '%s'", path);
+               die_errno(_("failed to stat '%s'"), path);
        if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)))
-               die("'%s': not a regular file or symlink", path);
+               die(_("'%s': not a regular file or symlink"), path);
 
        diff_set_mnemonic_prefix(&revs->diffopt, "o/", "w/");
 
@@ -135,7 +135,7 @@ static int builtin_diff_index(struct rev_info *revs,
            revs->max_count != -1 || revs->min_age != -1 ||
            revs->max_age != -1)
                usage(builtin_diff_usage);
-       if (read_cache_preload(revs->diffopt.paths) < 0) {
+       if (read_cache_preload(revs->diffopt.pathspec.raw) < 0) {
                perror("read_cache_preload");
                return -1;
        }
@@ -197,12 +197,7 @@ static void refresh_index_quietly(void)
        discard_cache();
        read_cache();
        refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
-
-       if (active_cache_changed &&
-           !write_cache(fd, active_cache, active_nr))
-               commit_locked_index(lock_file);
-
-       rollback_lock_file(lock_file);
+       update_index_if_able(&the_index, lock_file);
 }
 
 static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv)
@@ -222,7 +217,7 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
                else if (!strcmp(argv[1], "-h"))
                        usage(builtin_diff_usage);
                else
-                       return error("invalid option: %s", argv[1]);
+                       return error(_("invalid option: %s"), argv[1]);
                argv++; argc--;
        }
 
@@ -237,7 +232,7 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
                revs->combine_merges = revs->dense_combined_merges = 1;
 
        setup_work_tree();
-       if (read_cache_preload(revs->diffopt.paths) < 0) {
+       if (read_cache_preload(revs->diffopt.pathspec.raw) < 0) {
                perror("read_cache_preload");
                return -1;
        }
@@ -299,12 +294,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
 
        if (nongit)
-               die("Not a git repository");
+               die(_("Not a git repository"));
        argc = setup_revisions(argc, argv, &rev, NULL);
        if (!rev.diffopt.output_format) {
                rev.diffopt.output_format = DIFF_FORMAT_PATCH;
                if (diff_setup_done(&rev.diffopt) < 0)
-                       die("diff_setup_done failed");
+                       die(_("diff_setup_done failed"));
        }
 
        DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
@@ -349,12 +344,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
                        obj = parse_object(obj->sha1);
                obj = deref_tag(obj, NULL, 0);
                if (!obj)
-                       die("invalid object '%s' given.", name);
+                       die(_("invalid object '%s' given."), name);
                if (obj->type == OBJ_COMMIT)
                        obj = &((struct commit *)obj)->tree->object;
                if (obj->type == OBJ_TREE) {
                        if (ARRAY_SIZE(ent) <= ents)
-                               die("more than %d trees given: '%s'",
+                               die(_("more than %d trees given: '%s'"),
                                    (int) ARRAY_SIZE(ent), name);
                        obj->flags |= flags;
                        ent[ents].item = obj;
@@ -364,7 +359,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
                }
                if (obj->type == OBJ_BLOB) {
                        if (2 <= blobs)
-                               die("more than two blobs given: '%s'", name);
+                               die(_("more than two blobs given: '%s'"), name);
                        hashcpy(blob[blobs].sha1, obj->sha1);
                        blob[blobs].name = name;
                        blob[blobs].mode = list->mode;
@@ -372,16 +367,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
                        continue;
 
                }
-               die("unhandled object '%s' given.", name);
+               die(_("unhandled object '%s' given."), name);
        }
-       if (rev.prune_data) {
-               const char **pathspec = rev.prune_data;
-               while (*pathspec) {
-                       if (!path)
-                               path = *pathspec;
-                       paths++;
-                       pathspec++;
-               }
+       if (rev.prune_data.nr) {
+               if (!path)
+                       path = rev.prune_data.items[0].match;
+               paths += rev.prune_data.nr;
        }
 
        /*
index b18fc85c4c1eecde36a7e953e1997bab1b97628b..daf19451ba7df541d1314c880679749232ccce35 100644 (file)
@@ -651,7 +651,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
        if (import_filename)
                import_marks(import_filename);
 
-       if (import_filename && revs.prune_data)
+       if (import_filename && revs.prune_data.nr)
                full_tree = 1;
 
        get_tags_and_duplicates(&revs.pending, &extra_refs);
index b9994139345834a58b08a5ce57cf59c124e21760..85aff029b225c023f09fda635f16cc00a22ed7ca 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "refs.h"
 #include "pkt-line.h"
 #include "commit.h"
@@ -9,11 +9,13 @@
 #include "fetch-pack.h"
 #include "remote.h"
 #include "run-command.h"
+#include "transport.h"
 
 static int transfer_unpack_limit = -1;
 static int fetch_unpack_limit = -1;
 static int unpack_limit = 100;
 static int prefer_ofs_delta = 1;
+static int no_done = 0;
 static struct fetch_pack_args args = {
        /* .uploadpack = */ "git-upload-pack",
 };
@@ -217,14 +219,40 @@ static void send_request(int fd, struct strbuf *buf)
                safe_write(fd, buf->buf, buf->len);
 }
 
+static void insert_one_alternate_ref(const struct ref *ref, void *unused)
+{
+       rev_list_insert_ref(NULL, ref->old_sha1, 0, NULL);
+}
+
+static void insert_alternate_refs(void)
+{
+       foreach_alt_odb(refs_from_alternate_cb, insert_one_alternate_ref);
+}
+
+#define INITIAL_FLUSH 16
+#define PIPESAFE_FLUSH 32
+#define LARGE_FLUSH 1024
+
+static int next_flush(int count)
+{
+       int flush_limit = args.stateless_rpc ? LARGE_FLUSH : PIPESAFE_FLUSH;
+
+       if (count < flush_limit)
+               count <<= 1;
+       else
+               count += flush_limit;
+       return count;
+}
+
 static int find_common(int fd[2], unsigned char *result_sha1,
                       struct ref *refs)
 {
        int fetching;
-       int count = 0, flushes = 0, retval;
+       int count = 0, flushes = 0, flush_at = INITIAL_FLUSH, retval;
        const unsigned char *sha1;
        unsigned in_vain = 0;
        int got_continue = 0;
+       int got_ready = 0;
        struct strbuf req_buf = STRBUF_INIT;
        size_t state_len = 0;
 
@@ -235,6 +263,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,
        marked = 1;
 
        for_each_ref(rev_list_insert_ref, NULL);
+       insert_alternate_refs();
 
        fetching = 0;
        for ( ; refs ; refs = refs->next) {
@@ -262,6 +291,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,
                        struct strbuf c = STRBUF_INIT;
                        if (multi_ack == 2)     strbuf_addstr(&c, " multi_ack_detailed");
                        if (multi_ack == 1)     strbuf_addstr(&c, " multi_ack");
+                       if (no_done)            strbuf_addstr(&c, " no-done");
                        if (use_sideband == 2)  strbuf_addstr(&c, " side-band-64k");
                        if (use_sideband == 1)  strbuf_addstr(&c, " side-band");
                        if (args.use_thin_pack) strbuf_addstr(&c, " thin-pack");
@@ -332,19 +362,20 @@ static int find_common(int fd[2], unsigned char *result_sha1,
                if (args.verbose)
                        fprintf(stderr, "have %s\n", sha1_to_hex(sha1));
                in_vain++;
-               if (!(31 & ++count)) {
+               if (flush_at <= ++count) {
                        int ack;
 
                        packet_buf_flush(&req_buf);
                        send_request(fd[1], &req_buf);
                        strbuf_setlen(&req_buf, state_len);
                        flushes++;
+                       flush_at = next_flush(count);
 
                        /*
                         * We keep one window "ahead" of the other side, and
                         * will wait for an ACK only on the next one
                         */
-                       if (!args.stateless_rpc && count == 32)
+                       if (!args.stateless_rpc && count == INITIAL_FLUSH)
                                continue;
 
                        consume_shallow_list(fd[0]);
@@ -379,6 +410,10 @@ static int find_common(int fd[2], unsigned char *result_sha1,
                                        retval = 0;
                                        in_vain = 0;
                                        got_continue = 1;
+                                       if (ack == ACK_ready) {
+                                               rev_list = NULL;
+                                               got_ready = 1;
+                                       }
                                        break;
                                        }
                                }
@@ -392,8 +427,10 @@ static int find_common(int fd[2], unsigned char *result_sha1,
                }
        }
 done:
-       packet_buf_write(&req_buf, "done\n");
-       send_request(fd[1], &req_buf);
+       if (!got_ready || !no_done) {
+               packet_buf_write(&req_buf, "done\n");
+               send_request(fd[1], &req_buf);
+       }
        if (args.verbose)
                fprintf(stderr, "done\n");
        if (retval != 0) {
@@ -696,6 +733,12 @@ static struct ref *do_fetch_pack(int fd[2],
                if (args.verbose)
                        fprintf(stderr, "Server supports multi_ack_detailed\n");
                multi_ack = 2;
+               if (server_supports("no-done")) {
+                       if (args.verbose)
+                               fprintf(stderr, "Server supports no-done\n");
+                       if (args.stateless_rpc)
+                               no_done = 1;
+               }
        }
        else if (server_supports("multi_ack")) {
                if (args.verbose)
@@ -804,6 +847,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
        char **pack_lockfile_ptr = NULL;
        struct child_process *conn;
 
+       packet_trace_identity("fetch-pack");
+
        nr_heads = 0;
        heads = NULL;
        for (i = 1; i < argc; i++) {
index 7efecfe1cf6b14a53d619b4bcc4760c81a492747..6cbb5f69ecf0946f4028b88563347332d54f65bc 100644 (file)
@@ -184,7 +184,7 @@ static struct ref *get_ref_map(struct transport *transport,
                } else {
                        ref_map = get_remote_ref(remote_refs, "HEAD");
                        if (!ref_map)
-                               die("Couldn't find remote ref HEAD");
+                               die(_("Couldn't find remote ref HEAD"));
                        ref_map->merge = 1;
                        tail = &ref_map->next;
                }
@@ -237,12 +237,12 @@ static int update_local_ref(struct ref *ref,
        *display = 0;
        type = sha1_object_info(ref->new_sha1, NULL);
        if (type < 0)
-               die("object %s not found", sha1_to_hex(ref->new_sha1));
+               die(_("object %s not found"), sha1_to_hex(ref->new_sha1));
 
        if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
                if (verbosity > 0)
                        sprintf(display, "= %-*s %-*s -> %s", TRANSPORT_SUMMARY_WIDTH,
-                               "[up to date]", REFCOL_WIDTH, remote,
+                               _("[up to date]"), REFCOL_WIDTH, remote,
                                pretty_ref);
                return 0;
        }
@@ -255,8 +255,8 @@ static int update_local_ref(struct ref *ref,
                 * If this is the head, and it's not okay to update
                 * the head, and the old value of the head isn't empty...
                 */
-               sprintf(display, "! %-*s %-*s -> %s  (can't fetch in current branch)",
-                       TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
+               sprintf(display, _("! %-*s %-*s -> %s  (can't fetch in current branch)"),
+                       TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
                        pretty_ref);
                return 1;
        }
@@ -266,8 +266,8 @@ static int update_local_ref(struct ref *ref,
                int r;
                r = s_update_ref("updating tag", ref, 0);
                sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '-',
-                       TRANSPORT_SUMMARY_WIDTH, "[tag update]", REFCOL_WIDTH, remote,
-                       pretty_ref, r ? "  (unable to update local ref)" : "");
+                       TRANSPORT_SUMMARY_WIDTH, _("[tag update]"), REFCOL_WIDTH, remote,
+                       pretty_ref, r ? _("  (unable to update local ref)") : "");
                return r;
        }
 
@@ -279,17 +279,17 @@ static int update_local_ref(struct ref *ref,
                int r;
                if (!strncmp(ref->name, "refs/tags/", 10)) {
                        msg = "storing tag";
-                       what = "[new tag]";
+                       what = _("[new tag]");
                }
                else {
                        msg = "storing head";
-                       what = "[new branch]";
+                       what = _("[new branch]");
                }
 
                r = s_update_ref(msg, ref, 0);
                sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '*',
                        TRANSPORT_SUMMARY_WIDTH, what, REFCOL_WIDTH, remote, pretty_ref,
-                       r ? "  (unable to update local ref)" : "");
+                       r ? _("  (unable to update local ref)") : "");
                return r;
        }
 
@@ -302,7 +302,7 @@ static int update_local_ref(struct ref *ref,
                r = s_update_ref("fast-forward", ref, 1);
                sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : ' ',
                        TRANSPORT_SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote,
-                       pretty_ref, r ? "  (unable to update local ref)" : "");
+                       pretty_ref, r ? _("  (unable to update local ref)") : "");
                return r;
        } else if (force || ref->force) {
                char quickref[84];
@@ -314,12 +314,12 @@ static int update_local_ref(struct ref *ref,
                sprintf(display, "%c %-*s %-*s -> %s  (%s)", r ? '!' : '+',
                        TRANSPORT_SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote,
                        pretty_ref,
-                       r ? "unable to update local ref" : "forced update");
+                       r ? _("unable to update local ref") : _("forced update"));
                return r;
        } else {
-               sprintf(display, "! %-*s %-*s -> %s  (non-fast-forward)",
-                       TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
-                       pretty_ref);
+               sprintf(display, "! %-*s %-*s -> %s  %s",
+                       TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
+                       pretty_ref, _("(non-fast-forward)"));
                return 1;
        }
 }
@@ -337,7 +337,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 
        fp = fopen(filename, "a");
        if (!fp)
-               return error("cannot open %s: %s\n", filename, strerror(errno));
+               return error(_("cannot open %s: %s\n"), filename, strerror(errno));
 
        if (raw_url)
                url = transport_anonymize_url(raw_url);
@@ -415,7 +415,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
                                 REFCOL_WIDTH, *what ? what : "HEAD");
                if (*note) {
                        if (verbosity >= 0 && !shown_url) {
-                               fprintf(stderr, "From %.*s\n",
+                               fprintf(stderr, _("From %.*s\n"),
                                                url_len, url);
                                shown_url = 1;
                        }
@@ -426,9 +426,9 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
        free(url);
        fclose(fp);
        if (rc & STORE_REF_ERROR_DF_CONFLICT)
-               error("some local refs could not be updated; try running\n"
+               error(_("some local refs could not be updated; try running\n"
                      " 'git remote prune %s' to remove any old, conflicting "
-                     "branches", remote_name);
+                     "branches"), remote_name);
        return rc;
 }
 
@@ -476,7 +476,7 @@ static int quickfetch(struct ref *ref_map)
 
        err = start_command(&revlist);
        if (err) {
-               error("could not run rev-list");
+               error(_("could not run rev-list"));
                return err;
        }
 
@@ -490,14 +490,14 @@ static int quickfetch(struct ref *ref_map)
                if (write_in_full(revlist.in, sha1_to_hex(ref->old_sha1), 40) < 0 ||
                    write_str_in_full(revlist.in, "\n") < 0) {
                        if (errno != EPIPE && errno != EINVAL)
-                               error("failed write to rev-list: %s", strerror(errno));
+                               error(_("failed write to rev-list: %s"), strerror(errno));
                        err = -1;
                        break;
                }
        }
 
        if (close(revlist.in)) {
-               error("failed to close rev-list's stdin: %s", strerror(errno));
+               error(_("failed to close rev-list's stdin: %s"), strerror(errno));
                err = -1;
        }
 
@@ -524,16 +524,16 @@ static int prune_refs(struct transport *transport, struct ref *ref_map)
        int result = 0;
        struct ref *ref, *stale_refs = get_stale_heads(transport->remote, ref_map);
        const char *dangling_msg = dry_run
-               ? "   (%s will become dangling)\n"
-               : "   (%s has become dangling)\n";
+               ? _("   (%s will become dangling)\n")
+               : _("   (%s has become dangling)\n");
 
        for (ref = stale_refs; ref; ref = ref->next) {
                if (!dry_run)
                        result |= delete_ref(ref->name, NULL, 0);
                if (verbosity >= 0) {
                        fprintf(stderr, " x %-*s %-*s -> %s\n",
-                               TRANSPORT_SUMMARY_WIDTH, "[deleted]",
-                               REFCOL_WIDTH, "(none)", prettify_refname(ref->name));
+                               TRANSPORT_SUMMARY_WIDTH, _("[deleted]"),
+                               REFCOL_WIDTH, _("(none)"), prettify_refname(ref->name));
                        warn_dangling_symref(stderr, dangling_msg, ref->name);
                }
        }
@@ -650,8 +650,8 @@ static void check_not_current_branch(struct ref *ref_map)
        for (; ref_map; ref_map = ref_map->next)
                if (ref_map->peer_ref && !strcmp(current_branch->refname,
                                        ref_map->peer_ref->name))
-                       die("Refusing to fetch into current branch %s "
-                           "of non-bare repository", current_branch->refname);
+                       die(_("Refusing to fetch into current branch %s "
+                           "of non-bare repository"), current_branch->refname);
 }
 
 static int truncate_fetch_head(void)
@@ -660,7 +660,7 @@ static int truncate_fetch_head(void)
        FILE *fp = fopen(filename, "w");
 
        if (!fp)
-               return error("cannot open %s: %s\n", filename, strerror(errno));
+               return error(_("cannot open %s: %s\n"), filename, strerror(errno));
        fclose(fp);
        return 0;
 }
@@ -684,7 +684,7 @@ static int do_fetch(struct transport *transport,
        }
 
        if (!transport->get_refs_list || !transport->fetch)
-               die("Don't know how to fetch from %s", transport->url);
+               die(_("Don't know how to fetch from %s"), transport->url);
 
        /* if not appending, truncate FETCH_HEAD */
        if (!append && !dry_run) {
@@ -738,10 +738,10 @@ static void set_option(const char *name, const char *value)
 {
        int r = transport_set_option(transport, name, value);
        if (r < 0)
-               die("Option \"%s\" value \"%s\" is not valid for %s",
+               die(_("Option \"%s\" value \"%s\" is not valid for %s"),
                        name, value, transport->url);
        if (r > 0)
-               warning("Option \"%s\" is ignored for %s\n",
+               warning(_("Option \"%s\" is ignored for %s\n"),
                        name, transport->url);
 }
 
@@ -838,9 +838,9 @@ static int fetch_multiple(struct string_list *list)
                argv[argc] = name;
                argv[argc + 1] = NULL;
                if (verbosity >= 0)
-                       printf("Fetching %s\n", name);
+                       printf(_("Fetching %s\n"), name);
                if (run_command_v_opt(argv, RUN_GIT_CMD)) {
-                       error("Could not fetch %s", name);
+                       error(_("Could not fetch %s"), name);
                        result = 1;
                }
        }
@@ -856,8 +856,8 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
        int exit_code;
 
        if (!remote)
-               die("No remote repository specified.  Please, specify either a URL or a\n"
-                   "remote name from which new revisions should be fetched.");
+               die(_("No remote repository specified.  Please, specify either a URL or a\n"
+                   "remote name from which new revisions should be fetched."));
 
        transport = transport_get(remote, NULL);
        transport_set_verbosity(transport, verbosity, progress);
@@ -876,7 +876,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
                                char *ref;
                                i++;
                                if (i >= argc)
-                                       die("You need to specify a tag name.");
+                                       die(_("You need to specify a tag name."));
                                ref = xmalloc(strlen(argv[i]) * 2 + 22);
                                strcpy(ref, "refs/tags/");
                                strcat(ref, argv[i]);
@@ -906,6 +906,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
        struct remote *remote;
        int result = 0;
 
+       packet_trace_identity("fetch");
+
        /* Record the command line for the reflog */
        strbuf_addstr(&default_rla, "fetch");
        for (i = 1; i < argc; i++)
@@ -916,9 +918,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 
        if (all) {
                if (argc == 1)
-                       die("fetch --all does not take a repository argument");
+                       die(_("fetch --all does not take a repository argument"));
                else if (argc > 1)
-                       die("fetch --all does not make sense with refspecs");
+                       die(_("fetch --all does not make sense with refspecs"));
                (void) for_each_remote(get_one_remote_for_fetch, &list);
                result = fetch_multiple(&list);
        } else if (argc == 0) {
@@ -929,7 +931,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
                /* All arguments are assumed to be remotes or groups */
                for (i = 0; i < argc; i++)
                        if (!add_remote_or_group(argv[i], &list))
-                               die("No such remote or remote group: %s", argv[i]);
+                               die(_("No such remote or remote group: %s"), argv[i]);
                result = fetch_multiple(&list);
        } else {
                /* Single remote or group */
@@ -937,7 +939,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
                if (list.nr > 1) {
                        /* More than one remote */
                        if (argc > 1)
-                               die("Fetching a group and specifying refspecs does not make sense");
+                               die(_("Fetching a group and specifying refspecs does not make sense"));
                        result = fetch_multiple(&list);
                } else {
                        /* Zero or one remotes */
index 5189b16c9e59c20b449435c413c34da9f7bf9baa..75816329d6153c35e0763b35f70cfaf165f2a4b8 100644 (file)
@@ -31,7 +31,7 @@ struct src_data {
        int head_status;
 };
 
-void init_src_data(struct src_data *data)
+static void init_src_data(struct src_data *data)
 {
        data->branch.strdup_strings = 1;
        data->tag.strdup_strings = 1;
index 795aba087fe9c6ce0e644526d662a561b7f13f31..5ae0366bc8cfe52f226c2af151a66d39b9df02aa 100644 (file)
@@ -140,11 +140,10 @@ static int traverse_reachable(void)
        int result = 0;
        while (pending.nr) {
                struct object_array_entry *entry;
-               struct object *obj, *parent;
+               struct object *obj;
 
                entry = pending.objects + --pending.nr;
                obj = entry->item;
-               parent = (struct object *) entry->name;
                result |= traverse_one_object(obj);
        }
        return !!result;
index 1a80702b3d1c86b55af24be3b3396f17e9d4a21c..ff5f73ba87b23fc7e361a1751c2d9a64e0267163 100644 (file)
@@ -60,7 +60,7 @@ static int gc_config(const char *var, const char *value, void *cb)
                if (value && strcmp(value, "now")) {
                        unsigned long now = approxidate("now");
                        if (approxidate(value) >= now)
-                               return error("Invalid %s: '%s'", var, value);
+                               return error(_("Invalid %s: '%s'"), var, value);
                }
                return git_config_string(&prune_expire, var, value);
        }
@@ -75,7 +75,7 @@ static void append_option(const char **cmd, const char *opt, int max_length)
                ;
 
        if (i + 2 >= max_length)
-               die("Too many options specified");
+               die(_("Too many options specified"));
        cmd[i++] = opt;
        cmd[i] = NULL;
 }
@@ -100,7 +100,7 @@ static int too_many_loose_objects(void)
                return 0;
 
        if (sizeof(path) <= snprintf(path, sizeof(path), "%s/17", objdir)) {
-               warning("insanely long object directory %.*s", 50, objdir);
+               warning(_("insanely long object directory %.*s"), 50, objdir);
                return 0;
        }
        dir = opendir(path);
@@ -219,13 +219,13 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                 */
                if (!need_to_gc())
                        return 0;
-               fprintf(stderr,
-                       "Auto packing the repository for optimum performance.%s\n",
-                       quiet
-                       ? ""
-                       : (" You may also\n"
-                          "run \"git gc\" manually. See "
-                          "\"git help gc\" for more information."));
+               if (quiet)
+                       fprintf(stderr, _("Auto packing the repository for optimum performance.\n"));
+               else
+                       fprintf(stderr,
+                                       _("Auto packing the repository for optimum performance. You may also\n"
+                                       "run \"git gc\" manually. See "
+                                       "\"git help gc\" for more information."));
        } else
                append_option(argv_repack,
                              prune_expire && !strcmp(prune_expire, "now")
@@ -251,8 +251,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                return error(FAILED_RUN, argv_rerere[0]);
 
        if (auto_gc && too_many_loose_objects())
-               warning("There are too many unreachable loose objects; "
-                       "run 'git prune' to remove them.");
+               warning(_("There are too many unreachable loose objects; "
+                       "run 'git prune' to remove them."));
 
        return 0;
 }
index bb0f93208fc6c3e418f9db5bcaec4b79c57e2bec..10a1f65310f28f2014bab3f3295205abf6dc59ad 100644 (file)
@@ -244,7 +244,7 @@ static void start_threads(struct grep_opt *opt)
                err = pthread_create(&threads[i], NULL, run, o);
 
                if (err)
-                       die("grep: failed to create thread: %s",
+                       die(_("grep: failed to create thread: %s"),
                            strerror(err));
        }
 }
@@ -302,6 +302,19 @@ static int grep_config(const char *var, const char *value, void *cb)
        default: return 0;
        }
 
+       if (!strcmp(var, "grep.extendedregexp")) {
+               if (git_config_bool(var, value))
+                       opt->regflags |= REG_EXTENDED;
+               else
+                       opt->regflags &= ~REG_EXTENDED;
+               return 0;
+       }
+
+       if (!strcmp(var, "grep.linenumber")) {
+               opt->linenum = git_config_bool(var, value);
+               return 0;
+       }
+
        if (!strcmp(var, "color.grep"))
                opt->color = git_config_colorbool(var, value, -1);
        else if (!strcmp(var, "color.grep.context"))
@@ -328,106 +341,6 @@ static int grep_config(const char *var, const char *value, void *cb)
        return 0;
 }
 
-/*
- * Return non-zero if max_depth is negative or path has no more then max_depth
- * slashes.
- */
-static int accept_subdir(const char *path, int max_depth)
-{
-       if (max_depth < 0)
-               return 1;
-
-       while ((path = strchr(path, '/')) != NULL) {
-               max_depth--;
-               if (max_depth < 0)
-                       return 0;
-               path++;
-       }
-       return 1;
-}
-
-/*
- * Return non-zero if name is a subdirectory of match and is not too deep.
- */
-static int is_subdir(const char *name, int namelen,
-               const char *match, int matchlen, int max_depth)
-{
-       if (matchlen > namelen || strncmp(name, match, matchlen))
-               return 0;
-
-       if (name[matchlen] == '\0') /* exact match */
-               return 1;
-
-       if (!matchlen || match[matchlen-1] == '/' || name[matchlen] == '/')
-               return accept_subdir(name + matchlen + 1, max_depth);
-
-       return 0;
-}
-
-/*
- * git grep pathspecs are somewhat different from diff-tree pathspecs;
- * pathname wildcards are allowed.
- */
-static int pathspec_matches(const char **paths, const char *name, int max_depth)
-{
-       int namelen, i;
-       if (!paths || !*paths)
-               return accept_subdir(name, max_depth);
-       namelen = strlen(name);
-       for (i = 0; paths[i]; i++) {
-               const char *match = paths[i];
-               int matchlen = strlen(match);
-               const char *cp, *meta;
-
-               if (is_subdir(name, namelen, match, matchlen, max_depth))
-                       return 1;
-               if (!fnmatch(match, name, 0))
-                       return 1;
-               if (name[namelen-1] != '/')
-                       continue;
-
-               /* We are being asked if the directory ("name") is worth
-                * descending into.
-                *
-                * Find the longest leading directory name that does
-                * not have metacharacter in the pathspec; the name
-                * we are looking at must overlap with that directory.
-                */
-               for (cp = match, meta = NULL; cp - match < matchlen; cp++) {
-                       char ch = *cp;
-                       if (ch == '*' || ch == '[' || ch == '?') {
-                               meta = cp;
-                               break;
-                       }
-               }
-               if (!meta)
-                       meta = cp; /* fully literal */
-
-               if (namelen <= meta - match) {
-                       /* Looking at "Documentation/" and
-                        * the pattern says "Documentation/howto/", or
-                        * "Documentation/diff*.txt".  The name we
-                        * have should match prefix.
-                        */
-                       if (!memcmp(match, name, namelen))
-                               return 1;
-                       continue;
-               }
-
-               if (meta - match < namelen) {
-                       /* Looking at "Documentation/howto/" and
-                        * the pattern says "Documentation/h*";
-                        * match up to "Do.../h"; this avoids descending
-                        * into "Documentation/technical/".
-                        */
-                       if (!memcmp(match, name, meta - match))
-                               return 1;
-                       continue;
-               }
-       }
-       return 0;
-}
-
 static void *lock_and_read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size)
 {
        void *data;
@@ -449,7 +362,7 @@ static void *load_sha1(const unsigned char *sha1, unsigned long *size,
        void *data = lock_and_read_sha1_file(sha1, &type, size);
 
        if (!data)
-               error("'%s': unable to read %s", name, sha1_to_hex(sha1));
+               error(_("'%s': unable to read %s"), name, sha1_to_hex(sha1));
 
        return data;
 }
@@ -500,21 +413,21 @@ static void *load_file(const char *filename, size_t *sz)
        if (lstat(filename, &st) < 0) {
        err_ret:
                if (errno != ENOENT)
-                       error("'%s': %s", filename, strerror(errno));
-               return 0;
+                       error(_("'%s': %s"), filename, strerror(errno));
+               return NULL;
        }
        if (!S_ISREG(st.st_mode))
-               return 0;
+               return NULL;
        *sz = xsize_t(st.st_size);
        i = open(filename, O_RDONLY);
        if (i < 0)
                goto err_ret;
        data = xmalloc(*sz + 1);
        if (st.st_size != read_in_full(i, data, *sz)) {
-               error("'%s': short read %s", filename, strerror(errno));
+               error(_("'%s': short read %s"), filename, strerror(errno));
                close(i);
                free(data);
-               return 0;
+               return NULL;
        }
        close(i);
        data[*sz] = 0;
@@ -573,14 +486,14 @@ static void run_pager(struct grep_opt *opt, const char *prefix)
        argv[path_list->nr] = NULL;
 
        if (prefix && chdir(prefix))
-               die("Failed to chdir: %s", prefix);
+               die(_("Failed to chdir: %s"), prefix);
        status = run_command_v_opt(argv, RUN_USING_SHELL);
        if (status)
                exit(status);
        free(argv);
 }
 
-static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
+static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int cached)
 {
        int hit = 0;
        int nr;
@@ -590,7 +503,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
                struct cache_entry *ce = active_cache[nr];
                if (!S_ISREG(ce->ce_mode))
                        continue;
-               if (!pathspec_matches(paths, ce->name, opt->max_depth))
+               if (!match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL))
                        continue;
                /*
                 * If CE_VALID is on, we assume worktree file and its cache entry
@@ -617,44 +530,29 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
        return hit;
 }
 
-static int grep_tree(struct grep_opt *opt, const char **paths,
-                    struct tree_desc *tree,
-                    const char *tree_name, const char *base)
+static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
+                    struct tree_desc *tree, struct strbuf *base, int tn_len)
 {
-       int len;
-       int hit = 0;
+       int hit = 0, matched = 0;
        struct name_entry entry;
-       char *down;
-       int tn_len = strlen(tree_name);
-       struct strbuf pathbuf;
-
-       strbuf_init(&pathbuf, PATH_MAX + tn_len);
-
-       if (tn_len) {
-               strbuf_add(&pathbuf, tree_name, tn_len);
-               strbuf_addch(&pathbuf, ':');
-               tn_len = pathbuf.len;
-       }
-       strbuf_addstr(&pathbuf, base);
-       len = pathbuf.len;
+       int old_baselen = base->len;
 
        while (tree_entry(tree, &entry)) {
                int te_len = tree_entry_len(entry.path, entry.sha1);
-               pathbuf.len = len;
-               strbuf_add(&pathbuf, entry.path, te_len);
-
-               if (S_ISDIR(entry.mode))
-                       /* Match "abc/" against pathspec to
-                        * decide if we want to descend into "abc"
-                        * directory.
-                        */
-                       strbuf_addch(&pathbuf, '/');
-
-               down = pathbuf.buf + tn_len;
-               if (!pathspec_matches(paths, down, opt->max_depth))
-                       ;
-               else if (S_ISREG(entry.mode))
-                       hit |= grep_sha1(opt, entry.sha1, pathbuf.buf, tn_len);
+
+               if (matched != 2) {
+                       matched = tree_entry_interesting(&entry, base, tn_len, pathspec);
+                       if (matched == -1)
+                               break; /* no more matches */
+                       if (!matched)
+                               continue;
+               }
+
+               strbuf_add(base, entry.path, te_len);
+
+               if (S_ISREG(entry.mode)) {
+                       hit |= grep_sha1(opt, entry.sha1, base->buf, tn_len);
+               }
                else if (S_ISDIR(entry.mode)) {
                        enum object_type type;
                        struct tree_desc sub;
@@ -663,20 +561,23 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
 
                        data = lock_and_read_sha1_file(entry.sha1, &type, &size);
                        if (!data)
-                               die("unable to read tree (%s)",
+                               die(_("unable to read tree (%s)"),
                                    sha1_to_hex(entry.sha1));
+
+                       strbuf_addch(base, '/');
                        init_tree_desc(&sub, data, size);
-                       hit |= grep_tree(opt, paths, &sub, tree_name, down);
+                       hit |= grep_tree(opt, pathspec, &sub, base, tn_len);
                        free(data);
                }
+               strbuf_setlen(base, old_baselen);
+
                if (hit && opt->status_only)
                        break;
        }
-       strbuf_release(&pathbuf);
        return hit;
 }
 
-static int grep_object(struct grep_opt *opt, const char **paths,
+static int grep_object(struct grep_opt *opt, const struct pathspec *pathspec,
                       struct object *obj, const char *name)
 {
        if (obj->type == OBJ_BLOB)
@@ -685,20 +586,30 @@ static int grep_object(struct grep_opt *opt, const char **paths,
                struct tree_desc tree;
                void *data;
                unsigned long size;
-               int hit;
+               struct strbuf base;
+               int hit, len;
+
                data = read_object_with_reference(obj->sha1, tree_type,
                                                  &size, NULL);
                if (!data)
-                       die("unable to read tree (%s)", sha1_to_hex(obj->sha1));
+                       die(_("unable to read tree (%s)"), sha1_to_hex(obj->sha1));
+
+               len = name ? strlen(name) : 0;
+               strbuf_init(&base, PATH_MAX + len + 1);
+               if (len) {
+                       strbuf_add(&base, name, len);
+                       strbuf_addch(&base, ':');
+               }
                init_tree_desc(&tree, data, size);
-               hit = grep_tree(opt, paths, &tree, name, "");
+               hit = grep_tree(opt, pathspec, &tree, &base, base.len);
+               strbuf_release(&base);
                free(data);
                return hit;
        }
-       die("unable to grep from object of type %s", typename(obj->type));
+       die(_("unable to grep from object of type %s"), typename(obj->type));
 }
 
-static int grep_objects(struct grep_opt *opt, const char **paths,
+static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec,
                        const struct object_array *list)
 {
        unsigned int i;
@@ -708,7 +619,7 @@ static int grep_objects(struct grep_opt *opt, const char **paths,
        for (i = 0; i < nr; i++) {
                struct object *real_obj;
                real_obj = deref_tag(list->objects[i].item, NULL, 0);
-               if (grep_object(opt, paths, real_obj, list->objects[i].name)) {
+               if (grep_object(opt, pathspec, real_obj, list->objects[i].name)) {
                        hit = 1;
                        if (opt->status_only)
                                break;
@@ -717,7 +628,7 @@ static int grep_objects(struct grep_opt *opt, const char **paths,
        return hit;
 }
 
-static int grep_directory(struct grep_opt *opt, const char **paths)
+static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec)
 {
        struct dir_struct dir;
        int i, hit = 0;
@@ -725,8 +636,12 @@ static int grep_directory(struct grep_opt *opt, const char **paths)
        memset(&dir, 0, sizeof(dir));
        setup_standard_excludes(&dir);
 
-       fill_directory(&dir, paths);
+       fill_directory(&dir, pathspec->raw);
        for (i = 0; i < dir.nr; i++) {
+               const char *name = dir.entries[i]->name;
+               int namelen = strlen(name);
+               if (!match_pathspec_depth(pathspec, name, namelen, 0, NULL))
+                       continue;
                hit |= grep_file(opt, dir.entries[i]->name);
                if (hit && opt->status_only)
                        break;
@@ -747,7 +662,7 @@ static int context_callback(const struct option *opt, const char *arg,
        }
        value = strtol(arg, (char **)&endp, 10);
        if (*endp) {
-               return error("switch `%c' expects a numerical value",
+               return error(_("switch `%c' expects a numerical value"),
                             opt->short_name);
        }
        grep_opt->pre_context = grep_opt->post_context = value;
@@ -757,13 +672,14 @@ static int context_callback(const struct option *opt, const char *arg,
 static int file_callback(const struct option *opt, const char *arg, int unset)
 {
        struct grep_opt *grep_opt = opt->value;
+       int from_stdin = !strcmp(arg, "-");
        FILE *patterns;
        int lno = 0;
        struct strbuf sb = STRBUF_INIT;
 
-       patterns = fopen(arg, "r");
+       patterns = from_stdin ? stdin : fopen(arg, "r");
        if (!patterns)
-               die_errno("cannot open '%s'", arg);
+               die_errno(_("cannot open '%s'"), arg);
        while (strbuf_getline(&sb, patterns, '\n') == 0) {
                char *s;
                size_t len;
@@ -775,7 +691,8 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
                s = strbuf_detach(&sb, &len);
                append_grep_pat(grep_opt, s, len, arg, ++lno, GREP_PATTERN);
        }
-       fclose(patterns);
+       if (!from_stdin)
+               fclose(patterns);
        strbuf_release(&sb);
        return 0;
 }
@@ -831,6 +748,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        struct grep_opt opt;
        struct object_array list = OBJECT_ARRAY_INIT;
        const char **paths = NULL;
+       struct pathspec pathspec;
        struct string_list path_list = STRING_LIST_INIT_NODUP;
        int i;
        int dummy;
@@ -1004,11 +922,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        }
 
        if (!opt.pattern_list)
-               die("no pattern given.");
+               die(_("no pattern given."));
        if (!opt.fixed && opt.ignore_case)
                opt.regflags |= REG_ICASE;
        if ((opt.regflags != REG_NEWLINE) && opt.fixed)
-               die("cannot mix --fixed-strings and regexp");
+               die(_("cannot mix --fixed-strings and regexp"));
 
 #ifndef NO_PTHREADS
        if (online_cpus() == 1 || !grep_threads_ok(&opt))
@@ -1033,7 +951,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                if (!get_sha1(arg, sha1)) {
                        struct object *object = parse_object(sha1);
                        if (!object)
-                               die("bad object %s", arg);
+                               die(_("bad object %s"), arg);
                        add_object_array(object, arg, &list);
                        continue;
                }
@@ -1058,9 +976,12 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                paths[0] = prefix;
                paths[1] = NULL;
        }
+       init_pathspec(&pathspec, paths);
+       pathspec.max_depth = opt.max_depth;
+       pathspec.recursive = 1;
 
        if (show_in_pager && (cached || list.nr))
-               die("--open-files-in-pager only works on the worktree");
+               die(_("--open-files-in-pager only works on the worktree"));
 
        if (show_in_pager && opt.pattern_list && !opt.pattern_list->next) {
                const char *pager = path_list.items[0].string;
@@ -1085,19 +1006,19 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 
        if (!use_index) {
                if (cached)
-                       die("--cached cannot be used with --no-index.");
+                       die(_("--cached cannot be used with --no-index."));
                if (list.nr)
-                       die("--no-index cannot be used with revs.");
-               hit = grep_directory(&opt, paths);
+                       die(_("--no-index cannot be used with revs."));
+               hit = grep_directory(&opt, &pathspec);
        } else if (!list.nr) {
                if (!cached)
                        setup_work_tree();
 
-               hit = grep_cache(&opt, paths, cached);
+               hit = grep_cache(&opt, &pathspec, cached);
        } else {
                if (cached)
-                       die("both --cached and trees are given.");
-               hit = grep_objects(&opt, paths, &list);
+                       die(_("both --cached and trees are given."));
+               hit = grep_objects(&opt, &pathspec, &list);
        }
 
        if (use_threads)
index 080af1a01b8155680faf6c04101217b60ae7b919..b96f46acf52d23f68c1ec164be8264396dea22db 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) Linus Torvalds, 2005
  * Copyright (C) Junio C Hamano, 2005
  */
-#include "cache.h"
+#include "builtin.h"
 #include "blob.h"
 #include "quote.h"
 #include "parse-options.h"
@@ -15,7 +15,7 @@ static void hash_fd(int fd, const char *type, int write_object, const char *path
        struct stat st;
        unsigned char sha1[20];
        if (fstat(fd, &st) < 0 ||
-           index_fd(sha1, fd, &st, write_object, type_from_string(type), path))
+           index_fd(sha1, fd, &st, write_object, type_from_string(type), path, 1))
                die(write_object
                    ? "Unable to add %s to database"
                    : "Unable to hash %s", path);
index c7e600db4745c80fddcb14986bc192d80630aa51..31f001f1059ec533ee62d6bd951b068d7f924f50 100644 (file)
@@ -207,7 +207,7 @@ static void parse_pack_header(void)
 static NORETURN void bad_object(unsigned long offset, const char *format,
                       ...) __attribute__((format (printf, 2, 3)));
 
-static void bad_object(unsigned long offset, const char *format, ...)
+static NORETURN void bad_object(unsigned long offset, const char *format, ...)
 {
        va_list params;
        char buf[1024];
@@ -294,7 +294,7 @@ static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_
        void *data;
 
        obj->idx.offset = consumed_bytes;
-       input_crc32 = crc32(0, Z_NULL, 0);
+       input_crc32 = crc32(0, NULL, 0);
 
        p = fill(1);
        c = *p;
index fbeb380ee2af2b21478e5766a3dd956b8fe06104..b7370d9bb8f235f1cf39b1ffa768498ca1e88654 100644 (file)
@@ -21,6 +21,7 @@
 static int init_is_bare_repository = 0;
 static int init_shared_repository = -1;
 static const char *init_db_template_dir;
+static const char *git_link;
 
 static void safe_create_dir(const char *dir, int share)
 {
@@ -31,7 +32,7 @@ static void safe_create_dir(const char *dir, int share)
                }
        }
        else if (share && adjust_shared_perm(dir))
-               die("Could not make %s writable by group", dir);
+               die(_("Could not make %s writable by group"), dir);
 }
 
 static void copy_templates_1(char *path, int baselen,
@@ -58,25 +59,25 @@ static void copy_templates_1(char *path, int baselen,
                namelen = strlen(de->d_name);
                if ((PATH_MAX <= baselen + namelen) ||
                    (PATH_MAX <= template_baselen + namelen))
-                       die("insanely long template name %s", de->d_name);
+                       die(_("insanely long template name %s"), de->d_name);
                memcpy(path + baselen, de->d_name, namelen+1);
                memcpy(template + template_baselen, de->d_name, namelen+1);
                if (lstat(path, &st_git)) {
                        if (errno != ENOENT)
-                               die_errno("cannot stat '%s'", path);
+                               die_errno(_("cannot stat '%s'"), path);
                }
                else
                        exists = 1;
 
                if (lstat(template, &st_template))
-                       die_errno("cannot stat template '%s'", template);
+                       die_errno(_("cannot stat template '%s'"), template);
 
                if (S_ISDIR(st_template.st_mode)) {
                        DIR *subdir = opendir(template);
                        int baselen_sub = baselen + namelen;
                        int template_baselen_sub = template_baselen + namelen;
                        if (!subdir)
-                               die_errno("cannot opendir '%s'", template);
+                               die_errno(_("cannot opendir '%s'"), template);
                        path[baselen_sub++] =
                                template[template_baselen_sub++] = '/';
                        path[baselen_sub] =
@@ -93,20 +94,20 @@ static void copy_templates_1(char *path, int baselen,
                        int len;
                        len = readlink(template, lnk, sizeof(lnk));
                        if (len < 0)
-                               die_errno("cannot readlink '%s'", template);
+                               die_errno(_("cannot readlink '%s'"), template);
                        if (sizeof(lnk) <= len)
-                               die("insanely long symlink %s", template);
+                               die(_("insanely long symlink %s"), template);
                        lnk[len] = 0;
                        if (symlink(lnk, path))
-                               die_errno("cannot symlink '%s' '%s'", lnk, path);
+                               die_errno(_("cannot symlink '%s' '%s'"), lnk, path);
                }
                else if (S_ISREG(st_template.st_mode)) {
                        if (copy_file(path, template, st_template.st_mode))
-                               die_errno("cannot copy '%s' to '%s'", template,
+                               die_errno(_("cannot copy '%s' to '%s'"), template,
                                          path);
                }
                else
-                       error("ignoring template %s", template);
+                       error(_("ignoring template %s"), template);
        }
 }
 
@@ -129,7 +130,7 @@ static void copy_templates(const char *template_dir)
                return;
        template_len = strlen(template_dir);
        if (PATH_MAX <= (template_len+strlen("/config")))
-               die("insanely long template path %s", template_dir);
+               die(_("insanely long template path %s"), template_dir);
        strcpy(template_path, template_dir);
        if (template_path[template_len-1] != '/') {
                template_path[template_len++] = '/';
@@ -137,7 +138,7 @@ static void copy_templates(const char *template_dir)
        }
        dir = opendir(template_path);
        if (!dir) {
-               warning("templates not found %s", template_dir);
+               warning(_("templates not found %s"), template_dir);
                return;
        }
 
@@ -150,8 +151,8 @@ static void copy_templates(const char *template_dir)
 
        if (repository_format_version &&
            repository_format_version != GIT_REPO_VERSION) {
-               warning("not copying templates of "
-                       "a wrong format version %d from '%s'",
+               warning(_("not copying templates of "
+                       "a wrong format version %d from '%s'"),
                        repository_format_version,
                        template_dir);
                closedir(dir);
@@ -188,7 +189,7 @@ static int create_default_files(const char *template_path)
        int filemode;
 
        if (len > sizeof(path)-50)
-               die("insane git directory %s", git_dir);
+               die(_("insane git directory %s"), git_dir);
        memcpy(path, git_dir, len);
 
        if (len && path[len-1] != '/')
@@ -311,11 +312,67 @@ static void create_object_directory(void)
        free(path);
 }
 
+int set_git_dir_init(const char *git_dir, const char *real_git_dir,
+                    int exist_ok)
+{
+       if (real_git_dir) {
+               struct stat st;
+
+               if (!exist_ok && !stat(git_dir, &st))
+                       die("%s already exists", git_dir);
+
+               if (!exist_ok && !stat(real_git_dir, &st))
+                       die("%s already exists", real_git_dir);
+
+               /*
+                * make sure symlinks are resolved because we'll be
+                * moving the target repo later on in separate_git_dir()
+                */
+               git_link = xstrdup(real_path(git_dir));
+       }
+       else {
+               real_git_dir = real_path(git_dir);
+               git_link = NULL;
+       }
+       set_git_dir(real_path(real_git_dir));
+       return 0;
+}
+
+static void separate_git_dir(const char *git_dir)
+{
+       struct stat st;
+       FILE *fp;
+
+       if (!stat(git_link, &st)) {
+               const char *src;
+
+               if (S_ISREG(st.st_mode))
+                       src = read_gitfile_gently(git_link);
+               else if (S_ISDIR(st.st_mode))
+                       src = git_link;
+               else
+                       die("unable to handle file type %d", st.st_mode);
+
+               if (rename(src, git_dir))
+                       die_errno("unable to move %s to %s", src, git_dir);
+       }
+
+       fp = fopen(git_link, "w");
+       if (!fp)
+               die("Could not create git link %s", git_link);
+       fprintf(fp, "gitdir: %s\n", git_dir);
+       fclose(fp);
+}
+
 int init_db(const char *template_dir, unsigned int flags)
 {
        int reinit;
+       const char *git_dir = get_git_dir();
+
+       if (git_link)
+               separate_git_dir(git_dir);
 
-       safe_create_dir(get_git_dir(), 0);
+       safe_create_dir(git_dir, 0);
 
        init_is_bare_repository = is_bare_repository();
 
@@ -352,11 +409,16 @@ int init_db(const char *template_dir, unsigned int flags)
        }
 
        if (!(flags & INIT_DB_QUIET)) {
-               const char *git_dir = get_git_dir();
                int len = strlen(git_dir);
-               printf("%s%s Git repository in %s%s\n",
-                      reinit ? "Reinitialized existing" : "Initialized empty",
-                      shared_repository ? " shared" : "",
+
+               /*
+                * TRANSLATORS: The first '%s' is either "Reinitialized
+                * existing" or "Initialized empty", the second " shared" or
+                * "", and the last '%s%s' is the verbatim directory name.
+                */
+               printf(_("%s%s Git repository in %s%s\n"),
+                      reinit ? _("Reinitialized existing") : _("Initialized empty"),
+                      shared_repository ? _(" shared") : "",
                       git_dir, len && git_dir[len-1] != '/' ? "/" : "");
        }
 
@@ -375,7 +437,7 @@ static int guess_repository_type(const char *git_dir)
        if (!strcmp(".", git_dir))
                return 1;
        if (!getcwd(cwd, sizeof(cwd)))
-               die_errno("cannot tell cwd");
+               die_errno(_("cannot tell cwd"));
        if (!strcmp(git_dir, cwd))
                return 1;
        /*
@@ -414,6 +476,7 @@ static const char *const init_db_usage[] = {
 int cmd_init_db(int argc, const char **argv, const char *prefix)
 {
        const char *git_dir;
+       const char *real_git_dir = NULL;
        const char *work_tree;
        const char *template_dir = NULL;
        unsigned int flags = 0;
@@ -427,11 +490,16 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
                        "specify that the git repository is to be shared amongst several users",
                        PARSE_OPT_OPTARG | PARSE_OPT_NONEG, shared_callback, 0},
                OPT_BIT('q', "quiet", &flags, "be quiet", INIT_DB_QUIET),
+               OPT_STRING('L', "separate-git-dir", &real_git_dir, "gitdir",
+                          "separate git dir from working tree"),
                OPT_END()
        };
 
        argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0);
 
+       if (real_git_dir && !is_absolute_path(real_git_dir))
+               real_git_dir = xstrdup(real_path(real_git_dir));
+
        if (argc == 1) {
                int mkdir_tried = 0;
        retry:
@@ -450,18 +518,18 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
                                        errno = EEXIST;
                                        /* fallthru */
                                case -1:
-                                       die_errno("cannot mkdir %s", argv[0]);
+                                       die_errno(_("cannot mkdir %s"), argv[0]);
                                        break;
                                default:
                                        break;
                                }
                                shared_repository = saved;
                                if (mkdir(argv[0], 0777) < 0)
-                                       die_errno("cannot mkdir %s", argv[0]);
+                                       die_errno(_("cannot mkdir %s"), argv[0]);
                                mkdir_tried = 1;
                                goto retry;
                        }
-                       die_errno("cannot chdir to %s", argv[0]);
+                       die_errno(_("cannot chdir to %s"), argv[0]);
                }
        } else if (0 < argc) {
                usage(init_db_usage[0]);
@@ -483,8 +551,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
        git_dir = getenv(GIT_DIR_ENVIRONMENT);
        work_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);
        if ((!git_dir || is_bare_repository_cfg == 1) && work_tree)
-               die("%s (or --work-tree=<directory>) not allowed without "
-                   "specifying %s (or --git-dir=<directory>)",
+               die(_("%s (or --work-tree=<directory>) not allowed without "
+                         "specifying %s (or --git-dir=<directory>)"),
                    GIT_WORK_TREE_ENVIRONMENT,
                    GIT_DIR_ENVIRONMENT);
 
@@ -501,28 +569,28 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
                const char *git_dir_parent = strrchr(git_dir, '/');
                if (git_dir_parent) {
                        char *rel = xstrndup(git_dir, git_dir_parent - git_dir);
-                       git_work_tree_cfg = xstrdup(make_absolute_path(rel));
+                       git_work_tree_cfg = xstrdup(real_path(rel));
                        free(rel);
                }
                if (!git_work_tree_cfg) {
                        git_work_tree_cfg = xcalloc(PATH_MAX, 1);
                        if (!getcwd(git_work_tree_cfg, PATH_MAX))
-                               die_errno ("Cannot access current working directory");
+                               die_errno (_("Cannot access current working directory"));
                }
                if (work_tree)
-                       set_git_work_tree(make_absolute_path(work_tree));
+                       set_git_work_tree(real_path(work_tree));
                else
                        set_git_work_tree(git_work_tree_cfg);
                if (access(get_git_work_tree(), X_OK))
-                       die_errno ("Cannot access work tree '%s'",
+                       die_errno (_("Cannot access work tree '%s'"),
                                   get_git_work_tree());
        }
        else {
                if (work_tree)
-                       set_git_work_tree(make_absolute_path(work_tree));
+                       set_git_work_tree(real_path(work_tree));
        }
 
-       set_git_dir(make_absolute_path(git_dir));
+       set_git_dir_init(git_dir, real_git_dir, 1);
 
        return init_db(template_dir, flags);
 }
index 0f43d2ec78555339cfb788bc173780acdaa2139d..9db43edb063bbcb4da3b213d92d14b5c92aa4cfb 100644 (file)
@@ -89,7 +89,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
                rev->always_show_header = 0;
        if (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {
                rev->always_show_header = 0;
-               if (rev->diffopt.nr_paths != 1)
+               if (rev->diffopt.pathspec.nr != 1)
                        usage("git logs can only follow renames on one pathname at a time");
        }
        for (i = 1; i < argc; i++) {
@@ -101,7 +101,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
                        const char *v = skip_prefix(arg, "--decorate=");
                        decoration_style = parse_decoration_style(arg, v);
                        if (decoration_style < 0)
-                               die("invalid --decorate option: %s", arg);
+                               die(_("invalid --decorate option: %s"), arg);
                        decoration_given = 1;
                } else if (!strcmp(arg, "--no-decorate")) {
                        decoration_style = 0;
@@ -110,7 +110,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
                } else if (!strcmp(arg, "-h")) {
                        usage(builtin_log_usage);
                } else
-                       die("unrecognized argument: %s", arg);
+                       die(_("unrecognized argument: %s"), arg);
        }
 
        /*
@@ -153,7 +153,7 @@ static void show_early_header(struct rev_info *rev, const char *stage, int nr)
                if (rev->commit_format != CMIT_FMT_ONELINE)
                        putchar(rev->diffopt.line_termination);
        }
-       printf("Final output: %d %s\n", nr, stage);
+       printf(_("Final output: %d %s\n"), nr, stage);
 }
 
 static struct itimerval early_output_timer;
@@ -252,7 +252,7 @@ static int cmd_log_walk(struct rev_info *rev)
                setup_early_output(rev);
 
        if (prepare_revision_walk(rev))
-               die("revision walk setup failed");
+               die(_("revision walk setup failed"));
 
        if (rev->early_output)
                finish_early_output(rev);
@@ -263,7 +263,13 @@ static int cmd_log_walk(struct rev_info *rev)
         * retain that state information if replacing rev->diffopt in this loop
         */
        while ((commit = get_revision(rev)) != NULL) {
-               log_tree_commit(rev, commit);
+               if (!log_tree_commit(rev, commit) &&
+                   rev->max_count >= 0)
+                       /*
+                        * We decremented max_count in get_revision,
+                        * but we didn't actually show the commit.
+                        */
+                       rev->max_count++;
                if (!rev->reflog_info) {
                        /* we allow cycles in reflog ancestry */
                        free(commit->buffer);
@@ -343,7 +349,7 @@ static int show_object(const unsigned char *sha1, int show_tag_object,
        int offset = 0;
 
        if (!buf)
-               return error("Could not read object %s", sha1_to_hex(sha1));
+               return error(_("Could not read object %s"), sha1_to_hex(sha1));
 
        if (show_tag_object)
                while (offset < size && buf[offset] != '\n') {
@@ -430,7 +436,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
                                break;
                        o = parse_object(t->tagged->sha1);
                        if (!o)
-                               ret = error("Could not read object %s",
+                               ret = error(_("Could not read object %s"),
                                            sha1_to_hex(t->tagged->sha1));
                        objects[i].item = o;
                        i--;
@@ -454,7 +460,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
                        ret = cmd_log_walk(&rev);
                        break;
                default:
-                       ret = error("Unknown type: %d", o->type);
+                       ret = error(_("Unknown type: %d"), o->type);
                }
        }
        free(objects);
@@ -554,7 +560,7 @@ static int git_format_config(const char *var, const char *value, void *cb)
 {
        if (!strcmp(var, "format.headers")) {
                if (!value)
-                       die("format.headers without value");
+                       die(_("format.headers without value"));
                add_header(value);
                return 0;
        }
@@ -626,7 +632,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)
                strbuf_addstr(&filename, output_directory);
                if (filename.len >=
                    PATH_MAX - FORMAT_PATCH_NAME_MAX - suffix_len)
-                       return error("name of output directory is too long");
+                       return error(_("name of output directory is too long"));
                if (filename.buf[filename.len - 1] != '/')
                        strbuf_addch(&filename, '/');
        }
@@ -637,7 +643,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)
                fprintf(realstdout, "%s\n", filename.buf + outdir_offset);
 
        if (freopen(filename.buf, "w", stdout) == NULL)
-               return error("Cannot open patch file %s", filename.buf);
+               return error(_("Cannot open patch file %s"), filename.buf);
 
        strbuf_release(&filename);
        return 0;
@@ -651,7 +657,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
        unsigned flags1, flags2;
 
        if (rev->pending.nr != 2)
-               die("Need exactly one range.");
+               die(_("Need exactly one range."));
 
        o1 = rev->pending.objects[0].item;
        flags1 = o1->flags;
@@ -659,7 +665,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
        flags2 = o2->flags;
 
        if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
-               die("Not a range.");
+               die(_("Not a range."));
 
        init_patch_ids(ids);
 
@@ -670,7 +676,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
        add_pending_object(&check_rev, o1, "o1");
        add_pending_object(&check_rev, o2, "o2");
        if (prepare_revision_walk(&check_rev))
-               die("revision walk setup failed");
+               die(_("revision walk setup failed"));
 
        while ((commit = get_revision(&check_rev)) != NULL) {
                /* ignore merges */
@@ -696,7 +702,7 @@ static void gen_message_id(struct rev_info *info, char *base)
        const char *email_end = strrchr(committer, '>');
        struct strbuf buf = STRBUF_INIT;
        if (!email_start || !email_end || email_start > email_end - 1)
-               die("Could not extract email from committer identity.");
+               die(_("Could not extract email from committer identity."));
        strbuf_addf(&buf, "%s.%lu.git.%.*s", base,
                    (unsigned long) time(NULL),
                    (int)(email_end - email_start - 1), email_start + 1);
@@ -728,7 +734,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
        struct commit *commit = NULL;
 
        if (rev->commit_format != CMIT_FMT_EMAIL)
-               die("Cover letter needs email format");
+               die(_("Cover letter needs email format"));
 
        committer = git_committer_info(0);
 
@@ -821,7 +827,7 @@ static const char *clean_message_id(const char *msg_id)
                m++;
        }
        if (!z)
-               die("insane in-reply-to: %s", msg_id);
+               die(_("insane in-reply-to: %s"), msg_id);
        if (++z == m)
                return a;
        return xmemdupz(a, z - a);
@@ -894,7 +900,7 @@ static int output_directory_callback(const struct option *opt, const char *arg,
 {
        const char **dir = (const char **)opt->value;
        if (*dir)
-               die("Two output directories?");
+               die(_("Two output directories?"));
        *dir = arg;
        return 0;
 }
@@ -1055,7 +1061,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        rev.commit_format = CMIT_FMT_EMAIL;
        rev.verbose_header = 1;
        rev.diff = 1;
-       rev.no_merges = 1;
+       rev.max_parents = 1;
        DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
        rev.subject_prefix = fmt_patch_subject_prefix;
        memset(&s_r_opt, 0, sizeof(s_r_opt));
@@ -1082,7 +1088,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
                endpos = strchr(committer, '>');
                if (!endpos)
-                       die("bogus committer info %s", committer);
+                       die(_("bogus committer info %s"), committer);
                add_signoff = xmemdupz(committer, endpos - committer + 1);
        }
 
@@ -1127,20 +1133,20 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                numbered = 0;
 
        if (numbered && keep_subject)
-               die ("-n and -k are mutually exclusive.");
+               die (_("-n and -k are mutually exclusive."));
        if (keep_subject && subject_prefix)
-               die ("--subject-prefix and -k are mutually exclusive.");
+               die (_("--subject-prefix and -k are mutually exclusive."));
 
        argc = setup_revisions(argc, argv, &rev, &s_r_opt);
        if (argc > 1)
-               die ("unrecognized argument: %s", argv[1]);
+               die (_("unrecognized argument: %s"), argv[1]);
 
        if (rev.diffopt.output_format & DIFF_FORMAT_NAME)
-               die("--name-only does not make sense");
+               die(_("--name-only does not make sense"));
        if (rev.diffopt.output_format & DIFF_FORMAT_NAME_STATUS)
-               die("--name-status does not make sense");
+               die(_("--name-status does not make sense"));
        if (rev.diffopt.output_format & DIFF_FORMAT_CHECKDIFF)
-               die("--check does not make sense");
+               die(_("--check does not make sense"));
 
        if (!use_patch_format &&
                (!rev.diffopt.output_format ||
@@ -1163,9 +1169,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
        if (output_directory) {
                if (use_stdout)
-                       die("standard output, or directory, which one?");
+                       die(_("standard output, or directory, which one?"));
                if (mkdir(output_directory, 0777) < 0 && errno != EEXIST)
-                       die_errno("Could not create directory '%s'",
+                       die_errno(_("Could not create directory '%s'"),
                                  output_directory);
        }
 
@@ -1219,7 +1225,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                realstdout = xfdopen(xdup(1), "w");
 
        if (prepare_revision_walk(&rev))
-               die("revision walk setup failed");
+               die(_("revision walk setup failed"));
        rev.boundary = 1;
        while ((commit = get_revision(&rev)) != NULL) {
                if (commit->object.flags & BOUNDARY) {
@@ -1300,7 +1306,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
                if (!use_stdout && reopen_stdout(numbered_files ? NULL : commit,
                                                 &rev))
-                       die("Failed to create output files");
+                       die(_("Failed to create output files"));
                shown = log_tree_commit(&rev, commit);
                free(commit->buffer);
                commit->buffer = NULL;
@@ -1404,9 +1410,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
                if (!current_branch || !current_branch->merge
                                        || !current_branch->merge[0]
                                        || !current_branch->merge[0]->dst) {
-                       fprintf(stderr, "Could not find a tracked"
+                       fprintf(stderr, _("Could not find a tracked"
                                        " remote branch, please"
-                                       " specify <upstream> manually.\n");
+                                       " specify <upstream> manually.\n"));
                        usage_with_options(cherry_usage, options);
                }
 
@@ -1420,9 +1426,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
        DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
 
        if (add_pending_commit(head, &revs, 0))
-               die("Unknown commit %s", head);
+               die(_("Unknown commit %s"), head);
        if (add_pending_commit(upstream, &revs, UNINTERESTING))
-               die("Unknown commit %s", upstream);
+               die(_("Unknown commit %s"), upstream);
 
        /* Don't say anything if head and upstream are the same. */
        if (revs.pending.nr == 2) {
@@ -1434,11 +1440,11 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
        get_patch_ids(&revs, &ids, prefix);
 
        if (limit && add_pending_commit(limit, &revs, UNINTERESTING))
-               die("Unknown commit %s", limit);
+               die(_("Unknown commit %s"), limit);
 
        /* reverse the list of commits */
        if (prepare_revision_walk(&revs))
-               die("revision walk setup failed");
+               die(_("revision walk setup failed"));
        while ((commit = get_revision(&revs)) != NULL) {
                /* ignore merges */
                if (commit->parents && commit->parents->next)
index 97eed4012ba23cfe7f13cf2b6c160ade54f6b2d1..1a1ff87e8f9ed7db84f106960f36888835f7057b 100644 (file)
@@ -33,6 +33,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
        int i;
        const char *dest = NULL;
        unsigned flags = 0;
+       int get_url = 0;
        int quiet = 0;
        const char *uploadpack = NULL;
        const char **pattern = NULL;
@@ -69,6 +70,10 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
                                quiet = 1;
                                continue;
                        }
+                       if (!strcmp("--get-url", arg)) {
+                               get_url = 1;
+                               continue;
+                       }
                        usage(ls_remote_usage);
                }
                dest = arg;
@@ -94,6 +99,12 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
        }
        if (!remote->url_nr)
                die("remote %s has no configured URL", dest);
+
+       if (get_url) {
+               printf("%s\n", *remote->url);
+               return 0;
+       }
+
        transport = transport_get(remote, NULL);
        if (uploadpack != NULL)
                transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);
index 2c4cf5e559b4166973f12bda567e1a6c5657a7e7..23388325879c5a52a4a8c25f254aafe23573e820 100644 (file)
@@ -1,6 +1,5 @@
-#include "cache.h"
+#include "builtin.h"
 #include "run-command.h"
-#include "exec_cmd.h"
 
 static const char *pgm;
 static int one_shot, quiet;
index c33091b3ed52bc8539ff82f039ec8c7718f3dcc2..3a64f5d0bdbcc8d7d21edb01f285cc8b41755228 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "commit.h"
 #include "tag.h"
 #include "merge-recursive.h"
index 9b25ddc9794efe489ee9ec9fd3203ffa997f03f7..19917426fba19cf60b838ff9b07d20b5e44259a5 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "tree-walk.h"
 #include "xdiff-interface.h"
 #include "blob.h"
index f9fb26dc3319200de96181d9e30aad75693d1704..d54e7ddbb12286beb4f9622864f2eeaa79453d32 100644 (file)
@@ -25,6 +25,7 @@
 #include "help.h"
 #include "merge-recursive.h"
 #include "resolve-undo.h"
+#include "remote.h"
 
 #define DEFAULT_TWOHEAD (1<<0)
 #define DEFAULT_OCTOPUS (1<<1)
@@ -37,8 +38,9 @@ struct strategy {
 };
 
 static const char * const builtin_merge_usage[] = {
-       "git merge [options] <remote>...",
-       "git merge [options] <msg> HEAD <remote>",
+       "git merge [options] [<commit>...]",
+       "git merge [options] <msg> HEAD <commit>",
+       "git merge --abort",
        NULL
 };
 
@@ -58,6 +60,8 @@ static int option_renormalize;
 static int verbosity;
 static int allow_rerere_auto;
 static int abort_current_merge;
+static int show_progress = -1;
+static int default_to_upstream;
 
 static struct strategy all_strategy[] = {
        { "recursive",  DEFAULT_TWOHEAD | NO_TRIVIAL },
@@ -80,7 +84,7 @@ static int option_parse_message(const struct option *opt,
                strbuf_addf(buf, "%s%s", buf->len ? "\n\n" : "", arg);
                have_message = 1;
        } else
-               return error("switch `m' requires a value");
+               return error(_("switch `m' requires a value"));
        return 0;
 }
 
@@ -117,13 +121,13 @@ static struct strategy *get_strategy(const char *name)
                exclude_cmds(&main_cmds, &not_strategies);
        }
        if (!is_in_cmdlist(&main_cmds, name) && !is_in_cmdlist(&other_cmds, name)) {
-               fprintf(stderr, "Could not find merge strategy '%s'.\n", name);
-               fprintf(stderr, "Available strategies are:");
+               fprintf(stderr, _("Could not find merge strategy '%s'.\n"), name);
+               fprintf(stderr, _("Available strategies are:"));
                for (i = 0; i < main_cmds.cnt; i++)
                        fprintf(stderr, " %s", main_cmds.names[i]->name);
                fprintf(stderr, ".\n");
                if (other_cmds.cnt) {
-                       fprintf(stderr, "Available custom strategies are:");
+                       fprintf(stderr, _("Available custom strategies are:"));
                        for (i = 0; i < other_cmds.cnt; i++)
                                fprintf(stderr, " %s", other_cmds.names[i]->name);
                        fprintf(stderr, ".\n");
@@ -200,6 +204,7 @@ static struct option builtin_merge_options[] = {
        OPT__VERBOSITY(&verbosity),
        OPT_BOOLEAN(0, "abort", &abort_current_merge,
                "abort the current in-progress merge"),
+       OPT_SET_INT(0, "progress", &show_progress, "force progress reporting", 1),
        OPT_END()
 };
 
@@ -224,17 +229,17 @@ static void save_state(void)
        cp.git_cmd = 1;
 
        if (start_command(&cp))
-               die("could not run stash.");
+               die(_("could not run stash."));
        len = strbuf_read(&buffer, cp.out, 1024);
        close(cp.out);
 
        if (finish_command(&cp) || len < 0)
-               die("stash failed");
+               die(_("stash failed"));
        else if (!len)
                return;
        strbuf_setlen(&buffer, buffer.len-1);
        if (get_sha1(buffer.buf, stash))
-               die("not a valid object: %s", buffer.buf);
+               die(_("not a valid object: %s"), buffer.buf);
 }
 
 static void read_empty(unsigned const char *sha1, int verbose)
@@ -252,7 +257,7 @@ static void read_empty(unsigned const char *sha1, int verbose)
        args[i] = NULL;
 
        if (run_command_v_opt(args, RUN_GIT_CMD))
-               die("read-tree failed");
+               die(_("read-tree failed"));
 }
 
 static void reset_hard(unsigned const char *sha1, int verbose)
@@ -269,7 +274,7 @@ static void reset_hard(unsigned const char *sha1, int verbose)
        args[i] = NULL;
 
        if (run_command_v_opt(args, RUN_GIT_CMD))
-               die("read-tree failed");
+               die(_("read-tree failed"));
 }
 
 static void restore_state(void)
@@ -298,7 +303,7 @@ static void restore_state(void)
 static void finish_up_to_date(const char *msg)
 {
        if (verbosity >= 0)
-               printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
+               printf("%s%s\n", squash ? _(" (nothing to squash)") : "", msg);
        drop_save();
 }
 
@@ -311,10 +316,10 @@ static void squash_message(void)
        int fd;
        struct pretty_print_context ctx = {0};
 
-       printf("Squash commit -- not updating HEAD\n");
+       printf(_("Squash commit -- not updating HEAD\n"));
        fd = open(git_path("SQUASH_MSG"), O_WRONLY | O_CREAT, 0666);
        if (fd < 0)
-               die_errno("Could not write to '%s'", git_path("SQUASH_MSG"));
+               die_errno(_("Could not write to '%s'"), git_path("SQUASH_MSG"));
 
        init_revisions(&rev, NULL);
        rev.ignore_merges = 1;
@@ -329,7 +334,7 @@ static void squash_message(void)
 
        setup_revisions(0, NULL, &rev, NULL);
        if (prepare_revision_walk(&rev))
-               die("revision walk setup failed");
+               die(_("revision walk setup failed"));
 
        ctx.abbrev = rev.abbrev;
        ctx.date_mode = rev.date_mode;
@@ -342,9 +347,9 @@ static void squash_message(void)
                pretty_print_commit(rev.commit_format, commit, &out, &ctx);
        }
        if (write(fd, out.buf, out.len) < 0)
-               die_errno("Writing SQUASH_MSG");
+               die_errno(_("Writing SQUASH_MSG"));
        if (close(fd))
-               die_errno("Finishing SQUASH_MSG");
+               die_errno(_("Finishing SQUASH_MSG"));
        strbuf_release(&out);
 }
 
@@ -364,7 +369,7 @@ static void finish(const unsigned char *new_head, const char *msg)
                squash_message();
        } else {
                if (verbosity >= 0 && !merge_msg.len)
-                       printf("No merge message -- not updating HEAD\n");
+                       printf(_("No merge message -- not updating HEAD\n"));
                else {
                        const char *argv_gc_auto[] = { "gc", "--auto", NULL };
                        update_ref(reflog_message.buf, "HEAD",
@@ -386,7 +391,7 @@ static void finish(const unsigned char *new_head, const char *msg)
                if (diff_use_color_default > 0)
                        DIFF_OPT_SET(&opts, COLOR_DIFF);
                if (diff_setup_done(&opts) < 0)
-                       die("diff_setup_done failed");
+                       die(_("diff_setup_done failed"));
                diff_tree_sha1(head, new_head, "", &opts);
                diffcore_std(&opts);
                diff_flush(&opts);
@@ -415,7 +420,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
        memset(branch_head, 0, sizeof(branch_head));
        remote_head = peel_to_type(remote, 0, NULL, OBJ_COMMIT);
        if (!remote_head)
-               die("'%s' does not point to a commit", remote);
+               die(_("'%s' does not point to a commit"), remote);
 
        if (dwim_ref(remote, strlen(remote), branch_head, &found_ref) > 0) {
                if (!prefixcmp(found_ref, "refs/heads/")) {
@@ -480,7 +485,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
 
                fp = fopen(git_path("FETCH_HEAD"), "r");
                if (!fp)
-                       die_errno("could not open '%s' for reading",
+                       die_errno(_("could not open '%s' for reading"),
                                  git_path("FETCH_HEAD"));
                strbuf_getline(&line, fp, '\n');
                fclose(fp);
@@ -510,7 +515,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)
                buf = xstrdup(v);
                argc = split_cmdline(buf, &argv);
                if (argc < 0)
-                       die("Bad branch.%s.mergeoptions string: %s", branch,
+                       die(_("Bad branch.%s.mergeoptions string: %s"), branch,
                            split_cmdline_strerror(argc));
                argv = xrealloc(argv, sizeof(*argv) * (argc + 2));
                memmove(argv + 1, argv, sizeof(*argv) * (argc + 1));
@@ -532,10 +537,13 @@ static int git_merge_config(const char *k, const char *v, void *cb)
                int is_bool;
                shortlog_len = git_config_bool_or_int(k, v, &is_bool);
                if (!is_bool && shortlog_len < 0)
-                       return error("%s: negative length %s", k, v);
+                       return error(_("%s: negative length %s"), k, v);
                if (is_bool && shortlog_len)
                        shortlog_len = DEFAULT_MERGE_LOG_LEN;
                return 0;
+       } else if (!strcmp(k, "merge.defaulttoupstream")) {
+               default_to_upstream = git_config_bool(k, v);
+               return 0;
        }
        return git_diff_ui_config(k, v, cb);
 }
@@ -579,10 +587,11 @@ static int read_tree_trivial(unsigned char *common, unsigned char *head,
 static void write_tree_trivial(unsigned char *sha1)
 {
        if (write_cache_as_tree(sha1, 0, NULL))
-               die("git write-tree failed to write a tree");
+               die(_("git write-tree failed to write a tree"));
 }
 
-int try_merge_command(const char *strategy, struct commit_list *common,
+int try_merge_command(const char *strategy, size_t xopts_nr,
+                     const char **xopts, struct commit_list *common,
                      const char *head_arg, struct commit_list *remotes)
 {
        const char **args;
@@ -620,7 +629,7 @@ int try_merge_command(const char *strategy, struct commit_list *common,
        free(args);
        discard_cache();
        if (read_cache() < 0)
-               die("failed to read the cache");
+               die(_("failed to read the cache"));
        resolve_undo_clear();
 
        return ret;
@@ -637,7 +646,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
        if (active_cache_changed &&
                        (write_cache(index_fd, active_cache, active_nr) ||
                         commit_locked_index(lock)))
-               return error("Unable to write index.");
+               return error(_("Unable to write index."));
        rollback_lock_file(lock);
 
        if (!strcmp(strategy, "recursive") || !strcmp(strategy, "subtree")) {
@@ -650,7 +659,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
                struct commit_list *j;
 
                if (remoteheads->next) {
-                       error("Not handling anything other than two heads merge.");
+                       error(_("Not handling anything other than two heads merge."));
                        return 2;
                }
 
@@ -659,10 +668,12 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
                        o.subtree_shift = "";
 
                o.renormalize = option_renormalize;
+               o.show_rename_progress =
+                       show_progress == -1 ? isatty(2) : show_progress;
 
                for (x = 0; x < xopts_nr; x++)
                        if (parse_merge_opt(&o, xopts[x]))
-                               die("Unknown option for merge-recursive: -X%s", xopts[x]);
+                               die(_("Unknown option for merge-recursive: -X%s"), xopts[x]);
 
                o.branch1 = head_arg;
                o.branch2 = remoteheads->item->util;
@@ -676,11 +687,12 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
                if (active_cache_changed &&
                                (write_cache(index_fd, active_cache, active_nr) ||
                                 commit_locked_index(lock)))
-                       die ("unable to write %s", get_index_file());
+                       die (_("unable to write %s"), get_index_file());
                rollback_lock_file(lock);
                return clean ? 0 : 1;
        } else {
-               return try_merge_command(strategy, common, head_arg, remoteheads);
+               return try_merge_command(strategy, xopts_nr, xopts,
+                                               common, head_arg, remoteheads);
        }
 }
 
@@ -747,7 +759,7 @@ int checkout_fast_forward(const unsigned char *head, const unsigned char *remote
                return -1;
        if (write_cache(fd, active_cache, active_nr) ||
                commit_locked_index(lock_file))
-               die("unable to write new index file");
+               die(_("unable to write new index file"));
        return 0;
 }
 
@@ -799,10 +811,10 @@ static void write_merge_msg(void)
 {
        int fd = open(git_path("MERGE_MSG"), O_WRONLY | O_CREAT, 0666);
        if (fd < 0)
-               die_errno("Could not open '%s' for writing",
+               die_errno(_("Could not open '%s' for writing"),
                          git_path("MERGE_MSG"));
        if (write_in_full(fd, merge_msg.buf, merge_msg.len) != merge_msg.len)
-               die_errno("Could not write to '%s'", git_path("MERGE_MSG"));
+               die_errno(_("Could not write to '%s'"), git_path("MERGE_MSG"));
        close(fd);
 }
 
@@ -827,7 +839,7 @@ static int merge_trivial(void)
        struct commit_list *parent = xmalloc(sizeof(*parent));
 
        write_tree_trivial(result_tree);
-       printf("Wonderful.\n");
+       printf(_("Wonderful.\n"));
        parent->item = lookup_commit(head);
        parent->next = xmalloc(sizeof(*parent->next));
        parent->next->item = remoteheads->item;
@@ -878,7 +890,7 @@ static int suggest_conflicts(int renormalizing)
 
        fp = fopen(git_path("MERGE_MSG"), "a");
        if (!fp)
-               die_errno("Could not open '%s' for writing",
+               die_errno(_("Could not open '%s' for writing"),
                          git_path("MERGE_MSG"));
        fprintf(fp, "\nConflicts:\n");
        for (pos = 0; pos < active_nr; pos++) {
@@ -894,8 +906,8 @@ static int suggest_conflicts(int renormalizing)
        }
        fclose(fp);
        rerere(allow_rerere_auto);
-       printf("Automatic merge failed; "
-                       "fix conflicts and then commit the result.\n");
+       printf(_("Automatic merge failed; "
+                       "fix conflicts and then commit the result.\n"));
        return 1;
 }
 
@@ -909,7 +921,7 @@ static struct commit *is_old_style_invocation(int argc, const char **argv)
                        return NULL;
                second_token = lookup_commit_reference_gently(second_sha1, 0);
                if (!second_token)
-                       die("'%s' is not a commit", argv[1]);
+                       die(_("'%s' is not a commit"), argv[1]);
                if (hashcmp(second_token->object.sha1, head))
                        return NULL;
        }
@@ -939,6 +951,35 @@ static int evaluate_result(void)
        return cnt;
 }
 
+/*
+ * Pretend as if the user told us to merge with the tracking
+ * branch we have for the upstream of the current branch
+ */
+static int setup_with_upstream(const char ***argv)
+{
+       struct branch *branch = branch_get(NULL);
+       int i;
+       const char **args;
+
+       if (!branch)
+               die("No current branch.");
+       if (!branch->remote)
+               die("No remote for the current branch.");
+       if (!branch->merge_nr)
+               die("No default upstream defined for the current branch.");
+
+       args = xcalloc(branch->merge_nr + 1, sizeof(char *));
+       for (i = 0; i < branch->merge_nr; i++) {
+               if (!branch->merge[i]->dst)
+                       die("No remote tracking branch for %s from %s",
+                           branch->merge[i]->src, branch->remote_name);
+               args[i] = branch->merge[i]->dst;
+       }
+       args[i] = NULL;
+       *argv = args;
+       return i;
+}
+
 int cmd_merge(int argc, const char **argv, const char *prefix)
 {
        unsigned char result_tree[20];
@@ -972,12 +1013,15 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
        argc = parse_options(argc, argv, prefix, builtin_merge_options,
                        builtin_merge_usage, 0);
 
+       if (verbosity < 0 && show_progress == -1)
+               show_progress = 0;
+
        if (abort_current_merge) {
                int nargc = 2;
                const char *nargv[] = {"reset", "--merge", NULL};
 
                if (!file_exists(git_path("MERGE_HEAD")))
-                       die("There is no merge to abort (MERGE_HEAD missing).");
+                       die(_("There is no merge to abort (MERGE_HEAD missing)."));
 
                /* Invoke 'git reset --merge' */
                return cmd_reset(nargc, nargv, prefix);
@@ -992,10 +1036,17 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                 * add/rm <file>', just 'git commit'.
                 */
                if (advice_resolve_conflict)
-                       die("You have not concluded your merge (MERGE_HEAD exists).\n"
+                       die(_("You have not concluded your merge (MERGE_HEAD exists).\n"
+                                 "Please, commit your changes before you can merge."));
+               else
+                       die(_("You have not concluded your merge (MERGE_HEAD exists)."));
+       }
+       if (file_exists(git_path("CHERRY_PICK_HEAD"))) {
+               if (advice_resolve_conflict)
+                       die("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
                            "Please, commit your changes before you can merge.");
                else
-                       die("You have not concluded your merge (MERGE_HEAD exists).");
+                       die("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).");
        }
        resolve_undo_clear();
 
@@ -1004,12 +1055,15 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
        if (squash) {
                if (!allow_fast_forward)
-                       die("You cannot combine --squash with --no-ff.");
+                       die(_("You cannot combine --squash with --no-ff."));
                option_commit = 0;
        }
 
        if (!allow_fast_forward && fast_forward_only)
-               die("You cannot combine --no-ff with --ff-only.");
+               die(_("You cannot combine --no-ff with --ff-only."));
+
+       if (!argc && !abort_current_merge && default_to_upstream)
+               argc = setup_with_upstream(&argv);
 
        if (!argc)
                usage_with_options(builtin_merge_usage,
@@ -1037,19 +1091,19 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                 * We do the same for "git pull".
                 */
                if (argc != 1)
-                       die("Can merge only exactly one commit into "
-                               "empty head");
+                       die(_("Can merge only exactly one commit into "
+                               "empty head"));
                if (squash)
-                       die("Squash commit into empty head not supported yet");
+                       die(_("Squash commit into empty head not supported yet"));
                if (!allow_fast_forward)
-                       die("Non-fast-forward commit does not make sense into "
-                           "an empty head");
+                       die(_("Non-fast-forward commit does not make sense into "
+                           "an empty head"));
                remote_head = peel_to_type(argv[0], 0, NULL, OBJ_COMMIT);
                if (!remote_head)
-                       die("%s - not something we can merge", argv[0]);
+                       die(_("%s - not something we can merge"), argv[0]);
+               read_empty(remote_head->sha1, 0);
                update_ref("initial pull", "HEAD", remote_head->sha1, NULL, 0,
                                DIE_ON_ERR);
-               read_empty(remote_head->sha1, 0);
                return 0;
        } else {
                struct strbuf merge_names = STRBUF_INIT;
@@ -1092,7 +1146,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
                o = peel_to_type(argv[i], 0, NULL, OBJ_COMMIT);
                if (!o)
-                       die("%s - not something we can merge", argv[i]);
+                       die(_("%s - not something we can merge"), argv[i]);
                commit = lookup_commit(o->sha1);
                commit->util = (void *)argv[i];
                remotes = &commit_list_insert(commit, remotes)->next;
@@ -1150,7 +1204,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                strcpy(hex, find_unique_abbrev(head, DEFAULT_ABBREV));
 
                if (verbosity >= 0)
-                       printf("Updating %s..%s\n",
+                       printf(_("Updating %s..%s\n"),
                                hex,
                                find_unique_abbrev(remoteheads->item->object.sha1,
                                DEFAULT_ABBREV));
@@ -1184,11 +1238,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                if (allow_trivial && !fast_forward_only) {
                        /* See if it is really trivial. */
                        git_committer_info(IDENT_ERROR_ON_NO_NAME);
-                       printf("Trying really trivial in-index merge...\n");
+                       printf(_("Trying really trivial in-index merge...\n"));
                        if (!read_tree_trivial(common->item->object.sha1,
                                        head, remoteheads->item->object.sha1))
                                return merge_trivial();
-                       printf("Nope.\n");
+                       printf(_("Nope.\n"));
                }
        } else {
                /*
@@ -1221,7 +1275,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
        }
 
        if (fast_forward_only)
-               die("Not possible to fast-forward, aborting.");
+               die(_("Not possible to fast-forward, aborting."));
 
        /* We are going to make a new commit. */
        git_committer_info(IDENT_ERROR_ON_NO_NAME);
@@ -1247,11 +1301,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
        for (i = 0; i < use_strategies_nr; i++) {
                int ret;
                if (i) {
-                       printf("Rewinding the tree to pristine...\n");
+                       printf(_("Rewinding the tree to pristine...\n"));
                        restore_state();
                }
                if (use_strategies_nr != 1)
-                       printf("Trying merge strategy %s...\n",
+                       printf(_("Trying merge strategy %s...\n"),
                                use_strategies[i]->name);
                /*
                 * Remember which strategy left the state in the working
@@ -1312,17 +1366,17 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                restore_state();
                if (use_strategies_nr > 1)
                        fprintf(stderr,
-                               "No merge strategy handled the merge.\n");
+                               _("No merge strategy handled the merge.\n"));
                else
-                       fprintf(stderr, "Merge with strategy %s failed.\n",
+                       fprintf(stderr, _("Merge with strategy %s failed.\n"),
                                use_strategies[0]->name);
                return 2;
        } else if (best_strategy == wt_strategy)
                ; /* We already have its result in the working tree. */
        else {
-               printf("Rewinding the tree to pristine...\n");
+               printf(_("Rewinding the tree to pristine...\n"));
                restore_state();
-               printf("Using the %s to prepare resolving by hand.\n",
+               printf(_("Using the %s to prepare resolving by hand.\n"),
                        best_strategy);
                try_merge_strategy(best_strategy, common, head_arg);
        }
@@ -1338,28 +1392,28 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                                sha1_to_hex(j->item->object.sha1));
                fd = open(git_path("MERGE_HEAD"), O_WRONLY | O_CREAT, 0666);
                if (fd < 0)
-                       die_errno("Could not open '%s' for writing",
+                       die_errno(_("Could not open '%s' for writing"),
                                  git_path("MERGE_HEAD"));
                if (write_in_full(fd, buf.buf, buf.len) != buf.len)
-                       die_errno("Could not write to '%s'", git_path("MERGE_HEAD"));
+                       die_errno(_("Could not write to '%s'"), git_path("MERGE_HEAD"));
                close(fd);
                strbuf_addch(&merge_msg, '\n');
                write_merge_msg();
                fd = open(git_path("MERGE_MODE"), O_WRONLY | O_CREAT | O_TRUNC, 0666);
                if (fd < 0)
-                       die_errno("Could not open '%s' for writing",
+                       die_errno(_("Could not open '%s' for writing"),
                                  git_path("MERGE_MODE"));
                strbuf_reset(&buf);
                if (!allow_fast_forward)
                        strbuf_addf(&buf, "no-ff");
                if (write_in_full(fd, buf.buf, buf.len) != buf.len)
-                       die_errno("Could not write to '%s'", git_path("MERGE_MODE"));
+                       die_errno(_("Could not write to '%s'"), git_path("MERGE_MODE"));
                close(fd);
        }
 
        if (merge_was_ok) {
-               fprintf(stderr, "Automatic merge went well; "
-                       "stopped before committing as requested\n");
+               fprintf(stderr, _("Automatic merge went well; "
+                       "stopped before committing as requested\n"));
                return 0;
        } else
                return suggest_conflicts(option_renormalize);
index 1cb0f3f2a7cf580efc76957de24684630d596af9..324a267163d758b5dea51405265ae89042a657ad 100644 (file)
@@ -1,6 +1,5 @@
-#include "cache.h"
+#include "builtin.h"
 #include "tag.h"
-#include "exec_cmd.h"
 
 /*
  * A signature file has a very simple fixed format: four lines
@@ -35,12 +34,6 @@ static int verify_object(const unsigned char *sha1, const char *expected_type)
        return ret;
 }
 
-#ifdef NO_C99_FORMAT
-#define PD_FMT "%d"
-#else
-#define PD_FMT "%td"
-#endif
-
 static int verify_tag(char *buffer, unsigned long size)
 {
        int typelen;
@@ -70,15 +63,18 @@ static int verify_tag(char *buffer, unsigned long size)
        /* Verify tag-line */
        tag_line = strchr(type_line, '\n');
        if (!tag_line)
-               return error("char" PD_FMT ": could not find next \"\\n\"", type_line - buffer);
+               return error("char%"PRIuMAX": could not find next \"\\n\"",
+                               (uintmax_t) (type_line - buffer));
        tag_line++;
        if (memcmp(tag_line, "tag ", 4) || tag_line[4] == '\n')
-               return error("char" PD_FMT ": no \"tag \" found", tag_line - buffer);
+               return error("char%"PRIuMAX": no \"tag \" found",
+                               (uintmax_t) (tag_line - buffer));
 
        /* Get the actual type */
        typelen = tag_line - type_line - strlen("type \n");
        if (typelen >= sizeof(type))
-               return error("char" PD_FMT ": type too long", type_line+5 - buffer);
+               return error("char%"PRIuMAX": type too long",
+                               (uintmax_t) (type_line+5 - buffer));
 
        memcpy(type, type_line+5, typelen);
        type[typelen] = 0;
@@ -95,15 +91,16 @@ static int verify_tag(char *buffer, unsigned long size)
                        break;
                if (c > ' ')
                        continue;
-               return error("char" PD_FMT ": could not verify tag name", tag_line - buffer);
+               return error("char%"PRIuMAX": could not verify tag name",
+                               (uintmax_t) (tag_line - buffer));
        }
 
        /* Verify the tagger line */
        tagger_line = tag_line;
 
        if (memcmp(tagger_line, "tagger ", 7))
-               return error("char" PD_FMT ": could not find \"tagger \"",
-                       tagger_line - buffer);
+               return error("char%"PRIuMAX": could not find \"tagger \"",
+                       (uintmax_t) (tagger_line - buffer));
 
        /*
         * Check for correct form for name and email
@@ -115,44 +112,42 @@ static int verify_tag(char *buffer, unsigned long size)
        if (!(lb = strstr(tagger_line, " <")) || !(rb = strstr(lb+2, "> ")) ||
                strpbrk(tagger_line, "<>\n") != lb+1 ||
                strpbrk(lb+2, "><\n ") != rb)
-               return error("char" PD_FMT ": malformed tagger field",
-                       tagger_line - buffer);
+               return error("char%"PRIuMAX": malformed tagger field",
+                       (uintmax_t) (tagger_line - buffer));
 
        /* Check for author name, at least one character, space is acceptable */
        if (lb == tagger_line)
-               return error("char" PD_FMT ": missing tagger name",
-                       tagger_line - buffer);
+               return error("char%"PRIuMAX": missing tagger name",
+                       (uintmax_t) (tagger_line - buffer));
 
        /* timestamp, 1 or more digits followed by space */
        tagger_line = rb + 2;
        if (!(len = strspn(tagger_line, "0123456789")))
-               return error("char" PD_FMT ": missing tag timestamp",
-                       tagger_line - buffer);
+               return error("char%"PRIuMAX": missing tag timestamp",
+                       (uintmax_t) (tagger_line - buffer));
        tagger_line += len;
        if (*tagger_line != ' ')
-               return error("char" PD_FMT ": malformed tag timestamp",
-                       tagger_line - buffer);
+               return error("char%"PRIuMAX": malformed tag timestamp",
+                       (uintmax_t) (tagger_line - buffer));
        tagger_line++;
 
        /* timezone, 5 digits [+-]hhmm, max. 1400 */
        if (!((tagger_line[0] == '+' || tagger_line[0] == '-') &&
              strspn(tagger_line+1, "0123456789") == 4 &&
              tagger_line[5] == '\n' && atoi(tagger_line+1) <= 1400))
-               return error("char" PD_FMT ": malformed tag timezone",
-                       tagger_line - buffer);
+               return error("char%"PRIuMAX": malformed tag timezone",
+                       (uintmax_t) (tagger_line - buffer));
        tagger_line += 6;
 
        /* Verify the blank line separating the header from the body */
        if (*tagger_line != '\n')
-               return error("char" PD_FMT ": trailing garbage in tag header",
-                       tagger_line - buffer);
+               return error("char%"PRIuMAX": trailing garbage in tag header",
+                       (uintmax_t) (tagger_line - buffer));
 
        /* The actual stuff afterwards we don't care about.. */
        return 0;
 }
 
-#undef PD_FMT
-
 int cmd_mktag(int argc, const char **argv, const char *prefix)
 {
        struct strbuf buf = STRBUF_INIT;
index 93e8995d9e704faa041f97f92ba72dabe7839d81..40f33ca4d0e6d0bb1733e0544029c6f588d09b59 100644 (file)
@@ -74,7 +74,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
        newfd = hold_locked_index(&lock_file, 1);
        if (read_cache() < 0)
-               die("index file corrupt");
+               die(_("index file corrupt"));
 
        source = copy_pathspec(prefix, argv, argc, 0);
        modes = xcalloc(argc, sizeof(enum update_mode));
@@ -100,17 +100,17 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                const char *bad = NULL;
 
                if (show_only)
-                       printf("Checking rename of '%s' to '%s'\n", src, dst);
+                       printf(_("Checking rename of '%s' to '%s'\n"), src, dst);
 
                length = strlen(src);
                if (lstat(src, &st) < 0)
-                       bad = "bad source";
+                       bad = _("bad source");
                else if (!strncmp(src, dst, length) &&
                                (dst[length] == 0 || dst[length] == '/')) {
-                       bad = "can not move directory into itself";
+                       bad = _("can not move directory into itself");
                } else if ((src_is_dir = S_ISDIR(st.st_mode))
                                && lstat(dst, &st) == 0)
-                       bad = "cannot move directory over file";
+                       bad = _("cannot move directory over file");
                else if (src_is_dir) {
                        const char *src_w_slash = add_slash(src);
                        int len_w_slash = length + 1;
@@ -120,7 +120,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
                        first = cache_name_pos(src_w_slash, len_w_slash);
                        if (first >= 0)
-                               die ("Huh? %.*s is in index?",
+                               die (_("Huh? %.*s is in index?"),
                                                len_w_slash, src_w_slash);
 
                        first = -1 - first;
@@ -132,7 +132,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                        free((char *)src_w_slash);
 
                        if (last - first < 1)
-                               bad = "source directory is empty";
+                               bad = _("source directory is empty");
                        else {
                                int j, dst_len;
 
@@ -163,22 +163,22 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                argc += last - first;
                        }
                } else if (cache_name_pos(src, length) < 0)
-                       bad = "not under version control";
+                       bad = _("not under version control");
                else if (lstat(dst, &st) == 0) {
-                       bad = "destination exists";
+                       bad = _("destination exists");
                        if (force) {
                                /*
                                 * only files can overwrite each other:
                                 * check both source and destination
                                 */
                                if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-                                       warning("%s; will overwrite!", bad);
+                                       warning(_("%s; will overwrite!"), bad);
                                        bad = NULL;
                                } else
-                                       bad = "Cannot overwrite";
+                                       bad = _("Cannot overwrite");
                        }
                } else if (string_list_has_string(&src_for_dst, dst))
-                       bad = "multiple sources for the same target";
+                       bad = _("multiple sources for the same target");
                else
                        string_list_insert(&src_for_dst, dst);
 
@@ -193,7 +193,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                                        i--;
                                }
                        } else
-                               die ("%s, source=%s, destination=%s",
+                               die (_("%s, source=%s, destination=%s"),
                                     bad, src, dst);
                }
        }
@@ -203,10 +203,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
                enum update_mode mode = modes[i];
                int pos;
                if (show_only || verbose)
-                       printf("Renaming %s to %s\n", src, dst);
+                       printf(_("Renaming %s to %s\n"), src, dst);
                if (!show_only && mode != INDEX &&
                                rename(src, dst) < 0 && !ignore_errors)
-                       die_errno ("renaming '%s' failed", src);
+                       die_errno (_("renaming '%s' failed"), src);
 
                if (mode == WORKING_DIRECTORY)
                        continue;
@@ -220,7 +220,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
        if (active_cache_changed) {
                if (write_cache(newfd, active_cache, active_nr) ||
                    commit_locked_index(&lock_file))
-                       die("Unable to write new index file");
+                       die(_("Unable to write new index file"));
        }
 
        return 0;
index 0aab150c52c839512b82b5efc6e978b7a80653e3..d6dcfcb0149ab6dc45f4a71e21cf77d13b494e18 100644 (file)
@@ -146,13 +146,13 @@ static void write_commented_object(int fd, const unsigned char *object)
        show.err = 0;
        show.git_cmd = 1;
        if (start_command(&show))
-               die("unable to start 'show' for object '%s'",
+               die(_("unable to start 'show' for object '%s'"),
                    sha1_to_hex(object));
 
        /* Open the output as FILE* so strbuf_getline() can be used. */
        show_out = xfdopen(show.out, "r");
        if (show_out == NULL)
-               die_errno("can't fdopen 'show' output fd");
+               die_errno(_("can't fdopen 'show' output fd"));
 
        /* Prepend "# " to each output line and write result to 'fd' */
        while (strbuf_getline(&buf, show_out, '\n') != EOF) {
@@ -162,10 +162,10 @@ static void write_commented_object(int fd, const unsigned char *object)
        }
        strbuf_release(&buf);
        if (fclose(show_out))
-               die_errno("failed to close pipe to 'show' for object '%s'",
+               die_errno(_("failed to close pipe to 'show' for object '%s'"),
                          sha1_to_hex(object));
        if (finish_command(&show))
-               die("failed to finish 'show' for object '%s'",
+               die(_("failed to finish 'show' for object '%s'"),
                    sha1_to_hex(object));
 }
 
@@ -182,7 +182,7 @@ static void create_note(const unsigned char *object, struct msg_arg *msg,
                path = git_pathdup("NOTES_EDITMSG");
                fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
                if (fd < 0)
-                       die_errno("could not create file '%s'", path);
+                       die_errno(_("could not create file '%s'"), path);
 
                if (msg->given)
                        write_or_die(fd, msg->buf.buf, msg->buf.len);
@@ -196,8 +196,8 @@ static void create_note(const unsigned char *object, struct msg_arg *msg,
                strbuf_reset(&(msg->buf));
 
                if (launch_editor(path, &(msg->buf), NULL)) {
-                       die("Please supply the note contents using either -m" \
-                           " or -F option");
+                       die(_("Please supply the note contents using either -m" \
+                           " or -F option"));
                }
                stripspace(&(msg->buf), 1);
        }
@@ -217,14 +217,14 @@ static void create_note(const unsigned char *object, struct msg_arg *msg,
        }
 
        if (!msg->buf.len) {
-               fprintf(stderr, "Removing note for object %s\n",
+               fprintf(stderr, _("Removing note for object %s\n"),
                        sha1_to_hex(object));
                hashclr(result);
        } else {
                if (write_sha1_file(msg->buf.buf, msg->buf.len, blob_type, result)) {
-                       error("unable to write note object");
+                       error(_("unable to write note object"));
                        if (path)
-                               error("The note contents has been left in %s",
+                               error(_("The note contents has been left in %s"),
                                      path);
                        exit(128);
                }
@@ -258,9 +258,9 @@ static int parse_file_arg(const struct option *opt, const char *arg, int unset)
                strbuf_addch(&(msg->buf), '\n');
        if (!strcmp(arg, "-")) {
                if (strbuf_read(&(msg->buf), 0, 1024) < 0)
-                       die_errno("cannot read '%s'", arg);
+                       die_errno(_("cannot read '%s'"), arg);
        } else if (strbuf_read_file(&(msg->buf), arg, 1024) < 0)
-               die_errno("could not open or read '%s'", arg);
+               die_errno(_("could not open or read '%s'"), arg);
        stripspace(&(msg->buf), 0);
 
        msg->given = 1;
@@ -279,10 +279,10 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
                strbuf_addch(&(msg->buf), '\n');
 
        if (get_sha1(arg, object))
-               die("Failed to resolve '%s' as a valid ref.", arg);
+               die(_("Failed to resolve '%s' as a valid ref."), arg);
        if (!(buf = read_sha1_file(object, &type, &len)) || !len) {
                free(buf);
-               die("Failed to read object '%s'.", arg);;
+               die(_("Failed to read object '%s'."), arg);;
        }
        strbuf_add(&(msg->buf), buf, len);
        free(buf);
@@ -306,7 +306,7 @@ void commit_notes(struct notes_tree *t, const char *msg)
        if (!t)
                t = &default_notes_tree;
        if (!t->initialized || !t->ref || !*t->ref)
-               die("Cannot commit uninitialized/unreferenced notes tree");
+               die(_("Cannot commit uninitialized/unreferenced notes tree"));
        if (!t->dirty)
                return; /* don't have to commit an unchanged tree */
 
@@ -347,7 +347,7 @@ static int notes_rewrite_config(const char *k, const char *v, void *cb)
                        config_error_nonbool(k);
                c->combine = parse_combine_notes_fn(v);
                if (!c->combine) {
-                       error("Bad notes.rewriteMode value: '%s'", v);
+                       error(_("Bad notes.rewriteMode value: '%s'"), v);
                        return 1;
                }
                return 0;
@@ -357,8 +357,8 @@ static int notes_rewrite_config(const char *k, const char *v, void *cb)
                if (!prefixcmp(v, "refs/notes/"))
                        string_list_add_refs_by_glob(c->refs, v);
                else
-                       warning("Refusing to rewrite notes in %s"
-                               " (outside of refs/notes/)", v);
+                       warning(_("Refusing to rewrite notes in %s"
+                               " (outside of refs/notes/)"), v);
                return 0;
        }
 
@@ -382,8 +382,10 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
                c->mode_from_env = 1;
                c->combine = parse_combine_notes_fn(rewrite_mode_env);
                if (!c->combine)
-                       error("Bad " GIT_NOTES_REWRITE_MODE_ENVIRONMENT
-                             " value: '%s'", rewrite_mode_env);
+                       /* TRANSLATORS: The first %s is the name of the
+                          environment variable, the second %s is its value */
+                       error(_("Bad %s value: '%s'"), GIT_NOTES_REWRITE_MODE_ENVIRONMENT,
+                                       rewrite_mode_env);
        }
        if (rewrite_refs_env) {
                c->refs_from_env = 1;
@@ -423,7 +425,7 @@ void finish_copy_notes_for_rewrite(struct notes_rewrite_cfg *c)
        free(c);
 }
 
-int notes_copy_from_stdin(int force, const char *rewrite_cmd)
+static int notes_copy_from_stdin(int force, const char *rewrite_cmd)
 {
        struct strbuf buf = STRBUF_INIT;
        struct notes_rewrite_cfg *c = NULL;
@@ -446,13 +448,13 @@ int notes_copy_from_stdin(int force, const char *rewrite_cmd)
 
                split = strbuf_split(&buf, ' ');
                if (!split[0] || !split[1])
-                       die("Malformed input line: '%s'.", buf.buf);
+                       die(_("Malformed input line: '%s'."), buf.buf);
                strbuf_rtrim(split[0]);
                strbuf_rtrim(split[1]);
                if (get_sha1(split[0]->buf, from_obj))
-                       die("Failed to resolve '%s' as a valid ref.", split[0]->buf);
+                       die(_("Failed to resolve '%s' as a valid ref."), split[0]->buf);
                if (get_sha1(split[1]->buf, to_obj))
-                       die("Failed to resolve '%s' as a valid ref.", split[1]->buf);
+                       die(_("Failed to resolve '%s' as a valid ref."), split[1]->buf);
 
                if (rewrite_cmd)
                        err = copy_note_for_rewrite(c, from_obj, to_obj);
@@ -461,7 +463,7 @@ int notes_copy_from_stdin(int force, const char *rewrite_cmd)
                                        combine_notes_overwrite);
 
                if (err) {
-                       error("Failed to copy notes from '%s' to '%s'",
+                       error(_("Failed to copy notes from '%s' to '%s'"),
                              split[0]->buf, split[1]->buf);
                        ret = 1;
                }
@@ -505,20 +507,20 @@ static int list(int argc, const char **argv, const char *prefix)
                                     git_notes_list_usage, 0);
 
        if (1 < argc) {
-               error("too many parameters");
+               error(_("too many parameters"));
                usage_with_options(git_notes_list_usage, options);
        }
 
        t = init_notes_check("list");
        if (argc) {
                if (get_sha1(argv[0], object))
-                       die("Failed to resolve '%s' as a valid ref.", argv[0]);
+                       die(_("Failed to resolve '%s' as a valid ref."), argv[0]);
                note = get_note(t, object);
                if (note) {
                        puts(sha1_to_hex(note));
                        retval = 0;
                } else
-                       retval = error("No note found for object %s.",
+                       retval = error(_("No note found for object %s."),
                                       sha1_to_hex(object));
        } else
                retval = for_each_note(t, 0, list_each_note, NULL);
@@ -557,26 +559,26 @@ static int add(int argc, const char **argv, const char *prefix)
                             0);
 
        if (1 < argc) {
-               error("too many parameters");
+               error(_("too many parameters"));
                usage_with_options(git_notes_add_usage, options);
        }
 
        object_ref = argc ? argv[0] : "HEAD";
 
        if (get_sha1(object_ref, object))
-               die("Failed to resolve '%s' as a valid ref.", object_ref);
+               die(_("Failed to resolve '%s' as a valid ref."), object_ref);
 
        t = init_notes_check("add");
        note = get_note(t, object);
 
        if (note) {
                if (!force) {
-                       retval = error("Cannot add notes. Found existing notes "
+                       retval = error(_("Cannot add notes. Found existing notes "
                                       "for object %s. Use '-f' to overwrite "
-                                      "existing notes", sha1_to_hex(object));
+                                      "existing notes"), sha1_to_hex(object));
                        goto out;
                }
-               fprintf(stderr, "Overwriting existing notes for object %s\n",
+               fprintf(stderr, _("Overwriting existing notes for object %s\n"),
                        sha1_to_hex(object));
        }
 
@@ -618,7 +620,7 @@ static int copy(int argc, const char **argv, const char *prefix)
 
        if (from_stdin || rewrite_cmd) {
                if (argc) {
-                       error("too many parameters");
+                       error(_("too many parameters"));
                        usage_with_options(git_notes_copy_usage, options);
                } else {
                        return notes_copy_from_stdin(force, rewrite_cmd);
@@ -626,41 +628,41 @@ static int copy(int argc, const char **argv, const char *prefix)
        }
 
        if (argc < 2) {
-               error("too few parameters");
+               error(_("too few parameters"));
                usage_with_options(git_notes_copy_usage, options);
        }
        if (2 < argc) {
-               error("too many parameters");
+               error(_("too many parameters"));
                usage_with_options(git_notes_copy_usage, options);
        }
 
        if (get_sha1(argv[0], from_obj))
-               die("Failed to resolve '%s' as a valid ref.", argv[0]);
+               die(_("Failed to resolve '%s' as a valid ref."), argv[0]);
 
        object_ref = 1 < argc ? argv[1] : "HEAD";
 
        if (get_sha1(object_ref, object))
-               die("Failed to resolve '%s' as a valid ref.", object_ref);
+               die(_("Failed to resolve '%s' as a valid ref."), object_ref);
 
        t = init_notes_check("copy");
        note = get_note(t, object);
 
        if (note) {
                if (!force) {
-                       retval = error("Cannot copy notes. Found existing "
+                       retval = error(_("Cannot copy notes. Found existing "
                                       "notes for object %s. Use '-f' to "
-                                      "overwrite existing notes",
+                                      "overwrite existing notes"),
                                       sha1_to_hex(object));
                        goto out;
                }
-               fprintf(stderr, "Overwriting existing notes for object %s\n",
+               fprintf(stderr, _("Overwriting existing notes for object %s\n"),
                        sha1_to_hex(object));
        }
 
        from_note = get_note(t, from_obj);
        if (!from_note) {
-               retval = error("Missing notes on source object %s. Cannot "
-                              "copy.", sha1_to_hex(from_obj));
+               retval = error(_("Missing notes on source object %s. Cannot "
+                              "copy."), sha1_to_hex(from_obj));
                goto out;
        }
 
@@ -703,19 +705,19 @@ static int append_edit(int argc, const char **argv, const char *prefix)
                             PARSE_OPT_KEEP_ARGV0);
 
        if (2 < argc) {
-               error("too many parameters");
+               error(_("too many parameters"));
                usage_with_options(usage, options);
        }
 
        if (msg.given && edit)
-               fprintf(stderr, "The -m/-F/-c/-C options have been deprecated "
+               fprintf(stderr, _("The -m/-F/-c/-C options have been deprecated "
                        "for the 'edit' subcommand.\n"
-                       "Please use 'git notes add -f -m/-F/-c/-C' instead.\n");
+                       "Please use 'git notes add -f -m/-F/-c/-C' instead.\n"));
 
        object_ref = 1 < argc ? argv[1] : "HEAD";
 
        if (get_sha1(object_ref, object))
-               die("Failed to resolve '%s' as a valid ref.", object_ref);
+               die(_("Failed to resolve '%s' as a valid ref."), object_ref);
 
        t = init_notes_check(argv[0]);
        note = get_note(t, object);
@@ -750,20 +752,20 @@ static int show(int argc, const char **argv, const char *prefix)
                             0);
 
        if (1 < argc) {
-               error("too many parameters");
+               error(_("too many parameters"));
                usage_with_options(git_notes_show_usage, options);
        }
 
        object_ref = argc ? argv[0] : "HEAD";
 
        if (get_sha1(object_ref, object))
-               die("Failed to resolve '%s' as a valid ref.", object_ref);
+               die(_("Failed to resolve '%s' as a valid ref."), object_ref);
 
        t = init_notes_check("show");
        note = get_note(t, object);
 
        if (!note)
-               retval = error("No note found for object %s.",
+               retval = error(_("No note found for object %s."),
                               sha1_to_hex(object));
        else {
                const char *show_args[3] = {"show", sha1_to_hex(note), NULL};
@@ -819,7 +821,7 @@ static int merge_commit(struct notes_merge_options *o)
        t = xcalloc(1, sizeof(struct notes_tree));
        init_notes(t, "NOTES_MERGE_PARTIAL", combine_notes_overwrite, 0);
 
-       o->local_ref = resolve_ref("NOTES_MERGE_REF", sha1, 0, 0);
+       o->local_ref = resolve_ref("NOTES_MERGE_REF", sha1, 0, NULL);
        if (!o->local_ref)
                die("Failed to resolve NOTES_MERGE_REF");
 
@@ -961,22 +963,22 @@ static int remove_cmd(int argc, const char **argv, const char *prefix)
                             git_notes_remove_usage, 0);
 
        if (1 < argc) {
-               error("too many parameters");
+               error(_("too many parameters"));
                usage_with_options(git_notes_remove_usage, options);
        }
 
        object_ref = argc ? argv[0] : "HEAD";
 
        if (get_sha1(object_ref, object))
-               die("Failed to resolve '%s' as a valid ref.", object_ref);
+               die(_("Failed to resolve '%s' as a valid ref."), object_ref);
 
        t = init_notes_check("remove");
 
        retval = remove_note(t, object);
        if (retval)
-               fprintf(stderr, "Object %s has no note\n", sha1_to_hex(object));
+               fprintf(stderr, _("Object %s has no note\n"), sha1_to_hex(object));
        else {
-               fprintf(stderr, "Removing note for object %s\n",
+               fprintf(stderr, _("Removing note for object %s\n"),
                        sha1_to_hex(object));
 
                commit_notes(t, "Notes removed by 'git notes remove'");
@@ -999,7 +1001,7 @@ static int prune(int argc, const char **argv, const char *prefix)
                             0);
 
        if (argc) {
-               error("too many parameters");
+               error(_("too many parameters"));
                usage_with_options(git_notes_prune_usage, options);
        }
 
@@ -1069,7 +1071,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
        else if (!strcmp(argv[0], "get-ref"))
                result = get_ref(argc, argv, prefix);
        else {
-               result = error("Unknown subcommand: %s", argv[0]);
+               result = error(_("Unknown subcommand: %s"), argv[0]);
                usage_with_options(git_notes_usage, options);
        }
 
index 41e1615a28d772d1677c172ff2f570f31de4026f..f5c6afc5dd46c8f856d0f125287724bbfdc65db7 100644 (file)
@@ -6,8 +6,7 @@
 *
 */
 
-#include "cache.h"
-#include "exec_cmd.h"
+#include "builtin.h"
 
 #define BLKSIZE 512
 
index 091860b2e370561f0811399b0d307e732e9eaac3..39a9d89fbdf322a8ef42a62e41ac36af934ff638 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "parse-options.h"
 #include "pack-refs.h"
 
index 49a0472a9bd28274c4be1352996e700a1db4b94a..f821eb3f0b864c26d5e822cc7c5b0747340abee5 100644 (file)
@@ -1,5 +1,4 @@
-#include "cache.h"
-#include "exec_cmd.h"
+#include "builtin.h"
 
 static void flush_current_id(int patchlen, unsigned char *id, git_SHA_CTX *c)
 {
@@ -57,7 +56,7 @@ static int scan_hunk_header(const char *p, int *p_before, int *p_after)
        return 1;
 }
 
-int get_one_patchid(unsigned char *next_sha1, git_SHA_CTX *ctx)
+static int get_one_patchid(unsigned char *next_sha1, git_SHA_CTX *ctx)
 {
        static char line[1000];
        int patchlen = 0, found_next = 0;
index 31da418cf4a9e4732edb8201c80b07f7ddadbac1..9cebf9ea234d968eab638f7dcdc65370f77c0047 100644 (file)
@@ -40,7 +40,7 @@ static void set_refspecs(const char **refs, int nr)
                        char *tag;
                        int len;
                        if (nr <= ++i)
-                               die("tag shorthand without <tag>");
+                               die(_("tag shorthand without <tag>"));
                        len = strlen(refs[i]) + 11;
                        if (deleterefs) {
                                tag = xmalloc(len+1);
@@ -59,28 +59,38 @@ static void set_refspecs(const char **refs, int nr)
                        strcat(delref, ref);
                        ref = delref;
                } else if (deleterefs)
-                       die("--delete only accepts plain target ref names");
+                       die(_("--delete only accepts plain target ref names"));
                add_refspec(ref);
        }
 }
 
-static void setup_push_upstream(void)
+static void setup_push_upstream(struct remote *remote)
 {
        struct strbuf refspec = STRBUF_INIT;
        struct branch *branch = branch_get(NULL);
        if (!branch)
-               die("You are not currently on a branch.");
+               die(_("You are not currently on a branch.\n"
+                   "To push the history leading to the current (detached HEAD)\n"
+                   "state now, use\n"
+                   "\n"
+                   "    git push %s HEAD:<name-of-remote-branch>\n"),
+                   remote->name);
        if (!branch->merge_nr || !branch->merge)
-               die("The current branch %s has no upstream branch.",
+               die(_("The current branch %s has no upstream branch.\n"
+                   "To push the current branch and set the remote as upstream, use\n"
+                   "\n"
+                   "    git push --set-upstream %s %s\n"),
+                   branch->name,
+                   remote->name,
                    branch->name);
        if (branch->merge_nr != 1)
-               die("The current branch %s has multiple upstream branches, "
-                   "refusing to push.", branch->name);
+               die(_("The current branch %s has multiple upstream branches, "
+                   "refusing to push."), branch->name);
        strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
        add_refspec(refspec.buf);
 }
 
-static void setup_default_push_refspecs(void)
+static void setup_default_push_refspecs(struct remote *remote)
 {
        switch (push_default) {
        default:
@@ -89,7 +99,7 @@ static void setup_default_push_refspecs(void)
                break;
 
        case PUSH_DEFAULT_UPSTREAM:
-               setup_push_upstream();
+               setup_push_upstream(remote);
                break;
 
        case PUSH_DEFAULT_CURRENT:
@@ -97,8 +107,8 @@ static void setup_default_push_refspecs(void)
                break;
 
        case PUSH_DEFAULT_NOTHING:
-               die("You didn't specify any refspecs to push, and "
-                   "push.default is \"nothing\".");
+               die(_("You didn't specify any refspecs to push, and "
+                   "push.default is \"nothing\"."));
                break;
        }
 }
@@ -117,11 +127,11 @@ static int push_with_options(struct transport *transport, int flags)
                transport_set_option(transport, TRANS_OPT_THIN, "yes");
 
        if (verbosity > 0)
-               fprintf(stderr, "Pushing to %s\n", transport->url);
+               fprintf(stderr, _("Pushing to %s\n"), transport->url);
        err = transport_push(transport, refspec_nr, refspec, flags,
                             &nonfastforward);
        if (err != 0)
-               error("failed to push some refs to '%s'", transport->url);
+               error(_("failed to push some refs to '%s'"), transport->url);
 
        err |= transport_disconnect(transport);
 
@@ -129,9 +139,9 @@ static int push_with_options(struct transport *transport, int flags)
                return 0;
 
        if (nonfastforward && advice_push_nonfastforward) {
-               fprintf(stderr, "To prevent you from losing history, non-fast-forward updates were rejected\n"
+               fprintf(stderr, _("To prevent you from losing history, non-fast-forward updates were rejected\n"
                                "Merge the remote changes (e.g. 'git pull') before pushing again.  See the\n"
-                               "'Note about fast-forwards' section of 'git push --help' for details.\n");
+                               "'Note about fast-forwards' section of 'git push --help' for details.\n"));
        }
 
        return 1;
@@ -146,8 +156,15 @@ static int do_push(const char *repo, int flags)
 
        if (!remote) {
                if (repo)
-                       die("bad repository '%s'", repo);
-               die("No destination configured to push to.");
+                       die(_("bad repository '%s'"), repo);
+               die(_("No configured push destination.\n"
+                   "Either specify the URL from the command-line or configure a remote repository using\n"
+                   "\n"
+                   "    git remote add <name> <url>\n"
+                   "\n"
+                   "and then push using the remote name\n"
+                   "\n"
+                   "    git push <name>\n"));
        }
 
        if (remote->mirror)
@@ -155,19 +172,19 @@ static int do_push(const char *repo, int flags)
 
        if ((flags & TRANSPORT_PUSH_ALL) && refspec) {
                if (!strcmp(*refspec, "refs/tags/*"))
-                       return error("--all and --tags are incompatible");
-               return error("--all can't be combined with refspecs");
+                       return error(_("--all and --tags are incompatible"));
+               return error(_("--all can't be combined with refspecs"));
        }
 
        if ((flags & TRANSPORT_PUSH_MIRROR) && refspec) {
                if (!strcmp(*refspec, "refs/tags/*"))
-                       return error("--mirror and --tags are incompatible");
-               return error("--mirror can't be combined with refspecs");
+                       return error(_("--mirror and --tags are incompatible"));
+               return error(_("--mirror can't be combined with refspecs"));
        }
 
        if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) ==
                                (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) {
-               return error("--all and --mirror are incompatible");
+               return error(_("--all and --mirror are incompatible"));
        }
 
        if (!refspec && !(flags & TRANSPORT_PUSH_ALL)) {
@@ -175,7 +192,7 @@ static int do_push(const char *repo, int flags)
                        refspec = remote->push_refspec;
                        refspec_nr = remote->push_refspec_nr;
                } else if (!(flags & TRANSPORT_PUSH_MIRROR))
-                       setup_default_push_refspecs();
+                       setup_default_push_refspecs(remote);
        }
        errs = 0;
        if (remote->pushurl_nr) {
@@ -228,13 +245,14 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
 
+       packet_trace_identity("push");
        git_config(git_default_config, NULL);
        argc = parse_options(argc, argv, prefix, options, push_usage, 0);
 
        if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
-               die("--delete is incompatible with --all, --mirror and --tags");
+               die(_("--delete is incompatible with --all, --mirror and --tags"));
        if (deleterefs && argc < 2)
-               die("--delete doesn't make sense without any refs");
+               die(_("--delete doesn't make sense without any refs"));
 
        if (tags)
                add_refspec("refs/tags/*");
index 760817dbd7fec0086a0a1b62e58ab4438f227b7b..e1ba4dc697abd1b2582713744c5a1892ef4a4882 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "pack.h"
 #include "refs.h"
 #include "pkt-line.h"
@@ -731,43 +731,14 @@ static int delete_only(struct command *commands)
        return 1;
 }
 
-static int add_refs_from_alternate(struct alternate_object_database *e, void *unused)
+static void add_one_alternate_ref(const struct ref *ref, void *unused)
 {
-       char *other;
-       size_t len;
-       struct remote *remote;
-       struct transport *transport;
-       const struct ref *extra;
-
-       e->name[-1] = '\0';
-       other = xstrdup(make_absolute_path(e->base));
-       e->name[-1] = '/';
-       len = strlen(other);
-
-       while (other[len-1] == '/')
-               other[--len] = '\0';
-       if (len < 8 || memcmp(other + len - 8, "/objects", 8))
-               return 0;
-       /* Is this a git repository with refs? */
-       memcpy(other + len - 8, "/refs", 6);
-       if (!is_directory(other))
-               return 0;
-       other[len - 8] = '\0';
-       remote = remote_get(other);
-       transport = transport_get(remote, other);
-       for (extra = transport_get_remote_refs(transport);
-            extra;
-            extra = extra->next) {
-               add_extra_ref(".have", extra->old_sha1, 0);
-       }
-       transport_disconnect(transport);
-       free(other);
-       return 0;
+       add_extra_ref(".have", ref->old_sha1, 0);
 }
 
 static void add_alternate_refs(void)
 {
-       foreach_alt_odb(add_refs_from_alternate, NULL);
+       foreach_alt_odb(refs_from_alternate_cb, add_one_alternate_ref);
 }
 
 int cmd_receive_pack(int argc, const char **argv, const char *prefix)
@@ -778,6 +749,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
        char *dir = NULL;
        struct command *commands;
 
+       packet_trace_identity("receive-pack");
+
        argv++;
        for (i = 1; i < argc; i++) {
                const char *arg = *argv++;
index ea71977c8360e1a7899bbd035cf26f93d889800b..692c834d9dd48615e42b67e3924c64e3397ad903 100644 (file)
@@ -1,4 +1,4 @@
-#include "git-compat-util.h"
+#include "builtin.h"
 #include "transport.h"
 #include "run-command.h"
 
@@ -30,16 +30,12 @@ static char *strip_escapes(const char *str, const char *service,
        size_t rpos = 0;
        int escape = 0;
        char special = 0;
-       size_t pslen = 0;
-       size_t pSlen = 0;
        size_t psoff = 0;
        struct strbuf ret = STRBUF_INIT;
 
        /* Calculate prefix length for \s and lengths for \s and \S */
        if (!strncmp(service, "git-", 4))
                psoff = 4;
-       pSlen = strlen(service);
-       pslen = pSlen - psoff;
 
        /* Pass the service to command. */
        setenv("GIT_EXT_SERVICE", service, 1);
index 1f2467bdb756435764f9156ffefeeb510dc872d8..08d7121b6d118042a45086d2902769d282c062f8 100644 (file)
@@ -1,4 +1,4 @@
-#include "git-compat-util.h"
+#include "builtin.h"
 #include "transport.h"
 
 /*
index cb26080956077f8c9ae02c91ffdc341293a4f9f1..b71ecd228f5c27bc436602469d3090eb860a1222 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "parse-options.h"
 #include "transport.h"
 #include "remote.h"
index 642bf35587ed994948d3eeac0a189ae29e39bf11..82358855d1da90b75f94c3d424a5da5c0f97960e 100644 (file)
@@ -8,7 +8,7 @@
 #include "xdiff-interface.h"
 
 static const char * const rerere_usage[] = {
-       "git rerere [clear | status | diff | gc]",
+       "git rerere [clear | forget path... | status | remaining | diff | gc]",
        NULL,
 };
 
@@ -136,7 +136,10 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
                return rerere(flags);
 
        if (!strcmp(argv[0], "forget")) {
-               const char **pathspec = get_pathspec(prefix, argv + 1);
+               const char **pathspec;
+               if (argc < 2)
+                       warning("'git rerere forget' without paths is deprecated");
+               pathspec = get_pathspec(prefix, argv + 1);
                return rerere_forget(pathspec);
        }
 
@@ -156,7 +159,17 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
        else if (!strcmp(argv[0], "status"))
                for (i = 0; i < merge_rr.nr; i++)
                        printf("%s\n", merge_rr.items[i].string);
-       else if (!strcmp(argv[0], "diff"))
+       else if (!strcmp(argv[0], "remaining")) {
+               rerere_remaining(&merge_rr);
+               for (i = 0; i < merge_rr.nr; i++) {
+                       if (merge_rr.items[i].util != RERERE_RESOLVED)
+                               printf("%s\n", merge_rr.items[i].string);
+                       else
+                               /* prepare for later call to
+                                * string_list_clear() */
+                               merge_rr.items[i].util = NULL;
+               }
+       } else if (!strcmp(argv[0], "diff"))
                for (i = 0; i < merge_rr.nr; i++) {
                        const char *path = merge_rr.items[i].string;
                        const char *name = (const char *)merge_rr.items[i].util;
index 5de2bceeec8c1d243ed6da70464d0c4dd60d7352..98bca044c1267fa63cb084a45aaf621e85f7d9b6 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano
  */
-#include "cache.h"
+#include "builtin.h"
 #include "tag.h"
 #include "object.h"
 #include "commit.h"
@@ -30,7 +30,7 @@ static const char * const git_reset_usage[] = {
 
 enum reset_type { MIXED, SOFT, HARD, MERGE, KEEP, NONE };
 static const char *reset_type_names[] = {
-       "mixed", "soft", "hard", "merge", "keep", NULL
+       N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
 };
 
 static char *args_to_str(const char **argv)
@@ -92,20 +92,20 @@ static int reset_index_file(const unsigned char *sha1, int reset_type, int quiet
        if (reset_type == KEEP) {
                unsigned char head_sha1[20];
                if (get_sha1("HEAD", head_sha1))
-                       return error("You do not have a valid HEAD.");
+                       return error(_("You do not have a valid HEAD."));
                if (!fill_tree_descriptor(desc, head_sha1))
-                       return error("Failed to find tree of HEAD.");
+                       return error(_("Failed to find tree of HEAD."));
                nr++;
                opts.fn = twoway_merge;
        }
 
        if (!fill_tree_descriptor(desc + nr - 1, sha1))
-               return error("Failed to find tree of %s.", sha1_to_hex(sha1));
+               return error(_("Failed to find tree of %s."), sha1_to_hex(sha1));
        if (unpack_trees(nr, desc, &opts))
                return -1;
        if (write_cache(newfd, active_cache, active_nr) ||
            commit_locked_index(lock))
-               return error("Could not write new index file.");
+               return error(_("Could not write new index file."));
 
        return 0;
 }
@@ -115,7 +115,7 @@ static void print_new_head_line(struct commit *commit)
        const char *hex, *body;
 
        hex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
-       printf("HEAD is now at %s", hex);
+       printf(_("HEAD is now at %s"), hex);
        body = strstr(commit->buffer, "\n\n");
        if (body) {
                const char *eol;
@@ -139,10 +139,10 @@ static int update_index_refresh(int fd, struct lock_file *index_lock, int flags)
        }
 
        if (read_cache() < 0)
-               return error("Could not read index");
+               return error(_("Could not read index"));
 
        result = refresh_index(&the_index, (flags), NULL, NULL,
-                              "Unstaged changes after reset:") ? 1 : 0;
+                              _("Unstaged changes after reset:")) ? 1 : 0;
        if (write_cache(fd, active_cache, active_nr) ||
                        commit_locked_index(index_lock))
                return error ("Could not refresh index");
@@ -167,7 +167,7 @@ static void update_index_from_diff(struct diff_queue_struct *q,
                        ce = make_cache_entry(one->mode, one->sha1, one->path,
                                0, 0);
                        if (!ce)
-                               die("make_cache_entry failed for path '%s'",
+                               die(_("make_cache_entry failed for path '%s'"),
                                    one->path);
                        add_cache_entry(ce, ADD_CACHE_OK_TO_ADD |
                                ADD_CACHE_OK_TO_REPLACE);
@@ -222,14 +222,14 @@ static void prepend_reflog_action(const char *action, char *buf, size_t size)
        if (!rla)
                rla = sep = "";
        if (snprintf(buf, size, "%s%s%s", rla, sep, action) >= size)
-               warning("Reflog action message too long: %.*s...", 50, buf);
+               warning(_("Reflog action message too long: %.*s..."), 50, buf);
 }
 
 static void die_if_unmerged_cache(int reset_type)
 {
        if (is_merge() || read_cache() < 0 || unmerged_cache())
-               die("Cannot do a %s reset in the middle of a merge.",
-                   reset_type_names[reset_type]);
+               die(_("Cannot do a %s reset in the middle of a merge."),
+                   _(reset_type_names[reset_type]));
 
 }
 
@@ -300,16 +300,16 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
        }
 
        if (get_sha1(rev, sha1))
-               die("Failed to resolve '%s' as a valid ref.", rev);
+               die(_("Failed to resolve '%s' as a valid ref."), rev);
 
        commit = lookup_commit_reference(sha1);
        if (!commit)
-               die("Could not parse object '%s'.", rev);
+               die(_("Could not parse object '%s'."), rev);
        hashcpy(sha1, commit->object.sha1);
 
        if (patch_mode) {
                if (reset_type != NONE)
-                       die("--patch is incompatible with --{hard,mixed,soft}");
+                       die(_("--patch is incompatible with --{hard,mixed,soft}"));
                return interactive_reset(rev, argv + i, prefix);
        }
 
@@ -318,10 +318,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
         * affecting the working tree nor HEAD. */
        if (i < argc) {
                if (reset_type == MIXED)
-                       warning("--mixed with paths is deprecated; use 'git reset -- <paths>' instead.");
+                       warning(_("--mixed with paths is deprecated; use 'git reset -- <paths>' instead."));
                else if (reset_type != NONE)
-                       die("Cannot do %s reset with paths.",
-                                       reset_type_names[reset_type]);
+                       die(_("Cannot do %s reset with paths."),
+                                       _(reset_type_names[reset_type]));
                return read_from_tree(prefix, argv + i, sha1,
                                quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN);
        }
@@ -332,8 +332,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                setup_work_tree();
 
        if (reset_type == MIXED && is_bare_repository())
-               die("%s reset is not allowed in a bare repository",
-                   reset_type_names[reset_type]);
+               die(_("%s reset is not allowed in a bare repository"),
+                   _(reset_type_names[reset_type]));
 
        /* Soft reset does not touch the index file nor the working tree
         * at all, but requires them in a good order.  Other resets reset
@@ -348,7 +348,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                if (reset_type == KEEP)
                        err = err || reset_index_file(sha1, MIXED, quiet);
                if (err)
-                       die("Could not reset index file to revision '%s'.", rev);
+                       die(_("Could not reset index file to revision '%s'."), rev);
        }
 
        /* Any resets update HEAD to the head being switched to,
index ba27d39f977f2807cddb6e18364837b9fd50e970..9bfb94201f298f5902c6da13b12f4ca539bb86ed 100644 (file)
@@ -16,6 +16,10 @@ static const char rev_list_usage[] =
 "    --min-age=<epoch>\n"
 "    --sparse\n"
 "    --no-merges\n"
+"    --min-parents=<n>\n"
+"    --no-min-parents\n"
+"    --max-parents=<n>\n"
+"    --no-max-parents\n"
 "    --remove-empty\n"
 "    --all\n"
 "    --branches\n"
@@ -64,18 +68,8 @@ static void show_commit(struct commit *commit, void *data)
        if (info->header_prefix)
                fputs(info->header_prefix, stdout);
 
-       if (!revs->graph) {
-               if (commit->object.flags & BOUNDARY)
-                       putchar('-');
-               else if (commit->object.flags & UNINTERESTING)
-                       putchar('^');
-               else if (revs->left_right) {
-                       if (commit->object.flags & SYMMETRIC_LEFT)
-                               putchar('<');
-                       else
-                               putchar('>');
-               }
-       }
+       if (!revs->graph)
+               fputs(get_revision_mark(revs, commit), stdout);
        if (revs->abbrev_commit && revs->abbrev)
                fputs(find_unique_abbrev(commit->object.sha1, revs->abbrev),
                      stdout);
index a5a1c86e92720e8beefd8275acfc5df2dbdce175..adb1cae4f27ad3993aa2418f7b0fd355d19cdab9 100644 (file)
@@ -48,6 +48,10 @@ static int is_rev_argument(const char *arg)
                "--max-count=",
                "--min-age=",
                "--no-merges",
+               "--min-parents=",
+               "--no-min-parents",
+               "--max-parents=",
+               "--no-max-parents",
                "--objects",
                "--objects-edge",
                "--parents",
index bb6e9e83b756b47dae449064ca7762fe3558fc0e..2bb13ebb1de48e793e01d18ced29a468aa273b34 100644 (file)
@@ -3,7 +3,6 @@
 #include "object.h"
 #include "commit.h"
 #include "tag.h"
-#include "wt-status.h"
 #include "run-command.h"
 #include "exec_cmd.h"
 #include "utf8.h"
@@ -44,7 +43,11 @@ static const char **commit_argv;
 static int allow_rerere_auto;
 
 static const char *me;
+
+/* Merge strategy. */
 static const char *strategy;
+static const char **xopts;
+static size_t xopts_nr, xopts_alloc;
 
 #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
 
@@ -55,6 +58,17 @@ static const char * const *revert_or_cherry_pick_usage(void)
        return action == REVERT ? revert_usage : cherry_pick_usage;
 }
 
+static int option_parse_x(const struct option *opt,
+                         const char *arg, int unset)
+{
+       if (unset)
+               return 0;
+
+       ALLOC_GROW(xopts, xopts_nr + 1, xopts_alloc);
+       xopts[xopts_nr++] = xstrdup(arg);
+       return 0;
+}
+
 static void parse_args(int argc, const char **argv)
 {
        const char * const * usage_str = revert_or_cherry_pick_usage();
@@ -67,6 +81,8 @@ static void parse_args(int argc, const char **argv)
                OPT_INTEGER('m', "mainline", &mainline, "parent number"),
                OPT_RERERE_AUTOUPDATE(&allow_rerere_auto),
                OPT_STRING(0, "strategy", &strategy, "strategy", "merge strategy"),
+               OPT_CALLBACK('X', "strategy-option", &xopts, "option",
+                       "option for merge strategy", option_parse_x),
                OPT_END(),
                OPT_END(),
                OPT_END(),
@@ -79,7 +95,7 @@ static void parse_args(int argc, const char **argv)
                        OPT_END(),
                };
                if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra))
-                       die("program error");
+                       die(_("program error"));
        }
 
        commit_argc = parse_options(argc, argv, NULL, options, usage_str,
@@ -151,7 +167,7 @@ static char *get_encoding(const char *message)
        const char *p = message, *eol;
 
        if (!p)
-               die ("Could not read commit message of %s",
+               die (_("Could not read commit message of %s"),
                                sha1_to_hex(commit->object.sha1));
        while (*p && *p != '\n') {
                for (eol = p + 1; *eol && *eol != '\n'; eol++)
@@ -181,54 +197,20 @@ static void add_message_to_msg(struct strbuf *msgbuf, const char *message)
        strbuf_addstr(msgbuf, p);
 }
 
-static void set_author_ident_env(const char *message)
+static void write_cherry_pick_head(void)
 {
-       const char *p = message;
-       if (!p)
-               die ("Could not read commit message of %s",
-                               sha1_to_hex(commit->object.sha1));
-       while (*p && *p != '\n') {
-               const char *eol;
-
-               for (eol = p; *eol && *eol != '\n'; eol++)
-                       ; /* do nothing */
-               if (!prefixcmp(p, "author ")) {
-                       char *line, *pend, *email, *timestamp;
-
-                       p += 7;
-                       line = xmemdupz(p, eol - p);
-                       email = strchr(line, '<');
-                       if (!email)
-                               die ("Could not extract author email from %s",
-                                       sha1_to_hex(commit->object.sha1));
-                       if (email == line)
-                               pend = line;
-                       else
-                               for (pend = email; pend != line + 1 &&
-                                               isspace(pend[-1]); pend--);
-                                       ; /* do nothing */
-                       *pend = '\0';
-                       email++;
-                       timestamp = strchr(email, '>');
-                       if (!timestamp)
-                               die ("Could not extract author time from %s",
-                                       sha1_to_hex(commit->object.sha1));
-                       *timestamp = '\0';
-                       for (timestamp++; *timestamp && isspace(*timestamp);
-                                       timestamp++)
-                               ; /* do nothing */
-                       setenv("GIT_AUTHOR_NAME", line, 1);
-                       setenv("GIT_AUTHOR_EMAIL", email, 1);
-                       setenv("GIT_AUTHOR_DATE", timestamp, 1);
-                       free(line);
-                       return;
-               }
-               p = eol;
-               if (*p == '\n')
-                       p++;
-       }
-       die ("No author information found in %s",
-                       sha1_to_hex(commit->object.sha1));
+       int fd;
+       struct strbuf buf = STRBUF_INIT;
+
+       strbuf_addf(&buf, "%s\n", sha1_to_hex(commit->object.sha1));
+
+       fd = open(git_path("CHERRY_PICK_HEAD"), O_WRONLY | O_CREAT, 0666);
+       if (fd < 0)
+               die_errno(_("Could not open '%s' for writing"),
+                         git_path("CHERRY_PICK_HEAD"));
+       if (write_in_full(fd, buf.buf, buf.len) != buf.len || close(fd))
+               die_errno(_("Could not write to '%s'"), git_path("CHERRY_PICK_HEAD"));
+       strbuf_release(&buf);
 }
 
 static void advise(const char *advice, ...)
@@ -246,15 +228,18 @@ static void print_advice(void)
 
        if (msg) {
                fprintf(stderr, "%s\n", msg);
+               /*
+                * A conflict has occured but the porcelain
+                * (typically rebase --interactive) wants to take care
+                * of the commit itself so remove CHERRY_PICK_HEAD
+                */
+               unlink(git_path("CHERRY_PICK_HEAD"));
                return;
        }
 
        advise("after resolving the conflicts, mark the corrected paths");
        advise("with 'git add <paths>' or 'git rm <paths>'");
-
-       if (action == CHERRY_PICK)
-               advise("and commit the result with 'git commit -c %s'",
-                      find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
+       advise("and commit the result with 'git commit'");
 }
 
 static void write_message(struct strbuf *msgbuf, const char *filename)
@@ -264,10 +249,10 @@ static void write_message(struct strbuf *msgbuf, const char *filename)
        int msg_fd = hold_lock_file_for_update(&msg_file, filename,
                                               LOCK_DIE_ON_ERROR);
        if (write_in_full(msg_fd, msgbuf->buf, msgbuf->len) < 0)
-               die_errno("Could not write to %s.", filename);
+               die_errno(_("Could not write to %s."), filename);
        strbuf_release(msgbuf);
        if (commit_lock_file(&msg_file) < 0)
-               die("Error wrapping up %s", filename);
+               die(_("Error wrapping up %s"), filename);
 }
 
 static struct tree *empty_tree(void)
@@ -285,11 +270,19 @@ static NORETURN void die_dirty_index(const char *me)
        if (read_cache_unmerged()) {
                die_resolve_conflict(me);
        } else {
-               if (advice_commit_before_merge)
-                       die("Your local changes would be overwritten by %s.\n"
-                           "Please, commit your changes or stash them to proceed.", me);
-               else
-                       die("Your local changes would be overwritten by %s.\n", me);
+               if (advice_commit_before_merge) {
+                       if (action == REVERT)
+                               die(_("Your local changes would be overwritten by revert.\n"
+                                         "Please, commit your changes or stash them to proceed."));
+                       else
+                               die(_("Your local changes would be overwritten by cherry-pick.\n"
+                                         "Please, commit your changes or stash them to proceed."));
+               } else {
+                       if (action == REVERT)
+                               die(_("Your local changes would be overwritten by revert.\n"));
+                       else
+                               die(_("Your local changes would be overwritten by cherry-pick.\n"));
+               }
        }
 }
 
@@ -311,18 +304,13 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
        struct merge_options o;
        struct tree *result, *next_tree, *base_tree, *head_tree;
        int clean, index_fd;
+       const char **xopt;
        static struct lock_file index_lock;
 
        index_fd = hold_locked_index(&index_lock, 1);
 
        read_cache();
 
-       /*
-        * NEEDSWORK: cherry-picking between branches with
-        * different end-of-line normalization is a pain;
-        * plumb in an option to set o.renormalize?
-        * (or better: arbitrary -X options)
-        */
        init_merge_options(&o);
        o.ancestor = base ? base_label : "(empty tree)";
        o.branch1 = "HEAD";
@@ -332,6 +320,9 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
        next_tree = next ? next->tree : empty_tree();
        base_tree = base ? base->tree : empty_tree();
 
+       for (xopt = xopts; xopt != xopts + xopts_nr; xopt++)
+               parse_merge_opt(&o, *xopt);
+
        clean = merge_trees(&o,
                            head_tree,
                            next_tree, base_tree, &result);
@@ -339,7 +330,8 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
        if (active_cache_changed &&
            (write_cache(index_fd, active_cache, active_nr) ||
             commit_locked_index(&index_lock)))
-               die("%s: Unable to write new index file", me);
+               /* TRANSLATORS: %s will be "revert" or "cherry-pick" */
+               die(_("%s: Unable to write new index file"), me);
        rollback_lock_file(&index_lock);
 
        if (!clean) {
@@ -405,10 +397,10 @@ static int do_pick_commit(void)
                 * to work on.
                 */
                if (write_cache_as_tree(head, 0, NULL))
-                       die ("Your index file is unmerged.");
+                       die (_("Your index file is unmerged."));
        } else {
                if (get_sha1("HEAD", head))
-                       die ("You do not have a valid HEAD");
+                       die (_("You do not have a valid HEAD"));
                if (index_differs_from("HEAD", 0))
                        die_dirty_index(me);
        }
@@ -416,7 +408,7 @@ static int do_pick_commit(void)
 
        if (!commit->parents) {
                if (action == REVERT)
-                       die ("Cannot revert a root commit");
+                       die (_("Cannot revert a root commit"));
                parent = NULL;
        }
        else if (commit->parents->next) {
@@ -425,7 +417,7 @@ static int do_pick_commit(void)
                struct commit_list *p;
 
                if (!mainline)
-                       die("Commit %s is a merge but no -m option was given.",
+                       die(_("Commit %s is a merge but no -m option was given."),
                            sha1_to_hex(commit->object.sha1));
 
                for (cnt = 1, p = commit->parents;
@@ -433,11 +425,11 @@ static int do_pick_commit(void)
                     cnt++)
                        p = p->next;
                if (cnt != mainline || !p)
-                       die("Commit %s does not have parent %d",
+                       die(_("Commit %s does not have parent %d"),
                            sha1_to_hex(commit->object.sha1), mainline);
                parent = p->item;
        } else if (0 < mainline)
-               die("Mainline was specified but commit %s is not a merge.",
+               die(_("Mainline was specified but commit %s is not a merge."),
                    sha1_to_hex(commit->object.sha1));
        else
                parent = commit->parents->item;
@@ -446,11 +438,13 @@ static int do_pick_commit(void)
                return fast_forward_to(commit->object.sha1, head);
 
        if (parent && parse_commit(parent) < 0)
-               die("%s: cannot parse parent commit %s",
+               /* TRANSLATORS: The first %s will be "revert" or
+                  "cherry-pick", the second %s a SHA1 */
+               die(_("%s: cannot parse parent commit %s"),
                    me, sha1_to_hex(parent->object.sha1));
 
        if (get_message(commit->buffer, &msg) != 0)
-               die("Cannot get commit message for %s",
+               die(_("Cannot get commit message for %s"),
                                sha1_to_hex(commit->object.sha1));
 
        /*
@@ -482,13 +476,14 @@ static int do_pick_commit(void)
                base_label = msg.parent_label;
                next = commit;
                next_label = msg.label;
-               set_author_ident_env(msg.message);
                add_message_to_msg(&msgbuf, msg.message);
                if (no_replay) {
                        strbuf_addstr(&msgbuf, "(cherry picked from commit ");
                        strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
                        strbuf_addstr(&msgbuf, ")\n");
                }
+               if (!no_commit)
+                       write_cherry_pick_head();
        }
 
        if (!strategy || !strcmp(strategy, "recursive") || action == REVERT) {
@@ -503,15 +498,16 @@ static int do_pick_commit(void)
 
                commit_list_insert(base, &common);
                commit_list_insert(next, &remotes);
-               res = try_merge_command(strategy, common,
+               res = try_merge_command(strategy, xopts_nr, xopts, common,
                                        sha1_to_hex(head), remotes);
                free_commit_list(common);
                free_commit_list(remotes);
        }
 
        if (res) {
-               error("could not %s %s... %s",
-                     action == REVERT ? "revert" : "apply",
+               error(action == REVERT
+                     ? _("could not revert %s... %s")
+                     : _("could not apply %s... %s"),
                      find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),
                      msg.subject);
                print_advice();
@@ -541,10 +537,10 @@ static void prepare_revs(struct rev_info *revs)
                usage(*revert_or_cherry_pick_usage());
 
        if (prepare_revision_walk(revs))
-               die("revision walk setup failed");
+               die(_("revision walk setup failed"));
 
        if (!revs->commits)
-               die("empty commit set passed");
+               die(_("empty commit set passed"));
 }
 
 static void read_and_refresh_cache(const char *me)
@@ -552,12 +548,12 @@ static void read_and_refresh_cache(const char *me)
        static struct lock_file index_lock;
        int index_fd = hold_locked_index(&index_lock, 0);
        if (read_index_preload(&the_index, NULL) < 0)
-               die("git %s: failed to read the index", me);
+               die(_("git %s: failed to read the index"), me);
        refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
        if (the_index.cache_changed) {
                if (write_index(&the_index, index_fd) ||
                    commit_locked_index(&index_lock))
-                       die("git %s: failed to refresh the index", me);
+                       die(_("git %s: failed to refresh the index"), me);
        }
        rollback_lock_file(&index_lock);
 }
@@ -573,13 +569,13 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 
        if (allow_ff) {
                if (signoff)
-                       die("cherry-pick --ff cannot be used with --signoff");
+                       die(_("cherry-pick --ff cannot be used with --signoff"));
                if (no_commit)
-                       die("cherry-pick --ff cannot be used with --no-commit");
+                       die(_("cherry-pick --ff cannot be used with --no-commit"));
                if (no_replay)
-                       die("cherry-pick --ff cannot be used with -x");
+                       die(_("cherry-pick --ff cannot be used with -x"));
                if (edit)
-                       die("cherry-pick --ff cannot be used with --edit");
+                       die(_("cherry-pick --ff cannot be used with --edit"));
        }
 
        read_and_refresh_cache(me);
index ff491d77612ffb3c906c5e1ffa232f4410e4b661..90c8a5047c26cd7bdb939d150b842823f595333c 100644 (file)
@@ -106,19 +106,19 @@ static int check_local_mod(unsigned char *head, int index_only)
                 */
                if (local_changes && staged_changes) {
                        if (!index_only || !(ce->ce_flags & CE_INTENT_TO_ADD))
-                               errs = error("'%s' has staged content different "
+                               errs = error(_("'%s' has staged content different "
                                             "from both the file and the HEAD\n"
-                                            "(use -f to force removal)", name);
+                                            "(use -f to force removal)"), name);
                }
                else if (!index_only) {
                        if (staged_changes)
-                               errs = error("'%s' has changes staged in the index\n"
+                               errs = error(_("'%s' has changes staged in the index\n"
                                             "(use --cached to keep the file, "
-                                            "or -f to force removal)", name);
+                                            "or -f to force removal)"), name);
                        if (local_changes)
-                               errs = error("'%s' has local modifications\n"
+                               errs = error(_("'%s' has local modifications\n"
                                             "(use --cached to keep the file, "
-                                            "or -f to force removal)", name);
+                                            "or -f to force removal)"), name);
                }
        }
        return errs;
@@ -159,7 +159,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
        newfd = hold_locked_index(&lock_file, 1);
 
        if (read_cache() < 0)
-               die("index file corrupt");
+               die(_("index file corrupt"));
 
        pathspec = get_pathspec(prefix, argv);
        refresh_index(&the_index, REFRESH_QUIET, pathspec, NULL, NULL);
@@ -183,7 +183,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                for (i = 0; (match = pathspec[i]) != NULL ; i++) {
                        if (!seen[i]) {
                                if (!ignore_unmatch) {
-                                       die("pathspec '%s' did not match any files",
+                                       die(_("pathspec '%s' did not match any files"),
                                            match);
                                }
                        }
@@ -191,7 +191,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                                seen_any = 1;
                        }
                        if (!recursive && seen[i] == MATCHED_RECURSIVELY)
-                               die("not removing '%s' recursively without -r",
+                               die(_("not removing '%s' recursively without -r"),
                                    *match ? match : ".");
                }
 
@@ -227,7 +227,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                        printf("rm '%s'\n", path);
 
                if (remove_file_from_cache(path))
-                       die("git rm: unable to remove %s", path);
+                       die(_("git rm: unable to remove %s"), path);
        }
 
        if (show_only)
@@ -257,7 +257,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
        if (active_cache_changed) {
                if (write_cache(newfd, active_cache, active_nr) ||
                    commit_locked_index(&lock_file))
-                       die("Unable to write new index file");
+                       die(_("Unable to write new index file"));
        }
 
        return 0;
index 2cd1c40b70890732905ad9433e452aa9a9548533..8b0911c0d2ac5a60f8a3c7a43e7960617ded9d7a 100644 (file)
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "builtin.h"
 #include "commit.h"
 #include "refs.h"
 #include "pkt-line.h"
index 1a21e4b0538565f7a64488ed7b3a5c317e559699..f5efc67c9cad24fe54d5c6ab7257d38a4b1727ac 100644 (file)
@@ -158,7 +158,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
                buffer = eol;
        }
        if (!author)
-               die("Missing author: %s",
+               die(_("Missing author: %s"),
                    sha1_to_hex(commit->object.sha1));
        if (log->user_format) {
                struct pretty_print_context ctx = {0};
@@ -181,7 +181,7 @@ static void get_from_rev(struct rev_info *rev, struct shortlog *log)
        struct commit *commit;
 
        if (prepare_revision_walk(rev))
-               die("revision walk setup failed");
+               die(_("revision walk setup failed"));
        while ((commit = get_revision(rev)) != NULL)
                shortlog_add_commit(log, commit);
 }
@@ -284,7 +284,7 @@ parse_done:
        argc = parse_options_end(&ctx);
 
        if (setup_revisions(argc, argv, &rev, NULL) != 1) {
-               error("unrecognized argument: %s", argv[1]);
+               error(_("unrecognized argument: %s"), argv[1]);
                usage_with_options(shortlog_usage, options);
        }
 
@@ -296,7 +296,7 @@ parse_done:
                add_head_to_pending(&rev);
        if (rev.pending.nr == 0) {
                if (isatty(0))
-                       fprintf(stderr, "(reading log message from standard input)\n");
+                       fprintf(stderr, _("(reading log message from standard input)\n"));
                read_from_stdin(&log);
        }
        else
index 7cf48abca857f049243dfab7c95fea70d216ea93..b66b34a1820b3c258ddd85180442df865becee15 100644 (file)
@@ -118,12 +118,12 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn)
        for (p = argv; *p; p++) {
                if (snprintf(ref, sizeof(ref), "refs/tags/%s", *p)
                                        >= sizeof(ref)) {
-                       error("tag name too long: %.*s...", 50, *p);
+                       error(_("tag name too long: %.*s..."), 50, *p);
                        had_error = 1;
                        continue;
                }
                if (!resolve_ref(ref, sha1, 1, NULL)) {
-                       error("tag '%s' not found.", *p);
+                       error(_("tag '%s' not found."), *p);
                        had_error = 1;
                        continue;
                }
@@ -138,7 +138,7 @@ static int delete_tag(const char *name, const char *ref,
 {
        if (delete_ref(ref, sha1, 0))
                return 1;
-       printf("Deleted tag '%s' (was %s)\n", name, find_unique_abbrev(sha1, DEFAULT_ABBREV));
+       printf(_("Deleted tag '%s' (was %s)\n"), name, find_unique_abbrev(sha1, DEFAULT_ABBREV));
        return 0;
 }
 
@@ -150,7 +150,7 @@ static int verify_tag(const char *name, const char *ref,
        argv_verify_tag[2] = sha1_to_hex(sha1);
 
        if (run_command_v_opt(argv_verify_tag, RUN_GIT_CMD))
-               return error("could not verify the tag '%s'", name);
+               return error(_("could not verify the tag '%s'"), name);
        return 0;
 }
 
@@ -165,7 +165,7 @@ static int do_sign(struct strbuf *buffer)
        if (!*signingkey) {
                if (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME),
                                sizeof(signingkey)) > sizeof(signingkey) - 1)
-                       return error("committer info too long.");
+                       return error(_("committer info too long."));
                bracket = strchr(signingkey, '>');
                if (bracket)
                        bracket[1] = '\0';
@@ -185,20 +185,20 @@ static int do_sign(struct strbuf *buffer)
        args[3] = NULL;
 
        if (start_command(&gpg))
-               return error("could not run gpg.");
+               return error(_("could not run gpg."));
 
        if (write_in_full(gpg.in, buffer->buf, buffer->len) != buffer->len) {
                close(gpg.in);
                close(gpg.out);
                finish_command(&gpg);
-               return error("gpg did not accept the tag data");
+               return error(_("gpg did not accept the tag data"));
        }
        close(gpg.in);
        len = strbuf_read(buffer, gpg.out, 1024);
        close(gpg.out);
 
        if (finish_command(&gpg) || !len || len < 0)
-               return error("gpg failed to sign the tag");
+               return error(_("gpg failed to sign the tag"));
 
        /* Strip CR from the line endings, in case we are on Windows. */
        for (i = j = 0; i < buffer->len; i++)
@@ -213,15 +213,15 @@ static int do_sign(struct strbuf *buffer)
 }
 
 static const char tag_template[] =
-       "\n"
+       N_("\n"
        "#\n"
        "# Write a tag message\n"
-       "#\n";
+       "#\n");
 
 static void set_signingkey(const char *value)
 {
        if (strlcpy(signingkey, value, sizeof(signingkey)) >= sizeof(signingkey))
-               die("signing key value too long (%.10s...)", value);
+               die(_("signing key value too long (%.10s...)"), value);
 }
 
 static int git_tag_config(const char *var, const char *value, void *cb)
@@ -261,9 +261,9 @@ static void write_tag_body(int fd, const unsigned char *sha1)
 static int build_tag_object(struct strbuf *buf, int sign, unsigned char *result)
 {
        if (sign && do_sign(buf) < 0)
-               return error("unable to sign the tag");
+               return error(_("unable to sign the tag"));
        if (write_sha1_file(buf->buf, buf->len, tag_type, result) < 0)
-               return error("unable to write tag file");
+               return error(_("unable to write tag file"));
        return 0;
 }
 
@@ -278,7 +278,7 @@ static void create_tag(const unsigned char *object, const char *tag,
 
        type = sha1_object_info(object, NULL);
        if (type <= OBJ_NONE)
-           die("bad object type.");
+           die(_("bad object type."));
 
        header_len = snprintf(header_buf, sizeof(header_buf),
                          "object %s\n"
@@ -291,7 +291,7 @@ static void create_tag(const unsigned char *object, const char *tag,
                          git_committer_info(IDENT_ERROR_ON_NO_NAME));
 
        if (header_len > sizeof(header_buf) - 1)
-               die("tag header too big.");
+               die(_("tag header too big."));
 
        if (!message) {
                int fd;
@@ -300,17 +300,17 @@ static void create_tag(const unsigned char *object, const char *tag,
                path = git_pathdup("TAG_EDITMSG");
                fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
                if (fd < 0)
-                       die_errno("could not create file '%s'", path);
+                       die_errno(_("could not create file '%s'"), path);
 
                if (!is_null_sha1(prev))
                        write_tag_body(fd, prev);
                else
-                       write_or_die(fd, tag_template, strlen(tag_template));
+                       write_or_die(fd, _(tag_template), strlen(_(tag_template)));
                close(fd);
 
                if (launch_editor(path, buf, NULL)) {
                        fprintf(stderr,
-                       "Please supply the message using either -m or -F option.\n");
+                       _("Please supply the message using either -m or -F option.\n"));
                        exit(1);
                }
        }
@@ -318,13 +318,13 @@ static void create_tag(const unsigned char *object, const char *tag,
        stripspace(buf, 1);
 
        if (!message && !buf->len)
-               die("no tag message?");
+               die(_("no tag message?"));
 
        strbuf_insert(buf, 0, header_buf, header_len);
 
        if (build_tag_object(buf, sign, result) < 0) {
                if (path)
-                       fprintf(stderr, "The tag message has been left in %s\n",
+                       fprintf(stderr, _("The tag message has been left in %s\n"),
                                path);
                exit(128);
        }
@@ -417,9 +417,9 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                return list_tags(argv[0], lines == -1 ? 0 : lines,
                                 with_commit);
        if (lines != -1)
-               die("-n option is only allowed with -l.");
+               die(_("-n option is only allowed with -l."));
        if (with_commit)
-               die("--contains option is only allowed with -l.");
+               die(_("--contains option is only allowed with -l."));
        if (delete)
                return for_each_tag_name(argv, delete_tag);
        if (verify)
@@ -427,17 +427,17 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
        if (msg.given || msgfile) {
                if (msg.given && msgfile)
-                       die("only one -F or -m option is allowed.");
+                       die(_("only one -F or -m option is allowed."));
                annotate = 1;
                if (msg.given)
                        strbuf_addbuf(&buf, &(msg.buf));
                else {
                        if (!strcmp(msgfile, "-")) {
                                if (strbuf_read(&buf, 0, 1024) < 0)
-                                       die_errno("cannot read '%s'", msgfile);
+                                       die_errno(_("cannot read '%s'"), msgfile);
                        } else {
                                if (strbuf_read_file(&buf, msgfile, 1024) < 0)
-                                       die_errno("could not open or read '%s'",
+                                       die_errno(_("could not open or read '%s'"),
                                                msgfile);
                        }
                }
@@ -447,20 +447,20 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
        object_ref = argc == 2 ? argv[1] : "HEAD";
        if (argc > 2)
-               die("too many params");
+               die(_("too many params"));
 
        if (get_sha1(object_ref, object))
-               die("Failed to resolve '%s' as a valid ref.", object_ref);
+               die(_("Failed to resolve '%s' as a valid ref."), object_ref);
 
        if (snprintf(ref, sizeof(ref), "refs/tags/%s", tag) > sizeof(ref) - 1)
-               die("tag name too long: %.*s...", 50, tag);
+               die(_("tag name too long: %.*s..."), 50, tag);
        if (check_ref_format(ref))
-               die("'%s' is not a valid tag name.", tag);
+               die(_("'%s' is not a valid tag name."), tag);
 
        if (!resolve_ref(ref, prev, 1, NULL))
                hashclr(prev);
        else if (!force)
-               die("tag '%s' already exists", tag);
+               die(_("tag '%s' already exists"), tag);
 
        if (annotate)
                create_tag(object, tag, &buf, msg.given || msgfile,
@@ -468,11 +468,11 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
        lock = lock_any_ref_for_update(ref, prev, 0);
        if (!lock)
-               die("%s: cannot lock the ref", ref);
+               die(_("%s: cannot lock the ref"), ref);
        if (write_ref_sha1(lock, object, NULL) < 0)
-               die("%s: cannot update the ref", ref);
+               die(_("%s: cannot update the ref"), ref);
        if (force && hashcmp(prev, object))
-               printf("Updated tag '%s' (was %s)\n", tag, find_unique_abbrev(prev, DEFAULT_ABBREV));
+               printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev, DEFAULT_ABBREV));
 
        strbuf_release(&buf);
        return 0;
index 608590ada8105a2e6a8cb9d6176696b511b410f6..19200291a2632554223b1a675d5324b4682248ab 100644 (file)
@@ -1,6 +1,4 @@
-#include "cache.h"
-#include "blob.h"
-#include "exec_cmd.h"
+#include "builtin.h"
 
 static char *create_temp_file(unsigned char *sha1)
 {
index 56baf27fb7eb18d77e8793d089f2a719d4876689..d7850c6309aec0c1a4f640999fb757d7b32ba1b8 100644 (file)
@@ -546,7 +546,10 @@ static int do_reupdate(int ac, const char **av,
         */
        int pos;
        int has_head = 1;
-       const char **pathspec = get_pathspec(prefix, av + 1);
+       const char **paths = get_pathspec(prefix, av + 1);
+       struct pathspec pathspec;
+
+       init_pathspec(&pathspec, paths);
 
        if (read_ref("HEAD", head_sha1))
                /* If there is no HEAD, that means it is an initial
@@ -559,7 +562,7 @@ static int do_reupdate(int ac, const char **av,
                struct cache_entry *old = NULL;
                int save_nr;
 
-               if (ce_stage(ce) || !ce_path_match(ce, pathspec))
+               if (ce_stage(ce) || !ce_path_match(ce, &pathspec))
                        continue;
                if (has_head)
                        old = read_one_ent(NULL, head_sha1,
@@ -578,6 +581,7 @@ static int do_reupdate(int ac, const char **av,
                if (save_nr != active_nr)
                        goto redo;
        }
+       free_pathspec(&pathspec);
        return 0;
 }
 
index 0744bb83185289e26bd32b3b2ecaec717d8c75d7..99d068a5327255f36c8e415ecb8d0cf98cbbe180 100644 (file)
@@ -3,8 +3,7 @@
  *
  * Copyright (C) Eric Biederman, 2005
  */
-#include "cache.h"
-#include "exec_cmd.h"
+#include "builtin.h"
 
 static const char var_usage[] = "git var (-l | <variable>)";
 
diff --git a/cache.h b/cache.h
index f2dabefd9d75fddf0eb48e42a0907db6ac162b08..2674f4cf5a74aaa8e6137985d552d7b6123a432c 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -5,6 +5,7 @@
 #include "strbuf.h"
 #include "hash.h"
 #include "advice.h"
+#include "gettext.h"
 
 #include SHA1_HEADER
 #ifndef git_SHA_CTX
@@ -436,6 +437,7 @@ extern void verify_non_filename(const char *prefix, const char *name);
 
 #define INIT_DB_QUIET 0x0001
 
+extern int set_git_dir_init(const char *git_dir, const char *real_git_dir, int);
 extern int init_db(const char *template_dir, unsigned int flags);
 
 #define alloc_nr(x) (((x)+16)*3/2)
@@ -500,8 +502,23 @@ extern int index_name_is_other(const struct index_state *, const char *, int);
 extern int ie_match_stat(const struct index_state *, struct cache_entry *, struct stat *, unsigned int);
 extern int ie_modified(const struct index_state *, struct cache_entry *, struct stat *, unsigned int);
 
-extern int ce_path_match(const struct cache_entry *ce, const char **pathspec);
-extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path);
+struct pathspec {
+       const char **raw; /* get_pathspec() result, not freed by free_pathspec() */
+       int nr;
+       unsigned int has_wildcard:1;
+       unsigned int recursive:1;
+       int max_depth;
+       struct pathspec_item {
+               const char *match;
+               int len;
+               unsigned int has_wildcard:1;
+       } *items;
+};
+
+extern int init_pathspec(struct pathspec *, const char **);
+extern void free_pathspec(struct pathspec *);
+extern int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec);
+extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path, int format_check);
 extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
 extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
 
@@ -511,7 +528,7 @@ extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
 #define REFRESH_IGNORE_MISSING 0x0008  /* ignore non-existent */
 #define REFRESH_IGNORE_SUBMODULES      0x0010  /* ignore submodules */
 #define REFRESH_IN_PORCELAIN   0x0020  /* user friendly output, not "needs update" */
-extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen, char *header_msg);
+extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen, const char *header_msg);
 
 struct lock_file {
        struct lock_file *next;
@@ -527,6 +544,7 @@ extern NORETURN void unable_to_lock_index_die(const char *path, int err);
 extern int hold_lock_file_for_update(struct lock_file *, const char *path, int);
 extern int hold_lock_file_for_append(struct lock_file *, const char *path, int);
 extern int commit_lock_file(struct lock_file *);
+extern void update_index_if_able(struct index_state *, struct lock_file *);
 
 extern int hold_locked_index(struct lock_file *, int);
 extern int commit_locked_index(struct lock_file *);
@@ -540,6 +558,7 @@ extern int trust_executable_bit;
 extern int trust_ctime;
 extern int quote_path_fully;
 extern int has_symlinks;
+extern int minimum_abbrev, default_abbrev;
 extern int ignore_case;
 extern int assume_unchanged;
 extern int prefer_symlink_refs;
@@ -709,6 +728,7 @@ int set_shared_perm(const char *path, int mode);
 #define adjust_shared_perm(path) set_shared_perm((path), 0)
 int safe_create_leading_directories(char *path);
 int safe_create_leading_directories_const(const char *path);
+int mkdir_in_gitdir(const char *path);
 extern char *expand_user_path(const char *path);
 char *enter_repo(char *path, int strict);
 static inline int is_absolute_path(const char *path)
@@ -716,9 +736,9 @@ static inline int is_absolute_path(const char *path)
        return path[0] == '/' || has_dos_drive_prefix(path);
 }
 int is_directory(const char *);
-const char *make_absolute_path(const char *path);
-const char *make_nonrelative_path(const char *path);
-const char *make_relative_path(const char *abs, const char *base);
+const char *real_path(const char *path);
+const char *absolute_path(const char *path);
+const char *relative_path(const char *abs, const char *base);
 int normalize_path_copy(char *dst, const char *src);
 int longest_ancestor_length(const char *path, const char *prefix_list);
 char *strip_path_suffix(const char *path, const char *suffix);
@@ -759,8 +779,8 @@ static inline unsigned int hexval(unsigned char c)
 }
 
 /* Convert to/from hex/sha1 representation */
-#define MINIMUM_ABBREV 4
-#define DEFAULT_ABBREV 7
+#define MINIMUM_ABBREV minimum_abbrev
+#define DEFAULT_ABBREV default_abbrev
 
 struct object_context {
        unsigned char tree[20];
@@ -999,13 +1019,13 @@ extern int git_config_maybe_bool(const char *, const char *);
 extern int git_config_string(const char **, const char *, const char *);
 extern int git_config_pathname(const char **, const char *, const char *);
 extern int git_config_set(const char *, const char *);
+extern int git_config_parse_key(const char *, char **, int *);
 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, void *cb);
 extern int git_env_bool(const char *, int);
 extern int git_config_system(void);
-extern int git_config_global(void);
 extern int config_error_nonbool(const char *);
 extern const char *get_log_output_encoding(void);
 extern const char *get_commit_output_encoding(void);
@@ -1067,9 +1087,14 @@ extern void alloc_report(void);
 /* trace.c */
 __attribute__((format (printf, 1, 2)))
 extern void trace_printf(const char *format, ...);
+extern void trace_vprintf(const char *key, const char *format, va_list ap);
 __attribute__((format (printf, 2, 3)))
 extern void trace_argv_printf(const char **argv, const char *format, ...);
 extern void trace_repo_setup(const char *prefix);
+extern int trace_want(const char *key);
+extern void trace_strbuf(const char *key, const struct strbuf *buf);
+
+void packet_trace_identity(const char *prog);
 
 /* convert.c */
 /* returns 1 if *dst was used */
diff --git a/color.c b/color.c
index 6a5a54ec668e08ddef0d2f27359f3ebb3272243b..417cf8fb2812b09ad4f5bfa2674b35d7e11f32b9 100644 (file)
--- a/color.c
+++ b/color.c
@@ -175,6 +175,15 @@ int git_color_default_config(const char *var, const char *value, void *cb)
        return git_default_config(var, value, cb);
 }
 
+void color_print_strbuf(FILE *fp, const char *color, const struct strbuf *sb)
+{
+       if (*color)
+               fprintf(fp, "%s", color);
+       fprintf(fp, "%s", sb->buf);
+       if (*color)
+               fprintf(fp, "%s", GIT_COLOR_RESET);
+}
+
 static int color_vfprintf(FILE *fp, const char *color, const char *fmt,
                va_list args, const char *trail)
 {
diff --git a/color.h b/color.h
index 170ff4074d220e7e62264c4c63d1419f4a59d664..c0528cf08713ac8e101cfdeac2b3de193a0c5094 100644 (file)
--- a/color.h
+++ b/color.h
@@ -1,6 +1,8 @@
 #ifndef COLOR_H
 #define COLOR_H
 
+struct strbuf;
+
 /*  2 + (2 * num_attrs) + 8 + 1 + 8 + 'm' + NUL */
 /* "\033[1;2;4;5;7;38;5;2xx;48;5;2xxm\0" */
 /*
@@ -64,6 +66,7 @@ __attribute__((format (printf, 3, 4)))
 int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
 __attribute__((format (printf, 3, 4)))
 int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
+void color_print_strbuf(FILE *fp, const char *color, const struct strbuf *sb);
 
 int color_is_nil(const char *color);
 
index bee605441910caeddd1e94eb7795f615a3d1348a..878b1de97c6c437857e7a29e1b9afc677610f1fe 100644 (file)
@@ -2,6 +2,9 @@
 #include "win32.h"
 #include <conio.h>
 #include "../strbuf.h"
+#include "../run-command.h"
+
+static const int delay[] = { 0, 1, 10, 20, 40 };
 
 int err_win_to_posix(DWORD winerr)
 {
@@ -116,6 +119,165 @@ int err_win_to_posix(DWORD winerr)
        return error;
 }
 
+static inline int is_file_in_use_error(DWORD errcode)
+{
+       switch (errcode) {
+       case ERROR_SHARING_VIOLATION:
+       case ERROR_ACCESS_DENIED:
+               return 1;
+       }
+
+       return 0;
+}
+
+static int read_yes_no_answer(void)
+{
+       char answer[1024];
+
+       if (fgets(answer, sizeof(answer), stdin)) {
+               size_t answer_len = strlen(answer);
+               int got_full_line = 0, c;
+
+               /* remove the newline */
+               if (answer_len >= 2 && answer[answer_len-2] == '\r') {
+                       answer[answer_len-2] = '\0';
+                       got_full_line = 1;
+               } else if (answer_len >= 1 && answer[answer_len-1] == '\n') {
+                       answer[answer_len-1] = '\0';
+                       got_full_line = 1;
+               }
+               /* flush the buffer in case we did not get the full line */
+               if (!got_full_line)
+                       while ((c = getchar()) != EOF && c != '\n')
+                               ;
+       } else
+               /* we could not read, return the
+                * default answer which is no */
+               return 0;
+
+       if (tolower(answer[0]) == 'y' && !answer[1])
+               return 1;
+       if (!strncasecmp(answer, "yes", sizeof(answer)))
+               return 1;
+       if (tolower(answer[0]) == 'n' && !answer[1])
+               return 0;
+       if (!strncasecmp(answer, "no", sizeof(answer)))
+               return 0;
+
+       /* did not find an answer we understand */
+       return -1;
+}
+
+static int ask_yes_no_if_possible(const char *format, ...)
+{
+       char question[4096];
+       const char *retry_hook[] = { NULL, NULL, NULL };
+       va_list args;
+
+       va_start(args, format);
+       vsnprintf(question, sizeof(question), format, args);
+       va_end(args);
+
+       if ((retry_hook[0] = getenv("GIT_ASK_YESNO"))) {
+               retry_hook[1] = question;
+               return !run_command_v_opt(retry_hook, 0);
+       }
+
+       if (!isatty(_fileno(stdin)) || !isatty(_fileno(stderr)))
+               return 0;
+
+       while (1) {
+               int answer;
+               fprintf(stderr, "%s (y/n) ", question);
+
+               if ((answer = read_yes_no_answer()) >= 0)
+                       return answer;
+
+               fprintf(stderr, "Sorry, I did not understand your answer. "
+                               "Please type 'y' or 'n'\n");
+       }
+}
+
+#undef unlink
+int mingw_unlink(const char *pathname)
+{
+       int ret, tries = 0;
+
+       /* read-only files cannot be removed */
+       chmod(pathname, 0666);
+       while ((ret = unlink(pathname)) == -1 && tries < ARRAY_SIZE(delay)) {
+               if (!is_file_in_use_error(GetLastError()))
+                       break;
+               /*
+                * We assume that some other process had the source or
+                * destination file open at the wrong moment and retry.
+                * In order to give the other process a higher chance to
+                * complete its operation, we give up our time slice now.
+                * If we have to retry again, we do sleep a bit.
+                */
+               Sleep(delay[tries]);
+               tries++;
+       }
+       while (ret == -1 && is_file_in_use_error(GetLastError()) &&
+              ask_yes_no_if_possible("Unlink of file '%s' failed. "
+                       "Should I try again?", pathname))
+              ret = unlink(pathname);
+       return ret;
+}
+
+static int is_dir_empty(const char *path)
+{
+       struct strbuf buf = STRBUF_INIT;
+       WIN32_FIND_DATAA findbuf;
+       HANDLE handle;
+
+       strbuf_addf(&buf, "%s\\*", path);
+       handle = FindFirstFileA(buf.buf, &findbuf);
+       if (handle == INVALID_HANDLE_VALUE) {
+               strbuf_release(&buf);
+               return GetLastError() == ERROR_NO_MORE_FILES;
+       }
+
+       while (!strcmp(findbuf.cFileName, ".") ||
+                       !strcmp(findbuf.cFileName, ".."))
+               if (!FindNextFile(handle, &findbuf)) {
+                       strbuf_release(&buf);
+                       return GetLastError() == ERROR_NO_MORE_FILES;
+               }
+       FindClose(handle);
+       strbuf_release(&buf);
+       return 0;
+}
+
+#undef rmdir
+int mingw_rmdir(const char *pathname)
+{
+       int ret, tries = 0;
+
+       while ((ret = rmdir(pathname)) == -1 && tries < ARRAY_SIZE(delay)) {
+               if (!is_file_in_use_error(GetLastError()))
+                       break;
+               if (!is_dir_empty(pathname)) {
+                       errno = ENOTEMPTY;
+                       break;
+               }
+               /*
+                * We assume that some other process had the source or
+                * destination file open at the wrong moment and retry.
+                * In order to give the other process a higher chance to
+                * complete its operation, we give up our time slice now.
+                * If we have to retry again, we do sleep a bit.
+                */
+               Sleep(delay[tries]);
+               tries++;
+       }
+       while (ret == -1 && is_file_in_use_error(GetLastError()) &&
+              ask_yes_no_if_possible("Deletion of directory '%s' failed. "
+                       "Should I try again?", pathname))
+              ret = rmdir(pathname);
+       return ret;
+}
+
 #undef open
 int mingw_open (const char *filename, int oflags, ...)
 {
@@ -1249,7 +1411,6 @@ int mingw_rename(const char *pold, const char *pnew)
 {
        DWORD attrs, gle;
        int tries = 0;
-       static const int delay[] = { 0, 1, 10, 20, 40 };
 
        /*
         * Try native rename() first to get errno right.
@@ -1291,6 +1452,11 @@ repeat:
                tries++;
                goto repeat;
        }
+       if (gle == ERROR_ACCESS_DENIED &&
+              ask_yes_no_if_possible("Rename from '%s' to '%s' failed. "
+                      "Should I try again?", pold, pnew))
+               goto repeat;
+
        errno = EACCES;
        return -1;
 }
index 14211c6214ea4654e0bb9dd25b29d7b28ac6141d..62eccd33911e2f332dc9d0faf097ecff6d6a7aa6 100644 (file)
@@ -119,14 +119,6 @@ static inline int mingw_mkdir(const char *path, int mode)
 }
 #define mkdir mingw_mkdir
 
-static inline int mingw_unlink(const char *pathname)
-{
-       /* read-only files cannot be removed */
-       chmod(pathname, 0666);
-       return unlink(pathname);
-}
-#define unlink mingw_unlink
-
 #define WNOHANG 1
 pid_t waitpid(pid_t pid, int *status, unsigned options);
 
@@ -174,6 +166,12 @@ int link(const char *oldpath, const char *newpath);
  * replacements of existing functions
  */
 
+int mingw_unlink(const char *pathname);
+#define unlink mingw_unlink
+
+int mingw_rmdir(const char *path);
+#define rmdir mingw_rmdir
+
 int mingw_open (const char *filename, int oflags, ...);
 #define open mingw_open
 
index 023aba0238c844f79f2662a4b885058acbfc91fd..a33b01c032b1ab948d87b29447ad0787c86f14f1 100644 (file)
@@ -9,7 +9,6 @@
 #define inline __inline
 #define __inline__ __inline
 #define __attribute__(x)
-#define va_copy(dst, src)     ((dst) = (src))
 #define strncasecmp  _strnicmp
 #define ftruncate    _chsize
 
index 822ef8365ce29c48e4b04fcccc47ba2e0b3a255f..0abcada9381a3e6638f94bcf41bf9ee7b96f4de8 100644 (file)
--- a/config.c
+++ b/config.c
@@ -523,6 +523,14 @@ static int git_default_core_config(const char *var, const char *value)
                return 0;
        }
 
+       if (!strcmp(var, "core.abbrev")) {
+               int abbrev = git_config_int(var, value);
+               if (abbrev < minimum_abbrev || abbrev > 40)
+                       return -1;
+               default_abbrev = abbrev;
+               return 0;
+       }
+
        if (!strcmp(var, "core.loosecompression")) {
                int level = git_config_int(var, value);
                if (level == -1)
@@ -825,11 +833,6 @@ int git_config_system(void)
        return !git_env_bool("GIT_CONFIG_NOSYSTEM", 0);
 }
 
-int git_config_global(void)
-{
-       return !git_env_bool("GIT_CONFIG_NOGLOBAL", 0);
-}
-
 int git_config_from_parameters(config_fn_t fn, void *data)
 {
        static int loaded_environment;
@@ -861,7 +864,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
        }
 
        home = getenv("HOME");
-       if (git_config_global() && home) {
+       if (home) {
                char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
                if (!access(user_config, R_OK)) {
                        ret += git_config_from_file(fn, user_config, data);
@@ -1092,6 +1095,75 @@ int git_config_set(const char *key, const char *value)
        return git_config_set_multivar(key, value, NULL, 0);
 }
 
+/*
+ * Auxiliary function to sanity-check and split the key into the section
+ * identifier and variable name.
+ *
+ * Returns 0 on success, -1 when there is an invalid character in the key and
+ * -2 if there is no section name in the key.
+ *
+ * store_key - pointer to char* which will hold a copy of the key with
+ *             lowercase section and variable name
+ * baselen - pointer to int which will hold the length of the
+ *           section + subsection part, can be NULL
+ */
+int git_config_parse_key(const char *key, char **store_key, int *baselen_)
+{
+       int i, dot, baselen;
+       const char *last_dot = strrchr(key, '.');
+
+       /*
+        * Since "key" actually contains the section name and the real
+        * key name separated by a dot, we have to know where the dot is.
+        */
+
+       if (last_dot == NULL || last_dot == key) {
+               error("key does not contain a section: %s", key);
+               return -2;
+       }
+
+       if (!last_dot[1]) {
+               error("key does not contain variable name: %s", key);
+               return -2;
+       }
+
+       baselen = last_dot - key;
+       if (baselen_)
+               *baselen_ = baselen;
+
+       /*
+        * Validate the key and while at it, lower case it for matching.
+        */
+       *store_key = xmalloc(strlen(key) + 1);
+
+       dot = 0;
+       for (i = 0; key[i]; i++) {
+               unsigned char c = key[i];
+               if (c == '.')
+                       dot = 1;
+               /* Leave the extended basename untouched.. */
+               if (!dot || i > baselen) {
+                       if (!iskeychar(c) ||
+                           (i == baselen + 1 && !isalpha(c))) {
+                               error("invalid key: %s", key);
+                               goto out_free_ret_1;
+                       }
+                       c = tolower(c);
+               } else if (c == '\n') {
+                       error("invalid key (newline): %s", key);
+                       goto out_free_ret_1;
+               }
+               (*store_key)[i] = c;
+       }
+       (*store_key)[i] = 0;
+
+       return 0;
+
+out_free_ret_1:
+       free(*store_key);
+       return -1;
+}
+
 /*
  * If value==NULL, unset in (remove from) config,
  * if value_regex!=NULL, disregard key/value pairs where value does not match.
@@ -1118,59 +1190,23 @@ int git_config_set(const char *key, const char *value)
 int git_config_set_multivar(const char *key, const char *value,
        const char *value_regex, int multi_replace)
 {
-       int i, dot;
        int fd = -1, in_fd;
        int ret;
        char *config_filename;
        struct lock_file *lock = NULL;
-       const char *last_dot = strrchr(key, '.');
 
        if (config_exclusive_filename)
                config_filename = xstrdup(config_exclusive_filename);
        else
                config_filename = git_pathdup("config");
 
-       /*
-        * Since "key" actually contains the section name and the real
-        * key name separated by a dot, we have to know where the dot is.
-        */
-
-       if (last_dot == NULL) {
-               error("key does not contain a section: %s", key);
-               ret = 2;
+       /* parse-key returns negative; flip the sign to feed exit(3) */
+       ret = 0 - git_config_parse_key(key, &store.key, &store.baselen);
+       if (ret)
                goto out_free;
-       }
-       store.baselen = last_dot - key;
 
        store.multi_replace = multi_replace;
 
-       /*
-        * Validate the key and while at it, lower case it for matching.
-        */
-       store.key = xmalloc(strlen(key) + 1);
-       dot = 0;
-       for (i = 0; key[i]; i++) {
-               unsigned char c = key[i];
-               if (c == '.')
-                       dot = 1;
-               /* Leave the extended basename untouched.. */
-               if (!dot || i > store.baselen) {
-                       if (!iskeychar(c) || (i == store.baselen+1 && !isalpha(c))) {
-                               error("invalid key: %s", key);
-                               free(store.key);
-                               ret = 1;
-                               goto out_free;
-                       }
-                       c = tolower(c);
-               } else if (c == '\n') {
-                       error("invalid key (newline): %s", key);
-                       free(store.key);
-                       ret = 1;
-                       goto out_free;
-               }
-               store.key[i] = c;
-       }
-       store.key[i] = 0;
 
        /*
         * The lock serves a purpose in addition to locking: the new
index 961497305777fcbd67001fdae1335fcfe2910e88..e378534cbd57add4a6c75b8eb45353e8a9322914 100644 (file)
@@ -43,7 +43,6 @@ 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@
 NO_IPV6=@NO_IPV6@
-NO_C99_FORMAT=@NO_C99_FORMAT@
 NO_HSTRERROR=@NO_HSTRERROR@
 NO_STRCASESTR=@NO_STRCASESTR@
 NO_STRTOK_R=@NO_STRTOK_R@
index 20039c546f1cc91575771acbe6f52de6778bea89..fafd81557c2d3dd17cb1c15c545f3602a3a0c6bf 100644 (file)
@@ -686,30 +686,6 @@ AC_CHECK_TYPE([struct addrinfo],[
 ])
 AC_SUBST(NO_IPV6)
 #
-# Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
-# do not support the 'size specifiers' introduced by C99, namely ll, hh,
-# j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
-# some C compilers supported these specifiers prior to C99 as an extension.
-AC_CACHE_CHECK([whether formatted IO functions support C99 size specifiers],
- [ac_cv_c_c99_format],
-[# Actually git uses only %z (%zu) in alloc.c, and %t (%td) in mktag.c
-AC_RUN_IFELSE(
-       [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
-               [[char buf[64];
-               if (sprintf(buf, "%lld%hhd%jd%zd%td", (long long int)1, (char)2, (intmax_t)3, (size_t)4, (ptrdiff_t)5) != 5)
-                 return 1;
-               else if (strcmp(buf, "12345"))
-                 return 2;]])],
-       [ac_cv_c_c99_format=yes],
-       [ac_cv_c_c99_format=no])
-])
-if test $ac_cv_c_c99_format = no; then
-       NO_C99_FORMAT=YesPlease
-else
-       NO_C99_FORMAT=
-fi
-AC_SUBST(NO_C99_FORMAT)
-#
 # Define NO_REGEX if you have no or inferior regex support in your C library.
 AC_CACHE_CHECK([whether the platform regex can handle null bytes],
  [ac_cv_c_excellent_regex], [
@@ -919,7 +895,9 @@ AC_LANG_PROGRAM([[
 #include <pthread.h>
 ]], [[
        pthread_mutex_t test_mutex;
+       pthread_key_t test_key;
        int retcode = 0;
+       retcode |= pthread_key_create(&test_key, (void *)0);
        retcode |= pthread_mutex_init(&test_mutex,(void *)0);
        retcode |= pthread_mutex_lock(&test_mutex);
        retcode |= pthread_mutex_unlock(&test_mutex);
index 893b7716cafa4811d237480a980140d308aa20dc..840ae38760a5de84b369b208a52cc579ce478378 100755 (executable)
@@ -246,6 +246,8 @@ __git_ps1 ()
                                fi
                        elif [ -f "$g/MERGE_HEAD" ]; then
                                r="|MERGING"
+                       elif [ -f "$g/CHERRY_PICK_HEAD" ]; then
+                               r="|CHERRY-PICKING"
                        elif [ -f "$g/BISECT_LOG" ]; then
                                r="|BISECTING"
                        fi
@@ -662,11 +664,14 @@ __git_compute_merge_strategies ()
        : ${__git_merge_strategies:=$(__git_list_merge_strategies)}
 }
 
-__git_complete_file ()
+__git_complete_revlist_file ()
 {
        local pfx ls ref cur
        _get_comp_words_by_ref -n =: cur
        case "$cur" in
+       *..?*:*)
+               return
+               ;;
        ?*:*)
                ref="${cur%%:*}"
                cur="${cur#*:}"
@@ -680,7 +685,7 @@ __git_complete_file ()
                *)
                        ls="$ref"
                        ;;
-           esac
+               esac
 
                case "$COMP_WORDBREAKS" in
                *:*) : great ;;
@@ -705,17 +710,6 @@ __git_complete_file ()
                                       s/^.*    //')" \
                        -- "$cur"))
                ;;
-       *)
-               __gitcomp "$(__git_refs)"
-               ;;
-       esac
-}
-
-__git_complete_revlist ()
-{
-       local pfx cur
-       _get_comp_words_by_ref -n =: cur
-       case "$cur" in
        *...*)
                pfx="${cur%...*}..."
                cur="${cur#*...}"
@@ -732,6 +726,17 @@ __git_complete_revlist ()
        esac
 }
 
+
+__git_complete_file ()
+{
+       __git_complete_revlist_file
+}
+
+__git_complete_revlist ()
+{
+       __git_complete_revlist_file
+}
+
 __git_complete_remote_or_refspec ()
 {
        local cur words cword
@@ -1354,11 +1359,11 @@ _git_diff ()
                return
                ;;
        esac
-       __git_complete_file
+       __git_complete_revlist_file
 }
 
 __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
-                       tkdiff vimdiff gvimdiff xxdiff araxis p4merge
+                       tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3
 "
 
 _git_difftool ()
@@ -1506,7 +1511,7 @@ _git_help ()
                ;;
        esac
        __git_compute_all_commands
-       __gitcomp "$__git_all_commands
+       __gitcomp "$__git_all_commands $(__git_aliases)
                attributes cli core-tutorial cvs-migration
                diffcore gitk glossary hooks ignore modules
                repository-layout tutorial tutorial-2
@@ -1572,6 +1577,8 @@ __git_log_common_options="
        --max-count=
        --max-age= --since= --after=
        --min-age= --until= --before=
+       --min-parents= --max-parents=
+       --no-min-parents --no-max-parents
 "
 # Options that go well for log and gitk (not shortlog)
 __git_log_gitk_options="
index 214930a021e6ab18f855b0b4ff4bd7d53912d06b..65c95d9d5a6e00e376a75bdad2194ec9d6539667 100644 (file)
@@ -1310,6 +1310,13 @@ The FILES list must be sorted."
       (when sign-off (git-append-sign-off committer-name committer-email)))
     buffer))
 
+(define-derived-mode git-log-edit-mode log-edit-mode "Git-Log-Edit"
+  "Major mode for editing git log messages.
+
+Set up git-specific `font-lock-keywords' for `log-edit-mode'."
+  (set (make-local-variable 'font-lock-defaults)
+       '(git-log-edit-font-lock-keywords t t)))
+
 (defun git-commit-file ()
   "Commit the marked file(s), asking for a commit message."
   (interactive)
@@ -1335,9 +1342,9 @@ The FILES list must be sorted."
         (git-setup-log-buffer buffer (git-get-merge-heads) author-name author-email subject date))
       (if (boundp 'log-edit-diff-function)
          (log-edit 'git-do-commit nil '((log-edit-listfun . git-log-edit-files)
-                                        (log-edit-diff-function . git-log-edit-diff)) buffer)
-       (log-edit 'git-do-commit nil 'git-log-edit-files buffer))
-      (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))
+                                        (log-edit-diff-function . git-log-edit-diff)) buffer 'git-log-edit-mode)
+       (log-edit 'git-do-commit nil 'git-log-edit-files buffer
+                  'git-log-edit-mode))
       (setq paragraph-separate (concat (regexp-quote git-log-msg-separator) "$\\|Author: \\|Date: \\|Merge: \\|Signed-off-by: \\|\f\\|[        ]*$"))
       (setq buffer-file-coding-system coding-system)
       (re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
index 60a05a8b978345224c0313edb8060f5a7c2ccb54..6bf155cbdb61498bdaf84712a2dea6fb05361ce2 100755 (executable)
@@ -26,6 +26,7 @@ require_work_tree
 cd_to_toplevel
 
 no_commit=
+xopt=
 while case "$#" in 0) break ;; esac
 do
        case "$1" in
@@ -44,6 +45,16 @@ do
        -x|--i-really-want-to-expose-my-private-commit-object-name)
                replay=
                ;;
+       -X?*)
+               xopt="$xopt$(git rev-parse --sq-quote "--${1#-X}")"
+               ;;
+       --strategy-option=*)
+               xopt="$xopt$(git rev-parse --sq-quote "--${1#--strategy-option=}")"
+               ;;
+       -X|--strategy-option)
+               shift
+               xopt="$xopt$(git rev-parse --sq-quote "--$1")"
+               ;;
        -*)
                usage
                ;;
@@ -159,7 +170,7 @@ export GITHEAD_$head GITHEAD_$next
 # and $prev on top of us (when reverting), or the change between
 # $prev and $commit on top of us (when cherry-picking or replaying).
 
-git-merge-recursive $base -- $head $next &&
+eval "git merge-recursive $xopt $base -- $head $next" &&
 result=$(git-write-tree 2>/dev/null) || {
        mv -f .msg "$GIT_DIR/MERGE_MSG"
        {
index 04ce7e3b020f489d59fe103970fc989d7b351127..388151503423aeff0a99ee943f7eebf0c8fec476 100755 (executable)
@@ -333,9 +333,13 @@ def gitBranchExists(branch):
     return proc.wait() == 0;
 
 _gitConfig = {}
-def gitConfig(key):
+def gitConfig(key, args = None): # set args to "--bool", for instance
     if not _gitConfig.has_key(key):
-        _gitConfig[key] = read_pipe("git config %s" % key, ignore_error=True).strip()
+        argsFilter = ""
+        if args != None:
+            argsFilter = "%s " % args
+        cmd = "git config %s%s" % (argsFilter, key)
+        _gitConfig[key] = read_pipe(cmd, ignore_error=True).strip()
     return _gitConfig[key]
 
 def p4BranchesInGit(branchesAreInRemotes = True):
@@ -452,6 +456,19 @@ def p4ChangesForPaths(depotPaths, changeRange):
     changelist.sort()
     return changelist
 
+def p4PathStartsWith(path, prefix):
+    # This method tries to remedy a potential mixed-case issue:
+    #
+    # If UserA adds  //depot/DirA/file1
+    # and UserB adds //depot/dira/file2
+    #
+    # we may or may not have a problem. If you have core.ignorecase=true,
+    # we treat DirA and dira as the same directory
+    ignorecase = gitConfig("core.ignorecase", "--bool") == "true"
+    if ignorecase:
+        return path.lower().startswith(prefix.lower())
+    return path.startswith(prefix)
+
 class Command:
     def __init__(self):
         self.usage = "usage: %prog [options]"
@@ -543,13 +560,13 @@ class P4Submit(Command):
         self.options = [
                 optparse.make_option("--verbose", dest="verbose", action="store_true"),
                 optparse.make_option("--origin", dest="origin"),
-                optparse.make_option("-M", dest="detectRename", action="store_true"),
+                optparse.make_option("-M", dest="detectRenames", action="store_true"),
         ]
         self.description = "Submit changes from git to the perforce depot."
         self.usage += " [name of git branch to submit into perforce depot]"
         self.interactive = True
         self.origin = ""
-        self.detectRename = False
+        self.detectRenames = False
         self.verbose = False
         self.isWindows = (platform.system() == "Windows")
 
@@ -570,7 +587,7 @@ class P4Submit(Command):
                 continue
 
             if inDescriptionSection:
-                if line.startswith("Files:"):
+                if line.startswith("Files:") or line.startswith("Jobs:"):
                     inDescriptionSection = False
                 else:
                     continue
@@ -599,7 +616,7 @@ class P4Submit(Command):
                     lastTab = path.rfind("\t")
                     if lastTab != -1:
                         path = path[:lastTab]
-                        if not path.startswith(self.depotPath):
+                        if not p4PathStartsWith(path, self.depotPath):
                             continue
                 else:
                     inFilesSection = False
@@ -613,7 +630,22 @@ class P4Submit(Command):
 
     def applyCommit(self, id):
         print "Applying %s" % (read_pipe("git log --max-count=1 --pretty=oneline %s" % id))
-        diffOpts = ("", "-M")[self.detectRename]
+
+        if not self.detectRenames:
+            # If not explicitly set check the config variable
+            self.detectRenames = gitConfig("git-p4.detectRenames").lower() == "true"
+
+        if self.detectRenames:
+            diffOpts = "-M"
+        else:
+            diffOpts = ""
+
+        if gitConfig("git-p4.detectCopies").lower() == "true":
+            diffOpts += " -C"
+
+        if gitConfig("git-p4.detectCopiesHarder").lower() == "true":
+            diffOpts += " --find-copies-harder"
+
         diff = read_pipe_lines("git diff-tree -r %s \"%s^\" \"%s\"" % (diffOpts, id, id))
         filesToAdd = set()
         filesToDelete = set()
@@ -637,11 +669,23 @@ class P4Submit(Command):
                 filesToDelete.add(path)
                 if path in filesToAdd:
                     filesToAdd.remove(path)
+            elif modifier == "C":
+                src, dest = diff['src'], diff['dst']
+                p4_system("integrate -Dt \"%s\" \"%s\"" % (src, dest))
+                if diff['src_sha1'] != diff['dst_sha1']:
+                    p4_system("edit \"%s\"" % (dest))
+                if isModeExecChanged(diff['src_mode'], diff['dst_mode']):
+                    p4_system("edit \"%s\"" % (dest))
+                    filesToChangeExecBit[dest] = diff['dst_mode']
+                os.unlink(dest)
+                editedFiles.add(dest)
             elif modifier == "R":
                 src, dest = diff['src'], diff['dst']
                 p4_system("integrate -Dt \"%s\" \"%s\"" % (src, dest))
-                p4_system("edit \"%s\"" % (dest))
+                if diff['src_sha1'] != diff['dst_sha1']:
+                    p4_system("edit \"%s\"" % (dest))
                 if isModeExecChanged(diff['src_mode'], diff['dst_mode']):
+                    p4_system("edit \"%s\"" % (dest))
                     filesToChangeExecBit[dest] = diff['dst_mode']
                 os.unlink(dest)
                 editedFiles.add(dest)
@@ -834,6 +878,8 @@ class P4Submit(Command):
         return True
 
 class P4Sync(Command):
+    delete_actions = ( "delete", "move/delete", "purge" )
+
     def __init__(self):
         Command.__init__(self)
         self.options = [
@@ -882,6 +928,23 @@ class P4Sync(Command):
         if gitConfig("git-p4.syncFromOrigin") == "false":
             self.syncWithOrigin = False
 
+    #
+    # P4 wildcards are not allowed in filenames.  P4 complains
+    # if you simply add them, but you can force it with "-f", in
+    # which case it translates them into %xx encoding internally.
+    # Search for and fix just these four characters.  Do % last so
+    # that fixing it does not inadvertently create new %-escapes.
+    #
+    def wildcard_decode(self, path):
+        # Cannot have * in a filename in windows; untested as to
+        # what p4 would do in such a case.
+        if not self.isWindows:
+            path = path.replace("%2A", "*")
+        path = path.replace("%23", "#") \
+                   .replace("%40", "@") \
+                   .replace("%25", "%")
+        return path
+
     def extractFilesFromCommit(self, commit):
         self.cloneExclude = [re.sub(r"\.\.\.$", "", path)
                              for path in self.cloneExclude]
@@ -891,11 +954,11 @@ class P4Sync(Command):
             path =  commit["depotFile%s" % fnum]
 
             if [p for p in self.cloneExclude
-                if path.startswith (p)]:
+                if p4PathStartsWith(path, p)]:
                 found = False
             else:
                 found = [p for p in self.depotPaths
-                         if path.startswith (p)]
+                         if p4PathStartsWith(path, p)]
             if not found:
                 fnum = fnum + 1
                 continue
@@ -910,11 +973,27 @@ class P4Sync(Command):
         return files
 
     def stripRepoPath(self, path, prefixes):
+        if self.useClientSpec:
+
+            # if using the client spec, we use the output directory
+            # specified in the client.  For example, a view
+            #   //depot/foo/branch/... //client/branch/foo/...
+            # will end up putting all foo/branch files into
+            #  branch/foo/
+            for val in self.clientSpecDirs:
+                if path.startswith(val[0]):
+                    # replace the depot path with the client path
+                    path = path.replace(val[0], val[1][1])
+                    # now strip out the client (//client/...)
+                    path = re.sub("^(//[^/]+/)", '', path)
+                    # the rest is all path
+                    return path
+
         if self.keepRepoPath:
             prefixes = [re.sub("^(//[^/]+/).*", r'\1', prefixes[0])]
 
         for p in prefixes:
-            if path.startswith(p):
+            if p4PathStartsWith(path, p):
                 path = path[len(p):]
 
         return path
@@ -925,7 +1004,7 @@ class P4Sync(Command):
         while commit.has_key("depotFile%s" % fnum):
             path =  commit["depotFile%s" % fnum]
             found = [p for p in self.depotPaths
-                     if path.startswith (p)]
+                     if p4PathStartsWith(path, p)]
             if not found:
                 fnum = fnum + 1
                 continue
@@ -960,6 +1039,7 @@ class P4Sync(Command):
            return
 
         relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
+        relPath = self.wildcard_decode(relPath)
         if verbose:
             sys.stderr.write("%s\n" % relPath)
 
@@ -1032,16 +1112,16 @@ class P4Sync(Command):
             includeFile = True
             for val in self.clientSpecDirs:
                 if f['path'].startswith(val[0]):
-                    if val[1] <= 0:
+                    if val[1][0] <= 0:
                         includeFile = False
                     break
 
             if includeFile:
                 filesForCommit.append(f)
-                if f['action'] not in ('delete', 'move/delete', 'purge'):
-                    filesToRead.append(f)
-                else:
+                if f['action'] in self.delete_actions:
                     filesToDelete.append(f)
+                else:
+                    filesToRead.append(f)
 
         # deleted files...
         for f in filesToDelete:
@@ -1077,10 +1157,10 @@ class P4Sync(Command):
         # create a commit.
         new_files = []
         for f in files:
-            if [p for p in branchPrefixes if f['path'].startswith(p)]:
+            if [p for p in branchPrefixes if p4PathStartsWith(f['path'], p)]:
                 new_files.append (f)
             else:
-                sys.stderr.write("Ignoring file outside of prefix: %s\n" % path)
+                sys.stderr.write("Ignoring file outside of prefix: %s\n" % f['path'])
 
         self.gitStream.write("commit %s\n" % branch)
 #        gitStream.write("mark :%s\n" % details["change"])
@@ -1127,7 +1207,7 @@ class P4Sync(Command):
 
                 cleanedFiles = {}
                 for info in files:
-                    if info["action"] in ("delete", "purge"):
+                    if info["action"] in self.delete_actions:
                         continue
                     cleanedFiles[info["depotFile"]] = info["rev"]
 
@@ -1241,7 +1321,7 @@ class P4Sync(Command):
                 source = paths[0]
                 destination = paths[1]
                 ## HACK
-                if source.startswith(self.depotPaths[0]) and destination.startswith(self.depotPaths[0]):
+                if p4PathStartsWith(source, self.depotPaths[0]) and p4PathStartsWith(destination, self.depotPaths[0]):
                     source = source[len(self.depotPaths[0]):-4]
                     destination = destination[len(self.depotPaths[0]):-4]
 
@@ -1429,7 +1509,7 @@ class P4Sync(Command):
         print "Doing initial import of %s from revision %s into %s" % (' '.join(self.depotPaths), revision, self.branch)
 
         details = { "user" : "git perforce import user", "time" : int(time.time()) }
-        details["desc"] = ("Initial import of %s from the state at revision %s"
+        details["desc"] = ("Initial import of %s from the state at revision %s\n"
                            % (' '.join(self.depotPaths), revision))
         details["change"] = revision
         newestRevision = 0
@@ -1440,9 +1520,16 @@ class P4Sync(Command):
                                            % (p, revision)
                                            for p in self.depotPaths])):
 
-            if info['code'] == 'error':
+            if 'code' in info and info['code'] == 'error':
                 sys.stderr.write("p4 returned an error: %s\n"
                                  % info['data'])
+                if info['data'].find("must refer to client") >= 0:
+                    sys.stderr.write("This particular p4 error is misleading.\n")
+                    sys.stderr.write("Perhaps the depot path was misspelled.\n");
+                    sys.stderr.write("Depot path:  %s\n" % " ".join(self.depotPaths))
+                sys.exit(1)
+            if 'p4ExitCode' in info:
+                sys.stderr.write("p4 exitcode: %s\n" % info['p4ExitCode'])
                 sys.exit(1)
 
 
@@ -1450,7 +1537,7 @@ class P4Sync(Command):
             if change > newestRevision:
                 newestRevision = change
 
-            if info["action"] in ("delete", "purge"):
+            if info["action"] in self.delete_actions:
                 # don't increase the file cnt, otherwise details["depotFile123"] will have gaps!
                 #fileCnt = fileCnt + 1
                 continue
@@ -1475,19 +1562,45 @@ class P4Sync(Command):
         for entry in specList:
             for k,v in entry.iteritems():
                 if k.startswith("View"):
+
+                    # p4 has these %%1 to %%9 arguments in specs to
+                    # reorder paths; which we can't handle (yet :)
+                    if re.match('%%\d', v) != None:
+                        print "Sorry, can't handle %%n arguments in client specs"
+                        sys.exit(1)
+
                     if v.startswith('"'):
                         start = 1
                     else:
                         start = 0
                     index = v.find("...")
+
+                    # save the "client view"; i.e the RHS of the view
+                    # line that tells the client where to put the
+                    # files for this view.
+                    cv = v[index+3:].strip() # +3 to remove previous '...'
+
+                    # if the client view doesn't end with a
+                    # ... wildcard, then we're going to mess up the
+                    # output directory, so fail gracefully.
+                    if not cv.endswith('...'):
+                        print 'Sorry, client view in "%s" needs to end with wildcard' % (k)
+                        sys.exit(1)
+                    cv=cv[:-3]
+
+                    # now save the view; +index means included, -index
+                    # means it should be filtered out.
                     v = v[start:index]
                     if v.startswith("-"):
                         v = v[1:]
-                        temp[v] = -len(v)
+                        include = -len(v)
                     else:
-                        temp[v] = len(v)
+                        include = len(v)
+
+                    temp[v] = (include, cv)
+
         self.clientSpecDirs = temp.items()
-        self.clientSpecDirs.sort( lambda x, y: abs( y[1] ) - abs( x[1] ) )
+        self.clientSpecDirs.sort( lambda x, y: abs( y[1][0] ) - abs( x[1][0] ) )
 
     def run(self, args):
         self.depotPaths = []
@@ -1667,6 +1780,10 @@ class P4Sync(Command):
 
                 changes.sort()
             else:
+                # catch "git-p4 sync" with no new branches, in a repo that
+                # does not have any existing git-p4 branches
+                if len(args) == 0 and not self.p4BranchesInGit:
+                    die("No remote p4 branches.  Perhaps you never did \"git p4 clone\" in here.");
                 if self.verbose:
                     print "Getting p4 changes for %s...%s" % (', '.join(self.depotPaths),
                                                               self.changeRange)
@@ -1747,10 +1864,13 @@ class P4Clone(P4Sync):
                                  help="where to leave result of the clone"),
             optparse.make_option("-/", dest="cloneExclude",
                                  action="append", type="string",
-                                 help="exclude depot path")
+                                 help="exclude depot path"),
+            optparse.make_option("--bare", dest="cloneBare",
+                                 action="store_true", default=False),
         ]
         self.cloneDestination = None
         self.needsGit = False
+        self.cloneBare = False
 
     # This is required for the "append" cloneExclude action
     def ensure_value(self, attr, value):
@@ -1790,11 +1910,16 @@ class P4Clone(P4Sync):
             self.cloneDestination = self.defaultDestination(args)
 
         print "Importing from %s into %s" % (', '.join(depotPaths), self.cloneDestination)
+
         if not os.path.exists(self.cloneDestination):
             os.makedirs(self.cloneDestination)
         chdir(self.cloneDestination)
-        system("git init")
-        self.gitdir = os.getcwd() + "/.git"
+
+        init_cmd = [ "git", "init" ]
+        if self.cloneBare:
+            init_cmd.append("--bare")
+        subprocess.check_call(init_cmd)
+
         if not P4Sync.run(self, depotPaths):
             return False
         if self.branch != "master":
@@ -1804,7 +1929,8 @@ class P4Clone(P4Sync):
                 masterbranch = "refs/heads/p4/master"
             if gitBranchExists(masterbranch):
                 system("git branch master %s" % masterbranch)
-                system("git checkout -f")
+                if not self.cloneBare:
+                    system("git checkout -f")
             else:
                 print "Could not detect main branch. No checkout/master branch created."
 
index 49b335921a3871d82a2c0110170a6e66d71561ee..e09da445b692db2a1cbdba7ee49456de6e2571e9 100644 (file)
@@ -191,6 +191,11 @@ git-p4.useclientspec
 
   git config [--global] git-p4.useclientspec false
 
+The P4CLIENT environment variable should be correctly set for p4 to be
+able to find the relevant client.  This client spec will be used to
+both filter the files cloned by git and set the directory layout as
+specified in the client (this implies --keep-path style semantics).
+
 Implementation Details...
 =========================
 
index a2677b03e0ff8347d13a5d56f4fa2e1aba18824a..35db24f5eae600a973391915ceb61c4635941aec 100644 (file)
@@ -8,7 +8,8 @@
 
 int main(int argc, char **argv)
 {
-       svndump_init(NULL);
+       if (svndump_init(NULL))
+               return 1;
        svndump_read((argc > 1) ? argv[1] : NULL);
        svndump_deinit();
        svndump_reset();
index 4d50cc5ce18c24a1dc853d3050062b864fe0b943..be49d5fcf900cb47cb14d8c85a69112b26532b93 100644 (file)
@@ -116,7 +116,7 @@ struct sha1file *sha1fd_throughput(int fd, const char *name, struct progress *tp
 
 void crc32_begin(struct sha1file *f)
 {
-       f->crc32 = crc32(0, Z_NULL, 0);
+       f->crc32 = crc32(0, NULL, 0);
        f->do_crc = 1;
 }
 
index 347fd0c52b4cd797f5dafffb6885324f7c7f0274..4c8346d5a1fe1325de2dd335a4e61a2dad994211 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -660,7 +660,7 @@ static void check_dead_children(void)
 static char **cld_argv;
 static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
 {
-       struct child_process cld = { 0 };
+       struct child_process cld = { NULL };
        char addrbuf[300] = "REMOTE_ADDR=", portbuf[300];
        char *env[] = { addrbuf, portbuf, NULL };
 
index 392ce2bef05746cea7922d39da67bf25d1d3d192..2870de400ed533d83c77269ee1654af212c6510c 100644 (file)
@@ -103,10 +103,11 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                unsigned dirty_submodule = 0;
 
                if (DIFF_OPT_TST(&revs->diffopt, QUICK) &&
-                       DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
+                   !revs->diffopt.filter &&
+                   DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
                        break;
 
-               if (!ce_path_match(ce, revs->prune_data))
+               if (!ce_path_match(ce, &revs->prune_data))
                        continue;
 
                if (ce_stage(ce)) {
@@ -427,7 +428,7 @@ static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o)
        if (tree == o->df_conflict_entry)
                tree = NULL;
 
-       if (ce_path_match(idx ? idx : tree, revs->prune_data))
+       if (ce_path_match(idx ? idx : tree, &revs->prune_data))
                do_oneway_diff(o, idx, tree);
 
        return 0;
@@ -501,7 +502,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
        active_nr = dst - active_cache;
 
        init_revisions(&revs, NULL);
-       revs.prune_data = opt->paths;
+       init_pathspec(&revs.prune_data, opt->pathspec.raw);
        tree = parse_tree_indirect(tree_sha1);
        if (!tree)
                die("bad tree object %s", sha1_to_hex(tree_sha1));
index ce9e783407437bb1e0efc6d5bc2392af26da5a41..3a36144687ae2f5bf7bb3afc914ddbada8d5ff93 100644 (file)
@@ -231,8 +231,9 @@ void diff_no_index(struct rev_info *revs,
 
        if (prefix) {
                int len = strlen(prefix);
+               const char *paths[3];
+               memset(paths, 0, sizeof(paths));
 
-               revs->diffopt.paths = xcalloc(2, sizeof(char *));
                for (i = 0; i < 2; i++) {
                        const char *p = argv[argc - 2 + i];
                        /*
@@ -242,12 +243,12 @@ void diff_no_index(struct rev_info *revs,
                        p = (strcmp(p, "-")
                             ? xstrdup(prefix_filename(prefix, len, p))
                             : p);
-                       revs->diffopt.paths[i] = p;
+                       paths[i] = p;
                }
+               diff_tree_setup_paths(paths, &revs->diffopt);
        }
        else
-               revs->diffopt.paths = argv + argc - 2;
-       revs->diffopt.nr_paths = 2;
+               diff_tree_setup_paths(argv + argc - 2, &revs->diffopt);
        revs->diffopt.skip_stat_unmatch = 1;
        if (!revs->diffopt.output_format)
                revs->diffopt.output_format = DIFF_FORMAT_PATCH;
@@ -259,8 +260,8 @@ void diff_no_index(struct rev_info *revs,
        if (diff_setup_done(&revs->diffopt) < 0)
                die("diff_setup_done failed");
 
-       if (queue_diff(&revs->diffopt, revs->diffopt.paths[0],
-                      revs->diffopt.paths[1]))
+       if (queue_diff(&revs->diffopt, revs->diffopt.pathspec.raw[0],
+                      revs->diffopt.pathspec.raw[1]))
                exit(1);
        diff_set_mnemonic_prefix(&revs->diffopt, "1/", "2/");
        diffcore_std(&revs->diffopt);
diff --git a/diff.c b/diff.c
index 3fd9e0c70315727f835f39d9a0230ee9f24e7ea8..9fa841010cc21bebc464926b15232b2aace0f5ba 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -23,7 +23,7 @@
 #endif
 
 static int diff_detect_rename_default;
-static int diff_rename_limit_default = 200;
+static int diff_rename_limit_default = 400;
 static int diff_suppress_blank_empty;
 int diff_use_color_default = -1;
 static const char *diff_word_regex_cfg;
@@ -628,7 +628,7 @@ struct diff_words_style {
        const char *newline;
 };
 
-struct diff_words_style diff_words_styles[] = {
+static struct diff_words_style diff_words_styles[] = {
        { DIFF_WORDS_PORCELAIN, {"+", "\n"}, {"-", "\n"}, {" ", "\n"}, "~\n" },
        { DIFF_WORDS_PLAIN, {"{+", "+}"}, {"[-", "-]"}, {"", ""}, "\n" },
        { DIFF_WORDS_COLOR, {"", ""}, {"", ""}, {"", ""}, "\n" }
@@ -1242,7 +1242,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
        uintmax_t max_change = 0, max_len = 0;
        int total_files = data->nr;
        int width, name_width;
-       const char *reset, *set, *add_c, *del_c;
+       const char *reset, *add_c, *del_c;
        const char *line_prefix = "";
        struct strbuf *msg = NULL;
 
@@ -1269,7 +1269,6 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 
        /* Find the longest filename and max number of changes */
        reset = diff_get_color_opt(options, DIFF_RESET);
-       set   = diff_get_color_opt(options, DIFF_PLAIN);
        add_c = diff_get_color_opt(options, DIFF_FILE_NEW);
        del_c = diff_get_color_opt(options, DIFF_FILE_OLD);
 
diff --git a/diff.h b/diff.h
index 0083d92438916a8188656df140ba70d6acc8c6f6..007a0554d4b252e83e98f5578758d51ec0c6e120 100644 (file)
--- a/diff.h
+++ b/diff.h
@@ -110,7 +110,8 @@ struct diff_options {
        int pickaxe_opts;
        int rename_score;
        int rename_limit;
-       int warn_on_too_large_rename;
+       int needed_rename_limit;
+       int show_rename_progress;
        int dirstat_percent;
        int setup;
        int abbrev;
@@ -133,9 +134,7 @@ struct diff_options {
        FILE *file;
        int close_file;
 
-       int nr_paths;
-       const char **paths;
-       int *pathlens;
+       struct pathspec pathspec;
        change_fn_t change;
        add_remove_fn_t add_remove;
        diff_format_fn_t format_callback;
index 0cd4c1305ba82b39bb8455dd6779fec2cd692e02..d40e40a3ac9c919475d6157464fa906e37b0dd80 100644 (file)
@@ -5,6 +5,7 @@
 #include "diff.h"
 #include "diffcore.h"
 #include "hash.h"
+#include "progress.h"
 
 /* Table of rename/copy destinations */
 
@@ -449,6 +450,7 @@ void diffcore_rename(struct diff_options *options)
        struct diff_score *mx;
        int i, j, rename_count;
        int num_create, num_src, dst_cnt;
+       struct progress *progress = NULL;
 
        if (!minimum_score)
                minimum_score = DEFAULT_RENAME_SCORE;
@@ -518,15 +520,22 @@ void diffcore_rename(struct diff_options *options)
         * but handles the potential overflow case specially (and we
         * assume at least 32-bit integers)
         */
+       options->needed_rename_limit = 0;
        if (rename_limit <= 0 || rename_limit > 32767)
                rename_limit = 32767;
        if ((num_create > rename_limit && num_src > rename_limit) ||
            (num_create * num_src > rename_limit * rename_limit)) {
-               if (options->warn_on_too_large_rename)
-                       warning("too many files (created: %d deleted: %d), skipping inexact rename detection", num_create, num_src);
+               options->needed_rename_limit =
+                       num_src > num_create ? num_src : num_create;
                goto cleanup;
        }
 
+       if (options->show_rename_progress) {
+               progress = start_progress_delay(
+                               "Performing inexact rename detection",
+                               rename_dst_nr * rename_src_nr, 50, 1);
+       }
+
        mx = xcalloc(num_create * NUM_CANDIDATE_PER_DST, sizeof(*mx));
        for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
                struct diff_filespec *two = rename_dst[i].two;
@@ -556,7 +565,9 @@ void diffcore_rename(struct diff_options *options)
                        diff_free_filespec_blob(two);
                }
                dst_cnt++;
+               display_progress(progress, (i+1)*rename_src_nr);
        }
+       stop_progress(&progress);
 
        /* cost matrix sorted by most to least similar pair */
        qsort(mx, dst_cnt * NUM_CANDIDATE_PER_DST, sizeof(*mx), score_compare);
diff --git a/dir.c b/dir.c
index 570b651a17520cbb0273b9247ab0fcffc0129477..325fb56ad395c9b47dcbdea47b2833a4287198bc 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -87,6 +87,21 @@ int fill_directory(struct dir_struct *dir, const char **pathspec)
        return len;
 }
 
+int within_depth(const char *name, int namelen,
+                       int depth, int max_depth)
+{
+       const char *cp = name, *cpe = name + namelen;
+
+       while (cp < cpe) {
+               if (*cp++ != '/')
+                       continue;
+               depth++;
+               if (depth > max_depth)
+                       return 0;
+       }
+       return 1;
+}
+
 /*
  * Does 'match' match the given name?
  * A match is found if
@@ -184,6 +199,95 @@ int match_pathspec(const char **pathspec, const char *name, int namelen,
        return retval;
 }
 
+/*
+ * Does 'match' match the given name?
+ * A match is found if
+ *
+ * (1) the 'match' string is leading directory of 'name', or
+ * (2) the 'match' string is a wildcard and matches 'name', or
+ * (3) the 'match' string is exactly the same as 'name'.
+ *
+ * and the return value tells which case it was.
+ *
+ * It returns 0 when there is no match.
+ */
+static int match_pathspec_item(const struct pathspec_item *item, int prefix,
+                              const char *name, int namelen)
+{
+       /* name/namelen has prefix cut off by caller */
+       const char *match = item->match + prefix;
+       int matchlen = item->len - prefix;
+
+       /* If the match was just the prefix, we matched */
+       if (!*match)
+               return MATCHED_RECURSIVELY;
+
+       if (matchlen <= namelen && !strncmp(match, name, matchlen)) {
+               if (matchlen == namelen)
+                       return MATCHED_EXACTLY;
+
+               if (match[matchlen-1] == '/' || name[matchlen] == '/')
+                       return MATCHED_RECURSIVELY;
+       }
+
+       if (item->has_wildcard && !fnmatch(match, name, 0))
+               return MATCHED_FNMATCH;
+
+       return 0;
+}
+
+/*
+ * Given a name and a list of pathspecs, see if the name matches
+ * any of the pathspecs.  The caller is also interested in seeing
+ * all pathspec matches some names it calls this function with
+ * (otherwise the user could have mistyped the unmatched pathspec),
+ * and a mark is left in seen[] array for pathspec element that
+ * actually matched anything.
+ */
+int match_pathspec_depth(const struct pathspec *ps,
+                        const char *name, int namelen,
+                        int prefix, char *seen)
+{
+       int i, retval = 0;
+
+       if (!ps->nr) {
+               if (!ps->recursive || ps->max_depth == -1)
+                       return MATCHED_RECURSIVELY;
+
+               if (within_depth(name, namelen, 0, ps->max_depth))
+                       return MATCHED_EXACTLY;
+               else
+                       return 0;
+       }
+
+       name += prefix;
+       namelen -= prefix;
+
+       for (i = ps->nr - 1; i >= 0; i--) {
+               int how;
+               if (seen && seen[i] == MATCHED_EXACTLY)
+                       continue;
+               how = match_pathspec_item(ps->items+i, prefix, name, namelen);
+               if (ps->recursive && ps->max_depth != -1 &&
+                   how && how != MATCHED_FNMATCH) {
+                       int len = ps->items[i].len;
+                       if (name[len] == '/')
+                               len++;
+                       if (within_depth(name+len, namelen-len, 0, ps->max_depth))
+                               how = MATCHED_EXACTLY;
+                       else
+                               how = 0;
+               }
+               if (how) {
+                       if (retval < how)
+                               retval = how;
+                       if (seen && seen[i] < how)
+                               seen[i] = how;
+               }
+       }
+       return retval;
+}
+
 static int no_wildcard(const char *string)
 {
        return string[strcspn(string, "*?[{\\")] == '\0';
@@ -1024,7 +1128,7 @@ char *get_relative_cwd(char *buffer, int size, const char *dir)
                die_errno("can't find the current directory");
 
        if (!is_absolute_path(dir))
-               dir = make_absolute_path(dir);
+               dir = real_path(dir);
 
        while (*dir && *dir == *cwd) {
                dir++;
@@ -1151,3 +1255,50 @@ int remove_path(const char *name)
        return 0;
 }
 
+static int pathspec_item_cmp(const void *a_, const void *b_)
+{
+       struct pathspec_item *a, *b;
+
+       a = (struct pathspec_item *)a_;
+       b = (struct pathspec_item *)b_;
+       return strcmp(a->match, b->match);
+}
+
+int init_pathspec(struct pathspec *pathspec, const char **paths)
+{
+       const char **p = paths;
+       int i;
+
+       memset(pathspec, 0, sizeof(*pathspec));
+       if (!p)
+               return 0;
+       while (*p)
+               p++;
+       pathspec->raw = paths;
+       pathspec->nr = p - paths;
+       if (!pathspec->nr)
+               return 0;
+
+       pathspec->items = xmalloc(sizeof(struct pathspec_item)*pathspec->nr);
+       for (i = 0; i < pathspec->nr; i++) {
+               struct pathspec_item *item = pathspec->items+i;
+               const char *path = paths[i];
+
+               item->match = path;
+               item->len = strlen(path);
+               item->has_wildcard = !no_wildcard(path);
+               if (item->has_wildcard)
+                       pathspec->has_wildcard = 1;
+       }
+
+       qsort(pathspec->items, pathspec->nr,
+             sizeof(struct pathspec_item), pathspec_item_cmp);
+
+       return 0;
+}
+
+void free_pathspec(struct pathspec *pathspec)
+{
+       free(pathspec->items);
+       pathspec->items = NULL;
+}
diff --git a/dir.h b/dir.h
index 72a764ed84828e4a6336d2880f2167fbc9d3143a..aa511da77b0ec54cbdbd3786faad0c1285df7182 100644 (file)
--- a/dir.h
+++ b/dir.h
@@ -65,6 +65,10 @@ struct dir_struct {
 #define MATCHED_FNMATCH 2
 #define MATCHED_EXACTLY 3
 extern int match_pathspec(const char **pathspec, const char *name, int namelen, int prefix, char *seen);
+extern int match_pathspec_depth(const struct pathspec *pathspec,
+                               const char *name, int namelen,
+                               int prefix, char *seen);
+extern int within_depth(const char *name, int namelen, int depth, int max_depth);
 
 extern int fill_directory(struct dir_struct *dir, const char **pathspec);
 extern int read_directory(struct dir_struct *, const char *path, int len, const char **pathspec);
index c3efbb96084de04465f7eff45376cadc3ab2526b..f4549d3f7b0367b31b0fa0042fb12ff183beb081 100644 (file)
@@ -15,6 +15,7 @@ int user_ident_explicitly_given;
 int trust_executable_bit = 1;
 int trust_ctime = 1;
 int has_symlinks = 1;
+int minimum_abbrev = 4, default_abbrev = 7;
 int ignore_case;
 int assume_unchanged;
 int prefer_symlink_refs;
@@ -139,7 +140,7 @@ static int git_work_tree_initialized;
 void set_git_work_tree(const char *new_work_tree)
 {
        if (git_work_tree_initialized) {
-               new_work_tree = make_absolute_path(new_work_tree);
+               new_work_tree = real_path(new_work_tree);
                if (strcmp(new_work_tree, work_tree))
                        die("internal error: work tree has already been set\n"
                            "Current worktree: %s\nNew worktree: %s",
@@ -147,7 +148,7 @@ void set_git_work_tree(const char *new_work_tree)
                return;
        }
        git_work_tree_initialized = 1;
-       work_tree = xstrdup(make_absolute_path(new_work_tree));
+       work_tree = xstrdup(real_path(new_work_tree));
 }
 
 const char *get_git_work_tree(void)
index 38545e8bfd72c8cd4f91e0d33257b143db86bac5..171e841531de7fd5b51aa26f639104382395b854 100644 (file)
@@ -89,7 +89,7 @@ static void add_path(struct strbuf *out, const char *path)
                if (is_absolute_path(path))
                        strbuf_addstr(out, path);
                else
-                       strbuf_addstr(out, make_nonrelative_path(path));
+                       strbuf_addstr(out, absolute_path(path));
 
                strbuf_addch(out, PATH_SEP);
        }
index b3ba778924908946a0e20ebfdae9bc2058e8a55e..65d65bf8f91b7a584c7dc77f84a5dec263c3d11c 100644 (file)
@@ -24,10 +24,12 @@ Format of STDIN stream:
     commit_msg
     ('from' sp committish lf)?
     ('merge' sp committish lf)*
-    file_change*
+    (file_change | ls)*
     lf?;
   commit_msg ::= data;
 
+  ls ::= 'ls' sp '"' quoted(path) '"' lf;
+
   file_change ::= file_clr
     | file_del
     | file_rnm
@@ -132,7 +134,7 @@ Format of STDIN stream:
   ts    ::= # time since the epoch in seconds, ascii base10 notation;
   tz    ::= # GIT style timezone;
 
-     # note: comments and cat requests may appear anywhere
+     # note: comments, ls and cat requests may appear anywhere
      # in the input, except within a data command.  Any form
      # of the data command always escapes the related input
      # from comment processing.
@@ -141,7 +143,9 @@ Format of STDIN stream:
      # must be the first character on that line (an lf
      # preceded it).
      #
+
   cat_blob ::= 'cat-blob' sp (hexsha1 | idnum) lf;
+  ls_tree  ::= 'ls' sp (hexsha1 | idnum) sp path_str lf;
 
   comment ::= '#' not_lf* lf;
   not_lf  ::= # Any byte that is not ASCII newline (LF);
@@ -315,6 +319,7 @@ static struct mark_set *marks;
 static const char *export_marks_file;
 static const char *import_marks_file;
 static int import_marks_file_from_stream;
+static int import_marks_file_ignore_missing;
 static int relative_marks_paths;
 
 /* Our last blob */
@@ -359,6 +364,7 @@ static int cat_blob_fd = STDOUT_FILENO;
 
 static void parse_argv(void);
 static void parse_cat_blob(void);
+static void parse_ls(struct branch *b);
 
 static void write_branch_report(FILE *rpt, struct branch *b)
 {
@@ -1782,7 +1788,11 @@ static void read_marks(void)
 {
        char line[512];
        FILE *f = fopen(import_marks_file, "r");
-       if (!f)
+       if (f)
+               ;
+       else if (import_marks_file_ignore_missing && errno == ENOENT)
+               return; /* Marks file does not exist */
+       else
                die_errno("cannot read '%s'", import_marks_file);
        while (fgets(line, sizeof(line), f)) {
                uintmax_t mark;
@@ -2596,6 +2606,8 @@ static void parse_new_commit(void)
                        note_change_n(b, prev_fanout);
                else if (!strcmp("deleteall", command_buf.buf))
                        file_change_deleteall(b);
+               else if (!prefixcmp(command_buf.buf, "ls "))
+                       parse_ls(b);
                else {
                        unread_command_buf = 1;
                        break;
@@ -2819,6 +2831,153 @@ static void parse_cat_blob(void)
        cat_blob(oe, sha1);
 }
 
+static struct object_entry *dereference(struct object_entry *oe,
+                                       unsigned char sha1[20])
+{
+       unsigned long size;
+       char *buf = NULL;
+       if (!oe) {
+               enum object_type type = sha1_object_info(sha1, NULL);
+               if (type < 0)
+                       die("object not found: %s", sha1_to_hex(sha1));
+               /* cache it! */
+               oe = insert_object(sha1);
+               oe->type = type;
+               oe->pack_id = MAX_PACK_ID;
+               oe->idx.offset = 1;
+       }
+       switch (oe->type) {
+       case OBJ_TREE:  /* easy case. */
+               return oe;
+       case OBJ_COMMIT:
+       case OBJ_TAG:
+               break;
+       default:
+               die("Not a treeish: %s", command_buf.buf);
+       }
+
+       if (oe->pack_id != MAX_PACK_ID) {       /* in a pack being written */
+               buf = gfi_unpack_entry(oe, &size);
+       } else {
+               enum object_type unused;
+               buf = read_sha1_file(sha1, &unused, &size);
+       }
+       if (!buf)
+               die("Can't load object %s", sha1_to_hex(sha1));
+
+       /* Peel one layer. */
+       switch (oe->type) {
+       case OBJ_TAG:
+               if (size < 40 + strlen("object ") ||
+                   get_sha1_hex(buf + strlen("object "), sha1))
+                       die("Invalid SHA1 in tag: %s", command_buf.buf);
+               break;
+       case OBJ_COMMIT:
+               if (size < 40 + strlen("tree ") ||
+                   get_sha1_hex(buf + strlen("tree "), sha1))
+                       die("Invalid SHA1 in commit: %s", command_buf.buf);
+       }
+
+       free(buf);
+       return find_object(sha1);
+}
+
+static struct object_entry *parse_treeish_dataref(const char **p)
+{
+       unsigned char sha1[20];
+       struct object_entry *e;
+
+       if (**p == ':') {       /* <mark> */
+               char *endptr;
+               e = find_mark(strtoumax(*p + 1, &endptr, 10));
+               if (endptr == *p + 1)
+                       die("Invalid mark: %s", command_buf.buf);
+               if (!e)
+                       die("Unknown mark: %s", command_buf.buf);
+               *p = endptr;
+               hashcpy(sha1, e->idx.sha1);
+       } else {        /* <sha1> */
+               if (get_sha1_hex(*p, sha1))
+                       die("Invalid SHA1: %s", command_buf.buf);
+               e = find_object(sha1);
+               *p += 40;
+       }
+
+       while (!e || e->type != OBJ_TREE)
+               e = dereference(e, sha1);
+       return e;
+}
+
+static void print_ls(int mode, const unsigned char *sha1, const char *path)
+{
+       static struct strbuf line = STRBUF_INIT;
+
+       /* See show_tree(). */
+       const char *type =
+               S_ISGITLINK(mode) ? commit_type :
+               S_ISDIR(mode) ? tree_type :
+               blob_type;
+
+       if (!mode) {
+               /* missing SP path LF */
+               strbuf_reset(&line);
+               strbuf_addstr(&line, "missing ");
+               quote_c_style(path, &line, NULL, 0);
+               strbuf_addch(&line, '\n');
+       } else {
+               /* mode SP type SP object_name TAB path LF */
+               strbuf_reset(&line);
+               strbuf_addf(&line, "%06o %s %s\t",
+                               mode, type, sha1_to_hex(sha1));
+               quote_c_style(path, &line, NULL, 0);
+               strbuf_addch(&line, '\n');
+       }
+       cat_blob_write(line.buf, line.len);
+}
+
+static void parse_ls(struct branch *b)
+{
+       const char *p;
+       struct tree_entry *root = NULL;
+       struct tree_entry leaf = {NULL};
+
+       /* ls SP (<treeish> SP)? <path> */
+       p = command_buf.buf + strlen("ls ");
+       if (*p == '"') {
+               if (!b)
+                       die("Not in a commit: %s", command_buf.buf);
+               root = &b->branch_tree;
+       } else {
+               struct object_entry *e = parse_treeish_dataref(&p);
+               root = new_tree_entry();
+               hashcpy(root->versions[1].sha1, e->idx.sha1);
+               load_tree(root);
+               if (*p++ != ' ')
+                       die("Missing space after tree-ish: %s", command_buf.buf);
+       }
+       if (*p == '"') {
+               static struct strbuf uq = STRBUF_INIT;
+               const char *endp;
+               strbuf_reset(&uq);
+               if (unquote_c_style(&uq, p, &endp))
+                       die("Invalid path: %s", command_buf.buf);
+               if (*endp)
+                       die("Garbage after path in: %s", command_buf.buf);
+               p = uq.buf;
+       }
+       tree_content_get(root, p, &leaf);
+       /*
+        * A directory in preparation would have a sha1 of zero
+        * until it is saved.  Save, for simplicity.
+        */
+       if (S_ISDIR(leaf.versions[1].mode))
+               store_tree(&leaf);
+
+       print_ls(leaf.versions[1].mode, leaf.versions[1].sha1, p);
+       if (!b || root != &b->branch_tree)
+               release_tree_entry(root);
+}
+
 static void checkpoint(void)
 {
        checkpoint_requested = 0;
@@ -2854,7 +3013,8 @@ static char* make_fast_import_path(const char *path)
        return strbuf_detach(&abs_path, NULL);
 }
 
-static void option_import_marks(const char *marks, int from_stream)
+static void option_import_marks(const char *marks,
+                                       int from_stream, int ignore_missing)
 {
        if (import_marks_file) {
                if (from_stream)
@@ -2868,6 +3028,7 @@ static void option_import_marks(const char *marks, int from_stream)
        import_marks_file = make_fast_import_path(marks);
        safe_create_leading_directories_const(import_marks_file);
        import_marks_file_from_stream = from_stream;
+       import_marks_file_ignore_missing = ignore_missing;
 }
 
 static void option_date_format(const char *fmt)
@@ -2967,7 +3128,10 @@ static int parse_one_feature(const char *feature, int from_stream)
        if (!prefixcmp(feature, "date-format=")) {
                option_date_format(feature + 12);
        } else if (!prefixcmp(feature, "import-marks=")) {
-               option_import_marks(feature + 13, from_stream);
+               option_import_marks(feature + 13, from_stream, 0);
+       } else if (!prefixcmp(feature, "import-marks-if-exists=")) {
+               option_import_marks(feature + strlen("import-marks-if-exists="),
+                                       from_stream, 1);
        } else if (!prefixcmp(feature, "export-marks=")) {
                option_export_marks(feature + 13);
        } else if (!strcmp(feature, "cat-blob")) {
@@ -2978,7 +3142,7 @@ static int parse_one_feature(const char *feature, int from_stream)
                relative_marks_paths = 0;
        } else if (!prefixcmp(feature, "force")) {
                force_update = 1;
-       } else if (!strcmp(feature, "notes")) {
+       } else if (!strcmp(feature, "notes") || !strcmp(feature, "ls")) {
                ; /* do nothing; we have the feature */
        } else {
                return 0;
@@ -3119,6 +3283,8 @@ int main(int argc, const char **argv)
        while (read_next_command() != EOF) {
                if (!strcmp("blob", command_buf.buf))
                        parse_new_blob();
+               else if (!prefixcmp(command_buf.buf, "ls "))
+                       parse_ls(NULL);
                else if (!prefixcmp(command_buf.buf, "commit "))
                        parse_new_commit();
                else if (!prefixcmp(command_buf.buf, "tag "))
diff --git a/fsck.c b/fsck.c
index 3d05d4a794a4158a421ce1265422d241e28a5278..6f266c1ea4b8df503c211170741fa5b490a6a02a 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -347,26 +347,14 @@ int fsck_object(struct object *obj, int strict, fsck_error error_func)
 int fsck_error_function(struct object *obj, int type, const char *fmt, ...)
 {
        va_list ap;
-       int len;
        struct strbuf sb = STRBUF_INIT;
 
        strbuf_addf(&sb, "object %s:", obj->sha1?sha1_to_hex(obj->sha1):"(null)");
 
        va_start(ap, fmt);
-       len = vsnprintf(sb.buf + sb.len, strbuf_avail(&sb), fmt, ap);
+       strbuf_vaddf(&sb, fmt, ap);
        va_end(ap);
 
-       if (len < 0)
-               len = 0;
-       if (len >= strbuf_avail(&sb)) {
-               strbuf_grow(&sb, len + 2);
-               va_start(ap, fmt);
-               len = vsnprintf(sb.buf + sb.len, strbuf_avail(&sb), fmt, ap);
-               va_end(ap);
-               if (len >= strbuf_avail(&sb))
-                       die("this should not happen, your snprintf is broken");
-       }
-
        error("%s", sb.buf);
        strbuf_release(&sb);
        return 1;
diff --git a/gettext.c b/gettext.c
new file mode 100644 (file)
index 0000000..ae5394a
--- /dev/null
+++ b/gettext.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2010 Ævar Arnfjörð Bjarmason
+ */
+
+#include "git-compat-util.h"
+#include "gettext.h"
+
+int use_gettext_poison(void)
+{
+       static int poison_requested = -1;
+       if (poison_requested == -1)
+               poison_requested = getenv("GIT_GETTEXT_POISON") ? 1 : 0;
+       return poison_requested;
+}
diff --git a/gettext.h b/gettext.h
new file mode 100644 (file)
index 0000000..1b253b7
--- /dev/null
+++ b/gettext.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010-2011 Ævar Arnfjörð Bjarmason
+ *
+ * This is a skeleton no-op implementation of gettext for Git.
+ * You can replace it with something that uses libintl.h and wraps
+ * gettext() to try out the translations.
+ */
+
+#ifndef GETTEXT_H
+#define GETTEXT_H
+
+#if defined(_) || defined(Q_)
+#error "namespace conflict: '_' or 'Q_' is pre-defined?"
+#endif
+
+#define FORMAT_PRESERVING(n) __attribute__((format_arg(n)))
+
+#ifdef GETTEXT_POISON
+extern int use_gettext_poison(void);
+#else
+#define use_gettext_poison() 0
+#endif
+
+static inline FORMAT_PRESERVING(1) const char *_(const char *msgid)
+{
+       return use_gettext_poison() ? "# GETTEXT POISON #" : msgid;
+}
+
+static inline FORMAT_PRESERVING(1) FORMAT_PRESERVING(2)
+const char *Q_(const char *msgid, const char *plu, unsigned long n)
+{
+       if (use_gettext_poison())
+               return "# GETTEXT POISON #";
+       return n == 1 ? msgid : plu;
+}
+
+/* Mark msgid for translation but do not translate it. */
+#define N_(msgid) (msgid)
+
+#endif
index bf947b1ec361aafeef58d43ef8eae979699b35ac..40498b33c9f09ef9cac1f7340a9a1ceb2ffcd50d 100644 (file)
 #endif
 #ifndef __MINGW32__
 #include <sys/wait.h>
+#include <sys/resource.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <termios.h>
@@ -538,6 +539,19 @@ void git_qsort(void *base, size_t nmemb, size_t size,
 #define fstat_is_reliable() 1
 #endif
 
+#ifndef va_copy
+/*
+ * Since an obvious implementation of va_list would be to make it a
+ * pointer into the stack frame, a simple assignment will work on
+ * many systems.  But let's try to be more portable.
+ */
+#ifdef __va_copy
+#define va_copy(dst, src) __va_copy(dst, src)
+#else
+#define va_copy(dst, src) ((dst) = (src))
+#endif
+#endif
+
 /*
  * Preserves errno, prints a message, but gives no warning for ENOENT.
  * Always returns the return value of unlink(2).
index 8e683e54783ab6e916bdb8ade56832ac81470648..bbf327f3e891cacdd14c0b18b51702ce14b2b6df 100755 (executable)
@@ -366,7 +366,9 @@ sub conn {
        $self->{'socketo'}->write("valid-requests\n");
        $self->{'socketo'}->flush();
 
-       chomp(my $rep=$self->readline());
+       my $rep=$self->readline();
+       die "Failed to read from server" unless defined $rep;
+       chomp($rep);
        if ($rep !~ s/^Valid-requests\s*//) {
                $rep="<unknown>" unless $rep;
                die "Expected Valid-requests from server, but got: $rep\n";
index d3acf0d2134b40b8ffb3d0e8c3229f71fa6db663..fd6a43d0a29986d38094df2818b66beba0f49234 100755 (executable)
@@ -93,6 +93,25 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
 
 package require msgcat
 
+# Check for Windows 7 MUI language pack (missed by msgcat < 1.4.4)
+if {[tk windowingsystem] eq "win32"
+       && [package vcompare [package provide msgcat] 1.4.4] < 0
+} then {
+       proc _mc_update_locale {} {
+               set key {HKEY_CURRENT_USER\Control Panel\Desktop}
+               if {![catch {
+                       package require registry
+                       set uilocale [registry get $key "PreferredUILanguages"]
+                       msgcat::ConvertLocale [string map {- _} [lindex $uilocale 0]]
+               } uilocale]} {
+                       if {[string length $uilocale] > 0} {
+                               msgcat::mclocale $uilocale
+                       }
+               }
+       }
+       _mc_update_locale
+}
+
 proc _mc_trim {fmt} {
        set cmk [string first @@ $fmt]
        if {$cmk > 0} {
@@ -139,6 +158,10 @@ if {$_trace >= 0} {
        set _trace 0
 }
 
+# variable for the last merged branch (useful for a default when deleting
+# branches).
+set _last_merged_branch {}
+
 proc shellpath {} {
        global _shellpath env
        if {[string match @@* $_shellpath]} {
@@ -1448,13 +1471,17 @@ proc rescan_stage2 {fd after} {
                close $fd
        }
 
-       set ls_others [list --exclude-per-directory=.gitignore]
-       if {[have_info_exclude]} {
-               lappend ls_others "--exclude-from=[gitdir info exclude]"
-       }
-       set user_exclude [get_config core.excludesfile]
-       if {$user_exclude ne {} && [file readable $user_exclude]} {
-               lappend ls_others "--exclude-from=$user_exclude"
+       if {[package vsatisfies $::_git_version 1.6.3]} {
+               set ls_others [list --exclude-standard]
+       } else {
+               set ls_others [list --exclude-per-directory=.gitignore]
+               if {[have_info_exclude]} {
+                       lappend ls_others "--exclude-from=[gitdir info exclude]"
+               }
+               set user_exclude [get_config core.excludesfile]
+               if {$user_exclude ne {} && [file readable $user_exclude]} {
+                       lappend ls_others "--exclude-from=[file normalize $user_exclude]"
+               }
        }
 
        set buf_rdi {}
@@ -1958,8 +1985,8 @@ static unsigned char file_merge_bits[] = {
 } -maskdata $filemask
 
 image create bitmap file_statechange -background white -foreground green -data {
-#define file_merge_width 14
-#define file_merge_height 15
+#define file_statechange_width 14
+#define file_statechange_height 15
 static unsigned char file_statechange_bits[] = {
    0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x62, 0x10,
    0x62, 0x10, 0xba, 0x11, 0xba, 0x11, 0x62, 0x10, 0x62, 0x10, 0x02, 0x10,
@@ -1993,7 +2020,11 @@ foreach i {
                {MD {mc "Staged for commit, missing"}}
 
                {_T {mc "File type changed, not staged"}}
+               {MT {mc "File type changed, old type staged for commit"}}
+               {AT {mc "File type changed, old type staged for commit"}}
                {T_ {mc "File type changed, staged"}}
+               {TM {mc "File type change staged, modification not staged"}}
+               {TD {mc "File type change staged, file missing"}}
 
                {_O {mc "Untracked, not staged"}}
                {A_ {mc "Staged for commit"}}
@@ -3331,6 +3362,8 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr
 }
 $ui_diff tag configure clr1 -font font_diffbold
 
+$ui_diff tag conf d_info -foreground blue -font font_diffbold
+
 $ui_diff tag conf d_cr -elide true
 $ui_diff tag conf d_@ -font font_diffbold
 $ui_diff tag conf d_+ -foreground {#00a000}
@@ -3351,13 +3384,13 @@ $ui_diff tag conf d_s- \
        -foreground red \
        -background ivory1
 
-$ui_diff tag conf d<<<<<<< \
+$ui_diff tag conf d< \
        -foreground orange \
        -font font_diffbold
-$ui_diff tag conf d======= \
+$ui_diff tag conf d= \
        -foreground orange \
        -font font_diffbold
-$ui_diff tag conf d>>>>>>> \
+$ui_diff tag conf d> \
        -foreground orange \
        -font font_diffbold
 
@@ -3533,8 +3566,8 @@ proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} {
                        || $current_diff_path eq {}
                        || {__} eq $state
                        || {_O} eq $state
-                       || {_T} eq $state
-                       || {T_} eq $state
+                       || [string match {?T} $state]
+                       || [string match {T?} $state]
                        || [has_textconv $current_diff_path]} {
                        set s disabled
                } else {
index c2415729e036d87bc892b53901bd45d7e71b5ec2..a8c622351167be937b9f02df149a1a6ec2a16e98 100644 (file)
@@ -121,7 +121,7 @@ method _parent {} {
                if {$browser_stack eq {}} {
                        regsub {:.*$} $browser_path {:} browser_path
                } else {
-                       regsub {/[^/]+$} $browser_path {} browser_path
+                       regsub {/[^/]+/$} $browser_path {/} browser_path
                }
                set browser_status [mc "Loading %s..." $browser_path]
                _ls $this [lindex $parent 0] [lindex $parent 1]
index fae119286d3d4511d1b362fb05a8fab775e80a40..657f7d5dc19b13f36a31b833f04407b8ca0b2901 100644 (file)
@@ -214,14 +214,6 @@ constructor pick {} {
        }
 }
 
-proc _home {} {
-       if {[catch {set h $::env(HOME)}]
-               || ![file isdirectory $h]} {
-               set h .
-       }
-       return $h
-}
-
 method _center {} {
        set nx [winfo reqwidth $top]
        set ny [winfo reqheight $top]
@@ -420,7 +412,7 @@ method _new_local_path {} {
        if {$local_path ne {}} {
                set p [file dirname $local_path]
        } else {
-               set p [_home]
+               set p [pwd]
        }
 
        set p [tk_chooseDirectory \
@@ -541,7 +533,7 @@ method _open_origin {} {
        if {$origin_url ne {} && [file isdirectory $origin_url]} {
                set p $origin_url
        } else {
-               set p [_home]
+               set p [pwd]
        }
 
        set p [tk_chooseDirectory \
@@ -1042,7 +1034,7 @@ method _open_local_path {} {
        if {$local_path ne {}} {
                set p $local_path
        } else {
-               set p [_home]
+               set p [pwd]
        }
 
        set p [tk_chooseDirectory \
index 7f459cd5647f690a5e48ed7c29fc0d75eef89d0c..5ce46877bfb24701187f5ff5e94ce4aaf8b666b2 100644 (file)
@@ -161,11 +161,12 @@ The rescan will be automatically started now.
        #
        set files_ready 0
        foreach path [array names file_states] {
-               switch -glob -- [lindex $file_states($path) 0] {
+               set s $file_states($path)
+               switch -glob -- [lindex $s 0] {
                _? {continue}
                A? -
                D? -
-               T_ -
+               T? -
                M? {set files_ready 1}
                _U -
                U? {
@@ -452,7 +453,11 @@ A rescan will be automatically started now.
                }
                AM -
                AD -
+               AT -
+               TM -
+               TD -
                MM -
+               MT -
                MD {
                        set file_states($path) [list \
                                _[string index $m 1] \
index dcf0711be0119a8f5ec42b48d97980330f7113b3..cf8a95ec346a9a8afa60a3812d59a8caa4bb4c3f 100644 (file)
@@ -122,22 +122,22 @@ proc show_unmerged_diff {cont_info} {
        if {$merge_stages(2) eq {}} {
                set is_conflict_diff 1
                lappend current_diff_queue \
-                       [list [mc "LOCAL: deleted\nREMOTE:\n"] d======= \
+                       [list [mc "LOCAL: deleted\nREMOTE:\n"] d= \
                            [list ":1:$current_diff_path" ":3:$current_diff_path"]]
        } elseif {$merge_stages(3) eq {}} {
                set is_conflict_diff 1
                lappend current_diff_queue \
-                       [list [mc "REMOTE: deleted\nLOCAL:\n"] d======= \
+                       [list [mc "REMOTE: deleted\nLOCAL:\n"] d= \
                            [list ":1:$current_diff_path" ":2:$current_diff_path"]]
        } elseif {[lindex $merge_stages(1) 0] eq {120000}
                || [lindex $merge_stages(2) 0] eq {120000}
                || [lindex $merge_stages(3) 0] eq {120000}} {
                set is_conflict_diff 1
                lappend current_diff_queue \
-                       [list [mc "LOCAL:\n"] d======= \
+                       [list [mc "LOCAL:\n"] d= \
                            [list ":1:$current_diff_path" ":2:$current_diff_path"]]
                lappend current_diff_queue \
-                       [list [mc "REMOTE:\n"] d======= \
+                       [list [mc "REMOTE:\n"] d= \
                            [list ":1:$current_diff_path" ":3:$current_diff_path"]]
        } else {
                start_show_diff $cont_info
@@ -208,32 +208,32 @@ proc show_other_diff {path w m cont_info} {
                        $ui_diff insert end [append \
                                "* " \
                                [mc "Git Repository (subproject)"] \
-                               "\n"] d_@
+                               "\n"] d_info
                } elseif {![catch {set type [exec file $path]}]} {
                        set n [string length $path]
                        if {[string equal -length $n $path $type]} {
                                set type [string range $type $n end]
                                regsub {^:?\s*} $type {} type
                        }
-                       $ui_diff insert end "* $type\n" d_@
+                       $ui_diff insert end "* $type\n" d_info
                }
                if {[string first "\0" $content] != -1} {
                        $ui_diff insert end \
                                [mc "* Binary file (not showing content)."] \
-                               d_@
+                               d_info
                } else {
                        if {$sz > $max_sz} {
                                $ui_diff insert end [mc \
 "* Untracked file is %d bytes.
 * Showing only first %d bytes.
-" $sz $max_sz] d_@
+" $sz $max_sz] d_info
                        }
                        $ui_diff insert end $content
                        if {$sz > $max_sz} {
                                $ui_diff insert end [mc "
 * Untracked file clipped here by %s.
 * To see the entire file, use an external editor.
-" [appname]] d_@
+" [appname]] d_info
                        }
                }
                $ui_diff conf -state disabled
@@ -253,6 +253,19 @@ proc show_other_diff {path w m cont_info} {
        }
 }
 
+proc get_conflict_marker_size {path} {
+       set size 7
+       catch {
+               set fd_rc [eval [list git_read check-attr "conflict-marker-size" -- $path]]
+               set ret [gets $fd_rc line]
+               close $fd_rc
+               if {$ret > 0} {
+                       regexp {.*: conflict-marker-size: (\d+)$} $line line size
+               }
+       }
+       return $size
+}
+
 proc start_show_diff {cont_info {add_opts {}}} {
        global file_states file_lists
        global is_3way_diff is_submodule_diff diff_active repo_config
@@ -268,6 +281,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
        set is_submodule_diff 0
        set diff_active 1
        set current_diff_header {}
+       set conflict_size [get_conflict_marker_size $path]
 
        set cmd [list]
        if {$w eq $ui_index} {
@@ -329,7 +343,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
                -blocking 0 \
                -encoding [get_path_encoding $path] \
                -translation lf
-       fileevent $fd readable [list read_diff $fd $cont_info]
+       fileevent $fd readable [list read_diff $fd $conflict_size $cont_info]
 }
 
 proc parse_color_line {line} {
@@ -337,19 +351,27 @@ proc parse_color_line {line} {
        set result ""
        set markup [list]
        set regexp {\033\[((?:\d+;)*\d+)?m}
+       set need_reset 0
        while {[regexp -indices -start $start $regexp $line match code]} {
                foreach {begin end} $match break
                append result [string range $line $start [expr {$begin - 1}]]
-               lappend markup [string length $result] \
-                       [eval [linsert $code 0 string range $line]]
+               set pos [string length $result]
+               set col [eval [linsert $code 0 string range $line]]
                set start [incr end]
+               if {$col eq "0" || $col eq ""} {
+                       if {!$need_reset} continue
+                       set need_reset 0
+               } else {
+                       set need_reset 1
+               }
+               lappend markup $pos $col
        }
        append result [string range $line $start end]
        if {[llength $markup] < 4} {set markup {}}
        return [list $result $markup]
 }
 
-proc read_diff {fd cont_info} {
+proc read_diff {fd conflict_size cont_info} {
        global ui_diff diff_active is_submodule_diff
        global is_3way_diff is_conflict_diff current_diff_header
        global current_diff_queue
@@ -360,37 +382,50 @@ proc read_diff {fd cont_info} {
                foreach {line markup} [parse_color_line $line] break
                set line [string map {\033 ^} $line]
 
-               # -- Cleanup uninteresting diff header lines.
+               set tags {}
+
+               # -- Check for start of diff header.
+               if {   [string match {diff --git *}      $line]
+                   || [string match {diff --cc *}       $line]
+                   || [string match {diff --combined *} $line]} {
+                       set ::current_diff_inheader 1
+               }
+
+               # -- Check for end of diff header (any hunk line will do this).
+               #
+               if {[regexp {^@@+ } $line]} {set ::current_diff_inheader 0}
+
+               # -- Automatically detect if this is a 3 way diff.
                #
+               if {[string match {@@@ *} $line]} {set is_3way_diff 1}
+
                if {$::current_diff_inheader} {
+
+                       # -- These two lines stop a diff header and shouldn't be in there
+                       if {   [string match {Binary files * and * differ} $line]
+                           || [regexp {^\* Unmerged path }                $line]} {
+                               set ::current_diff_inheader 0
+                       } else {
+                               append current_diff_header $line "\n"
+                       }
+
+                       # -- Cleanup uninteresting diff header lines.
+                       #
                        if {   [string match {diff --git *}      $line]
                            || [string match {diff --cc *}       $line]
                            || [string match {diff --combined *} $line]
                            || [string match {--- *}             $line]
-                           || [string match {+++ *}             $line]} {
-                               append current_diff_header $line "\n"
+                           || [string match {+++ *}             $line]
+                           || [string match {index *}           $line]} {
                                continue
                        }
-               }
-               if {[string match {index *} $line]} continue
-               if {$line eq {deleted file mode 120000}} {
-                       set line "deleted symlink"
-               }
-               set ::current_diff_inheader 0
 
-               # -- Automatically detect if this is a 3 way diff.
-               #
-               if {[string match {@@@ *} $line]} {set is_3way_diff 1}
+                       # -- Name it symlink, not 120000
+                       #    Note, that the original line is in $current_diff_header
+                       regsub {^(deleted|new) file mode 120000} $line {\1 symlink} line
 
-               if {[string match {mode *} $line]
-                       || [string match {new file *} $line]
-                       || [regexp {^(old|new) mode *} $line]
-                       || [string match {deleted file *} $line]
-                       || [string match {deleted symlink} $line]
-                       || [string match {Binary files * and * differ} $line]
-                       || $line eq {\ No newline at end of file}
-                       || [regexp {^\* Unmerged path } $line]} {
-                       set tags {}
+               } elseif {   $line eq {\ No newline at end of file}} {
+                       # -- Handle some special lines
                } elseif {$is_3way_diff} {
                        set op [string range $line 0 1]
                        switch -- $op {
@@ -402,7 +437,9 @@ proc read_diff {fd cont_info} {
                        {- } {set tags d_-s}
                        {--} {set tags d_--}
                        {++} {
-                               if {[regexp {^\+\+([<>]{7} |={7})} $line _g op]} {
+                               set regexp [string map [list %conflict_size $conflict_size]\
+                                                               {^\+\+([<>=]){%conflict_size}(?: |$)}]
+                               if {[regexp $regexp $line _g op]} {
                                        set is_conflict_diff 1
                                        set line [string replace $line 0 1 {  }]
                                        set tags d$op
@@ -418,10 +455,10 @@ proc read_diff {fd cont_info} {
                } elseif {$is_submodule_diff} {
                        if {$line == ""} continue
                        if {[regexp {^Submodule } $line]} {
-                               set tags d_@
+                               set tags d_info
                        } elseif {[regexp {^\* } $line]} {
                                set line [string replace $line 0 1 {Submodule }]
-                               set tags d_@
+                               set tags d_info
                        } else {
                                set op [string range $line 0 2]
                                switch -- $op {
@@ -441,7 +478,9 @@ proc read_diff {fd cont_info} {
                        {@} {set tags d_@}
                        {-} {set tags d_-}
                        {+} {
-                               if {[regexp {^\+([<>]{7} |={7})} $line _g op]} {
+                               set regexp [string map [list %conflict_size $conflict_size]\
+                                                               {^\+([<>=]){%conflict_size}(?: |$)}]
+                               if {[regexp $regexp $line _g op]} {
                                        set is_conflict_diff 1
                                        set tags d$op
                                } else {
index e9db0c49895fbebdf8dbe7c0472546a05fea26a0..5d7bbf23eddeb2ff146487b28a79feee1d296289 100644 (file)
@@ -103,8 +103,11 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} {
                set s $file_states($path)
                switch -glob -- [lindex $s 0] {
                A? {set new _O}
-               M? {set new _M}
+               MT -
+               TM -
                T_ {set new _T}
+               M? {set new _M}
+               TD -
                D_ {set new _D}
                D? {set new _?}
                ?? {continue}
@@ -167,7 +170,10 @@ proc write_update_index {fd pathList totalCnt batch after} {
                AD {set new __}
                ?D {set new D_}
                _O -
+               AT -
                AM {set new A_}
+               TM -
+               MT -
                _T {set new T_}
                _U -
                U? {
@@ -261,7 +267,7 @@ proc unstage_helper {txt paths} {
                switch -glob -- [lindex $file_states($path) 0] {
                A? -
                M? -
-               T_ -
+               T? -
                D? {
                        lappend pathList $path
                        if {$path eq $current_diff_path} {
index 5cded2341c541b5688adbac35d3d2e1216bc2d0b..460d32fa22fc77f6621e5ec9a9c6ba6dc98050c2 100644 (file)
@@ -83,6 +83,7 @@ method _visualize {} {
 
 method _start {} {
        global HEAD current_branch remote_url
+       global _last_merged_branch
 
        set name [_rev $this]
        if {$name eq {}} {
@@ -109,6 +110,7 @@ method _start {} {
        regsub ^refs/heads/ $branch {} branch
        puts $fh "$cmit\t\tbranch '$branch' of $remote"
        close $fh
+       set _last_merged_branch $branch
 
        set cmd [list git]
        lappend cmd merge
index 3fe90e697002baaa1c5fa8df4c3d3eae199b062d..3c8e73bcebea652c11e328169f63a6d9950d6dc2 100644 (file)
@@ -175,43 +175,56 @@ proc merge_resolve_tool2 {} {
 
        # Build the command line
        switch -- $tool {
-       kdiff3 {
+       araxis {
                if {$base_stage ne {}} {
-                       set cmdline [list "$merge_tool_path" --auto --L1 "$MERGED (Base)" \
-                               --L2 "$MERGED (Local)" --L3 "$MERGED (Remote)" -o "$MERGED" "$BASE" "$LOCAL" "$REMOTE"]
+                       set cmdline [list "$merge_tool_path" -wait -merge -3 -a1 \
+                               -title1:"'$MERGED (Base)'" -title2:"'$MERGED (Local)'" \
+                               -title3:"'$MERGED (Remote)'" \
+                               "$BASE" "$LOCAL" "$REMOTE" "$MERGED"]
                } else {
-                       set cmdline [list "$merge_tool_path" --auto --L1 "$MERGED (Local)" \
-                               --L2 "$MERGED (Remote)" -o "$MERGED" "$LOCAL" "$REMOTE"]
+                       set cmdline [list "$merge_tool_path" -wait -2 \
+                                -title1:"'$MERGED (Local)'" -title2:"'$MERGED (Remote)'" \
+                                "$LOCAL" "$REMOTE" "$MERGED"]
                }
        }
-       tkdiff {
+       bc3 {
                if {$base_stage ne {}} {
-                       set cmdline [list "$merge_tool_path" -a "$BASE" -o "$MERGED" "$LOCAL" "$REMOTE"]
+                       set cmdline [list "$merge_tool_path" "$LOCAL" "$REMOTE" "$BASE" -mergeoutput="$MERGED"]
                } else {
-                       set cmdline [list "$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"]
+                       set cmdline [list "$merge_tool_path" "$LOCAL" "$REMOTE" -mergeoutput="$MERGED"]
                }
        }
-       meld {
-               set cmdline [list "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"]
+       ecmerge {
+               if {$base_stage ne {}} {
+                       set cmdline [list "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" --default --mode=merge3 --to="$MERGED"]
+               } else {
+                       set cmdline [list "$merge_tool_path" "$LOCAL" "$REMOTE" --default --mode=merge2 --to="$MERGED"]
+               }
+       }
+       emerge {
+               if {$base_stage ne {}} {
+                       set cmdline [list "$merge_tool_path" -f emerge-files-with-ancestor-command \
+                                       "$LOCAL" "$REMOTE" "$BASE" "$basename"]
+               } else {
+                       set cmdline [list "$merge_tool_path" -f emerge-files-command \
+                                       "$LOCAL" "$REMOTE" "$basename"]
+               }
        }
        gvimdiff {
                set cmdline [list "$merge_tool_path" -f "$LOCAL" "$MERGED" "$REMOTE"]
        }
-       xxdiff {
+       kdiff3 {
                if {$base_stage ne {}} {
-                       set cmdline [list "$merge_tool_path" -X --show-merged-pane \
-                                           -R {Accel.SaveAsMerged: "Ctrl-S"} \
-                                           -R {Accel.Search: "Ctrl+F"} \
-                                           -R {Accel.SearchForward: "Ctrl-G"} \
-                                           --merged-file "$MERGED" "$LOCAL" "$BASE" "$REMOTE"]
+                       set cmdline [list "$merge_tool_path" --auto --L1 "$MERGED (Base)" \
+                               --L2 "$MERGED (Local)" --L3 "$MERGED (Remote)" -o "$MERGED" "$BASE" "$LOCAL" "$REMOTE"]
                } else {
-                       set cmdline [list "$merge_tool_path" -X --show-merged-pane \
-                                           -R {Accel.SaveAsMerged: "Ctrl-S"} \
-                                           -R {Accel.Search: "Ctrl+F"} \
-                                           -R {Accel.SearchForward: "Ctrl-G"} \
-                                           --merged-file "$MERGED" "$LOCAL" "$REMOTE"]
+                       set cmdline [list "$merge_tool_path" --auto --L1 "$MERGED (Local)" \
+                               --L2 "$MERGED (Remote)" -o "$MERGED" "$LOCAL" "$REMOTE"]
                }
        }
+       meld {
+               set cmdline [list "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"]
+       }
        opendiff {
                if {$base_stage ne {}} {
                        set cmdline [list "$merge_tool_path" "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"]
@@ -219,22 +232,20 @@ proc merge_resolve_tool2 {} {
                        set cmdline [list "$merge_tool_path" "$LOCAL" "$REMOTE" -merge "$MERGED"]
                }
        }
-       ecmerge {
-               if {$base_stage ne {}} {
-                       set cmdline [list "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" --default --mode=merge3 --to="$MERGED"]
-               } else {
-                       set cmdline [list "$merge_tool_path" "$LOCAL" "$REMOTE" --default --mode=merge2 --to="$MERGED"]
-               }
+       p4merge {
+               set cmdline [list "$merge_tool_path" "$BASE" "$REMOTE" "$LOCAL" "$MERGED"]
        }
-       emerge {
+       tkdiff {
                if {$base_stage ne {}} {
-                       set cmdline [list "$merge_tool_path" -f emerge-files-with-ancestor-command \
-                                       "$LOCAL" "$REMOTE" "$BASE" "$basename"]
+                       set cmdline [list "$merge_tool_path" -a "$BASE" -o "$MERGED" "$LOCAL" "$REMOTE"]
                } else {
-                       set cmdline [list "$merge_tool_path" -f emerge-files-command \
-                                       "$LOCAL" "$REMOTE" "$basename"]
+                       set cmdline [list "$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"]
                }
        }
+       vimdiff {
+               error_popup [mc "Not a GUI merge tool: '%s'" $tool]
+               return
+       }
        winmerge {
                if {$base_stage ne {}} {
                        # This tool does not support 3-way merges.
@@ -245,25 +256,21 @@ proc merge_resolve_tool2 {} {
                                -dl "Theirs File" -dr "Mine File" "$REMOTE" "$LOCAL" "$MERGED"]
                }
        }
-       araxis {
+       xxdiff {
                if {$base_stage ne {}} {
-                       set cmdline [list "$merge_tool_path" -wait -merge -3 -a1 \
-                               -title1:"'$MERGED (Base)'" -title2:"'$MERGED (Local)'" \
-                               -title3:"'$MERGED (Remote)'" \
-                               "$BASE" "$LOCAL" "$REMOTE" "$MERGED"]
+                       set cmdline [list "$merge_tool_path" -X --show-merged-pane \
+                                           -R {Accel.SaveAsMerged: "Ctrl-S"} \
+                                           -R {Accel.Search: "Ctrl+F"} \
+                                           -R {Accel.SearchForward: "Ctrl-G"} \
+                                           --merged-file "$MERGED" "$LOCAL" "$BASE" "$REMOTE"]
                } else {
-                       set cmdline [list "$merge_tool_path" -wait -2 \
-                                -title1:"'$MERGED (Local)'" -title2:"'$MERGED (Remote)'" \
-                                "$LOCAL" "$REMOTE" "$MERGED"]
+                       set cmdline [list "$merge_tool_path" -X --show-merged-pane \
+                                           -R {Accel.SaveAsMerged: "Ctrl-S"} \
+                                           -R {Accel.Search: "Ctrl+F"} \
+                                           -R {Accel.SearchForward: "Ctrl-G"} \
+                                           --merged-file "$MERGED" "$LOCAL" "$REMOTE"]
                }
        }
-       p4merge {
-               set cmdline [list "$merge_tool_path" "$BASE" "$REMOTE" "$LOCAL" "$MERGED"]
-       }
-       vimdiff {
-               error_popup [mc "Not a GUI merge tool: '%s'" $tool]
-               return
-       }
        default {
                error_popup [mc "Unsupported merge tool '%s'" $tool]
                return
index b92b429cf766d525402047175ed0a69af015c682..5e4e7f4c83952ac2ec4c60eb79426248071ae54e 100644 (file)
@@ -157,22 +157,7 @@ proc add_fetch_entry {r} {
        }
 
        if {$enable} {
-               if {![winfo exists $fetch_m]} {
-                       menu $remove_m
-                       $remote_m insert 0 cascade \
-                               -label [mc "Remove Remote"] \
-                               -menu $remove_m
-
-                       menu $prune_m
-                       $remote_m insert 0 cascade \
-                               -label [mc "Prune from"] \
-                               -menu $prune_m
-
-                       menu $fetch_m
-                       $remote_m insert 0 cascade \
-                               -label [mc "Fetch from"] \
-                               -menu $fetch_m
-               }
+               make_sure_remote_submenues_exist $remote_m
 
                $fetch_m add command \
                        -label $r \
@@ -222,6 +207,70 @@ proc add_push_entry {r} {
        }
 }
 
+proc make_sure_remote_submenues_exist {remote_m} {
+       set fetch_m $remote_m.fetch
+       set prune_m $remote_m.prune
+       set remove_m $remote_m.remove
+
+       if {![winfo exists $fetch_m]} {
+               menu $remove_m
+               $remote_m insert 0 cascade \
+                       -label [mc "Remove Remote"] \
+                       -menu $remove_m
+
+               menu $prune_m
+               $remote_m insert 0 cascade \
+                       -label [mc "Prune from"] \
+                       -menu $prune_m
+
+               menu $fetch_m
+               $remote_m insert 0 cascade \
+                       -label [mc "Fetch from"] \
+                       -menu $fetch_m
+       }
+}
+
+proc update_all_remotes_menu_entry {} {
+       global all_remotes
+
+       if {[git-version < 1.6.6]} { return }
+
+       set have_remote 0
+       foreach r $all_remotes {
+               incr have_remote
+       }
+
+       set remote_m .mbar.remote
+       set fetch_m $remote_m.fetch
+       set prune_m $remote_m.prune
+       if {$have_remote > 1} {
+               make_sure_remote_submenues_exist $remote_m
+               if {[$fetch_m entrycget end -label] ne "All"} {
+
+                       $fetch_m insert end separator
+                       $fetch_m insert end command \
+                               -label "All" \
+                               -command fetch_from_all
+
+                       $prune_m insert end separator
+                       $prune_m insert end command \
+                               -label "All" \
+                               -command prune_from_all
+               }
+       } else {
+               if {[winfo exists $fetch_m]} {
+                       if {[$fetch_m entrycget end -label] eq "All"} {
+
+                               delete_from_menu $fetch_m end
+                               delete_from_menu $fetch_m end
+
+                               delete_from_menu $prune_m end
+                               delete_from_menu $prune_m end
+                       }
+               }
+       }
+}
+
 proc populate_remotes_menu {} {
        global all_remotes
 
@@ -229,6 +278,8 @@ proc populate_remotes_menu {} {
                add_fetch_entry $r
                add_push_entry $r
        }
+
+       update_all_remotes_menu_entry
 }
 
 proc add_single_remote {name location} {
@@ -244,6 +295,8 @@ proc add_single_remote {name location} {
 
        add_fetch_entry $name
        add_push_entry $name
+
+       update_all_remotes_menu_entry
 }
 
 proc delete_from_menu {menu name} {
@@ -264,8 +317,8 @@ proc remove_remote {name} {
                unset repo_config(remote.$name.push)
        }
 
-       set i [lsearch -exact all_remotes $name]
-       lreplace all_remotes $i $i
+       set i [lsearch -exact $all_remotes $name]
+       set all_remotes [lreplace $all_remotes $i $i]
 
        set remote_m .mbar.remote
        delete_from_menu $remote_m.fetch $name
@@ -273,4 +326,6 @@ proc remove_remote {name} {
        delete_from_menu $remote_m.remove $name
        # Not all remotes are in the push menu
        catch { delete_from_menu $remote_m.push $name }
+
+       update_all_remotes_menu_entry
 }
index f872a3d89d89bc861ea3729ec7974833bdac277f..fcc06d03a1dfc4919f762d70e2809f29dab77390 100644 (file)
@@ -251,7 +251,7 @@ method _write_url        {args} { set urltype url    }
 method _write_check_head {args} { set checktype head }
 
 method _write_head_list {args} {
-       global current_branch
+       global current_branch _last_merged_branch
 
        $head_m delete 0 end
        foreach abr $head_list {
@@ -267,6 +267,13 @@ method _write_head_list {args} {
                        set check_head $current_branch
                }
        }
+       set lmb [lsearch -exact -sorted $head_list $_last_merged_branch]
+       if {$lmb >= 0} {
+               $w.heads.l conf -state normal
+               $w.heads.l select set $lmb
+               $w.heads.l yview $lmb
+               $w.heads.l conf -state disabled
+       }
 }
 
 method _write_urltype {args} {
index 60e3a642c5fb7f1526c9feb1a1d3a495db7728f8..7fad9b7d91a6d6a0671ca7bac714dcc4fd022403 100644 (file)
@@ -20,6 +20,35 @@ proc prune_from {remote} {
        console::exec $w [list git remote prune $remote]
 }
 
+proc fetch_from_all {} {
+       set w [console::new \
+               [mc "fetch all remotes"] \
+               [mc "Fetching new changes from all remotes"]]
+
+       set cmd [list git fetch --all]
+       if {[is_config_true gui.pruneduringfetch]} {
+               lappend cmd --prune
+       }
+
+       console::exec $w $cmd
+}
+
+proc prune_from_all {} {
+       global all_remotes
+
+       set w [console::new \
+               [mc "remote prune all remotes"] \
+               [mc "Pruning tracking branches deleted from all remotes"]]
+
+       set cmd [list git remote prune]
+
+       foreach r $all_remotes {
+               lappend cmd $r
+       }
+
+       console::exec $w $cmd
+}
+
 proc push_to {remote} {
        set w [console::new \
                [mc "push %s" $remote] \
@@ -123,6 +152,7 @@ proc do_push_anywhere {} {
                $w.source.l insert end $h
                if {$h eq $current_branch} {
                        $w.source.l select set end
+                       $w.source.l yview end
                }
        }
        pack $w.source.l -side left -fill both -expand 1
@@ -135,7 +165,9 @@ proc do_push_anywhere {} {
                        -value remote \
                        -variable push_urltype
                if {$use_ttk} {
-                       ttk::combobox $w.dest.remote_m -textvariable push_remote \
+                       ttk::combobox $w.dest.remote_m -state readonly \
+                               -exportselection false \
+                               -textvariable push_remote \
                                -values $all_remotes
                } else {
                        eval tk_optionMenu $w.dest.remote_m push_remote $all_remotes
diff --git a/git-gui/po/glossary/pt_br.po b/git-gui/po/glossary/pt_br.po
new file mode 100644 (file)
index 0000000..eb039b2
--- /dev/null
@@ -0,0 +1,169 @@
+# Translation of git-gui to Brazilian Portuguese
+# Copyright (C) 2007 Shawn Pearce, et al.
+# This file is distributed under the same license as the git-gui package.
+#
+# Alexandre Erwin Ittner <alexandre@ittner.com.br>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: git-gui\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-01-26 15:47-0800\n"
+"PO-Revision-Date: 2010-09-18 11:09-0300\n"
+"Last-Translator: Alexandre Erwin Ittner <alexandre@ittner.com.br>\n"
+"Language-Team: Brazilian Portuguese <>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. "English Definition (Dear translator: This file will never be visible to the user! It should only serve as a tool for you, the translator. Nothing more.)"
+msgid ""
+"English Term (Dear translator: This file will never be visible to the user!)"
+msgstr ""
+
+#. ""
+msgid "amend"
+msgstr "corrigir"
+
+#. ""
+msgid "annotate"
+msgstr "anotar"
+
+#. "A 'branch' is an active line of development."
+msgid "branch [noun]"
+msgstr "ramo"
+
+#. ""
+msgid "branch [verb]"
+msgstr "ramificar"
+
+#. ""
+msgid "checkout [noun]"
+msgstr "checkout"
+
+#. "The action of updating the working tree to a revision which was stored in the object database."
+msgid "checkout [verb]"
+msgstr "efetuar checkout"
+
+#. ""
+msgid "clone [verb]"
+msgstr "clonar"
+
+#. "A single point in the git history."
+msgid "commit [noun]"
+msgstr "revisão"
+
+#. "The action of storing a new snapshot of the project's state in the git history."
+msgid "commit [verb]"
+msgstr "salvar revisão"
+
+#. ""
+msgid "diff [noun]"
+msgstr "diff"
+
+#. ""
+msgid "diff [verb]"
+msgstr "comparar"
+
+#. "A fast-forward is a special type of merge where you have a revision and you are merging another branch's changes that happen to be a descendant of what you have."
+msgid "fast forward merge"
+msgstr "mesclagem rápida"
+
+#. "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 "receber"
+
+#. "One context of consecutive lines in a whole patch, which consists of many such hunks"
+msgid "hunk"
+msgstr "trecho"
+
+#. "A collection of files. The index is a stored version of your working tree."
+msgid "index (in git-gui: staging area)"
+msgstr "índice"
+
+#. "A successful merge results in the creation of a new commit representing the result of the merge."
+msgid "merge [noun]"
+msgstr "mesclagem"
+
+#. "To bring the contents of another branch into the current branch."
+msgid "merge [verb]"
+msgstr "mesclar"
+
+#. ""
+msgid "message"
+msgstr "descrição da revisão"
+
+#. "Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in 'remotes/<name>'."
+msgid "prune"
+msgstr "limpar"
+
+#. "Pulling a branch means to fetch it and merge it."
+msgid "pull"
+msgstr "receber e mesclar"
+
+#. "Pushing a branch means to get the branch's head ref from a remote repository, and ... (well, can someone please explain it for mere mortals?)"
+msgid "push"
+msgstr "enviar"
+
+#. ""
+msgid "redo"
+msgstr "refazer"
+
+#. "An other repository ('remote'). One might have a set of remotes whose branches one tracks."
+msgid "remote"
+msgstr "repositório remoto"
+
+#. "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 "repositório"
+
+#. ""
+msgid "reset"
+msgstr "descartar, redefinir"
+
+#. ""
+msgid "revert"
+msgstr "reverter"
+
+#. "A particular state of files and directories which was stored in the object database."
+msgid "revision"
+msgstr "revisão"
+
+#. ""
+msgid "sign off"
+msgstr "assinar embaixo"
+
+#. ""
+msgid "staging area"
+msgstr "???"
+
+#. ""
+msgid "status"
+msgstr "status"
+
+#. "A ref pointing to a tag or commit object"
+msgid "tag [noun]"
+msgstr "etiqueta"
+
+#. ""
+msgid "tag [verb]"
+msgstr "marcar etiqueta"
+
+#. "A regular git branch that is used to follow changes from another repository."
+msgid "tracking branch"
+msgstr "ramo de rastreamento"
+
+#. ""
+msgid "undo"
+msgstr "desfazer"
+
+#. ""
+msgid "update"
+msgstr "atualizar"
+
+#. ""
+msgid "verify"
+msgstr "verificar"
+
+#. "The tree of actual checked out files."
+msgid "working copy, working tree"
+msgstr "cópia de trabalho, árvore de trabalho"
diff --git a/git-gui/po/pt_br.po b/git-gui/po/pt_br.po
new file mode 100644 (file)
index 0000000..b175b97
--- /dev/null
@@ -0,0 +1,2568 @@
+# Translation of git-gui to Brazilian Portuguese
+# Copyright (C) 2007 Shawn Pearce, et al.
+# This file is distributed under the same license as the git-gui package.
+#
+# Alexandre Erwin Ittner <alexandre@ittner.com.br>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: git-gui\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-01-26 15:47-0800\n"
+"PO-Revision-Date: 2010-09-18 11:09-0300\n"
+"Last-Translator: Alexandre Erwin Ittner <alexandre@ittner.com.br>\n"
+"Language-Team: Brazilian Portuguese <>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: git-gui.sh:41 git-gui.sh:793 git-gui.sh:807 git-gui.sh:820 git-gui.sh:903
+#: git-gui.sh:922
+msgid "git-gui: fatal error"
+msgstr "git-gui: erro fatal"
+
+#: git-gui.sh:743
+#, tcl-format
+msgid "Invalid font specified in %s:"
+msgstr "Fonte inválida indicada em %s:"
+
+#: git-gui.sh:779
+msgid "Main Font"
+msgstr "Fonte principal"
+
+#: git-gui.sh:780
+msgid "Diff/Console Font"
+msgstr "Fonte para o diff/console"
+
+#: git-gui.sh:794
+msgid "Cannot find git in PATH."
+msgstr "Impossível encontrar o git no \"PATH\""
+
+#: git-gui.sh:821
+msgid "Cannot parse Git version string:"
+msgstr "Impossível interpretar a versão do git:"
+
+#: git-gui.sh:839
+#, tcl-format
+msgid ""
+"Git version cannot be determined.\n"
+"\n"
+"%s claims it is version '%s'.\n"
+"\n"
+"%s requires at least Git 1.5.0 or later.\n"
+"\n"
+"Assume '%s' is version 1.5.0?\n"
+msgstr ""
+"Não foi possível determinar a versão do git:\n"
+"\n"
+"%s afirmar que sua versão é \"%s\".\n"
+"\n"
+"%s exige o Git 1.5.0 ou posterior.\n"
+"\n"
+"Assumir que '%s' é a versão 1.5.0?\n"
+
+#: git-gui.sh:1128
+msgid "Git directory not found:"
+msgstr "Diretório do Git não encontrado:"
+
+#: git-gui.sh:1146
+msgid "Cannot move to top of working directory:"
+msgstr "Impossível mover para o início do diretório de trabalho:"
+
+#: git-gui.sh:1154
+msgid "Cannot use bare repository:"
+msgstr "Impossível usar repositório puro:"
+
+#: git-gui.sh:1162
+msgid "No working directory"
+msgstr "Sem diretório de trabalho"
+
+#: git-gui.sh:1334 lib/checkout_op.tcl:306
+msgid "Refreshing file status..."
+msgstr "Atualizando estado dos arquivos..."
+
+#: git-gui.sh:1390
+msgid "Scanning for modified files ..."
+msgstr "Procurando por arquivos modificados ..."
+
+#: git-gui.sh:1454
+msgid "Calling prepare-commit-msg hook..."
+msgstr "Executando hook \"prepare-commit-msg\"..."
+
+#: git-gui.sh:1471
+msgid "Commit declined by prepare-commit-msg hook."
+msgstr "O script \"prepare-commit-msg\" negou a criação de uma nova revisão"
+
+#: git-gui.sh:1629 lib/browser.tcl:246
+msgid "Ready."
+msgstr "Pronto."
+
+#: git-gui.sh:1787
+#, tcl-format
+msgid "Displaying only %s of %s files."
+msgstr "Exibindo apenas %s de %s arquivos."
+
+#: git-gui.sh:1913
+msgid "Unmodified"
+msgstr "Não modificado"
+
+#: git-gui.sh:1915
+msgid "Modified, not staged"
+msgstr "Modificado, não marcado"
+
+#: git-gui.sh:1916 git-gui.sh:1924
+msgid "Staged for commit"
+msgstr "Marcado para uma nova revisão"
+
+#: git-gui.sh:1917 git-gui.sh:1925
+msgid "Portions staged for commit"
+msgstr "Trechos marcados para revisão"
+
+#: git-gui.sh:1918 git-gui.sh:1926
+msgid "Staged for commit, missing"
+msgstr "Marcado para revisão, faltando"
+
+#: git-gui.sh:1920
+msgid "File type changed, not staged"
+msgstr "Tipo do arquivo modificado, não marcado"
+
+#: git-gui.sh:1921
+msgid "File type changed, staged"
+msgstr "Tipo do arquivo modificado, marcado"
+
+#: git-gui.sh:1923
+msgid "Untracked, not staged"
+msgstr "Não monitorado, não marcado"
+
+#: git-gui.sh:1928
+msgid "Missing"
+msgstr "Faltando"
+
+#: git-gui.sh:1929
+msgid "Staged for removal"
+msgstr "Marcado para remoção"
+
+#: git-gui.sh:1930
+msgid "Staged for removal, still present"
+msgstr "Marcado para remoção, ainda presente"
+
+#: git-gui.sh:1932 git-gui.sh:1933 git-gui.sh:1934 git-gui.sh:1935
+#: git-gui.sh:1936 git-gui.sh:1937
+msgid "Requires merge resolution"
+msgstr "Requer resolução de conflitos"
+
+#: git-gui.sh:1972
+msgid "Starting gitk... please wait..."
+msgstr "Iniciando gitk... Aguarde..."
+
+#: git-gui.sh:1984
+msgid "Couldn't find gitk in PATH"
+msgstr "Impossível encontrar o gitk no PATH"
+
+#: git-gui.sh:2043
+msgid "Couldn't find git gui in PATH"
+msgstr "Impossível encontrar o \"git gui\" no PATH"
+
+#: git-gui.sh:2455 lib/choose_repository.tcl:36
+msgid "Repository"
+msgstr "Repositório"
+
+#: git-gui.sh:2456
+msgid "Edit"
+msgstr "Editar"
+
+#: git-gui.sh:2458 lib/choose_rev.tcl:561
+msgid "Branch"
+msgstr "Ramo"
+
+#: git-gui.sh:2461 lib/choose_rev.tcl:548
+msgid "Commit@@noun"
+msgstr "Revisão"
+
+#: git-gui.sh:2464 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168
+msgid "Merge"
+msgstr "Mesclar"
+
+#: git-gui.sh:2465 lib/choose_rev.tcl:557
+msgid "Remote"
+msgstr "Remoto"
+
+#: git-gui.sh:2468
+msgid "Tools"
+msgstr "Ferramentas"
+
+#: git-gui.sh:2477
+msgid "Explore Working Copy"
+msgstr "Explorar cópia de trabalho"
+
+#: git-gui.sh:2483
+msgid "Browse Current Branch's Files"
+msgstr "Explorar arquivos do ramo atual"
+
+#: git-gui.sh:2487
+msgid "Browse Branch Files..."
+msgstr "Explorar arquivos do ramo..."
+
+#: git-gui.sh:2492
+msgid "Visualize Current Branch's History"
+msgstr "Visualizar histórico do ramo atual"
+
+#: git-gui.sh:2496
+msgid "Visualize All Branch History"
+msgstr "Visualizar histórico de todos os ramos"
+
+#: git-gui.sh:2503
+#, tcl-format
+msgid "Browse %s's Files"
+msgstr "Explorar arquivos de %s"
+
+#: git-gui.sh:2505
+#, tcl-format
+msgid "Visualize %s's History"
+msgstr "Visualizar histórico de %s"
+
+#: git-gui.sh:2510 lib/database.tcl:27 lib/database.tcl:67
+msgid "Database Statistics"
+msgstr "Estatísticas do banco de dados"
+
+#: git-gui.sh:2513 lib/database.tcl:34
+msgid "Compress Database"
+msgstr "Compactar banco de dados"
+
+#: git-gui.sh:2516
+msgid "Verify Database"
+msgstr "Verificar banco de dados"
+
+#: git-gui.sh:2523 git-gui.sh:2527 git-gui.sh:2531 lib/shortcut.tcl:8
+#: lib/shortcut.tcl:40 lib/shortcut.tcl:72
+msgid "Create Desktop Icon"
+msgstr "Criar ícone na área de trabalho"
+
+#: git-gui.sh:2539 lib/choose_repository.tcl:183 lib/choose_repository.tcl:191
+msgid "Quit"
+msgstr "Sair"
+
+#: git-gui.sh:2547
+msgid "Undo"
+msgstr "Desfazer"
+
+#: git-gui.sh:2550
+msgid "Redo"
+msgstr "Refazer"
+
+#: git-gui.sh:2554 git-gui.sh:3109
+msgid "Cut"
+msgstr "Recortar"
+
+#: git-gui.sh:2557 git-gui.sh:3112 git-gui.sh:3186 git-gui.sh:3259
+#: lib/console.tcl:69
+msgid "Copy"
+msgstr "Copiar"
+
+#: git-gui.sh:2560 git-gui.sh:3115
+msgid "Paste"
+msgstr "Colar"
+
+#: git-gui.sh:2563 git-gui.sh:3118 lib/branch_delete.tcl:26
+#: lib/remote_branch_delete.tcl:38
+msgid "Delete"
+msgstr "Apagar"
+
+#: git-gui.sh:2567 git-gui.sh:3122 git-gui.sh:3263 lib/console.tcl:71
+msgid "Select All"
+msgstr "Selecionar tudo"
+
+#: git-gui.sh:2576
+msgid "Create..."
+msgstr "Criar..."
+
+#: git-gui.sh:2582
+msgid "Checkout..."
+msgstr "Checkout..."
+
+#: git-gui.sh:2588
+msgid "Rename..."
+msgstr "Renomear..."
+
+#: git-gui.sh:2593
+msgid "Delete..."
+msgstr "Apagar..."
+
+#: git-gui.sh:2598
+msgid "Reset..."
+msgstr "Redefinir..."
+
+#: git-gui.sh:2608
+msgid "Done"
+msgstr "Pronto"
+
+#: git-gui.sh:2610
+msgid "Commit@@verb"
+msgstr "Salvar revisão"
+
+#: git-gui.sh:2619 git-gui.sh:3050
+msgid "New Commit"
+msgstr "Nova revisão"
+
+#: git-gui.sh:2627 git-gui.sh:3057
+msgid "Amend Last Commit"
+msgstr "Corrigir última revisão"
+
+#: git-gui.sh:2637 git-gui.sh:3011 lib/remote_branch_delete.tcl:99
+msgid "Rescan"
+msgstr "Atualizar"
+
+#: git-gui.sh:2643
+msgid "Stage To Commit"
+msgstr "Marcar para revisão"
+
+#: git-gui.sh:2649
+msgid "Stage Changed Files To Commit"
+msgstr "Marcar arquivos modificados"
+
+#: git-gui.sh:2655
+msgid "Unstage From Commit"
+msgstr "Desmarcar"
+
+#: git-gui.sh:2661 lib/index.tcl:412
+msgid "Revert Changes"
+msgstr "Reverter mudanças"
+
+#: git-gui.sh:2669 git-gui.sh:3310 git-gui.sh:3341
+msgid "Show Less Context"
+msgstr "Mostrar menos contexto"
+
+#: git-gui.sh:2673 git-gui.sh:3314 git-gui.sh:3345
+msgid "Show More Context"
+msgstr "Mostrar mais contexto"
+
+#: git-gui.sh:2680 git-gui.sh:3024 git-gui.sh:3133
+msgid "Sign Off"
+msgstr "Assinar embaixo"
+
+#: git-gui.sh:2696
+msgid "Local Merge..."
+msgstr "Mesclar localmente..."
+
+#: git-gui.sh:2701
+msgid "Abort Merge..."
+msgstr "Abortar mesclagem..."
+
+#: git-gui.sh:2713 git-gui.sh:2741
+msgid "Add..."
+msgstr "Adicionar..."
+
+#: git-gui.sh:2717
+msgid "Push..."
+msgstr "Enviar..."
+
+#: git-gui.sh:2721
+msgid "Delete Branch..."
+msgstr "Apagar ramo..."
+
+#: git-gui.sh:2731 git-gui.sh:3292
+msgid "Options..."
+msgstr "Opções..."
+
+#: git-gui.sh:2742
+msgid "Remove..."
+msgstr "Remover..."
+
+#: git-gui.sh:2751 lib/choose_repository.tcl:50
+msgid "Help"
+msgstr "Ajuda"
+
+#: git-gui.sh:2755 git-gui.sh:2759 lib/about.tcl:14
+#: lib/choose_repository.tcl:44 lib/choose_repository.tcl:53
+#, tcl-format
+msgid "About %s"
+msgstr "Sobre o %s"
+
+#: git-gui.sh:2783
+msgid "Online Documentation"
+msgstr "Ajuda online"
+
+#: git-gui.sh:2786 lib/choose_repository.tcl:47 lib/choose_repository.tcl:56
+msgid "Show SSH Key"
+msgstr "Mostrar chave SSH"
+
+#: git-gui.sh:2893
+#, tcl-format
+msgid "fatal: cannot stat path %s: No such file or directory"
+msgstr ""
+"erro fatal: impossível executar \"stat\" em  %s: Arquivo ou diretório não "
+"encontrado"
+
+#: git-gui.sh:2926
+msgid "Current Branch:"
+msgstr "Ramo atual:"
+
+#: git-gui.sh:2947
+msgid "Staged Changes (Will Commit)"
+msgstr "Mudanças marcadas"
+
+#: git-gui.sh:2967
+msgid "Unstaged Changes"
+msgstr "Mudanças não marcadas"
+
+#: git-gui.sh:3017
+msgid "Stage Changed"
+msgstr "Marcar alterados"
+
+#: git-gui.sh:3036 lib/transport.tcl:104 lib/transport.tcl:193
+msgid "Push"
+msgstr "Enviar"
+
+#: git-gui.sh:3071
+msgid "Initial Commit Message:"
+msgstr "Descrição da revisão inicial:"
+
+#: git-gui.sh:3072
+msgid "Amended Commit Message:"
+msgstr "Descrição da revisão corrigida:"
+
+#: git-gui.sh:3073
+msgid "Amended Initial Commit Message:"
+msgstr "Descrição da revisão inicial corrigida:"
+
+#: git-gui.sh:3074
+msgid "Amended Merge Commit Message:"
+msgstr "Descrição da revisão de mescla corrigida:"
+
+#: git-gui.sh:3075
+msgid "Merge Commit Message:"
+msgstr "Descrição da revisão de mescla:"
+
+#: git-gui.sh:3076
+msgid "Commit Message:"
+msgstr "Descrição da revisão:"
+
+#: git-gui.sh:3125 git-gui.sh:3267 lib/console.tcl:73
+msgid "Copy All"
+msgstr "Copiar todos"
+
+#: git-gui.sh:3149 lib/blame.tcl:104
+msgid "File:"
+msgstr "Arquivo:"
+
+#: git-gui.sh:3255
+msgid "Refresh"
+msgstr "Atualizar"
+
+#: git-gui.sh:3276
+msgid "Decrease Font Size"
+msgstr "Reduzir tamanho da fonte"
+
+#: git-gui.sh:3280
+msgid "Increase Font Size"
+msgstr "Aumentar tamanho da fonte"
+
+#: git-gui.sh:3288 lib/blame.tcl:281
+msgid "Encoding"
+msgstr "Codificação"
+
+#: git-gui.sh:3299
+msgid "Apply/Reverse Hunk"
+msgstr "Aplicar/reverter trecho"
+
+#: git-gui.sh:3304
+msgid "Apply/Reverse Line"
+msgstr "Aplicar/reverter linha"
+
+#: git-gui.sh:3323
+msgid "Run Merge Tool"
+msgstr "Executar ferramenta de mescla"
+
+#: git-gui.sh:3328
+msgid "Use Remote Version"
+msgstr "Usar versão remota"
+
+#: git-gui.sh:3332
+msgid "Use Local Version"
+msgstr "Usar versão local"
+
+#: git-gui.sh:3336
+msgid "Revert To Base"
+msgstr "Reverter para a versão-base"
+
+#: git-gui.sh:3354
+msgid "Visualize These Changes In The Submodule"
+msgstr "Visualizar estas mudanças no sub-módulo"
+
+#: git-gui.sh:3358
+msgid "Visualize Current Branch History In The Submodule"
+msgstr "Visualizar histórico do ramo atual no sub-módulo"
+
+#: git-gui.sh:3362
+msgid "Visualize All Branch History In The Submodule"
+msgstr "Visualizar histórico de todos os camos no sub-módulo"
+
+#: git-gui.sh:3367
+msgid "Start git gui In The Submodule"
+msgstr "Iniciar \"git gui\" no sub-módulo"
+
+#: git-gui.sh:3389
+msgid "Unstage Hunk From Commit"
+msgstr "Desmarcar trecho para revisão"
+
+#: git-gui.sh:3391
+msgid "Unstage Lines From Commit"
+msgstr "Desmarcar linhas para revisão"
+
+#: git-gui.sh:3393
+msgid "Unstage Line From Commit"
+msgstr "Desmarcar linha para revisão"
+
+#: git-gui.sh:3396
+msgid "Stage Hunk For Commit"
+msgstr "Marcar trecho para revisão"
+
+#: git-gui.sh:3398
+msgid "Stage Lines For Commit"
+msgstr "Marcar linhas para revisão"
+
+#: git-gui.sh:3400
+msgid "Stage Line For Commit"
+msgstr "Marcar linha para revisão"
+
+#: git-gui.sh:3424
+msgid "Initializing..."
+msgstr "Iniciando..."
+
+#: git-gui.sh:3541
+#, tcl-format
+msgid ""
+"Possible environment issues exist.\n"
+"\n"
+"The following environment variables are probably\n"
+"going to be ignored by any Git subprocess run\n"
+"by %s:\n"
+"\n"
+msgstr ""
+"Possíveis problemas com as variáveis de ambiente.\n"
+"\n"
+"As seguintes variáveis de ambiente provavelmente serão\n"
+"ignoradas por qualquer sub-processo do Git executado por\n"
+"%s:\n"
+
+#: git-gui.sh:3570
+msgid ""
+"\n"
+"This is due to a known issue with the\n"
+"Tcl binary distributed by Cygwin."
+msgstr ""
+"\n"
+"Isto se deve a um problema conhecido com os binários da Tcl \n"
+"distribuídos com o Cygwin"
+
+#: git-gui.sh:3575
+#, tcl-format
+msgid ""
+"\n"
+"\n"
+"A good replacement for %s\n"
+"is placing values for the user.name and\n"
+"user.email settings into your personal\n"
+"~/.gitconfig file.\n"
+msgstr ""
+"\n"
+"\n"
+"Uma boa alternativa para %s\n"
+"é colocar os valores para o nome de usuário e e-mail\n"
+"no seu arquivo \"~/.gitconfig\"\n"
+
+#: lib/about.tcl:26
+msgid "git-gui - a graphical user interface for Git."
+msgstr "git-gui - uma interface gráfica para o Git"
+
+#: lib/blame.tcl:72
+msgid "File Viewer"
+msgstr "Visualizador de arquivos"
+
+#: lib/blame.tcl:78
+msgid "Commit:"
+msgstr "Revisão:"
+
+#: lib/blame.tcl:271
+msgid "Copy Commit"
+msgstr "Copiar revisão"
+
+#: lib/blame.tcl:275
+msgid "Find Text..."
+msgstr "Procurar texto..."
+
+#: lib/blame.tcl:284
+msgid "Do Full Copy Detection"
+msgstr "Executar detecção completa de cópias"
+
+#: lib/blame.tcl:288
+msgid "Show History Context"
+msgstr "Mostrar contexto do histórico"
+
+#: lib/blame.tcl:291
+msgid "Blame Parent Commit"
+msgstr "Anotar revisão anterior"
+
+#: lib/blame.tcl:450
+#, tcl-format
+msgid "Reading %s..."
+msgstr "Lendo %s..."
+
+#: lib/blame.tcl:557
+msgid "Loading copy/move tracking annotations..."
+msgstr "Carregando anotações de cópia/movimentação..."
+
+#: lib/blame.tcl:577
+msgid "lines annotated"
+msgstr "linhas anotadas"
+
+#: lib/blame.tcl:769
+msgid "Loading original location annotations..."
+msgstr "Carregando anotações originais..."
+
+#: lib/blame.tcl:772
+msgid "Annotation complete."
+msgstr "Anotação completa."
+
+#: lib/blame.tcl:802
+msgid "Busy"
+msgstr "Ocupado"
+
+#: lib/blame.tcl:803
+msgid "Annotation process is already running."
+msgstr "O processo de anotação já está em execução"
+
+#: lib/blame.tcl:842
+msgid "Running thorough copy detection..."
+msgstr "Executando detecção de cópia..."
+
+#: lib/blame.tcl:910
+msgid "Loading annotation..."
+msgstr "Carregando anotações..."
+
+#: lib/blame.tcl:963
+msgid "Author:"
+msgstr "Autor:"
+
+#: lib/blame.tcl:967
+msgid "Committer:"
+msgstr "Revisor:"
+
+#: lib/blame.tcl:972
+msgid "Original File:"
+msgstr "Arquivo original:"
+
+#: lib/blame.tcl:1020
+msgid "Cannot find HEAD commit:"
+msgstr "Impossível encontrar revisão HEAD:"
+
+#: lib/blame.tcl:1075
+msgid "Cannot find parent commit:"
+msgstr "Impossível encontrar revisão anterior:"
+
+#: lib/blame.tcl:1090
+msgid "Unable to display parent"
+msgstr "Impossível exibir revisão anterior"
+
+#: lib/blame.tcl:1091 lib/diff.tcl:320
+msgid "Error loading diff:"
+msgstr "Erro ao carregar as diferenças:"
+
+#: lib/blame.tcl:1231
+msgid "Originally By:"
+msgstr "Originalmente por:"
+
+#: lib/blame.tcl:1237
+msgid "In File:"
+msgstr "No arquivo:"
+
+#: lib/blame.tcl:1242
+msgid "Copied Or Moved Here By:"
+msgstr "Copiado ou movido para cá por:"
+
+#: lib/branch_checkout.tcl:14 lib/branch_checkout.tcl:19
+msgid "Checkout Branch"
+msgstr "Efetuar checkout do ramo"
+
+#: lib/branch_checkout.tcl:23
+msgid "Checkout"
+msgstr "Checkout"
+
+#: lib/branch_checkout.tcl:27 lib/branch_create.tcl:35
+#: lib/branch_delete.tcl:32 lib/branch_rename.tcl:30 lib/browser.tcl:282
+#: lib/checkout_op.tcl:579 lib/choose_font.tcl:43 lib/merge.tcl:172
+#: lib/option.tcl:125 lib/remote_add.tcl:32 lib/remote_branch_delete.tcl:42
+#: lib/tools_dlg.tcl:40 lib/tools_dlg.tcl:204 lib/tools_dlg.tcl:352
+#: lib/transport.tcl:108
+msgid "Cancel"
+msgstr "Cancelar"
+
+#: lib/branch_checkout.tcl:32 lib/browser.tcl:287 lib/tools_dlg.tcl:328
+msgid "Revision"
+msgstr "Revisão"
+
+#: lib/branch_checkout.tcl:36 lib/branch_create.tcl:69 lib/option.tcl:280
+msgid "Options"
+msgstr "Opções"
+
+#: lib/branch_checkout.tcl:39 lib/branch_create.tcl:92
+msgid "Fetch Tracking Branch"
+msgstr "Obter ramo de rastreamento"
+
+#: lib/branch_checkout.tcl:44
+msgid "Detach From Local Branch"
+msgstr "Separar do ramo local"
+
+#: lib/branch_create.tcl:22
+msgid "Create Branch"
+msgstr "Criar ramo"
+
+#: lib/branch_create.tcl:27
+msgid "Create New Branch"
+msgstr "Criar novo ramo"
+
+#: lib/branch_create.tcl:31 lib/choose_repository.tcl:381
+msgid "Create"
+msgstr "Criar"
+
+#: lib/branch_create.tcl:40
+msgid "Branch Name"
+msgstr "Nome do ramo"
+
+#: lib/branch_create.tcl:43 lib/remote_add.tcl:39 lib/tools_dlg.tcl:50
+msgid "Name:"
+msgstr "Nome:"
+
+#: lib/branch_create.tcl:58
+msgid "Match Tracking Branch Name"
+msgstr "Coincidir nome do ramo de rastreamento"
+
+#: lib/branch_create.tcl:66
+msgid "Starting Revision"
+msgstr "Revisão inicial"
+
+#: lib/branch_create.tcl:72
+msgid "Update Existing Branch:"
+msgstr "Atualizar ramo existente:"
+
+#: lib/branch_create.tcl:75
+msgid "No"
+msgstr "Não"
+
+#: lib/branch_create.tcl:80
+msgid "Fast Forward Only"
+msgstr "Somente se for um avanço rápido"
+
+#: lib/branch_create.tcl:85 lib/checkout_op.tcl:571
+msgid "Reset"
+msgstr "Redefinir"
+
+#: lib/branch_create.tcl:97
+msgid "Checkout After Creation"
+msgstr "Efetuar checkout após a criação"
+
+#: lib/branch_create.tcl:131
+msgid "Please select a tracking branch."
+msgstr "Selecione um ramo de rastreamento."
+
+#: lib/branch_create.tcl:140
+#, tcl-format
+msgid "Tracking branch %s is not a branch in the remote repository."
+msgstr "O ramo de rastreamento %s não é um ramo do repositório remoto."
+
+#: lib/branch_create.tcl:153 lib/branch_rename.tcl:86
+msgid "Please supply a branch name."
+msgstr "Indique um nome para o ramo."
+
+#: lib/branch_create.tcl:164 lib/branch_rename.tcl:106
+#, tcl-format
+msgid "'%s' is not an acceptable branch name."
+msgstr "\"%s\" não é um nome de ramo válido"
+
+#: lib/branch_delete.tcl:15
+msgid "Delete Branch"
+msgstr "Apagar ramo"
+
+#: lib/branch_delete.tcl:20
+msgid "Delete Local Branch"
+msgstr "Apagar ramo local"
+
+#: lib/branch_delete.tcl:37
+msgid "Local Branches"
+msgstr "Ramos locais"
+
+#: lib/branch_delete.tcl:52
+msgid "Delete Only If Merged Into"
+msgstr "Apagar somente se mesclado em"
+
+#: lib/branch_delete.tcl:54 lib/remote_branch_delete.tcl:119
+msgid "Always (Do not perform merge checks)"
+msgstr "Forçar exclusão (não verificar se o ramo foi mesclado)"
+
+#: lib/branch_delete.tcl:103
+#, tcl-format
+msgid "The following branches are not completely merged into %s:"
+msgstr "Os ramos seguintes não foram completamente mesclados em %s:"
+
+#: lib/branch_delete.tcl:115 lib/remote_branch_delete.tcl:217
+msgid ""
+"Recovering deleted branches is difficult.\n"
+"\n"
+"Delete the selected branches?"
+msgstr ""
+"Recuperar ramos apagados é difícil.\n"
+"\n"
+"Apagar os ramos selecionados?"
+
+#: lib/branch_delete.tcl:141
+#, tcl-format
+msgid ""
+"Failed to delete branches:\n"
+"%s"
+msgstr ""
+"Erro ao apagar ramos:\n"
+"%s"
+
+#: lib/branch_rename.tcl:14 lib/branch_rename.tcl:22
+msgid "Rename Branch"
+msgstr "Renomear ramo"
+
+#: lib/branch_rename.tcl:26
+msgid "Rename"
+msgstr "Renomear"
+
+#: lib/branch_rename.tcl:36
+msgid "Branch:"
+msgstr "Ramo:"
+
+#: lib/branch_rename.tcl:39
+msgid "New Name:"
+msgstr "Novo nome:"
+
+#: lib/branch_rename.tcl:75
+msgid "Please select a branch to rename."
+msgstr "Selecione um ramo para renomear."
+
+#: lib/branch_rename.tcl:96 lib/checkout_op.tcl:202
+#, tcl-format
+msgid "Branch '%s' already exists."
+msgstr "O ramo \"%s\" já existe."
+
+#: lib/branch_rename.tcl:117
+#, tcl-format
+msgid "Failed to rename '%s'."
+msgstr "Erro ao renomear \"%s\"."
+
+#: lib/browser.tcl:17
+msgid "Starting..."
+msgstr "Inciando..."
+
+#: lib/browser.tcl:26
+msgid "File Browser"
+msgstr "Navegador de arquivos"
+
+#: lib/browser.tcl:126 lib/browser.tcl:143
+#, tcl-format
+msgid "Loading %s..."
+msgstr "Carregando %s..."
+
+#: lib/browser.tcl:187
+msgid "[Up To Parent]"
+msgstr "[Subir]"
+
+#: lib/browser.tcl:267 lib/browser.tcl:273
+msgid "Browse Branch Files"
+msgstr "Explorar arquivos do ramo"
+
+#: lib/browser.tcl:278 lib/choose_repository.tcl:398
+#: lib/choose_repository.tcl:486 lib/choose_repository.tcl:497
+#: lib/choose_repository.tcl:1028
+msgid "Browse"
+msgstr "Explorar"
+
+#: lib/checkout_op.tcl:85
+#, tcl-format
+msgid "Fetching %s from %s"
+msgstr "Obtendo %s de %s"
+
+#: lib/checkout_op.tcl:133
+#, tcl-format
+msgid "fatal: Cannot resolve %s"
+msgstr "Erro fatal: impossível resolver %s"
+
+#: lib/checkout_op.tcl:146 lib/console.tcl:81 lib/database.tcl:31
+#: lib/sshkey.tcl:53
+msgid "Close"
+msgstr "Fechar"
+
+#: lib/checkout_op.tcl:175
+#, tcl-format
+msgid "Branch '%s' does not exist."
+msgstr "O ramo \"%s\" não existe."
+
+#: lib/checkout_op.tcl:194
+#, tcl-format
+msgid "Failed to configure simplified git-pull for '%s'."
+msgstr "Erro ao configurar git-pull simplificado para \"%s\"."
+
+#: lib/checkout_op.tcl:229
+#, tcl-format
+msgid ""
+"Branch '%s' already exists.\n"
+"\n"
+"It cannot fast-forward to %s.\n"
+"A merge is required."
+msgstr ""
+"O ramo \"%s\" já existe.\n"
+"\n"
+"Não é possível avançá-lo para %s.\n"
+"É preciso mesclar."
+
+#: lib/checkout_op.tcl:243
+#, tcl-format
+msgid "Merge strategy '%s' not supported."
+msgstr "Estratégia de mesclagem \"%s\" não suportada."
+
+#: lib/checkout_op.tcl:262
+#, tcl-format
+msgid "Failed to update '%s'."
+msgstr "Erro ao atualizar \"%s\"."
+
+#: lib/checkout_op.tcl:274
+msgid "Staging area (index) is already locked."
+msgstr "A área de marcação (staging area, index) já está bloqueada."
+
+#: lib/checkout_op.tcl:289
+msgid ""
+"Last scanned state does not match repository state.\n"
+"\n"
+"Another Git program has modified this repository since the last scan.  A "
+"rescan must be performed before the current branch can be changed.\n"
+"\n"
+"The rescan will be automatically started now.\n"
+msgstr ""
+"O último estado lido não confere com o estado atual.\n"
+"\n"
+"Outro programa do Git modificou o repositório desde a última leitura. Uma "
+"atualização deve ser executada antes de alterar o ramo atual.\n"
+"\n"
+"A atualização começará automaticamente agora.\n"
+
+#: lib/checkout_op.tcl:345
+#, tcl-format
+msgid "Updating working directory to '%s'..."
+msgstr "Atualizando diretório de trabalho para \"%s\"..."
+
+#: lib/checkout_op.tcl:346
+msgid "files checked out"
+msgstr "arquivos retirados"
+
+#: lib/checkout_op.tcl:376
+#, tcl-format
+msgid "Aborted checkout of '%s' (file level merging is required)."
+msgstr "Checkout de \"%s\" abortado (é preciso mesclar alguns arquivos)"
+
+#: lib/checkout_op.tcl:377
+msgid "File level merge required."
+msgstr "Mesclagem de arquivos necessária."
+
+#: lib/checkout_op.tcl:381
+#, tcl-format
+msgid "Staying on branch '%s'."
+msgstr "Permanecendo no ramo \"%s\"."
+
+#: lib/checkout_op.tcl:452
+msgid ""
+"You are no longer on a local branch.\n"
+"\n"
+"If you wanted to be on a branch, create one now starting from 'This Detached "
+"Checkout'."
+msgstr ""
+"Você não está mais em um ramo local\n"
+"\n"
+"Se você deseja um ramo, crie um agora a partir deste checkout."
+
+#: lib/checkout_op.tcl:503 lib/checkout_op.tcl:507
+#, tcl-format
+msgid "Checked out '%s'."
+msgstr "Checkout de \"%s\" concluído."
+
+#: lib/checkout_op.tcl:535
+#, tcl-format
+msgid "Resetting '%s' to '%s' will lose the following commits:"
+msgstr "Redefinir \"%s\" para \"%s\" provocará a perda das seguintes revisões:"
+
+#: lib/checkout_op.tcl:557
+msgid "Recovering lost commits may not be easy."
+msgstr "Recuperar revisões perdidas pode não ser fácil."
+
+#: lib/checkout_op.tcl:562
+#, tcl-format
+msgid "Reset '%s'?"
+msgstr "Redefinir \"%s\"?"
+
+#: lib/checkout_op.tcl:567 lib/merge.tcl:164 lib/tools_dlg.tcl:343
+msgid "Visualize"
+msgstr "Visualizar"
+
+#: lib/checkout_op.tcl:635
+#, tcl-format
+msgid ""
+"Failed to set current branch.\n"
+"\n"
+"This working directory is only partially switched.  We successfully updated "
+"your files, but failed to update an internal Git file.\n"
+"\n"
+"This should not have occurred.  %s will now close and give up."
+msgstr ""
+"Erro ao definir o ramo atual.\n"
+"\n"
+"Este diretório de trabalho está incompleto. Foi possível atualizar seus "
+"arquivos, mas houve uma falha ao atualizar os arquivos internos do Git.\n"
+"\n"
+"Isto não deveria ter acontecido, %s terminará agora."
+
+#: lib/choose_font.tcl:39
+msgid "Select"
+msgstr "Selecionar"
+
+#: lib/choose_font.tcl:53
+msgid "Font Family"
+msgstr "Tipo da fonte"
+
+#: lib/choose_font.tcl:74
+msgid "Font Size"
+msgstr "Tamanho da fonte"
+
+#: lib/choose_font.tcl:91
+msgid "Font Example"
+msgstr "Exemplo"
+
+#: lib/choose_font.tcl:103
+msgid ""
+"This is example text.\n"
+"If you like this text, it can be your font."
+msgstr ""
+"Este é um texto de exemplo.\n"
+"Se você gostar deste texto, esta pode ser sua fonte."
+
+#: lib/choose_repository.tcl:28
+msgid "Git Gui"
+msgstr "Git Gui"
+
+#: lib/choose_repository.tcl:87 lib/choose_repository.tcl:386
+msgid "Create New Repository"
+msgstr "Criar novo repositório"
+
+#: lib/choose_repository.tcl:93
+msgid "New..."
+msgstr "Novo..."
+
+#: lib/choose_repository.tcl:100 lib/choose_repository.tcl:471
+msgid "Clone Existing Repository"
+msgstr "Clonar repositório existente"
+
+#: lib/choose_repository.tcl:106
+msgid "Clone..."
+msgstr "Clonar..."
+
+#: lib/choose_repository.tcl:113 lib/choose_repository.tcl:1016
+msgid "Open Existing Repository"
+msgstr "Abrir repositório existente"
+
+#: lib/choose_repository.tcl:119
+msgid "Open..."
+msgstr "Abrir..."
+
+#: lib/choose_repository.tcl:132
+msgid "Recent Repositories"
+msgstr "Repositórios recentes"
+
+#: lib/choose_repository.tcl:138
+msgid "Open Recent Repository:"
+msgstr "Abrir repositório recente:"
+
+#: lib/choose_repository.tcl:306 lib/choose_repository.tcl:313
+#: lib/choose_repository.tcl:320
+#, tcl-format
+msgid "Failed to create repository %s:"
+msgstr "Erro ao criar repositório %s:"
+
+#: lib/choose_repository.tcl:391
+msgid "Directory:"
+msgstr "Diretório:"
+
+#: lib/choose_repository.tcl:423 lib/choose_repository.tcl:550
+#: lib/choose_repository.tcl:1052
+msgid "Git Repository"
+msgstr "Repositório Git"
+
+#: lib/choose_repository.tcl:448
+#, tcl-format
+msgid "Directory %s already exists."
+msgstr "O diretório %s já existe."
+
+#: lib/choose_repository.tcl:452
+#, tcl-format
+msgid "File %s already exists."
+msgstr "O arquivo %s já existe."
+
+#: lib/choose_repository.tcl:466
+msgid "Clone"
+msgstr "Clonar"
+
+#: lib/choose_repository.tcl:479
+msgid "Source Location:"
+msgstr "Origem:"
+
+#: lib/choose_repository.tcl:490
+msgid "Target Directory:"
+msgstr "Diretório de destino:"
+
+#: lib/choose_repository.tcl:502
+msgid "Clone Type:"
+msgstr "Tipo de clonagem:"
+
+#: lib/choose_repository.tcl:508
+msgid "Standard (Fast, Semi-Redundant, Hardlinks)"
+msgstr "Padrão (rápida, semi-redundante, com hardlinks)"
+
+#: lib/choose_repository.tcl:514
+msgid "Full Copy (Slower, Redundant Backup)"
+msgstr "Cópia completa (mais lenta, backup redundante)"
+
+#: lib/choose_repository.tcl:520
+msgid "Shared (Fastest, Not Recommended, No Backup)"
+msgstr "Compartilhada (A mais rápida, não recomendada, sem backup)"
+
+#: lib/choose_repository.tcl:556 lib/choose_repository.tcl:603
+#: lib/choose_repository.tcl:749 lib/choose_repository.tcl:819
+#: lib/choose_repository.tcl:1058 lib/choose_repository.tcl:1066
+#, tcl-format
+msgid "Not a Git repository: %s"
+msgstr "Este não é um repositório do Git: %s"
+
+#: lib/choose_repository.tcl:592
+msgid "Standard only available for local repository."
+msgstr "Clonagens padrões só são possíveis em repositórios locais."
+
+#: lib/choose_repository.tcl:596
+msgid "Shared only available for local repository."
+msgstr "Clonagens parciais só são possíveis em repositórios locais."
+
+#: lib/choose_repository.tcl:617
+#, tcl-format
+msgid "Location %s already exists."
+msgstr "O local %s já existe."
+
+#: lib/choose_repository.tcl:628
+msgid "Failed to configure origin"
+msgstr "Erro ao configurar origem"
+
+#: lib/choose_repository.tcl:640
+msgid "Counting objects"
+msgstr "Contando objetos"
+
+#: lib/choose_repository.tcl:641
+msgid "buckets"
+msgstr "buckets"
+
+#: lib/choose_repository.tcl:665
+#, tcl-format
+msgid "Unable to copy objects/info/alternates: %s"
+msgstr "Erro ao copiar objetos ou informações adicionais: %s"
+
+#: lib/choose_repository.tcl:701
+#, tcl-format
+msgid "Nothing to clone from %s."
+msgstr "Não há nada para clonar em %s."
+
+#: lib/choose_repository.tcl:703 lib/choose_repository.tcl:917
+#: lib/choose_repository.tcl:929
+msgid "The 'master' branch has not been initialized."
+msgstr "O ramo \"master\" não foi inicializado."
+
+#: lib/choose_repository.tcl:716
+msgid "Hardlinks are unavailable.  Falling back to copying."
+msgstr "Não foi possível criar hardlinks, usando cópias convencionais."
+
+#: lib/choose_repository.tcl:728
+#, tcl-format
+msgid "Cloning from %s"
+msgstr "Clonando de %s"
+
+#: lib/choose_repository.tcl:759
+msgid "Copying objects"
+msgstr "Copiando objetos"
+
+#: lib/choose_repository.tcl:760
+msgid "KiB"
+msgstr "KiB"
+
+#: lib/choose_repository.tcl:784
+#, tcl-format
+msgid "Unable to copy object: %s"
+msgstr "Não foi possível copiar o objeto: %s"
+
+#: lib/choose_repository.tcl:794
+msgid "Linking objects"
+msgstr "Ligando objetos"
+
+#: lib/choose_repository.tcl:795
+msgid "objects"
+msgstr "objetos"
+
+#: lib/choose_repository.tcl:803
+#, tcl-format
+msgid "Unable to hardlink object: %s"
+msgstr "Não foi possível ligar o objeto: %s"
+
+#: lib/choose_repository.tcl:858
+msgid "Cannot fetch branches and objects.  See console output for details."
+msgstr ""
+"Não foi possível receber ramos ou objetos. Veja a saída do console para "
+"detalhes."
+
+#: lib/choose_repository.tcl:869
+msgid "Cannot fetch tags.  See console output for details."
+msgstr ""
+"Não foi possível receber as etiquetas. Veja a saída do console para detalhes."
+
+#: lib/choose_repository.tcl:893
+msgid "Cannot determine HEAD.  See console output for details."
+msgstr ""
+"Não foi possível determinar a etiqueta HEAD. Veja a saída do console para "
+"detalhes."
+
+#: lib/choose_repository.tcl:902
+#, tcl-format
+msgid "Unable to cleanup %s"
+msgstr "Não foi possível limpar %s"
+
+#: lib/choose_repository.tcl:908
+msgid "Clone failed."
+msgstr "A clonagem falhou."
+
+#: lib/choose_repository.tcl:915
+msgid "No default branch obtained."
+msgstr "O ramo padrão não foi recebido."
+
+#: lib/choose_repository.tcl:926
+#, tcl-format
+msgid "Cannot resolve %s as a commit."
+msgstr "Não foi possível resolver %s como uma revisão."
+
+#: lib/choose_repository.tcl:938
+msgid "Creating working directory"
+msgstr "Criando diretório de trabalho."
+
+#: lib/choose_repository.tcl:939 lib/index.tcl:67 lib/index.tcl:130
+#: lib/index.tcl:198
+msgid "files"
+msgstr "arquivos"
+
+#: lib/choose_repository.tcl:968
+msgid "Initial file checkout failed."
+msgstr "Erro ao efetuar checkout inicial."
+
+#: lib/choose_repository.tcl:1011
+msgid "Open"
+msgstr "Abrir"
+
+#: lib/choose_repository.tcl:1021
+msgid "Repository:"
+msgstr "Repositório:"
+
+#: lib/choose_repository.tcl:1072
+#, tcl-format
+msgid "Failed to open repository %s:"
+msgstr "Erro ao abrir o repositório %s:"
+
+#: lib/choose_rev.tcl:53
+msgid "This Detached Checkout"
+msgstr "Este checkout"
+
+#: lib/choose_rev.tcl:60
+msgid "Revision Expression:"
+msgstr "Expressão de revisão:"
+
+#: lib/choose_rev.tcl:74
+msgid "Local Branch"
+msgstr "Ramo local"
+
+#: lib/choose_rev.tcl:79
+msgid "Tracking Branch"
+msgstr "Ramo de rastreamento"
+
+#: lib/choose_rev.tcl:84 lib/choose_rev.tcl:538
+msgid "Tag"
+msgstr "Etiqueta"
+
+#: lib/choose_rev.tcl:317
+#, tcl-format
+msgid "Invalid revision: %s"
+msgstr "Revisão inválida: %s"
+
+#: lib/choose_rev.tcl:338
+msgid "No revision selected."
+msgstr "Nenhuma revisão selecionada."
+
+#: lib/choose_rev.tcl:346
+msgid "Revision expression is empty."
+msgstr "A expressão de revisão está vazia."
+
+#: lib/choose_rev.tcl:531
+msgid "Updated"
+msgstr "Atualizado"
+
+#: lib/choose_rev.tcl:559
+msgid "URL"
+msgstr "URL"
+
+#: lib/commit.tcl:9
+msgid ""
+"There is nothing to amend.\n"
+"\n"
+"You are about to create the initial commit.  There is no commit before this "
+"to amend.\n"
+msgstr ""
+"Não há nada para corrigir.\n"
+"\n"
+"Você está prestes a criar uma revisão inicial. Não há revisão anterior para "
+"corrigir.\n"
+
+#: lib/commit.tcl:18
+msgid ""
+"Cannot amend while merging.\n"
+"\n"
+"You are currently in the middle of a merge that has not been fully "
+"completed.  You cannot amend the prior commit unless you first abort the "
+"current merge activity.\n"
+msgstr ""
+"Não é possível corrigir durante uma mesclagem.\n"
+"\n"
+"Você está em meio a uma operação de mesclagem que não foi completada. Não é "
+"possível corrigir a revisão anterior a menos que você aborte a mescla atual "
+"antes.\n"
+
+#: lib/commit.tcl:48
+msgid "Error loading commit data for amend:"
+msgstr "Erro ao carregar dados da revisão para corrigir:"
+
+#: lib/commit.tcl:75
+msgid "Unable to obtain your identity:"
+msgstr "Não foi possível obter a sua identidade:"
+
+#: lib/commit.tcl:80
+msgid "Invalid GIT_COMMITTER_IDENT:"
+msgstr "Variável \"GIT_COMMITTER_IDENT\" inválida:"
+
+#: lib/commit.tcl:129
+#, tcl-format
+msgid "warning: Tcl does not support encoding '%s'."
+msgstr "aviso: O Tcl não suporta a codificação \"%s\"."
+
+#: lib/commit.tcl:149
+msgid ""
+"Last scanned state does not match repository state.\n"
+"\n"
+"Another Git program has modified this repository since the last scan.  A "
+"rescan must be performed before another commit can be created.\n"
+"\n"
+"The rescan will be automatically started now.\n"
+msgstr ""
+"O último estado lido não confere com o estado atual.\n"
+"\n"
+"Outro programa do Git modificou o repositório desde a última leitura. Uma "
+"atualização deve ser executada antes de criar outra revisão.\n"
+"\n"
+"A atualização começará automaticamente agora.\n"
+
+#: lib/commit.tcl:172
+#, tcl-format
+msgid ""
+"Unmerged files cannot be committed.\n"
+"\n"
+"File %s has merge conflicts.  You must resolve them and stage the file "
+"before committing.\n"
+msgstr ""
+"Não é possível salvar revisões para arquivos não mesclados.\n"
+"\n"
+"O arquivo %s possui conflitos de mesclagem. Você deve resolvê-los e marcar o "
+"arquivo antes de salvar a revisão.\n"
+
+#: lib/commit.tcl:180
+#, tcl-format
+msgid ""
+"Unknown file state %s detected.\n"
+"\n"
+"File %s cannot be committed by this program.\n"
+msgstr ""
+"Estado desconhecido detectado para o arquivo %s.\n"
+"\n"
+"Este programa não pode salvar uma revisão para o arquivo %s.\n"
+
+#: lib/commit.tcl:188
+msgid ""
+"No changes to commit.\n"
+"\n"
+"You must stage at least 1 file before you can commit.\n"
+msgstr ""
+"Não há mudanças para salvar.\n"
+"\n"
+"Você deve marcar ao menos um arquivo antes de salvar a revisão.\n"
+
+#: lib/commit.tcl:203
+msgid ""
+"Please supply a commit message.\n"
+"\n"
+"A good commit message has the following format:\n"
+"\n"
+"- First line: Describe in one sentence what you did.\n"
+"- Second line: Blank\n"
+"- Remaining lines: Describe why this change is good.\n"
+msgstr ""
+"Por favor, indique uma descrição para a revisão.\n"
+"\n"
+"Uma boa descrição tem o seguinte formato:\n"
+"\n"
+"- Primeira linha: descreve, em uma única frase, o que você fez.\n"
+"- Segunda linha: em branco.\n"
+"- Demais linhas: Descreve detalhadamente a revisão.\n"
+
+#: lib/commit.tcl:234
+msgid "Calling pre-commit hook..."
+msgstr "Executando script \"pre-commit\"..."
+
+#: lib/commit.tcl:249
+msgid "Commit declined by pre-commit hook."
+msgstr "A revisão foi bloqueada pelo script \"pre-commit\"."
+
+#: lib/commit.tcl:272
+msgid "Calling commit-msg hook..."
+msgstr "Executando script \"commit-msg\"..."
+
+#: lib/commit.tcl:287
+msgid "Commit declined by commit-msg hook."
+msgstr "Revisão bloqueada pelo script \"commit-msg\"."
+
+#: lib/commit.tcl:300
+msgid "Committing changes..."
+msgstr "Salvando revisão..."
+
+#: lib/commit.tcl:316
+msgid "write-tree failed:"
+msgstr "write-tree falhou:"
+
+#: lib/commit.tcl:317 lib/commit.tcl:361 lib/commit.tcl:382
+msgid "Commit failed."
+msgstr "A revisão falhou."
+
+#: lib/commit.tcl:334
+#, tcl-format
+msgid "Commit %s appears to be corrupt"
+msgstr "A revisão %s parece estar corrompida."
+
+#: lib/commit.tcl:339
+msgid ""
+"No changes to commit.\n"
+"\n"
+"No files were modified by this commit and it was not a merge commit.\n"
+"\n"
+"A rescan will be automatically started now.\n"
+msgstr ""
+"Não há alterações para salvar.\n"
+"\n"
+"Nenhum arquivo foi modificado e esta não é uma revisão de mesclagem.\n"
+"\n"
+"Uma atualização será executada automaticamente agora.\n"
+
+#: lib/commit.tcl:346
+msgid "No changes to commit."
+msgstr "Não há alterações para salvar."
+
+#: lib/commit.tcl:360
+msgid "commit-tree failed:"
+msgstr "commit-tree falhou:"
+
+#: lib/commit.tcl:381
+msgid "update-ref failed:"
+msgstr "update-ref falhou:"
+
+#: lib/commit.tcl:469
+#, tcl-format
+msgid "Created commit %s: %s"
+msgstr "Revisão %s criada: %s"
+
+#: lib/console.tcl:59
+msgid "Working... please wait..."
+msgstr "Trabalhando... aguarde..."
+
+#: lib/console.tcl:186
+msgid "Success"
+msgstr "Sucesso"
+
+#: lib/console.tcl:200
+msgid "Error: Command Failed"
+msgstr "Erro: o comando falhou"
+
+#: lib/database.tcl:43
+msgid "Number of loose objects"
+msgstr "Número de objetos soltos"
+
+#: lib/database.tcl:44
+msgid "Disk space used by loose objects"
+msgstr "Espaço ocupado pelos objetos soltos"
+
+#: lib/database.tcl:45
+msgid "Number of packed objects"
+msgstr "Número de objetos compactados"
+
+#: lib/database.tcl:46
+msgid "Number of packs"
+msgstr "Número de pacotes"
+
+#: lib/database.tcl:47
+msgid "Disk space used by packed objects"
+msgstr "Espaço ocupado pelos objetos compactados"
+
+#: lib/database.tcl:48
+msgid "Packed objects waiting for pruning"
+msgstr "Objetos compactados aguardando eliminação"
+
+#: lib/database.tcl:49
+msgid "Garbage files"
+msgstr "Arquivos de lixo"
+
+#: lib/database.tcl:72
+msgid "Compressing the object database"
+msgstr "Compactando banco de dados de objetos"
+
+#: lib/database.tcl:83
+msgid "Verifying the object database with fsck-objects"
+msgstr "Verificando banco de dados de objetos com fsck-objects"
+
+#: lib/database.tcl:107
+#, tcl-format
+msgid ""
+"This repository currently has approximately %i loose objects.\n"
+"\n"
+"To maintain optimal performance it is strongly recommended that you compress "
+"the database.\n"
+"\n"
+"Compress the database now?"
+msgstr ""
+"Este repositório possui aproximadamente %i objetos soltos.\n"
+"\n"
+"Para manter o desempenho ótimo é altamente recomendado que você compacte o "
+"banco de dados.\n"
+"\n"
+"Compactar o banco de dados agora?"
+
+#: lib/date.tcl:25
+#, tcl-format
+msgid "Invalid date from Git: %s"
+msgstr "Data inválida recebida do Git: %s"
+
+#: lib/diff.tcl:64
+#, tcl-format
+msgid ""
+"No differences detected.\n"
+"\n"
+"%s has no changes.\n"
+"\n"
+"The modification date of this file was updated by another application, but "
+"the content within the file was not changed.\n"
+"\n"
+"A rescan will be automatically started to find other files which may have "
+"the same state."
+msgstr ""
+"Nenhuma diferença foi detectada.\n"
+"\n"
+"%s não possui mudanças.\n"
+"\n"
+"A data de modificação deste arquivo foi atualizada por outro aplicativo, mas "
+"o conteúdo do arquivo não foi alterado.\n"
+"\n"
+"Uma atualização ser executada para encontrar outros arquivos que possam ter "
+"o mesmo estado."
+
+#: lib/diff.tcl:104
+#, tcl-format
+msgid "Loading diff of %s..."
+msgstr "Carregando diferenças de %s..."
+
+#: lib/diff.tcl:125
+msgid ""
+"LOCAL: deleted\n"
+"REMOTE:\n"
+msgstr ""
+"Local: apagado\n"
+"Remoto:\n"
+
+#: lib/diff.tcl:130
+msgid ""
+"REMOTE: deleted\n"
+"LOCAL:\n"
+msgstr ""
+"Remoto: apagado\n"
+"Local:\n"
+
+#: lib/diff.tcl:137
+msgid "LOCAL:\n"
+msgstr "Local:\n"
+
+#: lib/diff.tcl:140
+msgid "REMOTE:\n"
+msgstr "Remoto:\n"
+
+#: lib/diff.tcl:202 lib/diff.tcl:319
+#, tcl-format
+msgid "Unable to display %s"
+msgstr "Impossível exibir %s"
+
+#: lib/diff.tcl:203
+msgid "Error loading file:"
+msgstr "Erro ao carregar o arquivo:"
+
+#: lib/diff.tcl:210
+msgid "Git Repository (subproject)"
+msgstr "Repositório Git (sub-projeto)"
+
+#: lib/diff.tcl:222
+msgid "* Binary file (not showing content)."
+msgstr "* Arquivo binário (conteúdo não exibido)."
+
+#: lib/diff.tcl:227
+#, tcl-format
+msgid ""
+"* Untracked file is %d bytes.\n"
+"* Showing only first %d bytes.\n"
+msgstr ""
+"* O arquivo não rastreado possui %d bytes.\n"
+"* Exibindo apenas os primeiros %d bytes.\n"
+
+#: lib/diff.tcl:233
+#, tcl-format
+msgid ""
+"\n"
+"* Untracked file clipped here by %s.\n"
+"* To see the entire file, use an external editor.\n"
+msgstr ""
+"\n"
+"* O arquivo não rastreado foi cortado aqui por %s.\n"
+"* Para ver o arquivo completo, use um editor externo.\n"
+
+#: lib/diff.tcl:482
+msgid "Failed to unstage selected hunk."
+msgstr "Erro ao desmarcar o trecho selecionado."
+
+#: lib/diff.tcl:489
+msgid "Failed to stage selected hunk."
+msgstr "Erro ao marcar o trecho selecionado."
+
+#: lib/diff.tcl:568
+msgid "Failed to unstage selected line."
+msgstr "Erro ao desmarcar a linha selecionada."
+
+#: lib/diff.tcl:576
+msgid "Failed to stage selected line."
+msgstr "Erro ao marcar a linha selecionada."
+
+#: lib/encoding.tcl:443
+msgid "Default"
+msgstr "Padrão"
+
+#: lib/encoding.tcl:448
+#, tcl-format
+msgid "System (%s)"
+msgstr "Sistema (%s)"
+
+#: lib/encoding.tcl:459 lib/encoding.tcl:465
+msgid "Other"
+msgstr "Outro"
+
+#: lib/error.tcl:20 lib/error.tcl:114
+msgid "error"
+msgstr "Erro"
+
+#: lib/error.tcl:36
+msgid "warning"
+msgstr "aviso"
+
+#: lib/error.tcl:94
+msgid "You must correct the above errors before committing."
+msgstr "Você precisa corrigir os erros acima antes de salvar a revisão."
+
+#: lib/index.tcl:6
+msgid "Unable to unlock the index."
+msgstr "Impossível desbloquear o índice."
+
+#: lib/index.tcl:15
+msgid "Index Error"
+msgstr "Erro no índice"
+
+#: lib/index.tcl:17
+msgid ""
+"Updating the Git index failed.  A rescan will be automatically started to "
+"resynchronize git-gui."
+msgstr ""
+"A atualização do índice do Git falhou. Uma atualização será executada "
+"automaticamente para ressincronizar o Git GUI"
+
+#: lib/index.tcl:28
+msgid "Continue"
+msgstr "Continuar"
+
+#: lib/index.tcl:31
+msgid "Unlock Index"
+msgstr "Desbloquear índice"
+
+#: lib/index.tcl:289
+#, tcl-format
+msgid "Unstaging %s from commit"
+msgstr "Desmarcando %s para revisão"
+
+#: lib/index.tcl:328
+msgid "Ready to commit."
+msgstr "Pronto para salvar a revisão."
+
+#: lib/index.tcl:341
+#, tcl-format
+msgid "Adding %s"
+msgstr "Adicionando %s"
+
+#: lib/index.tcl:398
+#, tcl-format
+msgid "Revert changes in file %s?"
+msgstr "Reverter as alterações no arquivo %s?"
+
+#: lib/index.tcl:400
+#, tcl-format
+msgid "Revert changes in these %i files?"
+msgstr "Reverter as alterações nestes %i arquivos?"
+
+#: lib/index.tcl:408
+msgid "Any unstaged changes will be permanently lost by the revert."
+msgstr ""
+"Qualquer alteração não marcada será permanentemente perdida na reversão."
+
+#: lib/index.tcl:411
+msgid "Do Nothing"
+msgstr "Não fazer nada"
+
+#: lib/index.tcl:429
+msgid "Reverting selected files"
+msgstr "Revertendo os arquivos selecionados"
+
+#: lib/index.tcl:433
+#, tcl-format
+msgid "Reverting %s"
+msgstr "Revertendo %s"
+
+#: lib/merge.tcl:13
+msgid ""
+"Cannot merge while amending.\n"
+"\n"
+"You must finish amending this commit before starting any type of merge.\n"
+msgstr ""
+"Não é possível mesclar durante uma correção.\n"
+"\n"
+"Você deve concluir a correção antes de começar qualquer mesclagem.\n"
+
+#: lib/merge.tcl:27
+msgid ""
+"Last scanned state does not match repository state.\n"
+"\n"
+"Another Git program has modified this repository since the last scan.  A "
+"rescan must be performed before a merge can be performed.\n"
+"\n"
+"The rescan will be automatically started now.\n"
+msgstr ""
+"O último estado lido não confere com o estado atual.\n"
+"\n"
+"Outro programa do Git modificou o repositório desde a última leitura. Uma "
+"atualização deve ser executada antes de efetuar uma mesclagem.\n"
+"\n"
+"A atualização começará automaticamente agora.\n"
+
+#: lib/merge.tcl:45
+#, tcl-format
+msgid ""
+"You are in the middle of a conflicted merge.\n"
+"\n"
+"File %s has merge conflicts.\n"
+"\n"
+"You must resolve them, stage the file, and commit to complete the current "
+"merge.  Only then can you begin another merge.\n"
+msgstr ""
+"Há uma mesclagem com conflitos em progresso.\n"
+"\n"
+"O arquivo %s possui conflitos de mesclagem.\n"
+"\n"
+"Você deve resolvê-los, marcar o arquivo e salvar a revisão para completar a "
+"mesclagem atual. Só então você poderá começar outra.\n"
+
+#: lib/merge.tcl:55
+#, tcl-format
+msgid ""
+"You are in the middle of a change.\n"
+"\n"
+"File %s is modified.\n"
+"\n"
+"You should complete the current commit before starting a merge.  Doing so "
+"will help you abort a failed merge, should the need arise.\n"
+msgstr ""
+"Você está em meio a uma mudança.\n"
+"\n"
+"O arquivo %s foi modificado.\n"
+"\n"
+"Você deve completar e salvar a revisão atual antes de começar uma mesclagem. "
+"Ao fazê-lo, você poderá abortar a mesclagem caso haja algum erro.\n"
+
+#: lib/merge.tcl:107
+#, tcl-format
+msgid "%s of %s"
+msgstr "%s de %s"
+
+#: lib/merge.tcl:120
+#, tcl-format
+msgid "Merging %s and %s..."
+msgstr "Mesclando %s e %s..."
+
+#: lib/merge.tcl:131
+msgid "Merge completed successfully."
+msgstr "Mesclagem completada com sucesso."
+
+#: lib/merge.tcl:133
+msgid "Merge failed.  Conflict resolution is required."
+msgstr "A mesclagem falhou. É necessário resolver conflitos."
+
+#: lib/merge.tcl:158
+#, tcl-format
+msgid "Merge Into %s"
+msgstr "Mesclar em %s"
+
+#: lib/merge.tcl:177
+msgid "Revision To Merge"
+msgstr "Revisão para mesclar"
+
+#: lib/merge.tcl:212
+msgid ""
+"Cannot abort while amending.\n"
+"\n"
+"You must finish amending this commit.\n"
+msgstr ""
+"Não é possível abortar durante uma correção.\n"
+"\n"
+"Você precisa finalizar a correção desta revisão.\n"
+
+#: lib/merge.tcl:222
+msgid ""
+"Abort merge?\n"
+"\n"
+"Aborting the current merge will cause *ALL* uncommitted changes to be lost.\n"
+"\n"
+"Continue with aborting the current merge?"
+msgstr ""
+"Abortar mesclagem?\n"
+"\n"
+"Abortar a mesclagem atual implicará na perda de *TODAS* as mudanças não "
+"salvas.\n"
+"\n"
+"Abortar a mesclagem atual?"
+
+#: lib/merge.tcl:228
+msgid ""
+"Reset changes?\n"
+"\n"
+"Resetting the changes will cause *ALL* uncommitted changes to be lost.\n"
+"\n"
+"Continue with resetting the current changes?"
+msgstr ""
+"Descartar as mudanças?\n"
+"\n"
+"Ao fazê-lo, *TODAS* as alterações não salvas serão perdidas.\n"
+"\n"
+"Continuar e descartar as mudanças atuais?"
+
+#: lib/merge.tcl:239
+msgid "Aborting"
+msgstr "Abortando"
+
+#: lib/merge.tcl:239
+msgid "files reset"
+msgstr "arquivos redefindos"
+
+#: lib/merge.tcl:267
+msgid "Abort failed."
+msgstr "A tentativa de abortar a operação falhou"
+
+#: lib/merge.tcl:269
+msgid "Abort completed.  Ready."
+msgstr "Operação abortada com sucesso. Pronto."
+
+#: lib/mergetool.tcl:8
+msgid "Force resolution to the base version?"
+msgstr "Forçar a resolução para a versão base?"
+
+#: lib/mergetool.tcl:9
+msgid "Force resolution to this branch?"
+msgstr "Forçar resolução para este ramo?"
+
+#: lib/mergetool.tcl:10
+msgid "Force resolution to the other branch?"
+msgstr "Forçar resolução para o outro ramo?"
+
+#: lib/mergetool.tcl:14
+#, tcl-format
+msgid ""
+"Note that the diff shows only conflicting changes.\n"
+"\n"
+"%s will be overwritten.\n"
+"\n"
+"This operation can be undone only by restarting the merge."
+msgstr ""
+"Note que o diff mostra apenas as mudanças conflitantes.\n"
+"\n"
+"%s será sobrescrito.\n"
+"\n"
+"Caso necessário, será preciso reiniciar a mesclagem para desfazer esta "
+"operação."
+
+#: lib/mergetool.tcl:45
+#, tcl-format
+msgid "File %s seems to have unresolved conflicts, still stage?"
+msgstr "O arquivo %s parece ter conflitos não resolvidos. Marcar mesmo assim?"
+
+#: lib/mergetool.tcl:60
+#, tcl-format
+msgid "Adding resolution for %s"
+msgstr "Adicionando resolução para %s"
+
+#: lib/mergetool.tcl:141
+msgid "Cannot resolve deletion or link conflicts using a tool"
+msgstr ""
+"Impossível resolver conflitos envolvendo exclusão ou links de arquivos com "
+"esta ferramenta."
+
+#: lib/mergetool.tcl:146
+msgid "Conflict file does not exist"
+msgstr "O arquivo conflitante não existe"
+
+#: lib/mergetool.tcl:264
+#, tcl-format
+msgid "Not a GUI merge tool: '%s'"
+msgstr "Não é uma ferramenta de mesclagem gráfica: \"%s\""
+
+#: lib/mergetool.tcl:268
+#, tcl-format
+msgid "Unsupported merge tool '%s'"
+msgstr "Ferramenta de mesclagem não suportada \"%s\""
+
+#: lib/mergetool.tcl:303
+msgid "Merge tool is already running, terminate it?"
+msgstr "A ferramenta de mesclagem já está em execução. Finalizar?"
+
+#: lib/mergetool.tcl:323
+#, tcl-format
+msgid ""
+"Error retrieving versions:\n"
+"%s"
+msgstr ""
+"Erro ao obter as versões:\n"
+"%s"
+
+#: lib/mergetool.tcl:343
+#, tcl-format
+msgid ""
+"Could not start the merge tool:\n"
+"\n"
+"%s"
+msgstr ""
+"Não foi possível iniciar a ferramenta de mesclagem:\n"
+"\n"
+"%s"
+
+#: lib/mergetool.tcl:347
+msgid "Running merge tool..."
+msgstr "Executando ferramenta de mesclagem..."
+
+#: lib/mergetool.tcl:375 lib/mergetool.tcl:383
+msgid "Merge tool failed."
+msgstr "Ferramenta de mesclagem falhou."
+
+#: lib/option.tcl:11
+#, tcl-format
+msgid "Invalid global encoding '%s'"
+msgstr "Codificação global inválida \"%s\""
+
+#: lib/option.tcl:19
+#, tcl-format
+msgid "Invalid repo encoding '%s'"
+msgstr "Codificação do repositório inválida \"%s\""
+
+#: lib/option.tcl:117
+msgid "Restore Defaults"
+msgstr "Restaurar padrões"
+
+#: lib/option.tcl:121
+msgid "Save"
+msgstr "Salvar"
+
+#: lib/option.tcl:131
+#, tcl-format
+msgid "%s Repository"
+msgstr "Repositório %s"
+
+#: lib/option.tcl:132
+msgid "Global (All Repositories)"
+msgstr "Global (todos os repositórios)"
+
+#: lib/option.tcl:138
+msgid "User Name"
+msgstr "Nome do usuário"
+
+#: lib/option.tcl:139
+msgid "Email Address"
+msgstr "Endereço de e-mail"
+
+#: lib/option.tcl:141
+msgid "Summarize Merge Commits"
+msgstr "Exibir sumário das revisões de mesclagem"
+
+#: lib/option.tcl:142
+msgid "Merge Verbosity"
+msgstr "Nível de detalhamento da mesclagem"
+
+#: lib/option.tcl:143
+msgid "Show Diffstat After Merge"
+msgstr "Exibir estatísticas após mesclagens"
+
+#: lib/option.tcl:144
+msgid "Use Merge Tool"
+msgstr "Usar ferramenta de mesclagem"
+
+#: lib/option.tcl:146
+msgid "Trust File Modification Timestamps"
+msgstr "Confiar nas datas de modificação dos arquivos"
+
+#: lib/option.tcl:147
+msgid "Prune Tracking Branches During Fetch"
+msgstr "Eliminar ramos de rastreamento ao receber"
+
+#: lib/option.tcl:148
+msgid "Match Tracking Branches"
+msgstr "Coincidir ramos de rastreamento"
+
+#: lib/option.tcl:149
+msgid "Blame Copy Only On Changed Files"
+msgstr "Detectar cópias somente em arquivos modificados"
+
+#: lib/option.tcl:150
+msgid "Minimum Letters To Blame Copy On"
+msgstr "Número mínimo de letras para detectar cópias"
+
+#: lib/option.tcl:151
+msgid "Blame History Context Radius (days)"
+msgstr "Extensão do contexto de detecção (em dias)"
+
+#: lib/option.tcl:152
+msgid "Number of Diff Context Lines"
+msgstr "Número de linhas para o diff contextual"
+
+#: lib/option.tcl:153
+msgid "Commit Message Text Width"
+msgstr "Largura do texto da descrição da revisão"
+
+#: lib/option.tcl:154
+msgid "New Branch Name Template"
+msgstr "Modelo de nome para novos ramos"
+
+#: lib/option.tcl:155
+msgid "Default File Contents Encoding"
+msgstr "Codificação padrão dos arquivos"
+
+#: lib/option.tcl:203
+msgid "Change"
+msgstr "Alterar"
+
+#: lib/option.tcl:230
+msgid "Spelling Dictionary:"
+msgstr "Dicionário para o verificador ortográfico:"
+
+#: lib/option.tcl:254
+msgid "Change Font"
+msgstr "Mudar fonte"
+
+#: lib/option.tcl:258
+#, tcl-format
+msgid "Choose %s"
+msgstr "Escolher %s"
+
+#: lib/option.tcl:264
+msgid "pt."
+msgstr "pt."
+
+#: lib/option.tcl:278
+msgid "Preferences"
+msgstr "Preferências"
+
+#: lib/option.tcl:314
+msgid "Failed to completely save options:"
+msgstr "Houve um erro ao salvar as opções:"
+
+#: lib/remote.tcl:163
+msgid "Remove Remote"
+msgstr "Excluir"
+
+#: lib/remote.tcl:168
+msgid "Prune from"
+msgstr "Limpar de"
+
+#: lib/remote.tcl:173
+msgid "Fetch from"
+msgstr "Receber de"
+
+#: lib/remote.tcl:215
+msgid "Push to"
+msgstr "Enviar para"
+
+#: lib/remote_add.tcl:19
+msgid "Add Remote"
+msgstr "Adicionar repositório remoto"
+
+#: lib/remote_add.tcl:24
+msgid "Add New Remote"
+msgstr "Adicionar novo repositório remoto"
+
+#: lib/remote_add.tcl:28 lib/tools_dlg.tcl:36
+msgid "Add"
+msgstr "Adicionar"
+
+#: lib/remote_add.tcl:37
+msgid "Remote Details"
+msgstr "Detalhes do repositório remoto"
+
+#: lib/remote_add.tcl:50
+msgid "Location:"
+msgstr "Local:"
+
+#: lib/remote_add.tcl:62
+msgid "Further Action"
+msgstr "Ações adicionais"
+
+#: lib/remote_add.tcl:65
+msgid "Fetch Immediately"
+msgstr "Receber imediatamente"
+
+#: lib/remote_add.tcl:71
+msgid "Initialize Remote Repository and Push"
+msgstr "Inicializar repositório remoto e enviar"
+
+#: lib/remote_add.tcl:77
+msgid "Do Nothing Else Now"
+msgstr "Não fazer nada agora"
+
+#: lib/remote_add.tcl:101
+msgid "Please supply a remote name."
+msgstr "Por favor, indique um nome para o repositório remoto."
+
+#: lib/remote_add.tcl:114
+#, tcl-format
+msgid "'%s' is not an acceptable remote name."
+msgstr "\"%s\" não é um nome válido para um repositório remoto."
+
+#: lib/remote_add.tcl:125
+#, tcl-format
+msgid "Failed to add remote '%s' of location '%s'."
+msgstr "Erro ao adicionar repositório remoto \"%s\" do local \"%s\":"
+
+#: lib/remote_add.tcl:133 lib/transport.tcl:6
+#, tcl-format
+msgid "fetch %s"
+msgstr "receber %s"
+
+#: lib/remote_add.tcl:134
+#, tcl-format
+msgid "Fetching the %s"
+msgstr "Recebendo o %s"
+
+#: lib/remote_add.tcl:157
+#, tcl-format
+msgid "Do not know how to initialize repository at location '%s'."
+msgstr "Não sabe como inicializar o repositório remoto em \"%s\"."
+
+#: lib/remote_add.tcl:163 lib/transport.tcl:25 lib/transport.tcl:63
+#: lib/transport.tcl:81
+#, tcl-format
+msgid "push %s"
+msgstr "enviar %s"
+
+#: lib/remote_add.tcl:164
+#, tcl-format
+msgid "Setting up the %s (at %s)"
+msgstr "Configurando %s (em %s)"
+
+#: lib/remote_branch_delete.tcl:29 lib/remote_branch_delete.tcl:34
+msgid "Delete Branch Remotely"
+msgstr "Apagar ramo remoto"
+
+#: lib/remote_branch_delete.tcl:47
+msgid "From Repository"
+msgstr "Do repositório"
+
+#: lib/remote_branch_delete.tcl:50 lib/transport.tcl:134
+msgid "Remote:"
+msgstr "Remoto:"
+
+#: lib/remote_branch_delete.tcl:66 lib/transport.tcl:149
+msgid "Arbitrary Location:"
+msgstr "Outro local:"
+
+#: lib/remote_branch_delete.tcl:84
+msgid "Branches"
+msgstr "Ramos"
+
+#: lib/remote_branch_delete.tcl:109
+msgid "Delete Only If"
+msgstr "Apagar somente se"
+
+#: lib/remote_branch_delete.tcl:111
+msgid "Merged Into:"
+msgstr "Mesclado em:"
+
+#: lib/remote_branch_delete.tcl:152
+msgid "A branch is required for 'Merged Into'."
+msgstr "É preciso indicar um ramo para \"Mesclado em\"."
+
+#: lib/remote_branch_delete.tcl:184
+#, tcl-format
+msgid ""
+"The following branches are not completely merged into %s:\n"
+"\n"
+" - %s"
+msgstr ""
+"Os seguintes ramos não estão inteiramente mesclados em %s:\n"
+"\n"
+" - %s"
+
+#: lib/remote_branch_delete.tcl:189
+#, tcl-format
+msgid ""
+"One or more of the merge tests failed because you have not fetched the "
+"necessary commits.  Try fetching from %s first."
+msgstr ""
+"Um ou mais testes de mesclagem falharam porque você não possui as revisões "
+"necessárias. Tente receber revisões de %s primeiro."
+
+#: lib/remote_branch_delete.tcl:207
+msgid "Please select one or more branches to delete."
+msgstr "Por favor selecione um ou mais ramos para apagar."
+
+#: lib/remote_branch_delete.tcl:226
+#, tcl-format
+msgid "Deleting branches from %s"
+msgstr "Apagar ramos de %s"
+
+#: lib/remote_branch_delete.tcl:292
+msgid "No repository selected."
+msgstr "Nenhum repositório foi selecionado."
+
+#: lib/remote_branch_delete.tcl:297
+#, tcl-format
+msgid "Scanning %s..."
+msgstr "Atualizando %s..."
+
+#: lib/search.tcl:21
+msgid "Find:"
+msgstr "Encontrar:"
+
+#: lib/search.tcl:23
+msgid "Next"
+msgstr "Próximo"
+
+#: lib/search.tcl:24
+msgid "Prev"
+msgstr "Anterior"
+
+#: lib/search.tcl:25
+msgid "Case-Sensitive"
+msgstr "Sensível a maiúsculas/minúsculas"
+
+#: lib/shortcut.tcl:21 lib/shortcut.tcl:62
+msgid "Cannot write shortcut:"
+msgstr "Não foi possível gravar o atalho:"
+
+#: lib/shortcut.tcl:137
+msgid "Cannot write icon:"
+msgstr "Não foi possível gravar o ícone:"
+
+#: lib/spellcheck.tcl:57
+msgid "Unsupported spell checker"
+msgstr "Verificador ortográfico não suportado"
+
+#: lib/spellcheck.tcl:65
+msgid "Spell checking is unavailable"
+msgstr "Verificação ortográfica indisponível"
+
+#: lib/spellcheck.tcl:68
+msgid "Invalid spell checking configuration"
+msgstr "Configuração do verificador ortográfico inválida"
+
+#: lib/spellcheck.tcl:70
+#, tcl-format
+msgid "Reverting dictionary to %s."
+msgstr "Revertendo dicionário para %s."
+
+#: lib/spellcheck.tcl:73
+msgid "Spell checker silently failed on startup"
+msgstr "O verificador ortográfico falhou sem relatar nenhum erro"
+
+#: lib/spellcheck.tcl:80
+msgid "Unrecognized spell checker"
+msgstr "Verificador ortográfico não reconhecido"
+
+#: lib/spellcheck.tcl:186
+msgid "No Suggestions"
+msgstr "Sem sugestões"
+
+#: lib/spellcheck.tcl:388
+msgid "Unexpected EOF from spell checker"
+msgstr "Final de arquivo inesperado recebido do verificador ortográfico"
+
+#: lib/spellcheck.tcl:392
+msgid "Spell Checker Failed"
+msgstr "A verificação ortográfica falhou"
+
+#: lib/sshkey.tcl:31
+msgid "No keys found."
+msgstr "Nenhuma chave encontrada"
+
+#: lib/sshkey.tcl:34
+#, tcl-format
+msgid "Found a public key in: %s"
+msgstr "Chave pública encontrada em: %s"
+
+#: lib/sshkey.tcl:40
+msgid "Generate Key"
+msgstr "Gerar chave"
+
+#: lib/sshkey.tcl:56
+msgid "Copy To Clipboard"
+msgstr "Copiar para a área de transferência"
+
+#: lib/sshkey.tcl:70
+msgid "Your OpenSSH Public Key"
+msgstr "Sua chave pública OpenSSH"
+
+#: lib/sshkey.tcl:78
+msgid "Generating..."
+msgstr "Gerando..."
+
+#: lib/sshkey.tcl:84
+#, tcl-format
+msgid ""
+"Could not start ssh-keygen:\n"
+"\n"
+"%s"
+msgstr ""
+"Impossível iniciar ssh-keygen:\n"
+"\n"
+"%s"
+
+#: lib/sshkey.tcl:111
+msgid "Generation failed."
+msgstr "A geração da chave falhou."
+
+#: lib/sshkey.tcl:118
+msgid "Generation succeded, but no keys found."
+msgstr "A geração da chave foi bem-sucedida, mas nenhuma chave foi encontrada."
+
+#: lib/sshkey.tcl:121
+#, tcl-format
+msgid "Your key is in: %s"
+msgstr "Sua chave em: %s"
+
+#: lib/status_bar.tcl:83
+#, tcl-format
+msgid "%s ... %*i of %*i %s (%3i%%)"
+msgstr "%s ... %*i de %*i %s (%3i%%)"
+
+#: lib/tools.tcl:75
+#, tcl-format
+msgid "Running %s requires a selected file."
+msgstr "É preciso selecionar um arquivo para executar %s."
+
+#: lib/tools.tcl:90
+#, tcl-format
+msgid "Are you sure you want to run %s?"
+msgstr "Você tem certeza que deseja executar %s?"
+
+#: lib/tools.tcl:110
+#, tcl-format
+msgid "Tool: %s"
+msgstr "Ferramenta: %s"
+
+#: lib/tools.tcl:111
+#, tcl-format
+msgid "Running: %s"
+msgstr "Executando: %s"
+
+#: lib/tools.tcl:149
+#, tcl-format
+msgid "Tool completed successfully: %s"
+msgstr "Execução completada com sucesso: %s"
+
+#: lib/tools.tcl:151
+#, tcl-format
+msgid "Tool failed: %s"
+msgstr "Ferramenta falhou: %s"
+
+#: lib/tools_dlg.tcl:22
+msgid "Add Tool"
+msgstr "Adicionar ferramenta"
+
+#: lib/tools_dlg.tcl:28
+msgid "Add New Tool Command"
+msgstr "Adicionar novo comando de ferramenta"
+
+#: lib/tools_dlg.tcl:33
+msgid "Add globally"
+msgstr "Adicionar globalmente"
+
+#: lib/tools_dlg.tcl:45
+msgid "Tool Details"
+msgstr "Detalhes da ferramenta"
+
+#: lib/tools_dlg.tcl:48
+msgid "Use '/' separators to create a submenu tree:"
+msgstr "Use o separador \"/\" para criar uma árvore de sub-menus:"
+
+#: lib/tools_dlg.tcl:61
+msgid "Command:"
+msgstr "Comando:"
+
+#: lib/tools_dlg.tcl:74
+msgid "Show a dialog before running"
+msgstr "Exibir uma caixa de diálogo antes de executar"
+
+#: lib/tools_dlg.tcl:80
+msgid "Ask the user to select a revision (sets $REVISION)"
+msgstr "Solicitar a seleção de uma revisão (a variável $REVISION)"
+
+#: lib/tools_dlg.tcl:85
+msgid "Ask the user for additional arguments (sets $ARGS)"
+msgstr "Solicitar argumentos adicionais (define a variável $ARGS)"
+
+#: lib/tools_dlg.tcl:92
+msgid "Don't show the command output window"
+msgstr "Não exibir a janela de saída do comando"
+
+#: lib/tools_dlg.tcl:97
+msgid "Run only if a diff is selected ($FILENAME not empty)"
+msgstr "Executar apenas se houver um diff selecionado ($FILENAME não-vazio)"
+
+#: lib/tools_dlg.tcl:121
+msgid "Please supply a name for the tool."
+msgstr "Por favor, indique um nome para a ferramenta."
+
+#: lib/tools_dlg.tcl:129
+#, tcl-format
+msgid "Tool '%s' already exists."
+msgstr "A ferramenta \"%s\" já existe."
+
+#: lib/tools_dlg.tcl:151
+#, tcl-format
+msgid ""
+"Could not add tool:\n"
+"%s"
+msgstr ""
+"Não foi possível adicionar a ferramenta:\n"
+"%s"
+
+#: lib/tools_dlg.tcl:190
+msgid "Remove Tool"
+msgstr "Excluir ferramenta"
+
+#: lib/tools_dlg.tcl:196
+msgid "Remove Tool Commands"
+msgstr "Excluir comando de ferramenta"
+
+#: lib/tools_dlg.tcl:200
+msgid "Remove"
+msgstr "Excluir"
+
+#: lib/tools_dlg.tcl:236
+msgid "(Blue denotes repository-local tools)"
+msgstr "(Azul indica ferramentas do repositório local)"
+
+#: lib/tools_dlg.tcl:297
+#, tcl-format
+msgid "Run Command: %s"
+msgstr "Executar comando: %s"
+
+#: lib/tools_dlg.tcl:311
+msgid "Arguments"
+msgstr "Argumentos"
+
+#: lib/tools_dlg.tcl:348
+msgid "OK"
+msgstr "OK"
+
+#: lib/transport.tcl:7
+#, tcl-format
+msgid "Fetching new changes from %s"
+msgstr "Recebendo novas mudanças de %s"
+
+#: lib/transport.tcl:18
+#, tcl-format
+msgid "remote prune %s"
+msgstr "Limpar %s"
+
+#: lib/transport.tcl:19
+#, tcl-format
+msgid "Pruning tracking branches deleted from %s"
+msgstr "Limpando ramos excluídos de %s"
+
+#: lib/transport.tcl:26
+#, tcl-format
+msgid "Pushing changes to %s"
+msgstr "Enviando mudanças para %s"
+
+#: lib/transport.tcl:64
+#, tcl-format
+msgid "Mirroring to %s"
+msgstr "Duplicando para %s"
+
+#: lib/transport.tcl:82
+#, tcl-format
+msgid "Pushing %s %s to %s"
+msgstr "Enviando %s %s para %s"
+
+#: lib/transport.tcl:100
+msgid "Push Branches"
+msgstr "Enviar ramos"
+
+#: lib/transport.tcl:114
+msgid "Source Branches"
+msgstr "Ramos de origem"
+
+#: lib/transport.tcl:131
+msgid "Destination Repository"
+msgstr "Repositório de destino"
+
+#: lib/transport.tcl:169
+msgid "Transfer Options"
+msgstr "Opções de transferência"
+
+#: lib/transport.tcl:171
+msgid "Force overwrite existing branch (may discard changes)"
+msgstr "Sobrescrever ramos existentes (pode descartar mudanças)"
+
+#: lib/transport.tcl:175
+msgid "Use thin pack (for slow network connections)"
+msgstr "Usar compactação minimalista (para redes lentas)"
+
+#: lib/transport.tcl:179
+msgid "Include tags"
+msgstr "Incluir etiquetas"
index 364c074c504ce2150effdbf01927aa052107c1af..30f4b77dac08d9c69ea3d0009ec97d30b9349be8 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: git-gui\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-12-08 08:31-0800\n"
+"POT-Creation-Date: 2010-01-26 15:47-0800\n"
 "PO-Revision-Date: 2007-10-22 22:30-0200\n"
 "Last-Translator: Alex Riesen <raa.lkml@gmail.com>\n"
 "Language-Team: Russian Translation <git@vger.kernel.org>\n"
@@ -15,33 +15,33 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: git-gui.sh:41 git-gui.sh:737 git-gui.sh:751 git-gui.sh:764 git-gui.sh:847
-#: git-gui.sh:866
+#: git-gui.sh:41 git-gui.sh:793 git-gui.sh:807 git-gui.sh:820 git-gui.sh:903
+#: git-gui.sh:922
 msgid "git-gui: fatal error"
 msgstr "git-gui: критическая ошибка"
 
-#: git-gui.sh:689
+#: git-gui.sh:743
 #, tcl-format
 msgid "Invalid font specified in %s:"
 msgstr "В %s установлен неверный шрифт:"
 
-#: git-gui.sh:723
+#: git-gui.sh:779
 msgid "Main Font"
 msgstr "Шрифт интерфейса"
 
-#: git-gui.sh:724
+#: git-gui.sh:780
 msgid "Diff/Console Font"
 msgstr "Шрифт консоли и изменений (diff)"
 
-#: git-gui.sh:738
+#: git-gui.sh:794
 msgid "Cannot find git in PATH."
 msgstr "git не найден в PATH."
 
-#: git-gui.sh:765
+#: git-gui.sh:821
 msgid "Cannot parse Git version string:"
 msgstr "Невозможно распознать строку версии Git: "
 
-#: git-gui.sh:783
+#: git-gui.sh:839
 #, tcl-format
 msgid ""
 "Git version cannot be determined.\n"
@@ -60,450 +60,474 @@ msgstr ""
 "\n"
 "Принять '%s' как версию 1.5.0?\n"
 
-#: git-gui.sh:1062
+#: git-gui.sh:1128
 msgid "Git directory not found:"
 msgstr "Каталог Git не найден:"
 
-#: git-gui.sh:1069
+#: git-gui.sh:1146
 msgid "Cannot move to top of working directory:"
 msgstr "Невозможно перейти к корню рабочего каталога репозитория: "
 
-#: git-gui.sh:1076
-msgid "Cannot use funny .git directory:"
-msgstr "Ð\9aаÑ\82алог .git Ð¸Ñ\81поÑ\80Ñ\87ен: "
+#: git-gui.sh:1154
+msgid "Cannot use bare repository:"
+msgstr "Ð\9dевозможно Ð¸Ñ\81полÑ\8cзование Ñ\80епозиÑ\82оÑ\80иÑ\8f Ð±ÐµÐ· Ñ\80абоÑ\87его ÐºÐ°Ñ\82алога:"
 
-#: git-gui.sh:1081
+#: git-gui.sh:1162
 msgid "No working directory"
 msgstr "Отсутствует рабочий каталог"
 
-#: git-gui.sh:1247 lib/checkout_op.tcl:305
+#: git-gui.sh:1334 lib/checkout_op.tcl:306
 msgid "Refreshing file status..."
 msgstr "Обновление информации о состоянии файлов..."
 
-#: git-gui.sh:1303
+#: git-gui.sh:1390
 msgid "Scanning for modified files ..."
 msgstr "Поиск измененных файлов..."
 
-#: git-gui.sh:1367
+#: git-gui.sh:1454
 msgid "Calling prepare-commit-msg hook..."
 msgstr "Вызов программы поддержки репозитория prepare-commit-msg..."
 
-#: git-gui.sh:1384
+#: git-gui.sh:1471
 msgid "Commit declined by prepare-commit-msg hook."
 msgstr ""
 "Сохранение прервано программой поддержки репозитория prepare-commit-msg"
 
-#: git-gui.sh:1542 lib/browser.tcl:246
+#: git-gui.sh:1629 lib/browser.tcl:246
 msgid "Ready."
 msgstr "Готово."
 
-#: git-gui.sh:1726
+#: git-gui.sh:1787
 #, tcl-format
 msgid "Displaying only %s of %s files."
 msgstr "Показано %s из %s файлов."
 
-#: git-gui.sh:1819
+#: git-gui.sh:1913
 msgid "Unmodified"
 msgstr "Не изменено"
 
-#: git-gui.sh:1821
+#: git-gui.sh:1915
 msgid "Modified, not staged"
 msgstr "Изменено, не подготовлено"
 
-#: git-gui.sh:1822 git-gui.sh:1830
+#: git-gui.sh:1916 git-gui.sh:1924
 msgid "Staged for commit"
 msgstr "Подготовлено для сохранения"
 
-#: git-gui.sh:1823 git-gui.sh:1831
+#: git-gui.sh:1917 git-gui.sh:1925
 msgid "Portions staged for commit"
 msgstr "Части, подготовленные для сохранения"
 
-#: git-gui.sh:1824 git-gui.sh:1832
+#: git-gui.sh:1918 git-gui.sh:1926
 msgid "Staged for commit, missing"
 msgstr "Подготовлено для сохранения, отсутствует"
 
-#: git-gui.sh:1826
+#: git-gui.sh:1920
 msgid "File type changed, not staged"
 msgstr "Тип файла изменён, не подготовлено"
 
-#: git-gui.sh:1827
+#: git-gui.sh:1921
 msgid "File type changed, staged"
 msgstr "Тип файла изменён, подготовлено"
 
-#: git-gui.sh:1829
+#: git-gui.sh:1923
 msgid "Untracked, not staged"
 msgstr "Не отслеживается, не подготовлено"
 
-#: git-gui.sh:1834
+#: git-gui.sh:1928
 msgid "Missing"
 msgstr "Отсутствует"
 
-#: git-gui.sh:1835
+#: git-gui.sh:1929
 msgid "Staged for removal"
 msgstr "Подготовлено для удаления"
 
-#: git-gui.sh:1836
+#: git-gui.sh:1930
 msgid "Staged for removal, still present"
 msgstr "Подготовлено для удаления, еще не удалено"
 
-#: git-gui.sh:1838 git-gui.sh:1839 git-gui.sh:1840 git-gui.sh:1841
-#: git-gui.sh:1842 git-gui.sh:1843
+#: git-gui.sh:1932 git-gui.sh:1933 git-gui.sh:1934 git-gui.sh:1935
+#: git-gui.sh:1936 git-gui.sh:1937
 msgid "Requires merge resolution"
 msgstr "Требуется разрешение конфликта при слиянии"
 
-#: git-gui.sh:1878
+#: git-gui.sh:1972
 msgid "Starting gitk... please wait..."
 msgstr "Запускается gitk... Подождите, пожалуйста..."
 
-#: git-gui.sh:1887
+#: git-gui.sh:1984
 msgid "Couldn't find gitk in PATH"
 msgstr "gitk не найден в PATH."
 
-#: git-gui.sh:2280 lib/choose_repository.tcl:36
+#: git-gui.sh:2043
+msgid "Couldn't find git gui in PATH"
+msgstr "git gui не найден в PATH."
+
+#: git-gui.sh:2455 lib/choose_repository.tcl:36
 msgid "Repository"
 msgstr "Репозиторий"
 
-#: git-gui.sh:2281
+#: git-gui.sh:2456
 msgid "Edit"
 msgstr "Редактировать"
 
-#: git-gui.sh:2283 lib/choose_rev.tcl:561
+#: git-gui.sh:2458 lib/choose_rev.tcl:561
 msgid "Branch"
 msgstr "Ветвь"
 
-#: git-gui.sh:2286 lib/choose_rev.tcl:548
+#: git-gui.sh:2461 lib/choose_rev.tcl:548
 msgid "Commit@@noun"
 msgstr "Состояние"
 
-#: git-gui.sh:2289 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168
+#: git-gui.sh:2464 lib/merge.tcl:121 lib/merge.tcl:150 lib/merge.tcl:168
 msgid "Merge"
 msgstr "Слияние"
 
-#: git-gui.sh:2290 lib/choose_rev.tcl:557
+#: git-gui.sh:2465 lib/choose_rev.tcl:557
 msgid "Remote"
 msgstr "Внешние репозитории"
 
-#: git-gui.sh:2293
+#: git-gui.sh:2468
 msgid "Tools"
 msgstr "Вспомогательные операции"
 
-#: git-gui.sh:2302
+#: git-gui.sh:2477
 msgid "Explore Working Copy"
 msgstr "Просмотр рабочего каталога"
 
-#: git-gui.sh:2307
+#: git-gui.sh:2483
 msgid "Browse Current Branch's Files"
 msgstr "Просмотреть файлы текущей ветви"
 
-#: git-gui.sh:2311
+#: git-gui.sh:2487
 msgid "Browse Branch Files..."
 msgstr "Показать файлы ветви..."
 
-#: git-gui.sh:2316
+#: git-gui.sh:2492
 msgid "Visualize Current Branch's History"
 msgstr "Показать историю текущей ветви"
 
-#: git-gui.sh:2320
+#: git-gui.sh:2496
 msgid "Visualize All Branch History"
 msgstr "Показать историю всех ветвей"
 
-#: git-gui.sh:2327
+#: git-gui.sh:2503
 #, tcl-format
 msgid "Browse %s's Files"
 msgstr "Показать файлы ветви %s"
 
-#: git-gui.sh:2329
+#: git-gui.sh:2505
 #, tcl-format
 msgid "Visualize %s's History"
 msgstr "Показать историю ветви %s"
 
-#: git-gui.sh:2334 lib/database.tcl:27 lib/database.tcl:67
+#: git-gui.sh:2510 lib/database.tcl:27 lib/database.tcl:67
 msgid "Database Statistics"
 msgstr "Статистика базы данных"
 
-#: git-gui.sh:2337 lib/database.tcl:34
+#: git-gui.sh:2513 lib/database.tcl:34
 msgid "Compress Database"
 msgstr "Сжать базу данных"
 
-#: git-gui.sh:2340
+#: git-gui.sh:2516
 msgid "Verify Database"
 msgstr "Проверить базу данных"
 
-#: git-gui.sh:2347 git-gui.sh:2351 git-gui.sh:2355 lib/shortcut.tcl:7
-#: lib/shortcut.tcl:39 lib/shortcut.tcl:71
+#: git-gui.sh:2523 git-gui.sh:2527 git-gui.sh:2531 lib/shortcut.tcl:8
+#: lib/shortcut.tcl:40 lib/shortcut.tcl:72
 msgid "Create Desktop Icon"
 msgstr "Создать ярлык на рабочем столе"
 
-#: git-gui.sh:2363 lib/choose_repository.tcl:183 lib/choose_repository.tcl:191
+#: git-gui.sh:2539 lib/choose_repository.tcl:183 lib/choose_repository.tcl:191
 msgid "Quit"
 msgstr "Выход"
 
-#: git-gui.sh:2371
+#: git-gui.sh:2547
 msgid "Undo"
 msgstr "Отменить"
 
-#: git-gui.sh:2374
+#: git-gui.sh:2550
 msgid "Redo"
 msgstr "Повторить"
 
-#: git-gui.sh:2378 git-gui.sh:2937
+#: git-gui.sh:2554 git-gui.sh:3109
 msgid "Cut"
 msgstr "Вырезать"
 
-#: git-gui.sh:2381 git-gui.sh:2940 git-gui.sh:3014 git-gui.sh:3096
+#: git-gui.sh:2557 git-gui.sh:3112 git-gui.sh:3186 git-gui.sh:3259
 #: lib/console.tcl:69
 msgid "Copy"
 msgstr "Копировать"
 
-#: git-gui.sh:2384 git-gui.sh:2943
+#: git-gui.sh:2560 git-gui.sh:3115
 msgid "Paste"
 msgstr "Вставить"
 
-#: git-gui.sh:2387 git-gui.sh:2946 lib/branch_delete.tcl:26
+#: git-gui.sh:2563 git-gui.sh:3118 lib/branch_delete.tcl:26
 #: lib/remote_branch_delete.tcl:38
 msgid "Delete"
 msgstr "Удалить"
 
-#: git-gui.sh:2391 git-gui.sh:2950 git-gui.sh:3100 lib/console.tcl:71
+#: git-gui.sh:2567 git-gui.sh:3122 git-gui.sh:3263 lib/console.tcl:71
 msgid "Select All"
 msgstr "Выделить все"
 
-#: git-gui.sh:2400
+#: git-gui.sh:2576
 msgid "Create..."
 msgstr "Создать..."
 
-#: git-gui.sh:2406
+#: git-gui.sh:2582
 msgid "Checkout..."
 msgstr "Перейти..."
 
-#: git-gui.sh:2412
+#: git-gui.sh:2588
 msgid "Rename..."
 msgstr "Переименовать..."
 
-#: git-gui.sh:2417
+#: git-gui.sh:2593
 msgid "Delete..."
 msgstr "Удалить..."
 
-#: git-gui.sh:2422
+#: git-gui.sh:2598
 msgid "Reset..."
 msgstr "Сбросить..."
 
-#: git-gui.sh:2432
+#: git-gui.sh:2608
 msgid "Done"
 msgstr "Завершено"
 
-#: git-gui.sh:2434
+#: git-gui.sh:2610
 msgid "Commit@@verb"
 msgstr "Сохранить"
 
-#: git-gui.sh:2443 git-gui.sh:2878
+#: git-gui.sh:2619 git-gui.sh:3050
 msgid "New Commit"
 msgstr "Новое состояние"
 
-#: git-gui.sh:2451 git-gui.sh:2885
+#: git-gui.sh:2627 git-gui.sh:3057
 msgid "Amend Last Commit"
 msgstr "Исправить последнее состояние"
 
-#: git-gui.sh:2461 git-gui.sh:2839 lib/remote_branch_delete.tcl:99
+#: git-gui.sh:2637 git-gui.sh:3011 lib/remote_branch_delete.tcl:99
 msgid "Rescan"
 msgstr "Перечитать"
 
-#: git-gui.sh:2467
+#: git-gui.sh:2643
 msgid "Stage To Commit"
 msgstr "Подготовить для сохранения"
 
-#: git-gui.sh:2473
+#: git-gui.sh:2649
 msgid "Stage Changed Files To Commit"
 msgstr "Подготовить измененные файлы для сохранения"
 
-#: git-gui.sh:2479
+#: git-gui.sh:2655
 msgid "Unstage From Commit"
 msgstr "Убрать из подготовленного"
 
-#: git-gui.sh:2484 lib/index.tcl:410
+#: git-gui.sh:2661 lib/index.tcl:412
 msgid "Revert Changes"
 msgstr "Отменить изменения"
 
-#: git-gui.sh:2491 git-gui.sh:3083
+#: git-gui.sh:2669 git-gui.sh:3310 git-gui.sh:3341
 msgid "Show Less Context"
 msgstr "Меньше контекста"
 
-#: git-gui.sh:2495 git-gui.sh:3087
+#: git-gui.sh:2673 git-gui.sh:3314 git-gui.sh:3345
 msgid "Show More Context"
 msgstr "Больше контекста"
 
-#: git-gui.sh:2502 git-gui.sh:2852 git-gui.sh:2961
+#: git-gui.sh:2680 git-gui.sh:3024 git-gui.sh:3133
 msgid "Sign Off"
 msgstr "Вставить Signed-off-by"
 
-#: git-gui.sh:2518
+#: git-gui.sh:2696
 msgid "Local Merge..."
 msgstr "Локальное слияние..."
 
-#: git-gui.sh:2523
+#: git-gui.sh:2701
 msgid "Abort Merge..."
 msgstr "Прервать слияние..."
 
-#: git-gui.sh:2535 git-gui.sh:2575
+#: git-gui.sh:2713 git-gui.sh:2741
 msgid "Add..."
 msgstr "Добавить..."
 
-#: git-gui.sh:2539
+#: git-gui.sh:2717
 msgid "Push..."
 msgstr "Отправить..."
 
-#: git-gui.sh:2543
+#: git-gui.sh:2721
 msgid "Delete Branch..."
 msgstr "Удалить ветвь..."
 
-#: git-gui.sh:2553 git-gui.sh:2589 lib/about.tcl:14
-#: lib/choose_repository.tcl:44 lib/choose_repository.tcl:53
-#, tcl-format
-msgid "About %s"
-msgstr "О %s"
-
-#: git-gui.sh:2557
-msgid "Preferences..."
-msgstr "Настройки..."
-
-#: git-gui.sh:2565 git-gui.sh:3129
+#: git-gui.sh:2731 git-gui.sh:3292
 msgid "Options..."
 msgstr "Настройки..."
 
-#: git-gui.sh:2576
+#: git-gui.sh:2742
 msgid "Remove..."
 msgstr "Удалить..."
 
-#: git-gui.sh:2585 lib/choose_repository.tcl:50
+#: git-gui.sh:2751 lib/choose_repository.tcl:50
 msgid "Help"
 msgstr "Помощь"
 
-#: git-gui.sh:2611
+#: git-gui.sh:2755 git-gui.sh:2759 lib/about.tcl:14
+#: lib/choose_repository.tcl:44 lib/choose_repository.tcl:53
+#, tcl-format
+msgid "About %s"
+msgstr "О %s"
+
+#: git-gui.sh:2783
 msgid "Online Documentation"
 msgstr "Документация в интернете"
 
-#: git-gui.sh:2614 lib/choose_repository.tcl:47 lib/choose_repository.tcl:56
+#: git-gui.sh:2786 lib/choose_repository.tcl:47 lib/choose_repository.tcl:56
 msgid "Show SSH Key"
 msgstr "Показать ключ SSH"
 
-#: git-gui.sh:2721
+#: git-gui.sh:2893
 #, tcl-format
 msgid "fatal: cannot stat path %s: No such file or directory"
 msgstr "критическая ошибка: %s: нет такого файла или каталога"
 
-#: git-gui.sh:2754
+#: git-gui.sh:2926
 msgid "Current Branch:"
 msgstr "Текущая ветвь:"
 
-#: git-gui.sh:2775
+#: git-gui.sh:2947
 msgid "Staged Changes (Will Commit)"
 msgstr "Подготовлено (будет сохранено)"
 
-#: git-gui.sh:2795
+#: git-gui.sh:2967
 msgid "Unstaged Changes"
 msgstr "Изменено (не будет сохранено)"
 
-#: git-gui.sh:2845
+#: git-gui.sh:3017
 msgid "Stage Changed"
 msgstr "Подготовить все"
 
-#: git-gui.sh:2864 lib/transport.tcl:104 lib/transport.tcl:193
+#: git-gui.sh:3036 lib/transport.tcl:104 lib/transport.tcl:193
 msgid "Push"
 msgstr "Отправить"
 
-#: git-gui.sh:2899
+#: git-gui.sh:3071
 msgid "Initial Commit Message:"
 msgstr "Комментарий к первому состоянию:"
 
-#: git-gui.sh:2900
+#: git-gui.sh:3072
 msgid "Amended Commit Message:"
 msgstr "Комментарий к исправленному состоянию:"
 
-#: git-gui.sh:2901
+#: git-gui.sh:3073
 msgid "Amended Initial Commit Message:"
 msgstr "Комментарий к исправленному первоначальному состоянию:"
 
-#: git-gui.sh:2902
+#: git-gui.sh:3074
 msgid "Amended Merge Commit Message:"
 msgstr "Комментарий к исправленному слиянию:"
 
-#: git-gui.sh:2903
+#: git-gui.sh:3075
 msgid "Merge Commit Message:"
 msgstr "Комментарий к слиянию:"
 
-#: git-gui.sh:2904
+#: git-gui.sh:3076
 msgid "Commit Message:"
 msgstr "Комментарий к состоянию:"
 
-#: git-gui.sh:2953 git-gui.sh:3104 lib/console.tcl:73
+#: git-gui.sh:3125 git-gui.sh:3267 lib/console.tcl:73
 msgid "Copy All"
 msgstr "Копировать все"
 
-#: git-gui.sh:2977 lib/blame.tcl:104
+#: git-gui.sh:3149 lib/blame.tcl:104
 msgid "File:"
 msgstr "Файл:"
 
-#: git-gui.sh:3092
+#: git-gui.sh:3255
 msgid "Refresh"
 msgstr "Обновить"
 
-#: git-gui.sh:3113
+#: git-gui.sh:3276
 msgid "Decrease Font Size"
 msgstr "Уменьшить размер шрифта"
 
-#: git-gui.sh:3117
+#: git-gui.sh:3280
 msgid "Increase Font Size"
 msgstr "Увеличить размер шрифта"
 
-#: git-gui.sh:3125 lib/blame.tcl:281
+#: git-gui.sh:3288 lib/blame.tcl:281
 msgid "Encoding"
 msgstr "Кодировка"
 
-#: git-gui.sh:3136
+#: git-gui.sh:3299
 msgid "Apply/Reverse Hunk"
 msgstr "Применить/Убрать изменение"
 
-#: git-gui.sh:3141
+#: git-gui.sh:3304
 msgid "Apply/Reverse Line"
 msgstr "Применить/Убрать строку"
 
-#: git-gui.sh:3151
+#: git-gui.sh:3323
 msgid "Run Merge Tool"
 msgstr "Запустить программу слияния"
 
-#: git-gui.sh:3156
+#: git-gui.sh:3328
 msgid "Use Remote Version"
 msgstr "Взять внешнюю версию"
 
-#: git-gui.sh:3160
+#: git-gui.sh:3332
 msgid "Use Local Version"
 msgstr "Взять локальную версию"
 
-#: git-gui.sh:3164
+#: git-gui.sh:3336
 msgid "Revert To Base"
 msgstr "Отменить изменения"
 
-#: git-gui.sh:3183
+#: git-gui.sh:3354
+msgid "Visualize These Changes In The Submodule"
+msgstr ""
+
+#: git-gui.sh:3358
+msgid "Visualize Current Branch History In The Submodule"
+msgstr "Показать историю текущей ветви подмодуля"
+
+#: git-gui.sh:3362
+msgid "Visualize All Branch History In The Submodule"
+msgstr "Показать историю всех ветвей подмодуля"
+
+#: git-gui.sh:3367
+msgid "Start git gui In The Submodule"
+msgstr ""
+
+#: git-gui.sh:3389
 msgid "Unstage Hunk From Commit"
 msgstr "Не сохранять часть"
 
-#: git-gui.sh:3184
+#: git-gui.sh:3391
+msgid "Unstage Lines From Commit"
+msgstr "Убрать строки из подготовленного"
+
+#: git-gui.sh:3393
 msgid "Unstage Line From Commit"
 msgstr "Убрать строку из подготовленного"
 
-#: git-gui.sh:3186
+#: git-gui.sh:3396
 msgid "Stage Hunk For Commit"
 msgstr "Подготовить часть для сохранения"
 
-#: git-gui.sh:3187
+#: git-gui.sh:3398
+msgid "Stage Lines For Commit"
+msgstr "Подготовить строки для сохранения"
+
+#: git-gui.sh:3400
 msgid "Stage Line For Commit"
 msgstr "Подготовить строку для сохранения"
 
-#: git-gui.sh:3210
+#: git-gui.sh:3424
 msgid "Initializing..."
 msgstr "Инициализация..."
 
-#: git-gui.sh:3315
+#: git-gui.sh:3541
 #, tcl-format
 msgid ""
 "Possible environment issues exist.\n"
@@ -520,7 +544,7 @@ msgstr ""
 "запущенными из %s\n"
 "\n"
 
-#: git-gui.sh:3345
+#: git-gui.sh:3570
 msgid ""
 "\n"
 "This is due to a known issue with the\n"
@@ -530,7 +554,7 @@ msgstr ""
 "Это известная проблема с Tcl,\n"
 "распространяемым Cygwin."
 
-#: git-gui.sh:3350
+#: git-gui.sh:3575
 #, tcl-format
 msgid ""
 "\n"
@@ -640,7 +664,7 @@ msgstr "Невозможно найти состояние предка:"
 msgid "Unable to display parent"
 msgstr "Не могу показать предка"
 
-#: lib/blame.tcl:1091 lib/diff.tcl:297
+#: lib/blame.tcl:1091 lib/diff.tcl:320
 msgid "Error loading diff:"
 msgstr "Ошибка загрузки изменений:"
 
@@ -666,7 +690,7 @@ msgstr "Перейти"
 
 #: lib/branch_checkout.tcl:27 lib/branch_create.tcl:35
 #: lib/branch_delete.tcl:32 lib/branch_rename.tcl:30 lib/browser.tcl:282
-#: lib/checkout_op.tcl:544 lib/choose_font.tcl:43 lib/merge.tcl:172
+#: lib/checkout_op.tcl:579 lib/choose_font.tcl:43 lib/merge.tcl:172
 #: lib/option.tcl:125 lib/remote_add.tcl:32 lib/remote_branch_delete.tcl:42
 #: lib/tools_dlg.tcl:40 lib/tools_dlg.tcl:204 lib/tools_dlg.tcl:352
 #: lib/transport.tcl:108
@@ -697,7 +721,7 @@ msgstr "Создание ветви"
 msgid "Create New Branch"
 msgstr "Создать новую ветвь"
 
-#: lib/branch_create.tcl:31 lib/choose_repository.tcl:377
+#: lib/branch_create.tcl:31 lib/choose_repository.tcl:381
 msgid "Create"
 msgstr "Создать"
 
@@ -729,7 +753,7 @@ msgstr "Нет"
 msgid "Fast Forward Only"
 msgstr "Только Fast Forward"
 
-#: lib/branch_create.tcl:85 lib/checkout_op.tcl:536
+#: lib/branch_create.tcl:85 lib/checkout_op.tcl:571
 msgid "Reset"
 msgstr "Сброс"
 
@@ -771,8 +795,8 @@ msgstr "Локальные ветви"
 msgid "Delete Only If Merged Into"
 msgstr "Удалить только в случае, если было слияние с"
 
-#: lib/branch_delete.tcl:54
-msgid "Always (Do not perform merge test.)"
+#: lib/branch_delete.tcl:54 lib/remote_branch_delete.tcl:119
+msgid "Always (Do not perform merge checks)"
 msgstr "Всегда (не выполнять проверку на слияние)"
 
 #: lib/branch_delete.tcl:103
@@ -780,6 +804,16 @@ msgstr "Всегда (не выполнять проверку на слияни
 msgid "The following branches are not completely merged into %s:"
 msgstr "Ветви, которые не полностью сливаются с %s:"
 
+#: lib/branch_delete.tcl:115 lib/remote_branch_delete.tcl:217
+msgid ""
+"Recovering deleted branches is difficult.\n"
+"\n"
+"Delete the selected branches?"
+msgstr ""
+"Восстановить удаленные ветви сложно.\n"
+"\n"
+"Продолжить?"
+
 #: lib/branch_delete.tcl:141
 #, tcl-format
 msgid ""
@@ -809,7 +843,7 @@ msgstr "Новое название:"
 msgid "Please select a branch to rename."
 msgstr "Укажите ветвь для переименования."
 
-#: lib/branch_rename.tcl:96 lib/checkout_op.tcl:201
+#: lib/branch_rename.tcl:96 lib/checkout_op.tcl:202
 #, tcl-format
 msgid "Branch '%s' already exists."
 msgstr "Ветвь '%s' уже существует."
@@ -840,38 +874,38 @@ msgstr "[На уровень выше]"
 msgid "Browse Branch Files"
 msgstr "Показать файлы ветви"
 
-#: lib/browser.tcl:278 lib/choose_repository.tcl:394
-#: lib/choose_repository.tcl:480 lib/choose_repository.tcl:491
-#: lib/choose_repository.tcl:995
+#: lib/browser.tcl:278 lib/choose_repository.tcl:398
+#: lib/choose_repository.tcl:486 lib/choose_repository.tcl:497
+#: lib/choose_repository.tcl:1028
 msgid "Browse"
 msgstr "Показать"
 
-#: lib/checkout_op.tcl:84
+#: lib/checkout_op.tcl:85
 #, tcl-format
 msgid "Fetching %s from %s"
 msgstr "Получение %s из %s "
 
-#: lib/checkout_op.tcl:132
+#: lib/checkout_op.tcl:133
 #, tcl-format
 msgid "fatal: Cannot resolve %s"
 msgstr "критическая ошибка: невозможно разрешить %s"
 
-#: lib/checkout_op.tcl:145 lib/console.tcl:81 lib/database.tcl:31
+#: lib/checkout_op.tcl:146 lib/console.tcl:81 lib/database.tcl:31
 #: lib/sshkey.tcl:53
 msgid "Close"
 msgstr "Закрыть"
 
-#: lib/checkout_op.tcl:174
+#: lib/checkout_op.tcl:175
 #, tcl-format
 msgid "Branch '%s' does not exist."
 msgstr "Ветвь '%s' не существует "
 
-#: lib/checkout_op.tcl:193
+#: lib/checkout_op.tcl:194
 #, tcl-format
 msgid "Failed to configure simplified git-pull for '%s'."
 msgstr "Ошибка создания упрощённой конфигурации git pull для '%s'."
 
-#: lib/checkout_op.tcl:228
+#: lib/checkout_op.tcl:229
 #, tcl-format
 msgid ""
 "Branch '%s' already exists.\n"
@@ -884,21 +918,21 @@ msgstr ""
 "Она не может быть прокручена(fast-forward) к %s.\n"
 "Требуется слияние."
 
-#: lib/checkout_op.tcl:242
+#: lib/checkout_op.tcl:243
 #, tcl-format
 msgid "Merge strategy '%s' not supported."
 msgstr "Неизвестная стратегия слияния: '%s'."
 
-#: lib/checkout_op.tcl:261
+#: lib/checkout_op.tcl:262
 #, tcl-format
 msgid "Failed to update '%s'."
 msgstr "Не удалось обновить '%s'."
 
-#: lib/checkout_op.tcl:273
+#: lib/checkout_op.tcl:274
 msgid "Staging area (index) is already locked."
 msgstr "Рабочая область заблокирована другим процессом."
 
-#: lib/checkout_op.tcl:288
+#: lib/checkout_op.tcl:289
 msgid ""
 "Last scanned state does not match repository state.\n"
 "\n"
@@ -914,30 +948,30 @@ msgstr ""
 "\n"
 "Это будет сделано сейчас автоматически.\n"
 
-#: lib/checkout_op.tcl:344
+#: lib/checkout_op.tcl:345
 #, tcl-format
 msgid "Updating working directory to '%s'..."
 msgstr "Обновление рабочего каталога из '%s'..."
 
-#: lib/checkout_op.tcl:345
+#: lib/checkout_op.tcl:346
 msgid "files checked out"
 msgstr "файлы извлечены"
 
-#: lib/checkout_op.tcl:375
+#: lib/checkout_op.tcl:376
 #, tcl-format
 msgid "Aborted checkout of '%s' (file level merging is required)."
 msgstr "Прерван переход на '%s' (требуется слияние содержания файлов)"
 
-#: lib/checkout_op.tcl:376
+#: lib/checkout_op.tcl:377
 msgid "File level merge required."
 msgstr "Требуется слияние содержания файлов."
 
-#: lib/checkout_op.tcl:380
+#: lib/checkout_op.tcl:381
 #, tcl-format
 msgid "Staying on branch '%s'."
 msgstr "Ветвь '%s' остается текущей."
 
-#: lib/checkout_op.tcl:451
+#: lib/checkout_op.tcl:452
 msgid ""
 "You are no longer on a local branch.\n"
 "\n"
@@ -949,30 +983,30 @@ msgstr ""
 "Если вы хотите снова вернуться к какой-нибудь ветви, создайте ее сейчас, "
 "начиная с 'Текущего отсоединенного состояния'."
 
-#: lib/checkout_op.tcl:468 lib/checkout_op.tcl:472
+#: lib/checkout_op.tcl:503 lib/checkout_op.tcl:507
 #, tcl-format
 msgid "Checked out '%s'."
 msgstr "Ветвь '%s' сделана текущей."
 
-#: lib/checkout_op.tcl:500
+#: lib/checkout_op.tcl:535
 #, tcl-format
 msgid "Resetting '%s' to '%s' will lose the following commits:"
 msgstr "Сброс '%s' в '%s' приведет к потере следующих сохраненных состояний: "
 
-#: lib/checkout_op.tcl:522
+#: lib/checkout_op.tcl:557
 msgid "Recovering lost commits may not be easy."
 msgstr "Восстановить потерянные сохраненные состояния будет сложно."
 
-#: lib/checkout_op.tcl:527
+#: lib/checkout_op.tcl:562
 #, tcl-format
 msgid "Reset '%s'?"
 msgstr "Сбросить '%s'?"
 
-#: lib/checkout_op.tcl:532 lib/merge.tcl:164 lib/tools_dlg.tcl:343
+#: lib/checkout_op.tcl:567 lib/merge.tcl:164 lib/tools_dlg.tcl:343
 msgid "Visualize"
 msgstr "Наглядно"
 
-#: lib/checkout_op.tcl:600
+#: lib/checkout_op.tcl:635
 #, tcl-format
 msgid ""
 "Failed to set current branch.\n"
@@ -1017,7 +1051,7 @@ msgstr ""
 msgid "Git Gui"
 msgstr "Git Gui"
 
-#: lib/choose_repository.tcl:87 lib/choose_repository.tcl:382
+#: lib/choose_repository.tcl:87 lib/choose_repository.tcl:386
 msgid "Create New Repository"
 msgstr "Создать новый репозиторий"
 
@@ -1025,7 +1059,7 @@ msgstr "Создать новый репозиторий"
 msgid "New..."
 msgstr "Новый..."
 
-#: lib/choose_repository.tcl:100 lib/choose_repository.tcl:465
+#: lib/choose_repository.tcl:100 lib/choose_repository.tcl:471
 msgid "Clone Existing Repository"
 msgstr "Склонировать существующий репозиторий"
 
@@ -1033,7 +1067,7 @@ msgstr "Склонировать существующий репозиторий
 msgid "Clone..."
 msgstr "Склонировать..."
 
-#: lib/choose_repository.tcl:113 lib/choose_repository.tcl:983
+#: lib/choose_repository.tcl:113 lib/choose_repository.tcl:1016
 msgid "Open Existing Repository"
 msgstr "Выбрать существующий репозиторий"
 
@@ -1049,194 +1083,194 @@ msgstr "Недавние репозитории"
 msgid "Open Recent Repository:"
 msgstr "Открыть последний репозиторий"
 
-#: lib/choose_repository.tcl:302 lib/choose_repository.tcl:309
-#: lib/choose_repository.tcl:316
+#: lib/choose_repository.tcl:306 lib/choose_repository.tcl:313
+#: lib/choose_repository.tcl:320
 #, tcl-format
 msgid "Failed to create repository %s:"
 msgstr "Не удалось создать репозиторий %s:"
 
-#: lib/choose_repository.tcl:387
+#: lib/choose_repository.tcl:391
 msgid "Directory:"
 msgstr "Каталог:"
 
-#: lib/choose_repository.tcl:417 lib/choose_repository.tcl:544
-#: lib/choose_repository.tcl:1017
+#: lib/choose_repository.tcl:423 lib/choose_repository.tcl:550
+#: lib/choose_repository.tcl:1052
 msgid "Git Repository"
 msgstr "Репозиторий"
 
-#: lib/choose_repository.tcl:442
+#: lib/choose_repository.tcl:448
 #, tcl-format
 msgid "Directory %s already exists."
 msgstr "Каталог '%s' уже существует."
 
-#: lib/choose_repository.tcl:446
+#: lib/choose_repository.tcl:452
 #, tcl-format
 msgid "File %s already exists."
 msgstr "Файл '%s' уже существует."
 
-#: lib/choose_repository.tcl:460
+#: lib/choose_repository.tcl:466
 msgid "Clone"
 msgstr "Склонировать"
 
-#: lib/choose_repository.tcl:473
+#: lib/choose_repository.tcl:479
 msgid "Source Location:"
 msgstr "Исходное положение:"
 
-#: lib/choose_repository.tcl:484
+#: lib/choose_repository.tcl:490
 msgid "Target Directory:"
 msgstr "Каталог назначения:"
 
-#: lib/choose_repository.tcl:496
+#: lib/choose_repository.tcl:502
 msgid "Clone Type:"
 msgstr "Тип клона:"
 
-#: lib/choose_repository.tcl:502
+#: lib/choose_repository.tcl:508
 msgid "Standard (Fast, Semi-Redundant, Hardlinks)"
 msgstr "Стандартный (Быстрый, полуизбыточный, \"жесткие\" ссылки)"
 
-#: lib/choose_repository.tcl:508
+#: lib/choose_repository.tcl:514
 msgid "Full Copy (Slower, Redundant Backup)"
 msgstr "Полная копия (Медленный, создает резервную копию)"
 
-#: lib/choose_repository.tcl:514
+#: lib/choose_repository.tcl:520
 msgid "Shared (Fastest, Not Recommended, No Backup)"
 msgstr "Общий (Самый быстрый, не рекомендуется, без резервной копии)"
 
-#: lib/choose_repository.tcl:550 lib/choose_repository.tcl:597
-#: lib/choose_repository.tcl:743 lib/choose_repository.tcl:813
-#: lib/choose_repository.tcl:1023 lib/choose_repository.tcl:1031
+#: lib/choose_repository.tcl:556 lib/choose_repository.tcl:603
+#: lib/choose_repository.tcl:749 lib/choose_repository.tcl:819
+#: lib/choose_repository.tcl:1058 lib/choose_repository.tcl:1066
 #, tcl-format
 msgid "Not a Git repository: %s"
 msgstr "Каталог не является репозиторием: %s"
 
-#: lib/choose_repository.tcl:586
+#: lib/choose_repository.tcl:592
 msgid "Standard only available for local repository."
 msgstr "Стандартный клон возможен только для локального репозитория."
 
-#: lib/choose_repository.tcl:590
+#: lib/choose_repository.tcl:596
 msgid "Shared only available for local repository."
 msgstr "Общий клон возможен только для локального репозитория."
 
-#: lib/choose_repository.tcl:611
+#: lib/choose_repository.tcl:617
 #, tcl-format
 msgid "Location %s already exists."
 msgstr "Путь '%s' уже существует."
 
-#: lib/choose_repository.tcl:622
+#: lib/choose_repository.tcl:628
 msgid "Failed to configure origin"
 msgstr "Не могу сконфигурировать исходный репозиторий."
 
-#: lib/choose_repository.tcl:634
+#: lib/choose_repository.tcl:640
 msgid "Counting objects"
 msgstr "Считаю объекты"
 
-#: lib/choose_repository.tcl:635
+#: lib/choose_repository.tcl:641
 msgid "buckets"
 msgstr ""
 
-#: lib/choose_repository.tcl:659
+#: lib/choose_repository.tcl:665
 #, tcl-format
 msgid "Unable to copy objects/info/alternates: %s"
 msgstr "Не могу скопировать objects/info/alternates: %s"
 
-#: lib/choose_repository.tcl:695
+#: lib/choose_repository.tcl:701
 #, tcl-format
 msgid "Nothing to clone from %s."
 msgstr "Нечего клонировать с %s."
 
-#: lib/choose_repository.tcl:697 lib/choose_repository.tcl:911
-#: lib/choose_repository.tcl:923
+#: lib/choose_repository.tcl:703 lib/choose_repository.tcl:917
+#: lib/choose_repository.tcl:929
 msgid "The 'master' branch has not been initialized."
 msgstr "Не инициализирована ветвь 'master'."
 
-#: lib/choose_repository.tcl:710
+#: lib/choose_repository.tcl:716
 msgid "Hardlinks are unavailable.  Falling back to copying."
 msgstr "\"Жесткие ссылки\" недоступны. Будет использовано копирование."
 
-#: lib/choose_repository.tcl:722
+#: lib/choose_repository.tcl:728
 #, tcl-format
 msgid "Cloning from %s"
 msgstr "Клонирование %s"
 
-#: lib/choose_repository.tcl:753
+#: lib/choose_repository.tcl:759
 msgid "Copying objects"
 msgstr "Копирование objects"
 
-#: lib/choose_repository.tcl:754
+#: lib/choose_repository.tcl:760
 msgid "KiB"
 msgstr "КБ"
 
-#: lib/choose_repository.tcl:778
+#: lib/choose_repository.tcl:784
 #, tcl-format
 msgid "Unable to copy object: %s"
 msgstr "Не могу скопировать объект: %s"
 
-#: lib/choose_repository.tcl:788
+#: lib/choose_repository.tcl:794
 msgid "Linking objects"
 msgstr "Создание ссылок на objects"
 
-#: lib/choose_repository.tcl:789
+#: lib/choose_repository.tcl:795
 msgid "objects"
 msgstr "объекты"
 
-#: lib/choose_repository.tcl:797
+#: lib/choose_repository.tcl:803
 #, tcl-format
 msgid "Unable to hardlink object: %s"
 msgstr "Не могу \"жестко связать\" объект: %s"
 
-#: lib/choose_repository.tcl:852
+#: lib/choose_repository.tcl:858
 msgid "Cannot fetch branches and objects.  See console output for details."
 msgstr ""
 "Не могу получить ветви и объекты. Дополнительная информация на консоли."
 
-#: lib/choose_repository.tcl:863
+#: lib/choose_repository.tcl:869
 msgid "Cannot fetch tags.  See console output for details."
 msgstr "Не могу получить метки. Дополнительная информация на консоли."
 
-#: lib/choose_repository.tcl:887
+#: lib/choose_repository.tcl:893
 msgid "Cannot determine HEAD.  See console output for details."
 msgstr "Не могу определить HEAD. Дополнительная информация на консоли."
 
-#: lib/choose_repository.tcl:896
+#: lib/choose_repository.tcl:902
 #, tcl-format
 msgid "Unable to cleanup %s"
 msgstr "Не могу очистить %s"
 
-#: lib/choose_repository.tcl:902
+#: lib/choose_repository.tcl:908
 msgid "Clone failed."
 msgstr "Клонирование не удалось."
 
-#: lib/choose_repository.tcl:909
+#: lib/choose_repository.tcl:915
 msgid "No default branch obtained."
 msgstr "Не было получено ветви по умолчанию."
 
-#: lib/choose_repository.tcl:920
+#: lib/choose_repository.tcl:926
 #, tcl-format
 msgid "Cannot resolve %s as a commit."
 msgstr "Не могу распознать %s как состояние."
 
-#: lib/choose_repository.tcl:932
+#: lib/choose_repository.tcl:938
 msgid "Creating working directory"
 msgstr "Создаю рабочий каталог"
 
-#: lib/choose_repository.tcl:933 lib/index.tcl:65 lib/index.tcl:128
-#: lib/index.tcl:196
+#: lib/choose_repository.tcl:939 lib/index.tcl:67 lib/index.tcl:130
+#: lib/index.tcl:198
 msgid "files"
 msgstr "файлов"
 
-#: lib/choose_repository.tcl:962
+#: lib/choose_repository.tcl:968
 msgid "Initial file checkout failed."
 msgstr "Не удалось получить начальное состояние файлов репозитория."
 
-#: lib/choose_repository.tcl:978
+#: lib/choose_repository.tcl:1011
 msgid "Open"
 msgstr "Открыть"
 
-#: lib/choose_repository.tcl:988
+#: lib/choose_repository.tcl:1021
 msgid "Repository:"
 msgstr "Репозиторий:"
 
-#: lib/choose_repository.tcl:1037
+#: lib/choose_repository.tcl:1072
 #, tcl-format
 msgid "Failed to open repository %s:"
 msgstr "Не удалось открыть репозиторий %s:"
@@ -1318,7 +1352,12 @@ msgstr "Невозможно получить информацию об авто
 msgid "Invalid GIT_COMMITTER_IDENT:"
 msgstr "Неверный GIT_COMMITTER_IDENT:"
 
-#: lib/commit.tcl:132
+#: lib/commit.tcl:129
+#, tcl-format
+msgid "warning: Tcl does not support encoding '%s'."
+msgstr "предупреждение: Tcl не поддерживает кодировку '%s'."
+
+#: lib/commit.tcl:149
 msgid ""
 "Last scanned state does not match repository state.\n"
 "\n"
@@ -1334,7 +1373,7 @@ msgstr ""
 "\n"
 "Это будет сделано сейчас автоматически.\n"
 
-#: lib/commit.tcl:155
+#: lib/commit.tcl:172
 #, tcl-format
 msgid ""
 "Unmerged files cannot be committed.\n"
@@ -1342,12 +1381,12 @@ msgid ""
 "File %s has merge conflicts.  You must resolve them and stage the file "
 "before committing.\n"
 msgstr ""
-"Нельзя сохранить файлы с незавершённой операцей слияния.\n"
+"Ð\9dелÑ\8cзÑ\8f Ñ\81оÑ\85Ñ\80аниÑ\82Ñ\8c Ñ\84айлÑ\8b Ñ\81 Ð½ÐµÐ·Ð°Ð²ÐµÑ\80Ñ\88Ñ\91нной Ð¾Ð¿ÐµÑ\80аÑ\86ией Ñ\81лиÑ\8fниÑ\8f.\n"
 "\n"
 "Для файла %s возник конфликт слияния. Разрешите конфликт и добавьте к "
 "подготовленным файлам перед сохранением.\n"
 
-#: lib/commit.tcl:163
+#: lib/commit.tcl:180
 #, tcl-format
 msgid ""
 "Unknown file state %s detected.\n"
@@ -1358,7 +1397,7 @@ msgstr ""
 "\n"
 "Файл %s не может быть сохранен данной программой.\n"
 
-#: lib/commit.tcl:171
+#: lib/commit.tcl:188
 msgid ""
 "No changes to commit.\n"
 "\n"
@@ -1368,7 +1407,7 @@ msgstr ""
 "\n"
 "Подготовьте хотя бы один файл до создания сохраненного состояния.\n"
 
-#: lib/commit.tcl:186
+#: lib/commit.tcl:203
 msgid ""
 "Please supply a commit message.\n"
 "\n"
@@ -1386,45 +1425,40 @@ msgstr ""
 "- вторая строка пустая\n"
 "- оставшиеся строки: опишите, что дают ваши изменения.\n"
 
-#: lib/commit.tcl:210
-#, tcl-format
-msgid "warning: Tcl does not support encoding '%s'."
-msgstr "предупреждение: Tcl не поддерживает кодировку '%s'."
-
-#: lib/commit.tcl:226
+#: lib/commit.tcl:234
 msgid "Calling pre-commit hook..."
 msgstr "Вызов программы поддержки репозитория pre-commit..."
 
-#: lib/commit.tcl:241
+#: lib/commit.tcl:249
 msgid "Commit declined by pre-commit hook."
 msgstr "Сохранение прервано программой поддержки репозитория pre-commit"
 
-#: lib/commit.tcl:264
+#: lib/commit.tcl:272
 msgid "Calling commit-msg hook..."
 msgstr "Вызов программы поддержки репозитория commit-msg..."
 
-#: lib/commit.tcl:279
+#: lib/commit.tcl:287
 msgid "Commit declined by commit-msg hook."
 msgstr "Сохранение прервано программой поддержки репозитория commit-msg"
 
-#: lib/commit.tcl:292
+#: lib/commit.tcl:300
 msgid "Committing changes..."
 msgstr "Сохранение изменений..."
 
-#: lib/commit.tcl:308
+#: lib/commit.tcl:316
 msgid "write-tree failed:"
 msgstr "Программа write-tree завершилась с ошибкой:"
 
-#: lib/commit.tcl:309 lib/commit.tcl:353 lib/commit.tcl:373
+#: lib/commit.tcl:317 lib/commit.tcl:361 lib/commit.tcl:382
 msgid "Commit failed."
 msgstr "Сохранить состояние не удалось."
 
-#: lib/commit.tcl:326
+#: lib/commit.tcl:334
 #, tcl-format
 msgid "Commit %s appears to be corrupt"
 msgstr "Состояние %s выглядит поврежденным"
 
-#: lib/commit.tcl:331
+#: lib/commit.tcl:339
 msgid ""
 "No changes to commit.\n"
 "\n"
@@ -1438,19 +1472,19 @@ msgstr ""
 "\n"
 "Сейчас автоматически запустится перечитывание репозитория.\n"
 
-#: lib/commit.tcl:338
+#: lib/commit.tcl:346
 msgid "No changes to commit."
-msgstr "Ð\9eÑ\82Ñ\83Ñ\81Ñ\82вÑ\83Ñ\8eÑ\82 Ð¸Ð·Ð¼ения для сохранения."
+msgstr "Ð\9eÑ\82Ñ\81Ñ\83Ñ\82Ñ\81Ñ\82вÑ\83Ñ\8eÑ\82 Ð¸Ð·Ð¼ÐµÐ½ения для сохранения."
 
-#: lib/commit.tcl:352
+#: lib/commit.tcl:360
 msgid "commit-tree failed:"
 msgstr "Программа commit-tree завершилась с ошибкой:"
 
-#: lib/commit.tcl:372
+#: lib/commit.tcl:381
 msgid "update-ref failed:"
 msgstr "Программа update-ref завершилась с ошибкой:"
 
-#: lib/commit.tcl:460
+#: lib/commit.tcl:469
 #, tcl-format
 msgid "Created commit %s: %s"
 msgstr "Создано состояние %s: %s "
@@ -1503,20 +1537,19 @@ msgstr "Сжатие базы объектов"
 msgid "Verifying the object database with fsck-objects"
 msgstr "Проверка базы объектов при помощи fsck"
 
-#: lib/database.tcl:108
+#: lib/database.tcl:107
 #, tcl-format
 msgid ""
 "This repository currently has approximately %i loose objects.\n"
 "\n"
 "To maintain optimal performance it is strongly recommended that you compress "
-"the database when more than %i loose objects exist.\n"
+"the database.\n"
 "\n"
 "Compress the database now?"
 msgstr ""
 "Этот репозиторий сейчас содержит примерно %i свободных объектов\n"
 "\n"
-"Для лучшей производительности рекомендуется сжать базу данных, когда есть "
-"более %i несвязанных объектов.\n"
+"Для лучшей производительности рекомендуется сжать базу данных.\n"
 "\n"
 "Сжать базу данных сейчас?"
 
@@ -1525,7 +1558,7 @@ msgstr ""
 msgid "Invalid date from Git: %s"
 msgstr "Неправильная дата в репозитории: %s"
 
-#: lib/diff.tcl:59
+#: lib/diff.tcl:64
 #, tcl-format
 msgid ""
 "No differences detected.\n"
@@ -1540,19 +1573,19 @@ msgid ""
 msgstr ""
 "Изменений не обнаружено.\n"
 "\n"
-"в %s отутствуют изменения.\n"
+"в %s Ð¾Ñ\82Ñ\81Ñ\83Ñ\82Ñ\81Ñ\82вÑ\83Ñ\8eÑ\82 Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ\8f.\n"
 "\n"
 "Дата изменения файла была обновлена другой программой, но содержимое файла "
 "осталось прежним.\n"
 "\n"
 "Сейчас будет запущено перечитывание репозитория, чтобы найти подобные файлы."
 
-#: lib/diff.tcl:99
+#: lib/diff.tcl:104
 #, tcl-format
 msgid "Loading diff of %s..."
 msgstr "Загрузка изменений в %s..."
 
-#: lib/diff.tcl:120
+#: lib/diff.tcl:125
 msgid ""
 "LOCAL: deleted\n"
 "REMOTE:\n"
@@ -1560,7 +1593,7 @@ msgstr ""
 "ЛОКАЛЬНО: удалён\n"
 "ВНЕШНИЙ:\n"
 
-#: lib/diff.tcl:125
+#: lib/diff.tcl:130
 msgid ""
 "REMOTE: deleted\n"
 "LOCAL:\n"
@@ -1568,41 +1601,41 @@ msgstr ""
 "ВНЕШНИЙ: удалён\n"
 "ЛОКАЛЬНО:\n"
 
-#: lib/diff.tcl:132
+#: lib/diff.tcl:137
 msgid "LOCAL:\n"
 msgstr "ЛОКАЛЬНО:\n"
 
-#: lib/diff.tcl:135
+#: lib/diff.tcl:140
 msgid "REMOTE:\n"
 msgstr "ВНЕШНИЙ:\n"
 
-#: lib/diff.tcl:197 lib/diff.tcl:296
+#: lib/diff.tcl:202 lib/diff.tcl:319
 #, tcl-format
 msgid "Unable to display %s"
 msgstr "Не могу показать %s"
 
-#: lib/diff.tcl:198
+#: lib/diff.tcl:203
 msgid "Error loading file:"
 msgstr "Ошибка загрузки файла:"
 
-#: lib/diff.tcl:205
+#: lib/diff.tcl:210
 msgid "Git Repository (subproject)"
 msgstr "Репозиторий Git (подпроект)"
 
-#: lib/diff.tcl:217
+#: lib/diff.tcl:222
 msgid "* Binary file (not showing content)."
 msgstr "* Двоичный файл (содержимое не показано)"
 
-#: lib/diff.tcl:222
+#: lib/diff.tcl:227
 #, tcl-format
 msgid ""
 "* Untracked file is %d bytes.\n"
 "* Showing only first %d bytes.\n"
 msgstr ""
-"* Размер неподготовленого файла %d байт.\n"
+"* Ð Ð°Ð·Ð¼ÐµÑ\80 Ð½ÐµÐ¿Ð¾Ð´Ð³Ð¾Ñ\82овленного Ñ\84айла %d Ð±Ð°Ð¹Ñ\82.\n"
 "* Показано первых %d байт.\n"
 
-#: lib/diff.tcl:228
+#: lib/diff.tcl:233
 #, tcl-format
 msgid ""
 "\n"
@@ -1610,22 +1643,22 @@ msgid ""
 "* To see the entire file, use an external editor.\n"
 msgstr ""
 "\n"
-"* Неподготовленый файл обрезан: %s.\n"
+"* Неподготовленный файл обрезан: %s.\n"
 "* Чтобы увидеть весь файл, используйте программу-редактор.\n"
 
-#: lib/diff.tcl:436
+#: lib/diff.tcl:482
 msgid "Failed to unstage selected hunk."
 msgstr "Не удалось исключить выбранную часть."
 
-#: lib/diff.tcl:443
+#: lib/diff.tcl:489
 msgid "Failed to stage selected hunk."
 msgstr "Не удалось подготовить к сохранению выбранную часть."
 
-#: lib/diff.tcl:509
+#: lib/diff.tcl:568
 msgid "Failed to unstage selected line."
 msgstr "Не удалось исключить выбранную строку."
 
-#: lib/diff.tcl:517
+#: lib/diff.tcl:576
 msgid "Failed to stage selected line."
 msgstr "Не удалось подготовить к сохранению выбранную строку."
 
@@ -1662,15 +1695,15 @@ msgstr "Не удалось разблокировать индекс"
 msgid "Index Error"
 msgstr "Ошибка в индексе"
 
-#: lib/index.tcl:21
+#: lib/index.tcl:17
 msgid ""
 "Updating the Git index failed.  A rescan will be automatically started to "
 "resynchronize git-gui."
 msgstr ""
-"Не удалось обновить индекс Git. Состояние репозитория будетперечитано "
+"Не удалось обновить индекс Git. Состояние репозитория будет перечитано "
 "автоматически."
 
-#: lib/index.tcl:27
+#: lib/index.tcl:28
 msgid "Continue"
 msgstr "Продолжить"
 
@@ -1678,45 +1711,45 @@ msgstr "Продолжить"
 msgid "Unlock Index"
 msgstr "Разблокировать индекс"
 
-#: lib/index.tcl:287
+#: lib/index.tcl:289
 #, tcl-format
 msgid "Unstaging %s from commit"
 msgstr "Удаление %s из подготовленного"
 
-#: lib/index.tcl:326
+#: lib/index.tcl:328
 msgid "Ready to commit."
 msgstr "Подготовлено для сохранения"
 
-#: lib/index.tcl:339
+#: lib/index.tcl:341
 #, tcl-format
 msgid "Adding %s"
 msgstr "Добавление %s..."
 
-#: lib/index.tcl:396
+#: lib/index.tcl:398
 #, tcl-format
 msgid "Revert changes in file %s?"
 msgstr "Отменить изменения в файле %s?"
 
-#: lib/index.tcl:398
+#: lib/index.tcl:400
 #, tcl-format
 msgid "Revert changes in these %i files?"
 msgstr "Отменить изменения в %i файле(-ах)?"
 
-#: lib/index.tcl:406
+#: lib/index.tcl:408
 msgid "Any unstaged changes will be permanently lost by the revert."
 msgstr ""
 "Любые изменения, не подготовленные к сохранению, будут потеряны при данной "
 "операции."
 
-#: lib/index.tcl:409
+#: lib/index.tcl:411
 msgid "Do Nothing"
 msgstr "Ничего не делать"
 
-#: lib/index.tcl:427
+#: lib/index.tcl:429
 msgid "Reverting selected files"
-msgstr "Удаление изменений в выбраных файлах"
+msgstr "Удаление изменений в выбранных файлах"
 
-#: lib/index.tcl:431
+#: lib/index.tcl:433
 #, tcl-format
 msgid "Reverting %s"
 msgstr "Отмена изменений в %s"
@@ -1778,7 +1811,7 @@ msgstr ""
 "\n"
 "Файл %s изменен.\n"
 "\n"
-"Подготовьте и сохраните измения перед началом слияния. В случае "
+"Ð\9fодгоÑ\82овÑ\8cÑ\82е Ð¸ Ñ\81оÑ\85Ñ\80аниÑ\82е Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ\8f Ð¿ÐµÑ\80ед Ð½Ð°Ñ\87алом Ñ\81лиÑ\8fниÑ\8f. Ð\92 Ñ\81лÑ\83Ñ\87ае "
 "необходимости это позволит прервать операцию слияния.\n"
 
 #: lib/merge.tcl:107
@@ -1893,7 +1926,7 @@ msgstr ""
 #, tcl-format
 msgid "File %s seems to have unresolved conflicts, still stage?"
 msgstr ""
-"Файл %s кажется содержит необработаные конфликты. Продолжить подготовку к "
+"Файл %s, похоже, содержит необработанные конфликты. Продолжить подготовку к "
 "сохранению?"
 
 #: lib/mergetool.tcl:60
@@ -2152,7 +2185,7 @@ msgstr "Получение %s"
 #: lib/remote_add.tcl:157
 #, tcl-format
 msgid "Do not know how to initialize repository at location '%s'."
-msgstr "Невозможно инициалировать репозиторий в '%s'."
+msgstr "Невозможно инициализировать репозиторий в '%s'."
 
 #: lib/remote_add.tcl:163 lib/transport.tcl:25 lib/transport.tcl:63
 #: lib/transport.tcl:81
@@ -2179,7 +2212,7 @@ msgstr "внешний:"
 
 #: lib/remote_branch_delete.tcl:66 lib/transport.tcl:149
 msgid "Arbitrary Location:"
-msgstr "Указаное положение:"
+msgstr "Указанное Ð¿Ð¾Ð»Ð¾Ð¶ÐµÐ½Ð¸Ðµ:"
 
 #: lib/remote_branch_delete.tcl:84
 msgid "Branches"
@@ -2193,10 +2226,6 @@ msgstr "Удалить только в случае, если"
 msgid "Merged Into:"
 msgstr "Слияние с:"
 
-#: lib/remote_branch_delete.tcl:119
-msgid "Always (Do not perform merge checks)"
-msgstr "Всегда (не выполнять проверку на слияние)"
-
 #: lib/remote_branch_delete.tcl:152
 msgid "A branch is required for 'Merged Into'."
 msgstr "Для опции 'Слияние с' требуется указать ветвь."
@@ -2225,26 +2254,16 @@ msgstr ""
 msgid "Please select one or more branches to delete."
 msgstr "Укажите одну или несколько ветвей для удаления."
 
-#: lib/remote_branch_delete.tcl:216
-msgid ""
-"Recovering deleted branches is difficult.\n"
-"\n"
-"Delete the selected branches?"
-msgstr ""
-"Восстановить удаленные ветви сложно.\n"
-"\n"
-"Продолжить?"
-
 #: lib/remote_branch_delete.tcl:226
 #, tcl-format
 msgid "Deleting branches from %s"
 msgstr "Удаление ветвей из %s"
 
-#: lib/remote_branch_delete.tcl:286
+#: lib/remote_branch_delete.tcl:292
 msgid "No repository selected."
 msgstr "Не указан репозиторий."
 
-#: lib/remote_branch_delete.tcl:291
+#: lib/remote_branch_delete.tcl:297
 #, tcl-format
 msgid "Scanning %s..."
 msgstr "Перечитывание %s... "
@@ -2265,11 +2284,11 @@ msgstr "Обратно"
 msgid "Case-Sensitive"
 msgstr "Игн. большие/маленькие"
 
-#: lib/shortcut.tcl:20 lib/shortcut.tcl:61
+#: lib/shortcut.tcl:21 lib/shortcut.tcl:62
 msgid "Cannot write shortcut:"
 msgstr "Невозможно записать ссылку:"
 
-#: lib/shortcut.tcl:136
+#: lib/shortcut.tcl:137
 msgid "Cannot write icon:"
 msgstr "Невозможно записать значок:"
 
@@ -2292,11 +2311,11 @@ msgstr "Словарь вернут к %s."
 
 #: lib/spellcheck.tcl:73
 msgid "Spell checker silently failed on startup"
-msgstr "Программа проверки правописания не смогла запустится"
+msgstr "Ð\9fÑ\80огÑ\80амма Ð¿Ñ\80овеÑ\80ки Ð¿Ñ\80авопиÑ\81аниÑ\8f Ð½Ðµ Ñ\81могла Ð·Ð°Ð¿Ñ\83Ñ\81Ñ\82иÑ\82Ñ\8cÑ\81Ñ\8f"
 
 #: lib/spellcheck.tcl:80
 msgid "Unrecognized spell checker"
-msgstr "Нераспознаная программа проверки правописания"
+msgstr "Ð\9dеÑ\80аÑ\81познаннаÑ\8f Ð¿Ñ\80огÑ\80амма Ð¿Ñ\80овеÑ\80ки Ð¿Ñ\80авопиÑ\81аниÑ\8f"
 
 #: lib/spellcheck.tcl:186
 msgid "No Suggestions"
@@ -2412,7 +2431,7 @@ msgstr "Описание вспомогательной операции"
 
 #: lib/tools_dlg.tcl:48
 msgid "Use '/' separators to create a submenu tree:"
-msgstr "Испольуйте '/' для создания подменю"
+msgstr "Используйте '/' для создания подменю"
 
 #: lib/tools_dlg.tcl:61
 msgid "Command:"
index 10fcebb119ce2af81527aa3c24a9b7c3ab3b3e7f..8bfa8a055ccd0c344d595f112b571bb3d6e21c28 100755 (executable)
@@ -558,12 +558,14 @@ my \$app = builder {
 
 # make it runnable as standalone app,
 # like it would be run via 'plackup' utility
-if (__FILE__ eq \$0) {
+if (caller) {
+       return \$app;
+} else {
        require Plack::Runner;
 
        my \$runner = Plack::Runner->new();
        \$runner->parse_options(qw(--env deployment --port $port),
-                              "$local" ? qw(--host 127.0.0.1) : ());
+                               "$local" ? qw(--host 127.0.0.1) : ());
        \$runner->run(\$app);
 }
 __END__
index 78ce49e9846e908e0d5b262e2a12c2308ed8ac88..fb3f52ba2507b4fb78db150b5c183f24bd2c57c1 100644 (file)
@@ -10,17 +10,20 @@ merge_mode() {
 
 translate_merge_tool_path () {
        case "$1" in
-       vimdiff|vimdiff2)
-               echo vim
+       araxis)
+               echo compare
                ;;
-       gvimdiff|gvimdiff2)
-               echo gvim
+       bc3)
+               echo bcompare
                ;;
        emerge)
                echo emacs
                ;;
-       araxis)
-               echo compare
+       gvimdiff|gvimdiff2)
+               echo gvim
+               ;;
+       vimdiff|vimdiff2)
+               echo vim
                ;;
        *)
                echo "$1"
@@ -46,17 +49,16 @@ check_unchanged () {
 
 valid_tool () {
        case "$1" in
-       kdiff3 | tkdiff | xxdiff | meld | opendiff | \
-       vimdiff | gvimdiff | vimdiff2 | gvimdiff2 | \
-       emerge | ecmerge | diffuse | araxis | p4merge)
+       araxis | bc3 | diffuse | ecmerge | emerge | gvimdiff | gvimdiff2 | \
+       kdiff3 | meld | opendiff | p4merge | tkdiff | vimdiff | vimdiff2 | xxdiff)
                ;; # happy
-       tortoisemerge)
-               if ! merge_mode; then
+       kompare)
+               if ! diff_mode; then
                        return 1
                fi
                ;;
-       kompare)
-               if ! diff_mode; then
+       tortoisemerge)
+               if ! merge_mode; then
                        return 1
                fi
                ;;
@@ -89,88 +91,91 @@ run_merge_tool () {
        status=0
 
        case "$1" in
-       kdiff3)
+       araxis)
                if merge_mode; then
+                       touch "$BACKUP"
                        if $base_present; then
-                               ("$merge_tool_path" --auto \
-                                       --L1 "$MERGED (Base)" \
-                                       --L2 "$MERGED (Local)" \
-                                       --L3 "$MERGED (Remote)" \
-                                       -o "$MERGED" \
-                                       "$BASE" "$LOCAL" "$REMOTE" \
-                               > /dev/null 2>&1)
+                               "$merge_tool_path" -wait -merge -3 -a1 \
+                                       "$BASE" "$LOCAL" "$REMOTE" "$MERGED" \
+                                       >/dev/null 2>&1
                        else
-                               ("$merge_tool_path" --auto \
-                                       --L1 "$MERGED (Local)" \
-                                       --L2 "$MERGED (Remote)" \
-                                       -o "$MERGED" \
-                                       "$LOCAL" "$REMOTE" \
-                               > /dev/null 2>&1)
+                               "$merge_tool_path" -wait -2 \
+                                       "$LOCAL" "$REMOTE" "$MERGED" \
+                                       >/dev/null 2>&1
                        fi
-                       status=$?
+                       check_unchanged
                else
-                       ("$merge_tool_path" --auto \
-                               --L1 "$MERGED (A)" \
-                               --L2 "$MERGED (B)" "$LOCAL" "$REMOTE" \
-                       > /dev/null 2>&1)
+                       "$merge_tool_path" -wait -2 "$LOCAL" "$REMOTE" \
+                               >/dev/null 2>&1
                fi
                ;;
-       kompare)
-               "$merge_tool_path" "$LOCAL" "$REMOTE"
-               ;;
-       tkdiff)
+       bc3)
                if merge_mode; then
+                       touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" -a "$BASE" \
-                                       -o "$MERGED" "$LOCAL" "$REMOTE"
+                               "$merge_tool_path" "$LOCAL" "$REMOTE" "$BASE" \
+                                       -mergeoutput="$MERGED"
                        else
-                               "$merge_tool_path" \
-                                       -o "$MERGED" "$LOCAL" "$REMOTE"
+                               "$merge_tool_path" "$LOCAL" "$REMOTE" \
+                                       -mergeoutput="$MERGED"
                        fi
-                       status=$?
+                       check_unchanged
                else
                        "$merge_tool_path" "$LOCAL" "$REMOTE"
                fi
                ;;
-       p4merge)
+       diffuse)
                if merge_mode; then
-                   touch "$BACKUP"
+                       touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
+                               "$merge_tool_path" \
+                                       "$LOCAL" "$MERGED" "$REMOTE" \
+                                       "$BASE" | cat
                        else
-                               "$merge_tool_path" "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"
+                               "$merge_tool_path" \
+                                       "$LOCAL" "$MERGED" "$REMOTE" | cat
                        fi
                        check_unchanged
                else
-                       "$merge_tool_path" "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
                fi
                ;;
-       meld)
+       ecmerge)
                if merge_mode; then
                        touch "$BACKUP"
-                       "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
+                       if $base_present; then
+                               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" \
+                                       --default --mode=merge3 --to="$MERGED"
+                       else
+                               "$merge_tool_path" "$LOCAL" "$REMOTE" \
+                                       --default --mode=merge2 --to="$MERGED"
+                       fi
                        check_unchanged
                else
-                       "$merge_tool_path" "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" --default --mode=diff2 \
+                               "$LOCAL" "$REMOTE"
                fi
                ;;
-       diffuse)
+       emerge)
                if merge_mode; then
-                       touch "$BACKUP"
                        if $base_present; then
                                "$merge_tool_path" \
-                                       "$LOCAL" "$MERGED" "$REMOTE" \
-                                       "$BASE" | cat
+                                       -f emerge-files-with-ancestor-command \
+                                       "$LOCAL" "$REMOTE" "$BASE" \
+                                       "$(basename "$MERGED")"
                        else
                                "$merge_tool_path" \
-                                       "$LOCAL" "$MERGED" "$REMOTE" | cat
+                                       -f emerge-files-command \
+                                       "$LOCAL" "$REMOTE" \
+                                       "$(basename "$MERGED")"
                        fi
-                       check_unchanged
+                       status=$?
                else
-                       "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
+                       "$merge_tool_path" -f emerge-files-command \
+                               "$LOCAL" "$REMOTE"
                fi
                ;;
-       vimdiff|gvimdiff)
+       gvimdiff|vimdiff)
                if merge_mode; then
                        touch "$BACKUP"
                        if $base_present; then
@@ -186,7 +191,7 @@ run_merge_tool () {
                                "$LOCAL" "$REMOTE"
                fi
                ;;
-       vimdiff2|gvimdiff2)
+       gvimdiff2|vimdiff2)
                if merge_mode; then
                        touch "$BACKUP"
                        "$merge_tool_path" -f -d -c "wincmd l" \
@@ -197,30 +202,42 @@ run_merge_tool () {
                                "$LOCAL" "$REMOTE"
                fi
                ;;
-       xxdiff)
+       kdiff3)
                if merge_mode; then
-                       touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" -X --show-merged-pane \
-                                       -R 'Accel.SaveAsMerged: "Ctrl-S"' \
-                                       -R 'Accel.Search: "Ctrl+F"' \
-                                       -R 'Accel.SearchForward: "Ctrl-G"' \
-                                       --merged-file "$MERGED" \
-                                       "$LOCAL" "$BASE" "$REMOTE"
+                               ("$merge_tool_path" --auto \
+                                       --L1 "$MERGED (Base)" \
+                                       --L2 "$MERGED (Local)" \
+                                       --L3 "$MERGED (Remote)" \
+                                       -o "$MERGED" \
+                                       "$BASE" "$LOCAL" "$REMOTE" \
+                               > /dev/null 2>&1)
                        else
-                               "$merge_tool_path" -X $extra \
-                                       -R 'Accel.SaveAsMerged: "Ctrl-S"' \
-                                       -R 'Accel.Search: "Ctrl+F"' \
-                                       -R 'Accel.SearchForward: "Ctrl-G"' \
-                                       --merged-file "$MERGED" \
-                                       "$LOCAL" "$REMOTE"
+                               ("$merge_tool_path" --auto \
+                                       --L1 "$MERGED (Local)" \
+                                       --L2 "$MERGED (Remote)" \
+                                       -o "$MERGED" \
+                                       "$LOCAL" "$REMOTE" \
+                               > /dev/null 2>&1)
                        fi
+                       status=$?
+               else
+                       ("$merge_tool_path" --auto \
+                               --L1 "$MERGED (A)" \
+                               --L2 "$MERGED (B)" "$LOCAL" "$REMOTE" \
+                       > /dev/null 2>&1)
+               fi
+               ;;
+       kompare)
+               "$merge_tool_path" "$LOCAL" "$REMOTE"
+               ;;
+       meld)
+               if merge_mode; then
+                       touch "$BACKUP"
+                       "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
                        check_unchanged
                else
-                       "$merge_tool_path" \
-                               -R 'Accel.Search: "Ctrl+F"' \
-                               -R 'Accel.SearchForward: "Ctrl-G"' \
-                               "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" "$LOCAL" "$REMOTE"
                fi
                ;;
        opendiff)
@@ -239,39 +256,31 @@ run_merge_tool () {
                        "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
                fi
                ;;
-       ecmerge)
+       p4merge)
                if merge_mode; then
-                       touch "$BACKUP"
+                   touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" \
-                                       --default --mode=merge3 --to="$MERGED"
+                               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
                        else
-                               "$merge_tool_path" "$LOCAL" "$REMOTE" \
-                                       --default --mode=merge2 --to="$MERGED"
+                               "$merge_tool_path" "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED"
                        fi
                        check_unchanged
                else
-                       "$merge_tool_path" --default --mode=diff2 \
-                               "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" "$LOCAL" "$REMOTE"
                fi
                ;;
-       emerge)
+       tkdiff)
                if merge_mode; then
                        if $base_present; then
-                               "$merge_tool_path" \
-                                       -f emerge-files-with-ancestor-command \
-                                       "$LOCAL" "$REMOTE" "$BASE" \
-                                       "$(basename "$MERGED")"
+                               "$merge_tool_path" -a "$BASE" \
+                                       -o "$MERGED" "$LOCAL" "$REMOTE"
                        else
                                "$merge_tool_path" \
-                                       -f emerge-files-command \
-                                       "$LOCAL" "$REMOTE" \
-                                       "$(basename "$MERGED")"
+                                       -o "$MERGED" "$LOCAL" "$REMOTE"
                        fi
                        status=$?
                else
-                       "$merge_tool_path" -f emerge-files-command \
-                               "$LOCAL" "$REMOTE"
+                       "$merge_tool_path" "$LOCAL" "$REMOTE"
                fi
                ;;
        tortoisemerge)
@@ -286,22 +295,30 @@ run_merge_tool () {
                        status=1
                fi
                ;;
-       araxis)
+       xxdiff)
                if merge_mode; then
                        touch "$BACKUP"
                        if $base_present; then
-                               "$merge_tool_path" -wait -merge -3 -a1 \
-                                       "$BASE" "$LOCAL" "$REMOTE" "$MERGED" \
-                                       >/dev/null 2>&1
+                               "$merge_tool_path" -X --show-merged-pane \
+                                       -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+                                       -R 'Accel.Search: "Ctrl+F"' \
+                                       -R 'Accel.SearchForward: "Ctrl-G"' \
+                                       --merged-file "$MERGED" \
+                                       "$LOCAL" "$BASE" "$REMOTE"
                        else
-                               "$merge_tool_path" -wait -2 \
-                                       "$LOCAL" "$REMOTE" "$MERGED" \
-                                       >/dev/null 2>&1
+                               "$merge_tool_path" -X $extra \
+                                       -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+                                       -R 'Accel.Search: "Ctrl+F"' \
+                                       -R 'Accel.SearchForward: "Ctrl-G"' \
+                                       --merged-file "$MERGED" \
+                                       "$LOCAL" "$REMOTE"
                        fi
                        check_unchanged
                else
-                       "$merge_tool_path" -wait -2 "$LOCAL" "$REMOTE" \
-                               >/dev/null 2>&1
+                       "$merge_tool_path" \
+                               -R 'Accel.Search: "Ctrl+F"' \
+                               -R 'Accel.SearchForward: "Ctrl-G"' \
+                               "$LOCAL" "$REMOTE"
                fi
                ;;
        *)
@@ -343,7 +360,7 @@ guess_merge_tool () {
                else
                        tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
                fi
-               tools="$tools gvimdiff diffuse ecmerge p4merge araxis"
+               tools="$tools gvimdiff diffuse ecmerge p4merge araxis bc3"
        fi
        case "${VISUAL:-$EDITOR}" in
        *vim*)
index 2f8dc441c6d575323f2fad920ecdb7b20e1445e6..bacbda2bb75854235b912903c7e45fc94d38e719 100755 (executable)
@@ -269,7 +269,7 @@ rerere=false
 files_to_merge() {
     if test "$rerere" = true
     then
-       git rerere status
+       git rerere remaining
     else
        git ls-files -u | sed -e 's/^[^ ]*      //' | sort -u
     fi
index d3782d9559af8a0b99262d37f99b6035bd69e320..ea093d251d98af6a3d4df19e900d56df34d51572 100644 (file)
@@ -4,59 +4,9 @@
 # this would fail in that case and would issue an error message.
 GIT_DIR=$(git rev-parse -q --git-dir) || :;
 
-get_data_source () {
-       case "$1" in
-       */*)
-               echo ''
-               ;;
-       .)
-               echo self
-               ;;
-       *)
-               if test "$(git config --get "remote.$1.url")"
-               then
-                       echo config
-               elif test -f "$GIT_DIR/remotes/$1"
-               then
-                       echo remotes
-               elif test -f "$GIT_DIR/branches/$1"
-               then
-                       echo branches
-               else
-                       echo ''
-               fi ;;
-       esac
-}
-
-get_remote_url () {
-       data_source=$(get_data_source "$1")
-       case "$data_source" in
-       '')
-               echo "$1"
-               ;;
-       self)
-               echo "$1"
-               ;;
-       config)
-               git config --get "remote.$1.url"
-               ;;
-       remotes)
-               sed -ne '/^URL: */{
-                       s///p
-                       q
-               }' "$GIT_DIR/remotes/$1"
-               ;;
-       branches)
-               sed -e 's/#.*//' "$GIT_DIR/branches/$1"
-               ;;
-       *)
-               die "internal error: get-remote-url $1" ;;
-       esac
-}
-
 get_default_remote () {
        curr_branch=$(git symbolic-ref -q HEAD)
-       curr_branch="${cur_branch#refs/heads/}"
+       curr_branch="${curr_branch#refs/heads/}"
        origin=$(git config --get "branch.$curr_branch.remote")
        echo ${origin:-origin}
 }
index f6b7b8404896c15487044bcfaa64f758faeeef06..e31226b62fb8b50d918b1e418bb1607f24070bd0 100755 (executable)
@@ -53,6 +53,8 @@ do
                verbosity="$verbosity -v" ;;
        --progress)
                progress=--progress ;;
+       --no-progress)
+               progress=--no-progress ;;
        -n|--no-stat|--no-summary)
                diffstat=--no-stat ;;
        --stat|--summary)
@@ -272,7 +274,7 @@ esac
 if test -z "$orig_head"
 then
        git update-ref -m "initial pull" HEAD $merge_head "$curr_head" &&
-       git read-tree --reset -u HEAD || exit 1
+       git read-tree -m -u HEAD || exit 1
        exit
 fi
 
@@ -293,8 +295,8 @@ true)
        ;;
 *)
        eval="git-merge $diffstat $no_commit $squash $no_ff $ff_only"
-       eval="$eval  $log_arg $strategy_args $merge_args"
-       eval="$eval \"\$merge_name\" HEAD $merge_head $verbosity"
+       eval="$eval  $log_arg $strategy_args $merge_args $verbosity $progress"
+       eval="$eval \"\$merge_name\" HEAD $merge_head"
        ;;
 esac
 eval "exec $eval"
index 6fdea397ddec3cfa4ff37cdf672e7cced840bb60..fc080cc5e45d02e618e7224c052de1be676f4360 100755 (executable)
@@ -15,7 +15,6 @@ p    show patch text as well
 '
 
 . git-sh-setup
-. git-parse-remote
 
 GIT_PAGER=
 export GIT_PAGER
@@ -55,7 +54,7 @@ branch=$(git ls-remote "$url" \
                p
                q
        }")
-url=$(get_remote_url "$url")
+url=$(git ls-remote --get-url "$url")
 if [ -z "$branch" ]; then
        echo "warn: No branch of $url is at:" >&2
        git log --max-count=1 --pretty='tformat:warn:   %h: %s' $headrev >&2
index 7561b374d2ec90fe774e98e39a121a1a3a3cdfa9..a305fb19f11bc4ae80e585b102ecb5d982d1a0f5 100755 (executable)
@@ -12,12 +12,14 @@ USAGE="list [<options>]
 
 SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
+START_DIR=`pwd`
 . git-sh-setup
 require_work_tree
 cd_to_toplevel
 
 TMP="$GIT_DIR/.git-stash.$$"
-trap 'rm -f "$TMP-*"' 0
+TMPindex=${GIT_INDEX_FILE-"$GIT_DIR/index"}.stash.$$
+trap 'rm -f "$TMP-"* "$TMPindex"' 0
 
 ref_stash=refs/stash
 
@@ -81,14 +83,12 @@ create_stash () {
 
                # state of the working tree
                w_tree=$( (
-                       rm -f "$TMP-index" &&
-                       cp -p ${GIT_INDEX_FILE-"$GIT_DIR/index"} "$TMP-index" &&
-                       GIT_INDEX_FILE="$TMP-index" &&
+                       git read-tree --index-output="$TMPindex" -m $i_tree &&
+                       GIT_INDEX_FILE="$TMPindex" &&
                        export GIT_INDEX_FILE &&
-                       git read-tree -m $i_tree &&
                        git diff --name-only -z HEAD | git update-index -z --add --remove --stdin &&
                        git write-tree &&
-                       rm -f "$TMP-index"
+                       rm -f "$TMPindex"
                ) ) ||
                        die "Cannot save the current worktree state"
 
@@ -394,7 +394,7 @@ apply_stash () {
                then
                        squelch='>/dev/null 2>&1'
                fi
-               eval "git status $squelch" || :
+               (cd "$START_DIR" && eval "git status $squelch") || :
        else
                # Merge conflict; keep the exit status from merge-recursive
                status=$?
index 177dd259cd53cde017d73db5ccbecc7ed7dfa573..a5857c1ad45b0462f168a4b3b9249ed8c3cf6e89 100755 (executable)
@@ -5734,7 +5734,7 @@ sub cmd_show_log {
        my (@k, $c, $d, $stat);
        my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
        while (<$log>) {
-               if (/^${esc_color}commit -?($::sha1_short)/o) {
+               if (/^${esc_color}commit (- )?($::sha1_short)/o) {
                        my $cmt = $1;
                        if ($c && cmt_showable($c) && $c->{r} != $r_last) {
                                $r_last = $c->{r};
diff --git a/git.c b/git.c
index 68334f6a3134bb76a8ffc59e4da773400c59a388..ef598c3e7053b8dd2859f4d582ce2917a804fe42 100644 (file)
--- a/git.c
+++ b/git.c
@@ -177,24 +177,24 @@ static int handle_alias(int *argcp, const char ***argv)
        alias_string = alias_lookup(alias_command);
        if (alias_string) {
                if (alias_string[0] == '!') {
+                       const char **alias_argv;
+                       int argc = *argcp, i;
+
                        commit_pager_choice();
-                       if (*argcp > 1) {
-                               struct strbuf buf;
-
-                               strbuf_init(&buf, PATH_MAX);
-                               strbuf_addstr(&buf, alias_string);
-                               sq_quote_argv(&buf, (*argv) + 1, PATH_MAX);
-                               free(alias_string);
-                               alias_string = buf.buf;
-                       }
-                       trace_printf("trace: alias to shell cmd: %s => %s\n",
-                                    alias_command, alias_string + 1);
-                       ret = system(alias_string + 1);
-                       if (ret >= 0 && WIFEXITED(ret) &&
-                           WEXITSTATUS(ret) != 127)
-                               exit(WEXITSTATUS(ret));
-                       die("Failed to run '%s' when expanding alias '%s'",
-                           alias_string + 1, alias_command);
+
+                       /* build alias_argv */
+                       alias_argv = xmalloc(sizeof(*alias_argv) * (argc + 1));
+                       alias_argv[0] = alias_string + 1;
+                       for (i = 1; i < argc; ++i)
+                               alias_argv[i] = (*argv)[i];
+                       alias_argv[argc] = NULL;
+
+                       ret = run_command_v_opt(alias_argv, RUN_USING_SHELL);
+                       if (ret >= 0)   /* normal exit */
+                               exit(ret);
+
+                       die_errno("While expanding alias '%s': '%s'",
+                           alias_command, alias_string + 1);
                }
                count = split_cmdline(alias_string, &new_argv);
                if (count < 0)
@@ -313,7 +313,6 @@ static void handle_internal_command(int argc, const char **argv)
        const char *cmd = argv[0];
        static struct cmd_struct commands[] = {
                { "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
-               { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
                { "annotate", cmd_annotate, RUN_SETUP },
                { "apply", cmd_apply, RUN_SETUP_GENTLY },
                { "archive", cmd_archive },
@@ -322,15 +321,15 @@ static void handle_internal_command(int argc, const char **argv)
                { "branch", cmd_branch, RUN_SETUP },
                { "bundle", cmd_bundle, RUN_SETUP_GENTLY },
                { "cat-file", cmd_cat_file, RUN_SETUP },
+               { "check-attr", cmd_check_attr, RUN_SETUP },
+               { "check-ref-format", cmd_check_ref_format },
                { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
                { "checkout-index", cmd_checkout_index,
                        RUN_SETUP | NEED_WORK_TREE},
-               { "check-ref-format", cmd_check_ref_format },
-               { "check-attr", cmd_check_attr, RUN_SETUP },
                { "cherry", cmd_cherry, RUN_SETUP },
                { "cherry-pick", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },
-               { "clone", cmd_clone },
                { "clean", cmd_clean, RUN_SETUP | NEED_WORK_TREE },
+               { "clone", cmd_clone },
                { "commit", cmd_commit, RUN_SETUP | NEED_WORK_TREE },
                { "commit-tree", cmd_commit_tree, RUN_SETUP },
                { "config", cmd_config, RUN_SETUP_GENTLY },
@@ -358,8 +357,8 @@ static void handle_internal_command(int argc, const char **argv)
                { "init-db", cmd_init_db },
                { "log", cmd_log, RUN_SETUP },
                { "ls-files", cmd_ls_files, RUN_SETUP },
-               { "ls-tree", cmd_ls_tree, RUN_SETUP },
                { "ls-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
+               { "ls-tree", cmd_ls_tree, RUN_SETUP },
                { "mailinfo", cmd_mailinfo },
                { "mailsplit", cmd_mailsplit },
                { "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE },
@@ -379,6 +378,7 @@ static void handle_internal_command(int argc, const char **argv)
                { "notes", cmd_notes, RUN_SETUP },
                { "pack-objects", cmd_pack_objects, RUN_SETUP },
                { "pack-redundant", cmd_pack_redundant, RUN_SETUP },
+               { "pack-refs", cmd_pack_refs, RUN_SETUP },
                { "patch-id", cmd_patch_id },
                { "peek-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
                { "pickaxe", cmd_blame, RUN_SETUP },
@@ -392,7 +392,7 @@ static void handle_internal_command(int argc, const char **argv)
                { "remote-ext", cmd_remote_ext },
                { "remote-fd", cmd_remote_fd },
                { "replace", cmd_replace, RUN_SETUP },
-               { "repo-config", cmd_config, RUN_SETUP_GENTLY },
+               { "repo-config", cmd_repo_config, RUN_SETUP_GENTLY },
                { "rerere", cmd_rerere, RUN_SETUP },
                { "reset", cmd_reset, RUN_SETUP },
                { "rev-list", cmd_rev_list, RUN_SETUP },
@@ -401,8 +401,10 @@ static void handle_internal_command(int argc, const char **argv)
                { "rm", cmd_rm, RUN_SETUP },
                { "send-pack", cmd_send_pack, RUN_SETUP },
                { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
-               { "show-branch", cmd_show_branch, RUN_SETUP },
                { "show", cmd_show, RUN_SETUP },
+               { "show-branch", cmd_show_branch, RUN_SETUP },
+               { "show-ref", cmd_show_ref, RUN_SETUP },
+               { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
                { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
                { "stripspace", cmd_stripspace },
                { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
@@ -415,13 +417,11 @@ static void handle_internal_command(int argc, const char **argv)
                { "update-server-info", cmd_update_server_info, RUN_SETUP },
                { "upload-archive", cmd_upload_archive },
                { "var", cmd_var, RUN_SETUP_GENTLY },
+               { "verify-pack", cmd_verify_pack },
                { "verify-tag", cmd_verify_tag, RUN_SETUP },
                { "version", cmd_version },
                { "whatchanged", cmd_whatchanged, RUN_SETUP },
                { "write-tree", cmd_write_tree, RUN_SETUP },
-               { "verify-pack", cmd_verify_pack },
-               { "show-ref", cmd_show_ref, RUN_SETUP },
-               { "pack-refs", cmd_pack_refs, RUN_SETUP },
        };
        int i;
        static const char ext[] = STRIP_EXTENSION;
index 46186ab909ebe12a659bda7690ee5511a2cf7794..ee69ea683aedf81cd6e6eec0f500bddf2ff54450 100755 (executable)
@@ -1199,11 +1199,15 @@ if (defined caller) {
 # -full => 0|1      - use absolute/full URL ($my_uri/$my_url as base)
 # -replay => 1      - start from a current view (replay with modifications)
 # -path_info => 0|1 - don't use/use path_info URL (if possible)
+# -anchor => ANCHOR - add #ANCHOR to end of URL, implies -replay if used alone
 sub href {
        my %params = @_;
        # default is to use -absolute url() i.e. $my_uri
        my $href = $params{-full} ? $my_url : $my_uri;
 
+       # implicit -replay, must be first of implicit params
+       $params{-replay} = 1 if (keys %params == 1 && $params{-anchor});
+
        $params{'project'} = $project unless exists $params{'project'};
 
        if ($params{-replay}) {
@@ -1314,6 +1318,10 @@ sub href {
        # final transformation: trailing spaces must be escaped (URI-encoded)
        $href =~ s/(\s+)$/CGI::escape($1)/e;
 
+       if ($params{-anchor}) {
+               $href .= "#".esc_param($params{-anchor});
+       }
+
        return $href;
 }
 
@@ -4337,7 +4345,8 @@ sub git_difftree_body {
                                # link to patch
                                $patchno++;
                                print "<td class=\"link\">" .
-                                     $cgi->a({-href => "#patch$patchno"}, "patch") .
+                                     $cgi->a({-href => href(-anchor=>"patch$patchno")},
+                                             "patch") .
                                      " | " .
                                      "</td>\n";
                        }
@@ -4434,8 +4443,9 @@ sub git_difftree_body {
                        if ($action eq 'commitdiff') {
                                # link to patch
                                $patchno++;
-                               print $cgi->a({-href => "#patch$patchno"}, "patch");
-                               print " | ";
+                               print $cgi->a({-href => href(-anchor=>"patch$patchno")},
+                                             "patch") .
+                                     " | ";
                        }
                        print $cgi->a({-href => href(action=>"blob", hash=>$diff->{'to_id'},
                                                     hash_base=>$hash, file_name=>$diff->{'file'})},
@@ -4454,8 +4464,9 @@ sub git_difftree_body {
                        if ($action eq 'commitdiff') {
                                # link to patch
                                $patchno++;
-                               print $cgi->a({-href => "#patch$patchno"}, "patch");
-                               print " | ";
+                               print $cgi->a({-href => href(-anchor=>"patch$patchno")},
+                                             "patch") .
+                                     " | ";
                        }
                        print $cgi->a({-href => href(action=>"blob", hash=>$diff->{'from_id'},
                                                     hash_base=>$parent, file_name=>$diff->{'file'})},
@@ -4496,7 +4507,8 @@ sub git_difftree_body {
                        if ($action eq 'commitdiff') {
                                # link to patch
                                $patchno++;
-                               print $cgi->a({-href => "#patch$patchno"}, "patch") .
+                               print $cgi->a({-href => href(-anchor=>"patch$patchno")},
+                                             "patch") .
                                      " | ";
                        } elsif ($diff->{'to_id'} ne $diff->{'from_id'}) {
                                # "commit" view and modified file (not onlu mode changed)
@@ -4541,7 +4553,8 @@ sub git_difftree_body {
                        if ($action eq 'commitdiff') {
                                # link to patch
                                $patchno++;
-                               print $cgi->a({-href => "#patch$patchno"}, "patch") .
+                               print $cgi->a({-href => href(-anchor=>"patch$patchno")},
+                                             "patch") .
                                      " | ";
                        } elsif ($diff->{'to_id'} ne $diff->{'from_id'}) {
                                # "commit" view and modified file (not only pure rename or copy)
diff --git a/graph.c b/graph.c
index f1a63c2241a30cce0141b87b5e8005b1a899a8ef..ef2e24e85a41dc97cf00bb7b19985ec01b8662bf 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -798,22 +798,9 @@ static void graph_output_commit_char(struct git_graph *graph, struct strbuf *sb)
        }
 
        /*
-        * If revs->left_right is set, print '<' for commits that
-        * come from the left side, and '>' for commits from the right
-        * side.
+        * get_revision_mark() handles all other cases without assert()
         */
-       if (graph->revs && graph->revs->left_right) {
-               if (graph->commit->object.flags & SYMMETRIC_LEFT)
-                       strbuf_addch(sb, '<');
-               else
-                       strbuf_addch(sb, '>');
-               return;
-       }
-
-       /*
-        * Print '*' in all other cases
-        */
-       strbuf_addch(sb, '*');
+       strbuf_addstr(sb, get_revision_mark(graph->revs, graph->commit));
 }
 
 /*
index 923904f97f9274d09a0a0b08543492f78a141f79..3af4c71bd0fb8370c6f08b0e3d43adc722cac2f4 100644 (file)
@@ -8,7 +8,6 @@ static const char http_fetch_usage[] = "git http-fetch "
 
 int main(int argc, const char **argv)
 {
-       const char *prefix;
        struct walker *walker;
        int commits_on_stdin = 0;
        int commits;
@@ -60,7 +59,7 @@ int main(int argc, const char **argv)
        if (argv[arg])
                str_end_url_with_slash(argv[arg], &url);
 
-       prefix = setup_git_directory();
+       setup_git_directory();
 
        git_config(git_default_config, NULL);
 
index 71506a8dd3ed07fe44c487a644ce9a42b94a7578..9adf4b981953080676aa24907fead1038b920e60 100644 (file)
@@ -1069,7 +1069,7 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
 
        if (srvc->tunnel) {
                const char *argv[] = { srvc->tunnel, NULL };
-               struct child_process tunnel = {0};
+               struct child_process tunnel = {NULL};
 
                imap_info("Starting tunnel '%s'... ", srvc->tunnel);
 
index 8953548c07bb36f20798c7ca344d07960c22618c..838b6a732e4758265432cbc9c8e8fc81568a2b50 100644 (file)
@@ -61,12 +61,15 @@ static void process_tree(struct rev_info *revs,
                         struct tree *tree,
                         show_object_fn show,
                         struct name_path *path,
+                        struct strbuf *base,
                         const char *name)
 {
        struct object *obj = &tree->object;
        struct tree_desc desc;
        struct name_entry entry;
        struct name_path me;
+       int all_interesting = (revs->diffopt.pathspec.nr == 0);
+       int baselen = base->len;
 
        if (!revs->tree_objects)
                return;
@@ -82,13 +85,32 @@ static void process_tree(struct rev_info *revs,
        me.elem = name;
        me.elem_len = strlen(name);
 
+       if (!all_interesting) {
+               strbuf_addstr(base, name);
+               if (base->len)
+                       strbuf_addch(base, '/');
+       }
+
        init_tree_desc(&desc, tree->buffer, tree->size);
 
        while (tree_entry(&desc, &entry)) {
+               if (!all_interesting) {
+                       int showit = tree_entry_interesting(&entry,
+                                                           base, 0,
+                                                           &revs->diffopt.pathspec);
+
+                       if (showit < 0)
+                               break;
+                       else if (!showit)
+                               continue;
+                       else if (showit == 2)
+                               all_interesting = 1;
+               }
+
                if (S_ISDIR(entry.mode))
                        process_tree(revs,
                                     lookup_tree(entry.sha1),
-                                    show, &me, entry.path);
+                                    show, &me, base, entry.path);
                else if (S_ISGITLINK(entry.mode))
                        process_gitlink(revs, entry.sha1,
                                        show, &me, entry.path);
@@ -97,6 +119,7 @@ static void process_tree(struct rev_info *revs,
                                     lookup_blob(entry.sha1),
                                     show, &me, entry.path);
        }
+       strbuf_setlen(base, baselen);
        free(tree->buffer);
        tree->buffer = NULL;
 }
@@ -146,9 +169,16 @@ void traverse_commit_list(struct rev_info *revs,
 {
        int i;
        struct commit *commit;
+       struct strbuf base;
 
+       strbuf_init(&base, PATH_MAX);
        while ((commit = get_revision(revs)) != NULL) {
-               add_pending_tree(revs, commit->tree);
+               /*
+                * an uninteresting boundary commit may not have its tree
+                * parsed yet, but we are not going to show them anyway
+                */
+               if (commit->tree)
+                       add_pending_tree(revs, commit->tree);
                show_commit(commit, data);
        }
        for (i = 0; i < revs->pending.nr; i++) {
@@ -164,7 +194,7 @@ void traverse_commit_list(struct rev_info *revs,
                }
                if (obj->type == OBJ_TREE) {
                        process_tree(revs, (struct tree *)obj, show_object,
-                                    NULL, name);
+                                    NULL, &base, name);
                        continue;
                }
                if (obj->type == OBJ_BLOB) {
@@ -181,4 +211,5 @@ void traverse_commit_list(struct rev_info *revs,
                revs->pending.alloc = 0;
                revs->pending.objects = NULL;
        }
+       strbuf_release(&base);
 }
index b0d74cdddee2407de590cb9f725e8e24093d9d35..c6fb77b26fd88f4edf85a8920a6d72e49551deed 100644 (file)
@@ -164,10 +164,10 @@ static char *unable_to_lock_message(const char *path, int err)
                    "If no other git process is currently running, this probably means a\n"
                    "git process crashed in this repository earlier. Make sure no other git\n"
                    "process is running and remove the file manually to continue.",
-                           make_nonrelative_path(path), strerror(err));
+                           absolute_path(path), strerror(err));
        } else
                strbuf_addf(&buf, "Unable to create '%s.lock': %s",
-                           make_nonrelative_path(path), strerror(err));
+                           absolute_path(path), strerror(err));
        return strbuf_detach(&buf, NULL);
 }
 
index b46ed3baef7d9d9971a3886d700059217fbe974a..2a1e3a94c910cd74e41303d8b7aefa539817c831 100644 (file)
@@ -380,18 +380,8 @@ void show_log(struct rev_info *opt)
        if (!opt->verbose_header) {
                graph_show_commit(opt->graph);
 
-               if (!opt->graph) {
-                       if (commit->object.flags & BOUNDARY)
-                               putchar('-');
-                       else if (commit->object.flags & UNINTERESTING)
-                               putchar('^');
-                       else if (opt->left_right) {
-                               if (commit->object.flags & SYMMETRIC_LEFT)
-                                       putchar('<');
-                               else
-                                       putchar('>');
-                       }
-               }
+               if (!opt->graph)
+                       put_revision_mark(opt, commit);
                fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
                if (opt->print_parents)
                        show_parents(commit, abbrev_commit);
@@ -448,18 +438,8 @@ void show_log(struct rev_info *opt)
                if (opt->commit_format != CMIT_FMT_ONELINE)
                        fputs("commit ", stdout);
 
-               if (!opt->graph) {
-                       if (commit->object.flags & BOUNDARY)
-                               putchar('-');
-                       else if (commit->object.flags & UNINTERESTING)
-                               putchar('^');
-                       else if (opt->left_right) {
-                               if (commit->object.flags & SYMMETRIC_LEFT)
-                                       putchar('<');
-                               else
-                                       putchar('>');
-                       }
-               }
+               if (!opt->graph)
+                       put_revision_mark(opt, commit);
                fputs(find_unique_abbrev(commit->object.sha1, abbrev_commit),
                      stdout);
                if (opt->print_parents)
index 42d52cb5bc17e9bb289a6b6c3e90c97d241660a2..af131508ec7ffa3ac7b1b1b1cadfcda0040becf2 100644 (file)
 #include "dir.h"
 #include "submodule.h"
 
+static const char rename_limit_advice[] =
+"inexact rename detection was skipped because there were too many\n"
+"  files. You may want to set your merge.renamelimit variable to at least\n"
+"  %d and retry this merge.";
+
 static struct tree *shift_tree_object(struct tree *one, struct tree *two,
                                      const char *subtree_shift)
 {
@@ -135,7 +140,6 @@ static void flush_output(struct merge_options *o)
 __attribute__((format (printf, 3, 4)))
 static void output(struct merge_options *o, int v, const char *fmt, ...)
 {
-       int len;
        va_list ap;
 
        if (!show(o, v))
@@ -146,21 +150,9 @@ static void output(struct merge_options *o, int v, const char *fmt, ...)
        strbuf_setlen(&o->obuf, o->obuf.len + o->call_depth * 2);
 
        va_start(ap, fmt);
-       len = vsnprintf(o->obuf.buf + o->obuf.len, strbuf_avail(&o->obuf), fmt, ap);
+       strbuf_vaddf(&o->obuf, fmt, ap);
        va_end(ap);
 
-       if (len < 0)
-               len = 0;
-       if (len >= strbuf_avail(&o->obuf)) {
-               strbuf_grow(&o->obuf, len + 2);
-               va_start(ap, fmt);
-               len = vsnprintf(o->obuf.buf + o->obuf.len, strbuf_avail(&o->obuf), fmt, ap);
-               va_end(ap);
-               if (len >= strbuf_avail(&o->obuf)) {
-                       die("this should not happen, your snprintf is broken");
-               }
-       }
-       strbuf_setlen(&o->obuf, o->obuf.len + len);
        strbuf_add(&o->obuf, "\n", 1);
        if (!o->buffer_output)
                flush_output(o);
@@ -364,7 +356,6 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
         */
        const char *last_file = NULL;
        int last_len = 0;
-       struct stage_data *last_e;
        int i;
 
        for (i = 0; i < entries->nr; i++) {
@@ -394,7 +385,6 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
                if (S_ISREG(e->stages[2].mode) || S_ISLNK(e->stages[2].mode)) {
                        last_file = path;
                        last_len = len;
-                       last_e = e;
                } else {
                        last_file = NULL;
                }
@@ -431,14 +421,16 @@ static struct string_list *get_renames(struct merge_options *o,
        opts.detect_rename = DIFF_DETECT_RENAME;
        opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit :
                            o->diff_rename_limit >= 0 ? o->diff_rename_limit :
-                           500;
+                           1000;
        opts.rename_score = o->rename_score;
-       opts.warn_on_too_large_rename = 1;
+       opts.show_rename_progress = o->show_rename_progress;
        opts.output_format = DIFF_FORMAT_NO_OUTPUT;
        if (diff_setup_done(&opts) < 0)
                die("diff setup failed");
        diff_tree_sha1(o_tree->object.sha1, tree->object.sha1, "", &opts);
        diffcore_std(&opts);
+       if (opts.needed_rename_limit > o->needed_rename_limit)
+               o->needed_rename_limit = opts.needed_rename_limit;
        for (i = 0; i < diff_queued_diff.nr; ++i) {
                struct string_list_item *item;
                struct rename *re;
@@ -967,7 +959,6 @@ static int process_renames(struct merge_options *o,
        }
 
        for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) {
-               char *src;
                struct string_list *renames1, *renames2Dst;
                struct rename *ren1 = NULL, *ren2 = NULL;
                const char *branch1, *branch2;
@@ -1002,7 +993,6 @@ static int process_renames(struct merge_options *o,
                        ren2 = ren1;
                        ren1 = tmp;
                }
-               src = ren1->pair->one->path;
 
                ren1->dst_entry->processed = 1;
                ren1->src_entry->processed = 1;
@@ -1662,6 +1652,8 @@ int merge_recursive(struct merge_options *o,
                commit_list_insert(h2, &(*result)->parents->next);
        }
        flush_output(o);
+       if (o->needed_rename_limit)
+               warning(rename_limit_advice, o->needed_rename_limit);
        return clean;
 }
 
index c8135b0ec70cc2eb92e5a6fd9353a134fda6b7bf..7e1e972b13cb8a9f2fae084f769fffede24c8dbb 100644 (file)
@@ -20,6 +20,8 @@ struct merge_options {
        int diff_rename_limit;
        int merge_rename_limit;
        int rename_score;
+       int needed_rename_limit;
+       int show_rename_progress;
        int call_depth;
        struct strbuf obuf;
        struct string_list current_file_set;
@@ -57,6 +59,8 @@ struct tree *write_tree_from_memory(struct merge_options *o);
 int parse_merge_opt(struct merge_options *out, const char *s);
 
 /* builtin/merge.c */
-int try_merge_command(const char *strategy, struct commit_list *common, const char *head_arg, struct commit_list *remotes);
+int try_merge_command(const char *strategy, size_t xopts_nr,
+               const char **xopts, struct commit_list *common,
+               const char *head_arg, struct commit_list *remotes);
 
 #endif
index 1467ad31795ae21896f1e608e7cb032df2bc94a8..28046a998426e88dec9ad6ab431624bb41a81ce1 100644 (file)
@@ -359,7 +359,7 @@ static int ll_merge_in_worktree(struct notes_merge_options *o,
        read_mmblob(&remote, p->remote);
 
        status = ll_merge(&result_buf, sha1_to_hex(p->obj), &base, NULL,
-                         &local, o->local_ref, &remote, o->remote_ref, 0);
+                         &local, o->local_ref, &remote, o->remote_ref, NULL);
 
        free(base.ptr);
        free(local.ptr);
index 4d1d61546f0441bd198cda3ad153b35a91444b72..b6618d92bf04d549350d83b6237770c48734686f 100644 (file)
--- a/object.h
+++ b/object.h
@@ -6,11 +6,6 @@ struct object_list {
        struct object_list *next;
 };
 
-struct object_refs {
-       unsigned count;
-       struct object *ref[FLEX_ARRAY]; /* more */
-};
-
 struct object_array {
        unsigned int nr;
        unsigned int alloc;
index c3bf21dbcb4b79fdc815ef80ae5c970aafd02bbf..a1a521648deee8e7e82c4e2cb7fe8fe03605dc06 100644 (file)
@@ -23,7 +23,7 @@ int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
                   off_t offset, off_t len, unsigned int nr)
 {
        const uint32_t *index_crc;
-       uint32_t data_crc = crc32(0, Z_NULL, 0);
+       uint32_t data_crc = crc32(0, NULL, 0);
 
        do {
                unsigned int avail;
index 42b51ef14514f3c3df454e4b718718a9b58f1612..73bd28ad90986af1618d82176076133186d045de 100644 (file)
@@ -561,14 +561,14 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
        return PARSE_OPT_HELP;
 }
 
-void usage_with_options(const char * const *usagestr,
+void NORETURN usage_with_options(const char * const *usagestr,
                        const struct option *opts)
 {
        usage_with_options_internal(NULL, usagestr, opts, 0, 1);
        exit(129);
 }
 
-void usage_msg_opt(const char *msg,
+void NORETURN usage_msg_opt(const char *msg,
                   const char * const *usagestr,
                   const struct option *options)
 {
diff --git a/path.c b/path.c
index 8951333cb88a6e28ef29538183ebf71e3b0913fa..4d73cc9cd26708b4cb41e86fb319b93f526cb2f2 100644 (file)
--- a/path.c
+++ b/path.c
@@ -397,7 +397,7 @@ int set_shared_perm(const char *path, int mode)
        return 0;
 }
 
-const char *make_relative_path(const char *abs, const char *base)
+const char *relative_path(const char *abs, const char *base)
 {
        static char buf[PATH_MAX + 1];
        int i = 0, j = 0;
index 295ba2b16c8675d8c5c5d0a5ee6e61e044ce99dd..5a04984ea31744528de30269add2754ed2dcd105 100644 (file)
@@ -1,6 +1,51 @@
 #include "cache.h"
 #include "pkt-line.h"
 
+static const char *packet_trace_prefix = "git";
+static const char trace_key[] = "GIT_TRACE_PACKET";
+
+void packet_trace_identity(const char *prog)
+{
+       packet_trace_prefix = xstrdup(prog);
+}
+
+static void packet_trace(const char *buf, unsigned int len, int write)
+{
+       int i;
+       struct strbuf out;
+
+       if (!trace_want(trace_key))
+               return;
+
+       /* +32 is just a guess for header + quoting */
+       strbuf_init(&out, len+32);
+
+       strbuf_addf(&out, "packet: %12s%c ",
+                   packet_trace_prefix, write ? '>' : '<');
+
+       if ((len >= 4 && !prefixcmp(buf, "PACK")) ||
+           (len >= 5 && !prefixcmp(buf+1, "PACK"))) {
+               strbuf_addstr(&out, "PACK ...");
+               unsetenv(trace_key);
+       }
+       else {
+               /* XXX we should really handle printable utf8 */
+               for (i = 0; i < len; i++) {
+                       /* suppress newlines */
+                       if (buf[i] == '\n')
+                               continue;
+                       if (buf[i] >= 0x20 && buf[i] <= 0x7e)
+                               strbuf_addch(&out, buf[i]);
+                       else
+                               strbuf_addf(&out, "\\%o", buf[i]);
+               }
+       }
+
+       strbuf_addch(&out, '\n');
+       trace_strbuf(trace_key, &out);
+       strbuf_release(&out);
+}
+
 /*
  * Write a packetized stream, where each line is preceded by
  * its length (including the header) as a 4-byte hex number.
@@ -39,11 +84,13 @@ ssize_t safe_write(int fd, const void *buf, ssize_t n)
  */
 void packet_flush(int fd)
 {
+       packet_trace("0000", 4, 1);
        safe_write(fd, "0000", 4);
 }
 
 void packet_buf_flush(struct strbuf *buf)
 {
+       packet_trace("0000", 4, 1);
        strbuf_add(buf, "0000", 4);
 }
 
@@ -62,6 +109,7 @@ static unsigned format_packet(const char *fmt, va_list args)
        buffer[1] = hex(n >> 8);
        buffer[2] = hex(n >> 4);
        buffer[3] = hex(n);
+       packet_trace(buffer+4, n-4, 1);
        return n;
 }
 
@@ -130,13 +178,16 @@ int packet_read_line(int fd, char *buffer, unsigned size)
        len = packet_length(linelen);
        if (len < 0)
                die("protocol error: bad line length character: %.4s", linelen);
-       if (!len)
+       if (!len) {
+               packet_trace("0000", 4, 0);
                return 0;
+       }
        len -= 4;
        if (len >= size)
                die("protocol error: bad line length %d", len);
        safe_read(fd, buffer, len);
        buffer[len] = 0;
+       packet_trace(buffer, len, 0);
        return len;
 }
 
@@ -153,6 +204,7 @@ int packet_get_line(struct strbuf *out,
        if (!len) {
                *src_buf += 4;
                *src_len -= 4;
+               packet_trace("0000", 4, 0);
                return 0;
        }
        if (*src_len < len)
@@ -165,5 +217,6 @@ int packet_get_line(struct strbuf *out,
        strbuf_add(out, *src_buf, len);
        *src_buf += len;
        *src_len -= len;
+       packet_trace(out->buf, out->len, 0);
        return len;
 }
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644 (file)
index 0000000..a242a86
--- /dev/null
@@ -0,0 +1 @@
+/git.pot
index e3d0bda31a98372eb9b6a8c2cd0fd65917a9dbde..49cb08df96faa90101bb25d8f96acaffc066f19b 100644 (file)
@@ -35,7 +35,9 @@ static void *preload_thread(void *_data)
        struct index_state *index = p->index;
        struct cache_entry **cep = index->cache + p->offset;
        struct cache_def cache;
+       struct pathspec pathspec;
 
+       init_pathspec(&pathspec, p->pathspec);
        memset(&cache, 0, sizeof(cache));
        nr = p->nr;
        if (nr + p->offset > index->cache_nr)
@@ -51,7 +53,7 @@ static void *preload_thread(void *_data)
                        continue;
                if (ce_uptodate(ce))
                        continue;
-               if (!ce_path_match(ce, p->pathspec))
+               if (!ce_path_match(ce, &pathspec))
                        continue;
                if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce)))
                        continue;
@@ -61,6 +63,7 @@ static void *preload_thread(void *_data)
                        continue;
                ce_mark_uptodate(ce);
        } while (--nr > 0);
+       free_pathspec(&pathspec);
        return NULL;
 }
 
index 85499347514ec3e1d62d6caa9f53b886c556e345..e1d8a8f414bf052a59fbe78d022e611f44ed8361 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -216,36 +216,53 @@ static int is_rfc2047_special(char ch)
 static void add_rfc2047(struct strbuf *sb, const char *line, int len,
                       const char *encoding)
 {
-       int i, last;
+       static const int max_length = 78; /* per rfc2822 */
+       int i;
+       int line_len;
+
+       /* How many bytes are already used on the current line? */
+       for (i = sb->len - 1; i >= 0; i--)
+               if (sb->buf[i] == '\n')
+                       break;
+       line_len = sb->len - (i+1);
 
        for (i = 0; i < len; i++) {
                int ch = line[i];
-               if (non_ascii(ch))
+               if (non_ascii(ch) || ch == '\n')
                        goto needquote;
                if ((i + 1 < len) && (ch == '=' && line[i+1] == '?'))
                        goto needquote;
        }
-       strbuf_add(sb, line, len);
+       strbuf_add_wrapped_bytes(sb, line, len, 0, 1, max_length - line_len);
        return;
 
 needquote:
        strbuf_grow(sb, len * 3 + strlen(encoding) + 100);
        strbuf_addf(sb, "=?%s?q?", encoding);
-       for (i = last = 0; i < len; i++) {
+       line_len += strlen(encoding) + 5; /* 5 for =??q? */
+       for (i = 0; i < len; i++) {
                unsigned ch = line[i] & 0xFF;
+
+               if (line_len >= max_length - 2) {
+                       strbuf_addf(sb, "?=\n =?%s?q?", encoding);
+                       line_len = strlen(encoding) + 5 + 1; /* =??q? plus SP */
+               }
+
                /*
                 * We encode ' ' using '=20' even though rfc2047
                 * allows using '_' for readability.  Unfortunately,
                 * many programs do not understand this and just
                 * leave the underscore in place.
                 */
-               if (is_rfc2047_special(ch) || ch == ' ') {
-                       strbuf_add(sb, line + last, i - last);
+               if (is_rfc2047_special(ch) || ch == ' ' || ch == '\n') {
                        strbuf_addf(sb, "=%02X", ch);
-                       last = i + 1;
+                       line_len += 3;
+               }
+               else {
+                       strbuf_addch(sb, ch);
+                       line_len++;
                }
        }
-       strbuf_add(sb, line + last, len - last);
        strbuf_addstr(sb, "?=");
 }
 
@@ -859,11 +876,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
                                              c->abbrev_parent_hashes.off;
                return 1;
        case 'm':               /* left/right/bottom */
-               strbuf_addch(sb, (commit->object.flags & BOUNDARY)
-                                ? '-'
-                                : (commit->object.flags & SYMMETRIC_LEFT)
-                                ? '<'
-                                : '>');
+               strbuf_addstr(sb, get_revision_mark(NULL, commit));
                return 1;
        case 'd':
                format_decoration(sb, commit);
@@ -1106,11 +1119,10 @@ void pp_title_line(enum cmit_fmt fmt,
                   const char *encoding,
                   int need_8bit_cte)
 {
-       const char *line_separator = (fmt == CMIT_FMT_EMAIL) ? "\n " : " ";
        struct strbuf title;
 
        strbuf_init(&title, 80);
-       *msg_p = format_subject(&title, *msg_p, line_separator);
+       *msg_p = format_subject(&title, *msg_p, " ");
 
        strbuf_grow(sb, title.len + 1024);
        if (subject) {
index a03fabf060081e9fa5e0d753cd0d9cf4bca5062e..3fc6b1d320faad3a528db016a0d800ff1bdde4f0 100644 (file)
@@ -70,16 +70,11 @@ static void process_tree(struct tree *tree,
 static void process_tag(struct tag *tag, struct object_array *p, const char *name)
 {
        struct object *obj = &tag->object;
-       struct name_path me;
 
        if (obj->flags & SEEN)
                return;
        obj->flags |= SEEN;
 
-       me.up = NULL;
-       me.elem = "tag:/";
-       me.elem_len = 5;
-
        if (parse_tag(tag) < 0)
                die("bad tag object %s", sha1_to_hex(obj->sha1));
        if (tag->tagged)
index 4f2e890b01b0c27ef2e49080e1fd34bf67e969c7..f38471cac3ac57d8d52429cde2dcc4cf5b92557b 100644 (file)
@@ -92,7 +92,7 @@ static int ce_compare_data(struct cache_entry *ce, struct stat *st)
 
        if (fd >= 0) {
                unsigned char sha1[20];
-               if (!index_fd(sha1, fd, st, 0, OBJ_BLOB, ce->name))
+               if (!index_fd(sha1, fd, st, 0, OBJ_BLOB, ce->name, 0))
                        match = hashcmp(sha1, ce->sha1);
                /* index_fd() closed the file descriptor already */
        }
@@ -706,30 +706,9 @@ int ce_same_name(struct cache_entry *a, struct cache_entry *b)
        return ce_namelen(b) == len && !memcmp(a->name, b->name, len);
 }
 
-int ce_path_match(const struct cache_entry *ce, const char **pathspec)
+int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec)
 {
-       const char *match, *name;
-       int len;
-
-       if (!pathspec)
-               return 1;
-
-       len = ce_namelen(ce);
-       name = ce->name;
-       while ((match = *pathspec++) != NULL) {
-               int matchlen = strlen(match);
-               if (matchlen > len)
-                       continue;
-               if (memcmp(name, match, matchlen))
-                       continue;
-               if (matchlen && name[matchlen-1] == '/')
-                       return 1;
-               if (name[matchlen] == '/' || !name[matchlen])
-                       return 1;
-               if (!matchlen)
-                       return 1;
-       }
-       return 0;
+       return match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL);
 }
 
 /*
@@ -1104,7 +1083,7 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
 }
 
 static void show_file(const char * fmt, const char * name, int in_porcelain,
-                     int * first, char *header_msg)
+                     int * first, const char *header_msg)
 {
        if (in_porcelain && *first && header_msg) {
                printf("%s\n", header_msg);
@@ -1114,7 +1093,7 @@ static void show_file(const char * fmt, const char * name, int in_porcelain,
 }
 
 int refresh_index(struct index_state *istate, unsigned int flags, const char **pathspec,
-                 char *seen, char *header_msg)
+                 char *seen, const char *header_msg)
 {
        int i;
        int has_errors = 0;
@@ -1568,6 +1547,31 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce)
        return result;
 }
 
+static int has_racy_timestamp(struct index_state *istate)
+{
+       int entries = istate->cache_nr;
+       int i;
+
+       for (i = 0; i < entries; i++) {
+               struct cache_entry *ce = istate->cache[i];
+               if (is_racy_timestamp(istate, ce))
+                       return 1;
+       }
+       return 0;
+}
+
+/*
+ * Opportunisticly update the index but do not complain if we can't
+ */
+void update_index_if_able(struct index_state *istate, struct lock_file *lockfile)
+{
+       if ((istate->cache_changed || has_racy_timestamp(istate)) &&
+           !write_index(istate, lockfile->fd))
+               commit_locked_index(lockfile);
+       else
+               rollback_lock_file(lockfile);
+}
+
 int write_index(struct index_state *istate, int newfd)
 {
        git_SHA_CTX c;
index 04d4813e4183c675b54aba942cd078d8ff632053..775d6143037aa4573c0202715fe1b1a0f99e2799 100644 (file)
@@ -356,14 +356,59 @@ static size_t rpc_in(const void *ptr, size_t eltsize,
        return size;
 }
 
+static int run_slot(struct active_request_slot *slot)
+{
+       int err = 0;
+       struct slot_results results;
+
+       slot->results = &results;
+       slot->curl_result = curl_easy_perform(slot->curl);
+       finish_active_slot(slot);
+
+       if (results.curl_result != CURLE_OK) {
+               err |= error("RPC failed; result=%d, HTTP code = %ld",
+                       results.curl_result, results.http_code);
+       }
+
+       return err;
+}
+
+static int probe_rpc(struct rpc_state *rpc)
+{
+       struct active_request_slot *slot;
+       struct curl_slist *headers = NULL;
+       struct strbuf buf = STRBUF_INIT;
+       int err;
+
+       slot = get_active_slot();
+
+       headers = curl_slist_append(headers, rpc->hdr_content_type);
+       headers = curl_slist_append(headers, rpc->hdr_accept);
+
+       curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
+       curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
+       curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
+       curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
+       curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, "0000");
+       curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
+       curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
+       curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
+       curl_easy_setopt(slot->curl, CURLOPT_FILE, &buf);
+
+       err = run_slot(slot);
+
+       curl_slist_free_all(headers);
+       strbuf_release(&buf);
+       return err;
+}
+
 static int post_rpc(struct rpc_state *rpc)
 {
        struct active_request_slot *slot;
-       struct slot_results results;
        struct curl_slist *headers = NULL;
        int use_gzip = rpc->gzip_request;
        char *gzip_body = NULL;
-       int err = 0, large_request = 0;
+       int err, large_request = 0;
 
        /* Try to load the entire request, if we can fit it into the
         * allocated buffer space we can use HTTP/1.0 and avoid the
@@ -386,8 +431,13 @@ static int post_rpc(struct rpc_state *rpc)
                rpc->len += n;
        }
 
+       if (large_request) {
+               err = probe_rpc(rpc);
+               if (err)
+                       return err;
+       }
+
        slot = get_active_slot();
-       slot->results = &results;
 
        curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
        curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
@@ -396,12 +446,12 @@ static int post_rpc(struct rpc_state *rpc)
 
        headers = curl_slist_append(headers, rpc->hdr_content_type);
        headers = curl_slist_append(headers, rpc->hdr_accept);
+       headers = curl_slist_append(headers, "Expect:");
 
        if (large_request) {
                /* The request body is large and the size cannot be predicted.
                 * We must use chunked encoding to send it.
                 */
-               headers = curl_slist_append(headers, "Expect: 100-continue");
                headers = curl_slist_append(headers, "Transfer-Encoding: chunked");
                rpc->initial_buffer = 1;
                curl_easy_setopt(slot->curl, CURLOPT_READFUNCTION, rpc_out);
@@ -475,13 +525,7 @@ static int post_rpc(struct rpc_state *rpc)
        curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, rpc_in);
        curl_easy_setopt(slot->curl, CURLOPT_FILE, rpc);
 
-       slot->curl_result = curl_easy_perform(slot->curl);
-       finish_active_slot(slot);
-
-       if (results.curl_result != CURLE_OK) {
-               err |= error("RPC failed; result=%d, HTTP code = %ld",
-                       results.curl_result, results.http_code);
-       }
+       err = run_slot(slot);
 
        curl_slist_free_all(headers);
        free(gzip_body);
index eb59604fd39e2beaf7d43802499c27305ac92132..7c6c7544ada4585e62341f0c0854a919f10c2277 100644 (file)
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "sha1-lookup.h"
 #include "refs.h"
+#include "commit.h"
 
 static struct replace_object {
        unsigned char sha1[2][20];
index d2608434750c336c3f3881efda8373b7c67d4b11..22dfc843da1528ffd0466d496c50c56702e55a24 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -7,6 +7,11 @@
 #include "ll-merge.h"
 #include "attr.h"
 
+#define RESOLVED 0
+#define PUNTED 1
+#define THREE_STAGED 2
+void *RERERE_RESOLVED = &RERERE_RESOLVED;
+
 /* if rerere_enabled == -1, fall back to detection of .git/rr-cache */
 static int rerere_enabled = -1;
 
@@ -345,21 +350,74 @@ static int handle_cache(const char *path, unsigned char *sha1, const char *outpu
        return hunk_no;
 }
 
-static int find_conflict(struct string_list *conflict)
+static int check_one_conflict(int i, int *type)
 {
-       int i;
-       if (read_cache() < 0)
-               return error("Could not read index");
-       for (i = 0; i+1 < active_nr; i++) {
+       struct cache_entry *e = active_cache[i];
+
+       if (!ce_stage(e)) {
+               *type = RESOLVED;
+               return i + 1;
+       }
+
+       *type = PUNTED;
+       if (ce_stage(e) == 1) {
+               if (active_nr <= ++i)
+                       return i + 1;
+       }
+
+       /* Only handle regular files with both stages #2 and #3 */
+       if (i + 1 < active_nr) {
                struct cache_entry *e2 = active_cache[i];
-               struct cache_entry *e3 = active_cache[i+1];
+               struct cache_entry *e3 = active_cache[i + 1];
                if (ce_stage(e2) == 2 &&
                    ce_stage(e3) == 3 &&
-                   ce_same_name(e2, e3) &&
+                   ce_same_name(e, e3) &&
                    S_ISREG(e2->ce_mode) &&
-                   S_ISREG(e3->ce_mode)) {
-                       string_list_insert(conflict, (const char *)e2->name);
-                       i++; /* skip over both #2 and #3 */
+                   S_ISREG(e3->ce_mode))
+                       *type = THREE_STAGED;
+       }
+
+       /* Skip the entries with the same name */
+       while (i < active_nr && ce_same_name(e, active_cache[i]))
+               i++;
+       return i;
+}
+
+static int find_conflict(struct string_list *conflict)
+{
+       int i;
+       if (read_cache() < 0)
+               return error("Could not read index");
+
+       for (i = 0; i < active_nr;) {
+               int conflict_type;
+               struct cache_entry *e = active_cache[i];
+               i = check_one_conflict(i, &conflict_type);
+               if (conflict_type == THREE_STAGED)
+                       string_list_insert(conflict, (const char *)e->name);
+       }
+       return 0;
+}
+
+int rerere_remaining(struct string_list *merge_rr)
+{
+       int i;
+       if (read_cache() < 0)
+               return error("Could not read index");
+
+       for (i = 0; i < active_nr;) {
+               int conflict_type;
+               struct cache_entry *e = active_cache[i];
+               i = check_one_conflict(i, &conflict_type);
+               if (conflict_type == PUNTED)
+                       string_list_insert(merge_rr, (const char *)e->name);
+               else if (conflict_type == RESOLVED) {
+                       struct string_list_item *it;
+                       it = string_list_lookup(merge_rr, (const char *)e->name);
+                       if (it != NULL) {
+                               free(it->util);
+                               it->util = RERERE_RESOLVED;
+                       }
                }
        }
        return 0;
@@ -380,7 +438,7 @@ static int merge(const char *name, const char *path)
                ret = 1;
                goto out;
        }
-       ret = ll_merge(&result, path, &base, NULL, &cur, "", &other, "", 0);
+       ret = ll_merge(&result, path, &base, NULL, &cur, "", &other, "", NULL);
        if (!ret) {
                FILE *f;
 
@@ -532,8 +590,7 @@ static int is_rerere_enabled(void)
        if (rerere_enabled < 0)
                return rr_cache_exists;
 
-       if (!rr_cache_exists &&
-           (mkdir(rr_cache, 0777) || adjust_shared_perm(rr_cache)))
+       if (!rr_cache_exists && mkdir_in_gitdir(rr_cache))
                die("Could not create directory %s", rr_cache);
        return 1;
 }
index eaa9004dcdbb2f0dfd446e1ac68237c6dff18530..595f49f701dc1003927679085ca6eea8ad1083ae 100644 (file)
--- a/rerere.h
+++ b/rerere.h
@@ -6,11 +6,19 @@
 #define RERERE_AUTOUPDATE   01
 #define RERERE_NOAUTOUPDATE 02
 
+/*
+ * Marks paths that have been hand-resolved and added to the
+ * index. Set in the util field of such paths after calling
+ * rerere_remaining.
+ */
+extern void *RERERE_RESOLVED;
+
 extern int setup_rerere(struct string_list *, int);
 extern int rerere(int);
 extern const char *rerere_path(const char *hex, const char *file);
 extern int has_rerere_resolution(const char *hex);
 extern int rerere_forget(const char **);
+extern int rerere_remaining(struct string_list *);
 
 #define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, "rerere-autoupdate", (v), \
        "update the index with reused conflict resolution if possible")
index 7b9eaefae4ed03e994c2122453144b3c09591b9c..0f38364cf3f81a9088305ca802adf8b7c9260e91 100644 (file)
@@ -323,7 +323,7 @@ static int rev_compare_tree(struct rev_info *revs, struct commit *parent, struct
                 * tagged commit by specifying both --simplify-by-decoration
                 * and pathspec.
                 */
-               if (!revs->prune_data)
+               if (!revs->prune_data.nr)
                        return REV_TREE_SAME;
        }
 
@@ -535,6 +535,7 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
        int left_count = 0, right_count = 0;
        int left_first;
        struct patch_ids ids;
+       unsigned cherry_flag;
 
        /* First count the commits on the left and on the right */
        for (p = list; p; p = p->next) {
@@ -553,11 +554,7 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
 
        left_first = left_count < right_count;
        init_patch_ids(&ids);
-       if (revs->diffopt.nr_paths) {
-               ids.diffopts.nr_paths = revs->diffopt.nr_paths;
-               ids.diffopts.paths = revs->diffopt.paths;
-               ids.diffopts.pathlens = revs->diffopt.pathlens;
-       }
+       ids.diffopts.pathspec = revs->diffopt.pathspec;
 
        /* Compute patch-ids for one side */
        for (p = list; p; p = p->next) {
@@ -576,6 +573,9 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
                commit->util = add_commit_patch_id(commit, &ids);
        }
 
+       /* either cherry_mark or cherry_pick are true */
+       cherry_flag = revs->cherry_mark ? PATCHSAME : SHOWN;
+
        /* Check the other side */
        for (p = list; p; p = p->next) {
                struct commit *commit = p->item;
@@ -598,7 +598,7 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
                if (!id)
                        continue;
                id->seen = 1;
-               commit->object.flags |= SHOWN;
+               commit->object.flags |= cherry_flag;
        }
 
        /* Now check the original side for seen ones */
@@ -610,7 +610,7 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
                if (!ent)
                        continue;
                if (ent->seen)
-                       commit->object.flags |= SHOWN;
+                       commit->object.flags |= cherry_flag;
                commit->util = NULL;
        }
 
@@ -733,6 +733,23 @@ static struct commit_list *collect_bottom_commits(struct commit_list *list)
        return bottom;
 }
 
+/* Assumes either left_only or right_only is set */
+static void limit_left_right(struct commit_list *list, struct rev_info *revs)
+{
+       struct commit_list *p;
+
+       for (p = list; p; p = p->next) {
+               struct commit *commit = p->item;
+
+               if (revs->right_only) {
+                       if (commit->object.flags & SYMMETRIC_LEFT)
+                               commit->object.flags |= SHOWN;
+               } else  /* revs->left_only is set */
+                       if (!(commit->object.flags & SYMMETRIC_LEFT))
+                               commit->object.flags |= SHOWN;
+       }
+}
+
 static int limit_list(struct rev_info *revs)
 {
        int slop = SLOP;
@@ -785,9 +802,12 @@ static int limit_list(struct rev_info *revs)
                show(revs, newlist);
                show_early_output = NULL;
        }
-       if (revs->cherry_pick)
+       if (revs->cherry_pick || revs->cherry_mark)
                cherry_pick_list(newlist, revs);
 
+       if (revs->left_only || revs->right_only)
+               limit_left_right(newlist, revs);
+
        if (bottom) {
                limit_to_ancestry(bottom, newlist);
                free_commit_list(bottom);
@@ -921,6 +941,7 @@ void init_revisions(struct rev_info *revs, const char *prefix)
        revs->min_age = -1;
        revs->skip_count = -1;
        revs->max_count = -1;
+       revs->max_parents = -1;
 
        revs->commit_format = CMIT_FMT_DEFAULT;
 
@@ -973,7 +994,7 @@ static void prepare_show_merge(struct rev_info *revs)
                struct cache_entry *ce = active_cache[i];
                if (!ce_stage(ce))
                        continue;
-               if (ce_path_match(ce, revs->prune_data)) {
+               if (ce_path_match(ce, &revs->prune_data)) {
                        prune_num++;
                        prune = xrealloc(prune, sizeof(*prune) * prune_num);
                        prune[prune_num-2] = ce->name;
@@ -983,7 +1004,8 @@ static void prepare_show_merge(struct rev_info *revs)
                       ce_same_name(ce, active_cache[i+1]))
                        i++;
        }
-       revs->prune_data = prune;
+       free_pathspec(&revs->prune_data);
+       init_pathspec(&revs->prune_data, prune);
        revs->limited = 1;
 }
 
@@ -1256,16 +1278,47 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
        } else if (!strcmp(arg, "--remove-empty")) {
                revs->remove_empty_trees = 1;
        } else if (!strcmp(arg, "--merges")) {
-               revs->merges_only = 1;
+               revs->min_parents = 2;
        } else if (!strcmp(arg, "--no-merges")) {
-               revs->no_merges = 1;
+               revs->max_parents = 1;
+       } else if (!prefixcmp(arg, "--min-parents=")) {
+               revs->min_parents = atoi(arg+14);
+       } else if (!prefixcmp(arg, "--no-min-parents")) {
+               revs->min_parents = 0;
+       } else if (!prefixcmp(arg, "--max-parents=")) {
+               revs->max_parents = atoi(arg+14);
+       } else if (!prefixcmp(arg, "--no-max-parents")) {
+               revs->max_parents = -1;
        } else if (!strcmp(arg, "--boundary")) {
                revs->boundary = 1;
        } else if (!strcmp(arg, "--left-right")) {
                revs->left_right = 1;
+       } else if (!strcmp(arg, "--left-only")) {
+               if (revs->right_only)
+                       die("--left-only is incompatible with --right-only"
+                           " or --cherry");
+               revs->left_only = 1;
+       } else if (!strcmp(arg, "--right-only")) {
+               if (revs->left_only)
+                       die("--right-only is incompatible with --left-only");
+               revs->right_only = 1;
+       } else if (!strcmp(arg, "--cherry")) {
+               if (revs->left_only)
+                       die("--cherry is incompatible with --left-only");
+               revs->cherry_mark = 1;
+               revs->right_only = 1;
+               revs->max_parents = 1;
+               revs->limited = 1;
        } else if (!strcmp(arg, "--count")) {
                revs->count = 1;
+       } else if (!strcmp(arg, "--cherry-mark")) {
+               if (revs->cherry_pick)
+                       die("--cherry-mark is incompatible with --cherry-pick");
+               revs->cherry_mark = 1;
+               revs->limited = 1; /* needs limit_list() */
        } else if (!strcmp(arg, "--cherry-pick")) {
+               if (revs->cherry_mark)
+                       die("--cherry-pick is incompatible with --cherry-mark");
                revs->cherry_pick = 1;
                revs->limited = 1;
        } else if (!strcmp(arg, "--objects")) {
@@ -1620,7 +1673,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
        }
 
        if (prune_data)
-               revs->prune_data = get_pathspec(revs->prefix, prune_data);
+               init_pathspec(&revs->prune_data, get_pathspec(revs->prefix, prune_data));
 
        if (revs->def == NULL)
                revs->def = opt ? opt->def : NULL;
@@ -1651,13 +1704,13 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
        if (revs->topo_order)
                revs->limited = 1;
 
-       if (revs->prune_data) {
-               diff_tree_setup_paths(revs->prune_data, &revs->pruning);
+       if (revs->prune_data.nr) {
+               diff_tree_setup_paths(revs->prune_data.raw, &revs->pruning);
                /* Can't prune commits with rename following: the paths change.. */
                if (!DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))
                        revs->prune = 1;
                if (!revs->full_diff)
-                       diff_tree_setup_paths(revs->prune_data, &revs->diffopt);
+                       diff_tree_setup_paths(revs->prune_data.raw, &revs->diffopt);
        }
        if (revs->combine_merges)
                revs->ignore_merges = 0;
@@ -1985,10 +2038,15 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
                return commit_ignore;
        if (revs->min_age != -1 && (commit->date > revs->min_age))
                return commit_ignore;
-       if (revs->no_merges && commit->parents && commit->parents->next)
-               return commit_ignore;
-       if (revs->merges_only && !(commit->parents && commit->parents->next))
-               return commit_ignore;
+       if (revs->min_parents || (revs->max_parents >= 0)) {
+               int n = 0;
+               struct commit_list *p;
+               for (p = commit->parents; p; p = p->next)
+                       n++;
+               if ((n < revs->min_parents) ||
+                   ((revs->max_parents >= 0) && (n > revs->max_parents)))
+                       return commit_ignore;
+       }
        if (!commit_match(commit, revs))
                return commit_ignore;
        if (revs->prune && revs->dense) {
@@ -2235,3 +2293,32 @@ struct commit *get_revision(struct rev_info *revs)
                graph_update(revs->graph, c);
        return c;
 }
+
+char *get_revision_mark(const struct rev_info *revs, const struct commit *commit)
+{
+       if (commit->object.flags & BOUNDARY)
+               return "-";
+       else if (commit->object.flags & UNINTERESTING)
+               return "^";
+       else if (commit->object.flags & PATCHSAME)
+               return "=";
+       else if (!revs || revs->left_right) {
+               if (commit->object.flags & SYMMETRIC_LEFT)
+                       return "<";
+               else
+                       return ">";
+       } else if (revs->graph)
+               return "*";
+       else if (revs->cherry_mark)
+               return "+";
+       return "";
+}
+
+void put_revision_mark(const struct rev_info *revs, const struct commit *commit)
+{
+       char *mark = get_revision_mark(revs, commit);
+       if (!strlen(mark))
+               return;
+       fputs(mark, stdout);
+       putchar(' ');
+}
index 05659c64acd7fe8eb7be011cee6174e397e57baf..9fd8f3016fe8f935f176f57c615f72df8ba8d157 100644 (file)
@@ -14,7 +14,8 @@
 #define CHILD_SHOWN    (1u<<6)
 #define ADDED          (1u<<7) /* Parents already parsed and added? */
 #define SYMMETRIC_LEFT (1u<<8)
-#define ALL_REV_FLAGS  ((1u<<9)-1)
+#define PATCHSAME      (1u<<9)
+#define ALL_REV_FLAGS  ((1u<<10)-1)
 
 #define DECORATE_SHORT_REFS    1
 #define DECORATE_FULL_REFS     2
@@ -34,14 +35,12 @@ struct rev_info {
        /* Basic information */
        const char *prefix;
        const char *def;
-       void *prune_data;
+       struct pathspec prune_data;
        unsigned int early_output;
 
        /* Traversal flags */
        unsigned int    dense:1,
                        prune:1,
-                       no_merges:1,
-                       merges_only:1,
                        no_walk:1,
                        show_all:1,
                        remove_empty_trees:1,
@@ -59,6 +58,8 @@ struct rev_info {
                        boundary:2,
                        count:1,
                        left_right:1,
+                       left_only:1,
+                       right_only:1,
                        rewrite_parents:1,
                        print_parents:1,
                        show_source:1,
@@ -66,6 +67,7 @@ struct rev_info {
                        reverse:1,
                        reverse_output_stage:1,
                        cherry_pick:1,
+                       cherry_mark:1,
                        bisect:1,
                        ancestry_path:1,
                        first_parent_only:1;
@@ -122,6 +124,8 @@ struct rev_info {
        int max_count;
        unsigned long max_age;
        unsigned long min_age;
+       int min_parents;
+       int max_parents;
 
        /* diff info for patches and for paths limiting */
        struct diff_options diffopt;
@@ -163,6 +167,8 @@ extern int handle_revision_arg(const char *arg, struct rev_info *revs,int flags,
 
 extern int prepare_revision_walk(struct rev_info *revs);
 extern struct commit *get_revision(struct rev_info *revs);
+extern char *get_revision_mark(const struct rev_info *revs, const struct commit *commit);
+extern void put_revision_mark(const struct rev_info *revs, const struct commit *commit);
 
 extern void mark_parents_uninteresting(struct commit *commit);
 extern void mark_tree_uninteresting(struct tree *tree);
index f91e446c86be8e27f98554567143d7ce6f934bd1..8619c769a93c48e724957c019af5765ebee6af9f 100644 (file)
@@ -67,21 +67,26 @@ static int child_notifier = -1;
 
 static void notify_parent(void)
 {
-       ssize_t unused;
-       unused = write(child_notifier, "", 1);
+       /*
+        * execvp failed.  If possible, we'd like to let start_command
+        * know, so failures like ENOENT can be handled right away; but
+        * otherwise, finish_command will still report the error.
+        */
+       if (write(child_notifier, "", 1))
+               ; /* yes, dear gcc -D_FORTIFY_SOURCE, there was an error. */
 }
 
 static NORETURN void die_child(const char *err, va_list params)
 {
        char msg[4096];
-       ssize_t unused;
        int len = vsnprintf(msg, sizeof(msg), err, params);
        if (len > sizeof(msg))
                len = sizeof(msg);
 
-       unused = write(child_err, "fatal: ", 7);
-       unused = write(child_err, msg, len);
-       unused = write(child_err, "\n", 1);
+       if (write(child_err, "fatal: ", 7) ||
+           write(child_err, msg, len) ||
+           write(child_err, "\n", 1))
+               ; /* yes, gcc -D_FORTIFY_SOURCE, we know there was an error. */
        exit(128);
 }
 #endif
diff --git a/setup.c b/setup.c
index dadc66659a4037b614b215b7f812c4df8969562b..03cd84f2fcbf9cdbc25116308a9c2c9407af8e71 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -7,10 +7,13 @@ static int inside_work_tree = -1;
 char *prefix_path(const char *prefix, int len, const char *path)
 {
        const char *orig = path;
-       char *sanitized = xmalloc(len + strlen(path) + 1);
-       if (is_absolute_path(orig))
-               strcpy(sanitized, path);
-       else {
+       char *sanitized;
+       if (is_absolute_path(orig)) {
+               const char *temp = real_path(path);
+               sanitized = xmalloc(len + strlen(temp) + 1);
+               strcpy(sanitized, temp);
+       } else {
+               sanitized = xmalloc(len + strlen(path) + 1);
                if (len)
                        memcpy(sanitized, prefix, len);
                strcpy(sanitized + len, path);
@@ -218,7 +221,7 @@ void setup_work_tree(void)
        work_tree = get_git_work_tree();
        git_dir = get_git_dir();
        if (!is_absolute_path(git_dir))
-               git_dir = make_absolute_path(git_dir);
+               git_dir = real_path(get_git_dir());
        if (!work_tree || chdir(work_tree))
                die("This operation must be run in a work tree");
 
@@ -229,7 +232,7 @@ void setup_work_tree(void)
        if (getenv(GIT_WORK_TREE_ENVIRONMENT))
                setenv(GIT_WORK_TREE_ENVIRONMENT, ".", 1);
 
-       set_git_dir(make_relative_path(git_dir, work_tree));
+       set_git_dir(relative_path(git_dir, work_tree));
        initialized = 1;
 }
 
@@ -309,7 +312,7 @@ const char *read_gitfile_gently(const char *path)
 
        if (!is_git_directory(dir))
                die("Not a git repository: %s", dir);
-       path = make_absolute_path(dir);
+       path = real_path(dir);
 
        free(buf);
        return path;
@@ -389,7 +392,7 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,
 
        if (!prefixcmp(cwd, worktree) &&
            cwd[strlen(worktree)] == '/') { /* cwd inside worktree */
-               set_git_dir(make_absolute_path(gitdirenv));
+               set_git_dir(real_path(gitdirenv));
                if (chdir(worktree))
                        die_errno("Could not chdir to '%s'", worktree);
                cwd[len++] = '/';
@@ -414,7 +417,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,
        /* --work-tree is set without --git-dir; use discovered one */
        if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {
                if (offset != len && !is_absolute_path(gitdir))
-                       gitdir = xstrdup(make_absolute_path(gitdir));
+                       gitdir = xstrdup(real_path(gitdir));
                if (chdir(cwd))
                        die_errno("Could not come back to cwd");
                return setup_explicit_git_dir(gitdir, cwd, len, nongit_ok);
@@ -422,7 +425,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,
 
        /* #16.2, #17.2, #20.2, #21.2, #24, #25, #28, #29 (see t1510) */
        if (is_bare_repository_cfg > 0) {
-               set_git_dir(offset == len ? gitdir : make_absolute_path(gitdir));
+               set_git_dir(offset == len ? gitdir : real_path(gitdir));
                if (chdir(cwd))
                        die_errno("Could not come back to cwd");
                return NULL;
index e194f6a12862a4a4479fd714b550d426f8ee1313..df0edbad1e810727e384a5753001dc8c85d4ecf9 100644 (file)
@@ -13,6 +13,7 @@
 #include "commit.h"
 #include "tag.h"
 #include "tree.h"
+#include "tree-walk.h"
 #include "refs.h"
 #include "pack-revindex.h"
 #include "sha1-lookup.h"
 #endif
 #endif
 
-#ifdef NO_C99_FORMAT
-#define SZ_FMT "lu"
-static unsigned long sz_fmt(size_t s) { return (unsigned long)s; }
-#else
-#define SZ_FMT "zu"
-static size_t sz_fmt(size_t s) { return s; }
-#endif
+#define SZ_FMT PRIuMAX
+static inline uintmax_t sz_fmt(size_t s) { return s; }
 
 const unsigned char null_sha1[20];
 
@@ -72,6 +68,35 @@ static struct cached_object *find_cached_object(const unsigned char *sha1)
        return NULL;
 }
 
+int mkdir_in_gitdir(const char *path)
+{
+       if (mkdir(path, 0777)) {
+               int saved_errno = errno;
+               struct stat st;
+               struct strbuf sb = STRBUF_INIT;
+
+               if (errno != EEXIST)
+                       return -1;
+               /*
+                * Are we looking at a path in a symlinked worktree
+                * whose original repository does not yet have it?
+                * e.g. .git/rr-cache pointing at its original
+                * repository in which the user hasn't performed any
+                * conflict resolution yet?
+                */
+               if (lstat(path, &st) || !S_ISLNK(st.st_mode) ||
+                   strbuf_readlink(&sb, path, st.st_size) ||
+                   !is_absolute_path(sb.buf) ||
+                   mkdir(sb.buf, 0777)) {
+                       strbuf_release(&sb);
+                       errno = saved_errno;
+                       return -1;
+               }
+               strbuf_release(&sb);
+       }
+       return adjust_shared_perm(path);
+}
+
 int safe_create_leading_directories(char *path)
 {
        char *pos = path + offset_1st_component(path);
@@ -2527,8 +2552,37 @@ int has_sha1_file(const unsigned char *sha1)
        return has_loose_object(sha1);
 }
 
+static void check_tree(const void *buf, size_t size)
+{
+       struct tree_desc desc;
+       struct name_entry entry;
+
+       init_tree_desc(&desc, buf, size);
+       while (tree_entry(&desc, &entry))
+               /* do nothing
+                * tree_entry() will die() on malformed entries */
+               ;
+}
+
+static void check_commit(const void *buf, size_t size)
+{
+       struct commit c;
+       memset(&c, 0, sizeof(c));
+       if (parse_commit_buffer(&c, buf, size))
+               die("corrupt commit");
+}
+
+static void check_tag(const void *buf, size_t size)
+{
+       struct tag t;
+       memset(&t, 0, sizeof(t));
+       if (parse_tag_buffer(&t, buf, size))
+               die("corrupt tag");
+}
+
 static int index_mem(unsigned char *sha1, void *buf, size_t size,
-                    int write_object, enum object_type type, const char *path)
+                    int write_object, enum object_type type,
+                    const char *path, int format_check)
 {
        int ret, re_allocated = 0;
 
@@ -2546,6 +2600,14 @@ static int index_mem(unsigned char *sha1, void *buf, size_t size,
                        re_allocated = 1;
                }
        }
+       if (format_check) {
+               if (type == OBJ_TREE)
+                       check_tree(buf, size);
+               if (type == OBJ_COMMIT)
+                       check_commit(buf, size);
+               if (type == OBJ_TAG)
+                       check_tag(buf, size);
+       }
 
        if (write_object)
                ret = write_sha1_file(buf, size, typename(type), sha1);
@@ -2559,7 +2621,7 @@ static int index_mem(unsigned char *sha1, void *buf, size_t size,
 #define SMALL_FILE_SIZE (32*1024)
 
 int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
-            enum object_type type, const char *path)
+            enum object_type type, const char *path, int format_check)
 {
        int ret;
        size_t size = xsize_t(st->st_size);
@@ -2568,23 +2630,25 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
                struct strbuf sbuf = STRBUF_INIT;
                if (strbuf_read(&sbuf, fd, 4096) >= 0)
                        ret = index_mem(sha1, sbuf.buf, sbuf.len, write_object,
-                                       type, path);
+                                       type, path, format_check);
                else
                        ret = -1;
                strbuf_release(&sbuf);
        } else if (!size) {
-               ret = index_mem(sha1, NULL, size, write_object, type, path);
+               ret = index_mem(sha1, NULL, size, write_object, type, path,
+                               format_check);
        } else if (size <= SMALL_FILE_SIZE) {
                char *buf = xmalloc(size);
                if (size == read_in_full(fd, buf, size))
                        ret = index_mem(sha1, buf, size, write_object, type,
-                                       path);
+                                       path, format_check);
                else
                        ret = error("short read %s", strerror(errno));
                free(buf);
        } else {
                void *buf = xmmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
-               ret = index_mem(sha1, buf, size, write_object, type, path);
+               ret = index_mem(sha1, buf, size, write_object, type, path,
+                               format_check);
                munmap(buf, size);
        }
        close(fd);
@@ -2602,7 +2666,7 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write
                if (fd < 0)
                        return error("open(\"%s\"): %s", path,
                                     strerror(errno));
-               if (index_fd(sha1, fd, st, write_object, OBJ_BLOB, path) < 0)
+               if (index_fd(sha1, fd, st, write_object, OBJ_BLOB, path, 0) < 0)
                        return error("%s: failed to insert into database",
                                     path);
                break;
index 07e8883ceb297bdde79f06ffa2d0519581ee60b9..77444a94df3d4a0cda6403957fd13ea262d3ab24 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -195,24 +195,29 @@ void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len)
 
 void strbuf_addf(struct strbuf *sb, const char *fmt, ...)
 {
-       int len;
        va_list ap;
+       va_start(ap, fmt);
+       strbuf_vaddf(sb, fmt, ap);
+       va_end(ap);
+}
+
+void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap)
+{
+       int len;
+       va_list cp;
 
        if (!strbuf_avail(sb))
                strbuf_grow(sb, 64);
-       va_start(ap, fmt);
-       len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
-       va_end(ap);
+       va_copy(cp, ap);
+       len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, cp);
+       va_end(cp);
        if (len < 0)
-               die("your vsnprintf is broken");
+               die("BUG: your vsnprintf is broken (returned %d)", len);
        if (len > strbuf_avail(sb)) {
                strbuf_grow(sb, len);
-               va_start(ap, fmt);
                len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
-               va_end(ap);
-               if (len > strbuf_avail(sb)) {
-                       die("this should not happen, your snprintf is broken");
-               }
+               if (len > strbuf_avail(sb))
+                       die("BUG: your vsnprintf is broken (insatiable)");
        }
        strbuf_setlen(sb, sb->len + len);
 }
index 4ce7dedee07efced23c1214de71e0687d7cb297a..07060ce893d8303b7eb4d78db0f7a5575527f88f 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
@@ -85,6 +85,8 @@ extern void strbuf_addbuf_percentquote(struct strbuf *dst, const struct strbuf *
 
 __attribute__((format (printf,2,3)))
 extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);
+__attribute__((format (printf,2,0)))
+extern void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap);
 
 extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);
 /* XXX: if read fails, any partial read is undone */
index e9f2b19e1c867b870b0b5f3ef3db3c871fe20689..0cb6d1829944b8a6d0f1a7ed1c228b61c31c7e0d 100644 (file)
@@ -9,9 +9,9 @@
 #include "refs.h"
 #include "string-list.h"
 
-struct string_list config_name_for_path;
-struct string_list config_fetch_recurse_submodules_for_name;
-struct string_list config_ignore_for_name;
+static struct string_list config_name_for_path;
+static struct string_list config_fetch_recurse_submodules_for_name;
+static struct string_list config_ignore_for_name;
 static int config_fetch_recurse_submodules;
 
 static int add_submodule_odb(const char *path)
index 3cacebd91adc2958e81d952523bd7cfe0078078c..034943bda0e8be781f4a7568f0dbb5b1958f7e15 100644 (file)
@@ -223,7 +223,7 @@ int check_leading_path(const char *name, int len)
        int flags;
        int match_len = lstat_cache_matchlen(cache, name, len, &flags,
                           FL_SYMLINK|FL_NOENT|FL_DIR, USE_ONLY_LSTAT);
-       if (flags & (FL_SYMLINK|FL_NOENT))
+       if (flags & FL_NOENT)
                return 0;
        else if (flags & FL_DIR)
                return -1;
index 6122a6c73352e6986bc8f97fc803105dcd671c25..428ee05c4a5b844815ff4f9356b71bb147cb42a6 100644 (file)
--- a/t/README
+++ b/t/README
@@ -79,6 +79,10 @@ appropriately before running "make".
 --debug::
        This may help the person who is developing a new test.
        It causes the command defined with test_debug to run.
+       The "trash" directory (used to store all temporary data
+       during testing) is not deleted even if there are no
+       failed tests so that you can inspect its contents after
+       the test finished.
 
 --immediate::
        This causes the test to immediately exit upon the first
index 3f24384371bf227126e38da61f3b7efd3961ede8..d3829b8d0a18d15590f4cbde4606d130a9293ead 100644 (file)
@@ -157,7 +157,7 @@ test_http_push_nonff() {
                grep "^ ! \[rejected\][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" output
        '
 
-       test_expect_success 'non-fast-forward push shows help message' '
+       test_expect_success C_LOCALE_OUTPUT 'non-fast-forward push shows help message' '
                grep "To prevent you from losing history, non-fast-forward updates were rejected" \
                        output
        '
index 8deec75c3a0eef961986a0bb313a918ab532f58d..f4e8f43bae5d1929718578a2a589125beb5d30c8 100755 (executable)
@@ -435,7 +435,7 @@ test_expect_success 'update-index D/F conflict' '
        test $numpath0 = 1
 '
 
-test_expect_success SYMLINKS 'absolute path works as expected' '
+test_expect_success SYMLINKS 'real path works as expected' '
        mkdir first &&
        ln -s ../.git first/.git &&
        mkdir second &&
@@ -443,14 +443,14 @@ test_expect_success SYMLINKS 'absolute path works as expected' '
        mkdir third &&
        dir="$(cd .git; pwd -P)" &&
        dir2=third/../second/other/.git &&
-       test "$dir" = "$(test-path-utils make_absolute_path $dir2)" &&
+       test "$dir" = "$(test-path-utils real_path $dir2)" &&
        file="$dir"/index &&
-       test "$file" = "$(test-path-utils make_absolute_path $dir2/index)" &&
+       test "$file" = "$(test-path-utils real_path $dir2/index)" &&
        basename=blub &&
-       test "$dir/$basename" = "$(cd .git && test-path-utils make_absolute_path "$basename")" &&
+       test "$dir/$basename" = "$(cd .git && test-path-utils real_path "$basename")" &&
        ln -s ../first/file .git/syml &&
        sym="$(cd first; pwd -P)"/file &&
-       test "$sym" = "$(test-path-utils make_absolute_path "$dir2/syml")"
+       test "$sym" = "$(test-path-utils real_path "$dir2/syml")"
 '
 
 test_expect_success 'very long name in the index handled sanely' '
index f6849932112f1bbea1dafad09150857a707b64e4..a5816d0e4f3744f8ba30666d8bb5828abf6cda51 100755 (executable)
@@ -47,7 +47,7 @@ test_expect_success 'plain nested in bare' '
 
 test_expect_success 'plain through aliased command, outside any git repo' '
        (
-               sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG_NOGLOBAL &&
+               sane_unset GIT_DIR GIT_WORK_TREE &&
                HOME=$(pwd)/alias-config &&
                export HOME &&
                mkdir alias-config &&
@@ -180,7 +180,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
        fi
 '
 
-test_expect_success 'reinit' '
+test_expect_success C_LOCALE_OUTPUT 'reinit' '
 
        (
                sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
@@ -231,7 +231,6 @@ test_expect_success 'init with init.templatedir set' '
                git config -f "$test_config"  init.templatedir "${HOME}/templatedir-source" &&
                mkdir templatedir-set &&
                cd templatedir-set &&
-               sane_unset GIT_CONFIG_NOGLOBAL &&
                sane_unset GIT_TEMPLATE_DIR &&
                NO_SET_GIT_TEMPLATE_DIR=t &&
                export NO_SET_GIT_TEMPLATE_DIR &&
@@ -243,7 +242,6 @@ test_expect_success 'init with init.templatedir set' '
 test_expect_success 'init --bare/--shared overrides system/global config' '
        (
                test_config="$HOME"/.gitconfig &&
-               sane_unset GIT_CONFIG_NOGLOBAL &&
                git config -f "$test_config" core.bare false &&
                git config -f "$test_config" core.sharedRepository 0640 &&
                mkdir init-bare-shared-override &&
@@ -258,7 +256,6 @@ test_expect_success 'init --bare/--shared overrides system/global config' '
 test_expect_success 'init honors global core.sharedRepository' '
        (
                test_config="$HOME"/.gitconfig &&
-               sane_unset GIT_CONFIG_NOGLOBAL &&
                git config -f "$test_config" core.sharedRepository 0666 &&
                mkdir shared-honor-global &&
                cd shared-honor-global &&
@@ -374,4 +371,50 @@ test_expect_success 'init prefers command line to GIT_DIR' '
        ! test -d otherdir/refs
 '
 
+test_expect_success 'init with separate gitdir' '
+       rm -rf newdir &&
+       git init --separate-git-dir realgitdir newdir &&
+       echo "gitdir: `pwd`/realgitdir" >expected &&
+       test_cmp expected newdir/.git &&
+       test -d realgitdir/refs
+'
+
+test_expect_success 're-init to update git link' '
+       (
+       cd newdir &&
+       git init --separate-git-dir ../surrealgitdir
+       ) &&
+       echo "gitdir: `pwd`/surrealgitdir" >expected &&
+       test_cmp expected newdir/.git &&
+       test -d surrealgitdir/refs &&
+       ! test -d realgitdir/refs
+'
+
+test_expect_success 're-init to move gitdir' '
+       rm -rf newdir realgitdir surrealgitdir &&
+       git init newdir &&
+       (
+       cd newdir &&
+       git init --separate-git-dir ../realgitdir
+       ) &&
+       echo "gitdir: `pwd`/realgitdir" >expected &&
+       test_cmp expected newdir/.git &&
+       test -d realgitdir/refs
+'
+
+test_expect_success 're-init to move gitdir symlink' '
+       rm -rf newdir realgitdir &&
+       git init newdir &&
+       (
+       cd newdir &&
+       mv .git here &&
+       ln -s here .git &&
+       git init -L ../realgitdir
+       ) &&
+       echo "gitdir: `pwd`/realgitdir" >expected &&
+       test_cmp expected newdir/.git &&
+       test -d realgitdir/refs &&
+       ! test -d newdir/here
+'
+
 test_done
index d3225ada681d205f43914a6b59f4bdf4f2263451..99a314b08078960b8736ce94890e805943e4f970 100755 (executable)
@@ -76,60 +76,6 @@ test_expect_success 'obj pool: high-water mark' '
        test_cmp expected actual
 '
 
-test_expect_success 'line buffer' '
-       echo HELLO >expected1 &&
-       printf "%s\n" "" HELLO >expected2 &&
-       echo >expected3 &&
-       printf "%s\n" "" Q | q_to_nul >expected4 &&
-       printf "%s\n" foo "" >expected5 &&
-       printf "%s\n" "" foo >expected6 &&
-
-       test-line-buffer <<-\EOF >actual1 &&
-       5
-       HELLO
-       EOF
-
-       test-line-buffer <<-\EOF >actual2 &&
-       0
-
-       5
-       HELLO
-       EOF
-
-       q_to_nul <<-\EOF |
-       1
-       Q
-       EOF
-       test-line-buffer >actual3 &&
-
-       q_to_nul <<-\EOF |
-       0
-
-       1
-       Q
-       EOF
-       test-line-buffer >actual4 &&
-
-       test-line-buffer <<-\EOF >actual5 &&
-       5
-       foo
-       EOF
-
-       test-line-buffer <<-\EOF >actual6 &&
-       0
-
-       5
-       foo
-       EOF
-
-       test_cmp expected1 actual1 &&
-       test_cmp expected2 actual2 &&
-       test_cmp expected3 actual3 &&
-       test_cmp expected4 actual4 &&
-       test_cmp expected5 actual5 &&
-       test_cmp expected6 actual6
-'
-
 test_expect_success 'string pool' '
        echo a does not equal b >expected.differ &&
        echo a equals a >expected.match &&
diff --git a/t/t0081-line-buffer.sh b/t/t0081-line-buffer.sh
new file mode 100755 (executable)
index 0000000..5067d1e
--- /dev/null
@@ -0,0 +1,192 @@
+#!/bin/sh
+
+test_description="Test the svn importer's input handling routines.
+
+These tests exercise the line_buffer library, but their real purpose
+is to check the assumptions that library makes of the platform's input
+routines.  Processes engaged in bi-directional communication would
+hang if fread or fgets is too greedy.
+
+While at it, check that input of newlines and null bytes are handled
+correctly.
+"
+. ./test-lib.sh
+
+test -n "$GIT_REMOTE_SVN_TEST_BIG_FILES" && test_set_prereq EXPENSIVE
+
+generate_tens_of_lines () {
+       tens=$1 &&
+       line=$2 &&
+
+       i=0 &&
+       while test $i -lt "$tens"
+       do
+               for j in a b c d e f g h i j
+               do
+                       echo "$line"
+               done &&
+               : $((i = $i + 1)) ||
+               return
+       done
+}
+
+long_read_test () {
+       : each line is 10 bytes, including newline &&
+       line=abcdefghi &&
+       echo "$line" >expect &&
+
+       if ! test_declared_prereq PIPE
+       then
+               echo >&4 "long_read_test: need to declare PIPE prerequisite"
+               return 127
+       fi &&
+       tens_of_lines=$(($1 / 100 + 1)) &&
+       lines=$(($tens_of_lines * 10)) &&
+       readsize=$((($lines - 1) * 10 + 3)) &&
+       copysize=7 &&
+       rm -f input &&
+       mkfifo input &&
+       {
+               (
+                       generate_tens_of_lines $tens_of_lines "$line" &&
+                       exec sleep 100
+               ) >input &
+       } &&
+       test-line-buffer input <<-EOF >output &&
+       binary $readsize
+       copy $copysize
+       EOF
+       kill $! &&
+       test_line_count = $lines output &&
+       tail -n 1 <output >actual &&
+       test_cmp expect actual
+}
+
+test_expect_success 'setup: have pipes?' '
+      rm -f frob &&
+      if mkfifo frob
+      then
+               test_set_prereq PIPE
+      fi
+'
+
+test_expect_success 'hello world' '
+       echo ">HELLO" >expect &&
+       test-line-buffer <<-\EOF >actual &&
+       binary 6
+       HELLO
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success PIPE '0-length read, no input available' '
+       printf ">" >expect &&
+       rm -f input &&
+       mkfifo input &&
+       {
+               sleep 100 >input &
+       } &&
+       test-line-buffer input <<-\EOF >actual &&
+       binary 0
+       copy 0
+       EOF
+       kill $! &&
+       test_cmp expect actual
+'
+
+test_expect_success '0-length read, send along greeting' '
+       echo ">HELLO" >expect &&
+       test-line-buffer <<-\EOF >actual &&
+       binary 0
+       copy 6
+       HELLO
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success PIPE '1-byte read, no input available' '
+       printf ">%s" ab >expect &&
+       rm -f input &&
+       mkfifo input &&
+       {
+               (
+                       printf "%s" a &&
+                       printf "%s" b &&
+                       exec sleep 100
+               ) >input &
+       } &&
+       test-line-buffer input <<-\EOF >actual &&
+       binary 1
+       copy 1
+       EOF
+       kill $! &&
+       test_cmp expect actual
+'
+
+test_expect_success PIPE 'long read (around 8192 bytes)' '
+       long_read_test 8192
+'
+
+test_expect_success PIPE,EXPENSIVE 'longer read (around 65536 bytes)' '
+       long_read_test 65536
+'
+
+test_expect_success 'read from file descriptor' '
+       rm -f input &&
+       echo hello >expect &&
+       echo hello >input &&
+       echo copy 6 |
+       test-line-buffer "&4" 4<input >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'skip, copy null byte' '
+       echo Q | q_to_nul >expect &&
+       q_to_nul <<-\EOF | test-line-buffer >actual &&
+       skip 2
+       Q
+       copy 2
+       Q
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'read null byte' '
+       echo ">QhelloQ" | q_to_nul >expect &&
+       q_to_nul <<-\EOF | test-line-buffer >actual &&
+       binary 8
+       QhelloQ
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'long reads are truncated' '
+       echo ">foo" >expect &&
+       test-line-buffer <<-\EOF >actual &&
+       binary 5
+       foo
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'long copies are truncated' '
+       printf "%s\n" ">" foo >expect &&
+       test-line-buffer <<-\EOF >actual &&
+       binary 1
+
+       copy 5
+       foo
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'long binary reads are truncated' '
+       echo ">foo" >expect &&
+       test-line-buffer <<-\EOF >actual &&
+       binary 5
+       foo
+       EOF
+       test_cmp expect actual
+'
+
+test_done
index dd32432d626e4f3d192c2bbe4824772025bb08b1..6d52b824b115964c5551aaf4284205b98b885ce3 100755 (executable)
@@ -188,4 +188,17 @@ for args in "-w --stdin-paths" "--stdin-paths -w"; do
        pop_repo
 done
 
+test_expect_success 'corrupt tree' '
+       echo abc >malformed-tree
+       test_must_fail git hash-object -t tree malformed-tree
+'
+
+test_expect_success 'corrupt commit' '
+       test_must_fail git hash-object -t commit --stdin </dev/null
+'
+
+test_expect_success 'corrupt tag' '
+       test_must_fail git hash-object -t tag --stdin </dev/null
+'
+
 test_done
diff --git a/t/t1021-rerere-in-workdir.sh b/t/t1021-rerere-in-workdir.sh
new file mode 100755 (executable)
index 0000000..301e071
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+test_description='rerere run in a workdir'
+. ./test-lib.sh
+
+test_expect_success SYMLINKS setup '
+       git config rerere.enabled true &&
+       >world &&
+       git add world &&
+       test_tick &&
+       git commit -m initial &&
+
+       echo hello >world &&
+       test_tick &&
+       git commit -a -m hello &&
+
+       git checkout -b side HEAD^ &&
+       echo goodbye >world &&
+       test_tick &&
+       git commit -a -m goodbye &&
+
+       git checkout master
+'
+
+test_expect_success SYMLINKS 'rerere in workdir' '
+       rm -rf .git/rr-cache &&
+       "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . work &&
+       (
+               cd work &&
+               test_must_fail git merge side &&
+               git rerere status >actual &&
+               echo world >expect &&
+               test_cmp expect actual
+       )
+'
+
+# This fails because we don't resolve relative symlink in mkdir_in_gitdir()
+# For the purpose of helping contrib/workdir/git-new-workdir users, we do not
+# have to support relative symlinks, but it might be nicer to make this work
+# with a relative symbolic link someday.
+test_expect_failure SYMLINKS 'rerere in workdir (relative)' '
+       rm -rf .git/rr-cache &&
+       "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . krow &&
+       (
+               cd krow &&
+               rm -f .git/rr-cache &&
+               ln -s ../.git/rr-cache .git/rr-cache &&
+               test_must_fail git merge side &&
+               git rerere status >actual &&
+               echo world >expect &&
+               test_cmp expect actual
+       )
+'
+
+test_done
index bfa2c2190d0368eba533a8411df739eee77fa1be..3264fefbad8b941bd90b243948f618b65fe4929f 100755 (executable)
@@ -163,7 +163,10 @@ test_expect_success 'git resolve' '
        git checkout mybranch &&
        git merge -m "Merge upstream changes." master |
                sed -e "1s/[0-9a-f]\{7\}/VARIABLE/g" \
-               -e "s/^Fast[- ]forward /FASTFORWARD /" >resolve.output &&
+               -e "s/^Fast[- ]forward /FASTFORWARD /" >resolve.output
+'
+
+test_expect_success C_LOCALE_OUTPUT 'git resolve output' '
        test_cmp resolve.expect resolve.output
 '
 
index d0e55465ff08698376f5d9fa86357d51bd57458c..53fb8228cf18e2b58f3ea63e98a0220fa0fd39f2 100755 (executable)
@@ -876,11 +876,25 @@ test_expect_success 'check split_cmdline return' "
        "
 
 test_expect_success 'git -c "key=value" support' '
-       test "z$(git -c name=value config name)" = zvalue &&
        test "z$(git -c core.name=value config core.name)" = zvalue &&
-       test "z$(git -c CamelCase=value config camelcase)" = zvalue &&
-       test "z$(git -c flag config --bool flag)" = ztrue &&
-       test_must_fail git -c core.name=value config name
+       test "z$(git -c foo.CamelCase=value config foo.camelcase)" = zvalue &&
+       test "z$(git -c foo.flag config --bool foo.flag)" = ztrue &&
+       test_must_fail git -c name=value config core.name
+'
+
+test_expect_success 'key sanity-checking' '
+       test_must_fail git config foo=bar &&
+       test_must_fail git config foo=.bar &&
+       test_must_fail git config foo.ba=r &&
+       test_must_fail git config foo.1bar &&
+       test_must_fail git config foo."ba
+                               z".bar &&
+       test_must_fail git config . false &&
+       test_must_fail git config .foo false &&
+       test_must_fail git config foo. false &&
+       test_must_fail git config .foo. false &&
+       git config foo.bar true &&
+       git config foo."ba =z".bar false
 '
 
 test_done
index 15101d5e032fbbef4a66039342d07afbc5203ee0..ec50a9ad70450cb80074a6002c66bf2efb8e7833 100755 (executable)
@@ -57,7 +57,7 @@ test_repo () {
                        export GIT_WORK_TREE
                fi &&
                rm -f trace &&
-               GIT_TRACE="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
+               GIT_TRACE_SETUP="$(pwd)/trace" git symbolic-ref HEAD >/dev/null &&
                grep '^setup: ' trace >result &&
                test_cmp expected result
        )
diff --git a/t/t2019-checkout-ambiguous-ref.sh b/t/t2019-checkout-ambiguous-ref.sh
new file mode 100755 (executable)
index 0000000..cc34e55
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+test_description='checkout handling of ambiguous (branch/tag) refs'
+. ./test-lib.sh
+
+test_expect_success 'setup ambiguous refs' '
+       test_commit branch file &&
+       git branch ambiguity &&
+       git branch vagueness &&
+       test_commit tag file &&
+       git tag ambiguity &&
+       git tag vagueness HEAD:file &&
+       test_commit other file
+'
+
+test_expect_success 'checkout ambiguous ref succeeds' '
+       git checkout ambiguity >stdout 2>stderr
+'
+
+test_expect_success 'checkout produces ambiguity warning' '
+       grep "warning.*ambiguous" stderr
+'
+
+test_expect_success 'checkout chooses branch over tag' '
+       echo refs/heads/ambiguity >expect &&
+       git symbolic-ref HEAD >actual &&
+       test_cmp expect actual &&
+       echo branch >expect &&
+       test_cmp expect file
+'
+
+test_expect_success C_LOCALE_OUTPUT 'checkout reports switch to branch' '
+       grep "Switched to branch" stderr &&
+       ! grep "^HEAD is now at" stderr
+'
+
+test_expect_success 'checkout vague ref succeeds' '
+       git checkout vagueness >stdout 2>stderr &&
+       test_set_prereq VAGUENESS_SUCCESS
+'
+
+test_expect_success VAGUENESS_SUCCESS 'checkout produces ambiguity warning' '
+       grep "warning.*ambiguous" stderr
+'
+
+test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' '
+       echo refs/heads/vagueness >expect &&
+       git symbolic-ref HEAD >actual &&
+       test_cmp expect actual &&
+       echo branch >expect &&
+       test_cmp expect file
+'
+
+test_expect_success VAGUENESS_SUCCESS,C_LOCALE_OUTPUT 'checkout reports switch to branch' '
+       grep "Switched to branch" stderr &&
+       ! grep "^HEAD is now at" stderr
+'
+
+test_done
diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh
new file mode 100755 (executable)
index 0000000..569b27f
--- /dev/null
@@ -0,0 +1,142 @@
+#!/bin/sh
+
+test_description='checkout into detached HEAD state'
+. ./test-lib.sh
+
+check_detached () {
+       test_must_fail git symbolic-ref -q HEAD >/dev/null
+}
+
+check_not_detached () {
+       git symbolic-ref -q HEAD >/dev/null
+}
+
+ORPHAN_WARNING='you are leaving .* commit.*behind'
+check_orphan_warning() {
+       grep "$ORPHAN_WARNING" "$1"
+}
+check_no_orphan_warning() {
+       ! grep "$ORPHAN_WARNING" "$1"
+}
+
+reset () {
+       git checkout master &&
+       check_not_detached
+}
+
+test_expect_success 'setup' '
+       test_commit one &&
+       test_commit two &&
+       test_commit three && git tag -d three &&
+       test_commit four && git tag -d four &&
+       git branch branch &&
+       git tag tag
+'
+
+test_expect_success 'checkout branch does not detach' '
+       reset &&
+       git checkout branch &&
+       check_not_detached
+'
+
+test_expect_success 'checkout tag detaches' '
+       reset &&
+       git checkout tag &&
+       check_detached
+'
+
+test_expect_success 'checkout branch by full name detaches' '
+       reset &&
+       git checkout refs/heads/branch &&
+       check_detached
+'
+
+test_expect_success 'checkout non-ref detaches' '
+       reset &&
+       git checkout branch^ &&
+       check_detached
+'
+
+test_expect_success 'checkout ref^0 detaches' '
+       reset &&
+       git checkout branch^0 &&
+       check_detached
+'
+
+test_expect_success 'checkout --detach detaches' '
+       reset &&
+       git checkout --detach branch &&
+       check_detached
+'
+
+test_expect_success 'checkout --detach without branch name' '
+       reset &&
+       git checkout --detach &&
+       check_detached
+'
+
+test_expect_success 'checkout --detach errors out for non-commit' '
+       reset &&
+       test_must_fail git checkout --detach one^{tree} &&
+       check_not_detached
+'
+
+test_expect_success 'checkout --detach errors out for extra argument' '
+       reset &&
+       git checkout master &&
+       test_must_fail git checkout --detach tag one.t &&
+       check_not_detached
+'
+
+test_expect_success 'checkout --detached and -b are incompatible' '
+       reset &&
+       test_must_fail git checkout --detach -b newbranch tag &&
+       check_not_detached
+'
+
+test_expect_success 'checkout --detach moves HEAD' '
+       reset &&
+       git checkout one &&
+       git checkout --detach two &&
+       git diff --exit-code HEAD &&
+       git diff --exit-code two
+'
+
+test_expect_success 'checkout warns on orphan commits' '
+       reset &&
+       git checkout --detach two &&
+       echo content >orphan &&
+       git add orphan &&
+       git commit -a -m orphan &&
+       git checkout master 2>stderr &&
+       check_orphan_warning stderr
+'
+
+test_expect_success 'checkout does not warn leaving ref tip' '
+       reset &&
+       git checkout --detach two &&
+       git checkout master 2>stderr &&
+       check_no_orphan_warning stderr
+'
+
+test_expect_success 'checkout does not warn leaving reachable commit' '
+       reset &&
+       git checkout --detach HEAD^ &&
+       git checkout master 2>stderr &&
+       check_no_orphan_warning stderr
+'
+
+cat >expect <<'EOF'
+Your branch is behind 'master' by 1 commit, and can be fast-forwarded.
+EOF
+test_expect_success 'tracking count is accurate after orphan check' '
+       reset &&
+       git branch child master^ &&
+       git config branch.child.remote . &&
+       git config branch.child.merge refs/heads/master &&
+       git checkout child^ &&
+       git checkout child >stdout &&
+       test_cmp expect stdout
+'
+
+test_done
diff --git a/t/t2021-checkout-overwrite.sh b/t/t2021-checkout-overwrite.sh
new file mode 100755 (executable)
index 0000000..27db2ad
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+test_description='checkout must not overwrite an untracked objects'
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+
+       mkdir -p a/b/c &&
+       >a/b/c/d &&
+       git add -A &&
+       git commit -m base &&
+       git tag start
+'
+
+test_expect_success 'create a commit where dir a/b changed to file' '
+
+       git checkout -b file &&
+       rm -rf a/b &&
+       >a/b &&
+       git add -A &&
+       git commit -m "dir to file"
+'
+
+test_expect_success 'checkout commit with dir must not remove untracked a/b' '
+
+       git rm --cached a/b &&
+       git commit -m "un-track the file" &&
+       test_must_fail git checkout start &&
+       test -f a/b
+'
+
+test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink' '
+
+       rm -rf a/b &&   # cleanup if previous test failed
+       git checkout -f -b symlink start &&
+       rm -rf a/b &&
+       ln -s foo a/b &&
+       git add -A &&
+       git commit -m "dir to symlink"
+'
+
+test_expect_failure SYMLINKS 'checkout commit with dir must not remove untracked a/b' '
+
+       git rm --cached a/b &&
+       git commit -m "un-track the symlink" &&
+       test_must_fail git checkout start &&
+       test -h a/b
+'
+
+test_done
index 0692427cb69c62327da52061de6238ca8e12169d..856e7da1f2d3aba299d30aca9a1a6d5a288d2d91 100755 (executable)
@@ -111,7 +111,7 @@ test_expect_success 'touch and then add explicitly' '
 
 '
 
-test_expect_success 'add -n -u should not add but just report' '
+test_expect_success C_LOCALE_OUTPUT 'add -n -u should not add but just report' '
 
        (
                echo "add '\''check'\''" &&
index 24afdabab7e30feaf583079a75a756d267181bb9..49753362f0974627f1b5e5e11144484238875494 100755 (executable)
@@ -31,18 +31,21 @@ do
                rm -f .git/index &&
                test_must_fail git add "$i" 2>err &&
                git ls-files "$i" >out &&
-               ! test -s out &&
-               grep -e "Use -f if" err &&
-               cat err
+               ! test -s out
+       '
+
+       test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i output" '
+               grep -e "Use -f if" err
        '
 
        test_expect_success "complaints for ignored $i with unignored file" '
                rm -f .git/index &&
                test_must_fail git add "$i" file 2>err &&
                git ls-files "$i" >out &&
-               ! test -s out &&
-               grep -e "Use -f if" err &&
-               cat err
+               ! test -s out
+       '
+       test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i with unignored file output" '
+               grep -e "Use -f if" err
        '
 done
 
@@ -54,9 +57,14 @@ do
                        cd dir &&
                        test_must_fail git add "$i" 2>err &&
                        git ls-files "$i" >out &&
-                       ! test -s out &&
-                       grep -e "Use -f if" err &&
-                       cat err
+                       ! test -s out
+               )
+       '
+
+       test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in dir output" '
+               (
+                       cd dir &&
+                       grep -e "Use -f if" err
                )
        '
 done
@@ -69,9 +77,14 @@ do
                        cd sub &&
                        test_must_fail git add "$i" 2>err &&
                        git ls-files "$i" >out &&
-                       ! test -s out &&
-                       grep -e "Use -f if" err &&
-                       cat err
+                       ! test -s out
+               )
+       '
+
+       test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in sub output" '
+               (
+                       cd sub &&
+                       grep -e "Use -f if" err
                )
        '
 done
index 34794f8a70e1c9b71384363e022d08da4ac8872e..806fdccce1db994899509cb3dd9d7801b84c48ba 100755 (executable)
@@ -312,7 +312,7 @@ test_expect_success 'merge-recursive result' '
 
 '
 
-test_expect_success 'fail if the index has unresolved entries' '
+test_expect_success C_LOCALE_OUTPUT 'fail if the index has unresolved entries' '
 
        rm -fr [abcd] &&
        git checkout -f "$c1" &&
index 44f5421be45579b10c5556a958404ad2daa02002..2b17311cb0870ea210d9b5cbe167363d13641d67 100755 (executable)
@@ -110,6 +110,20 @@ test_expect_success '--ignore-space-change makes merge succeed' '
        git merge-recursive --ignore-space-change HEAD^ -- HEAD remote
 '
 
+test_expect_success 'naive cherry-pick fails' '
+       git read-tree --reset -u HEAD &&
+       test_must_fail git cherry-pick --no-commit remote &&
+       git read-tree --reset -u HEAD &&
+       test_must_fail git cherry-pick remote &&
+       test_must_fail git update-index --refresh &&
+       grep "<<<<<<" text.txt
+'
+
+test_expect_success '-Xignore-space-change makes cherry-pick succeed' '
+       git read-tree --reset -u HEAD &&
+       git cherry-pick --no-commit -Xignore-space-change remote
+'
+
 test_expect_success '--ignore-space-change: our w/s-only change wins' '
        q_to_cr <<-\EOF >expected &&
            justice and holiness and is the nurse of his age and theQ
index f308235f5dd28da2c19d91dc63803312aacd2cda..286a2a68692dd7a70e34851f75098506a1fc783a 100755 (executable)
@@ -203,7 +203,7 @@ test_expect_success 'test deleting branch deletes branch config' \
      test -z "$(git config branch.my7.remote)" &&
      test -z "$(git config branch.my7.merge)"'
 
-test_expect_success 'test deleting branch without config' \
+test_expect_success C_LOCALE_OUTPUT 'test deleting branch without config' \
     'git branch my7 s &&
      sha1=$(git rev-parse my7 | cut -c 1-7) &&
      test "$(git branch -d my7 2>&1)" = "Deleted branch my7 (was $sha1)."'
@@ -223,6 +223,11 @@ test_expect_success \
     'branch from non-branch HEAD w/--track causes failure' \
     'test_must_fail git branch --track my10 HEAD^'
 
+test_expect_success \
+    'branch from tag w/--track causes failure' \
+    'git tag foobar &&
+     test_must_fail git branch --track my11 foobar'
+
 # Keep this test last, as it changes the current branch
 cat >expect <<EOF
 0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000     branch: Created from master
@@ -488,6 +493,15 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' '
        test "z$(git config branch.myr20.rebase)" = z
 '
 
+test_expect_success 'autosetuprebase always on detached HEAD' '
+       git config branch.autosetupmerge always &&
+       test_when_finished git checkout master &&
+       git checkout HEAD^0 &&
+       git branch my11 &&
+       test -z "$(git config branch.my11.remote)" &&
+       test -z "$(git config branch.my11.merge)"
+'
+
 test_expect_success 'detect misconfigured autosetuprebase (bad value)' '
        git config branch.autosetuprebase garbage &&
        test_must_fail git branch
index 6028748c6cecaedb087c35182de172ca0e93fe08..4ef7d09115678ff97717a5f6a3027a87490dac79 100755 (executable)
@@ -72,7 +72,7 @@ cat >expect <<'EOF'
   branch-two
   master
 EOF
-test_expect_success 'git branch shows detached HEAD properly' '
+test_expect_success C_LOCALE_OUTPUT 'git branch shows detached HEAD properly' '
        git checkout HEAD^0 &&
        git branch >actual &&
        test_cmp expect actual
index 043954422c82d9afbb318bcb7d1aa5685a391c85..753a6c972cda61d2da3d2ecf7bd9c231004d6ad0 100755 (executable)
@@ -91,7 +91,7 @@ test_expect_success 'cherry-pick on stat-dirty working tree' '
        )
 '
 
-test_expect_success 'revert forbidden on dirty working tree' '
+test_expect_success C_LOCALE_OUTPUT 'revert forbidden on dirty working tree' '
 
        echo content >extra_file &&
        git add extra_file &&
index 607bf25d8ff7720407c2b15e4808c575b5f36093..c0c8330c20e80f26d51b62c8999533c5692094de 100755 (executable)
@@ -11,6 +11,18 @@ test_description='test cherry-pick and revert with conflicts
 
 . ./test-lib.sh
 
+test_cmp_rev () {
+       git rev-parse --verify "$1" >expect.rev &&
+       git rev-parse --verify "$2" >actual.rev &&
+       test_cmp expect.rev actual.rev
+}
+
+pristine_detach () {
+       git checkout -f "$1^0" &&
+       git read-tree -u --reset HEAD &&
+       git clean -d -f -f -q -x
+}
+
 test_expect_success setup '
 
        echo unrelated >unrelated &&
@@ -23,13 +35,7 @@ test_expect_success setup '
 '
 
 test_expect_success 'failed cherry-pick does not advance HEAD' '
-
-       git checkout -f initial^0 &&
-       git read-tree -u --reset HEAD &&
-       git clean -d -f -f -q -x &&
-
-       git update-index --refresh &&
-       git diff-index --exit-code HEAD &&
+       pristine_detach initial &&
 
        head=$(git rev-parse HEAD) &&
        test_must_fail git cherry-pick picked &&
@@ -38,34 +44,97 @@ test_expect_success 'failed cherry-pick does not advance HEAD' '
        test "$head" = "$newhead"
 '
 
-test_expect_success 'advice from failed cherry-pick' "
-       git checkout -f initial^0 &&
-       git read-tree -u --reset HEAD &&
-       git clean -d -f -f -q -x &&
-
-       git update-index --refresh &&
-       git diff-index --exit-code HEAD &&
+test_expect_success C_LOCALE_OUTPUT 'advice from failed cherry-pick' "
+       pristine_detach initial &&
 
        picked=\$(git rev-parse --short picked) &&
        cat <<-EOF >expected &&
        error: could not apply \$picked... picked
        hint: after resolving the conflicts, mark the corrected paths
        hint: with 'git add <paths>' or 'git rm <paths>'
-       hint: and commit the result with 'git commit -c \$picked'
+       hint: and commit the result with 'git commit'
        EOF
        test_must_fail git cherry-pick picked 2>actual &&
 
        test_cmp expected actual
 "
 
-test_expect_success 'failed cherry-pick produces dirty index' '
+test_expect_success 'failed cherry-pick sets CHERRY_PICK_HEAD' '
+       pristine_detach initial &&
+       test_must_fail git cherry-pick picked &&
+       test_cmp_rev picked CHERRY_PICK_HEAD
+'
 
-       git checkout -f initial^0 &&
-       git read-tree -u --reset HEAD &&
-       git clean -d -f -f -q -x &&
+test_expect_success 'successful cherry-pick does not set CHERRY_PICK_HEAD' '
+       pristine_detach initial &&
+       git cherry-pick base &&
+       test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
+'
+
+test_expect_success 'cherry-pick --no-commit does not set CHERRY_PICK_HEAD' '
+       pristine_detach initial &&
+       git cherry-pick --no-commit base &&
+       test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
+'
+
+test_expect_success 'GIT_CHERRY_PICK_HELP suppresses CHERRY_PICK_HEAD' '
+       pristine_detach initial &&
+       (
+               GIT_CHERRY_PICK_HELP="and then do something else" &&
+               export GIT_CHERRY_PICK_HELP &&
+               test_must_fail git cherry-pick picked
+       ) &&
+       test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
+'
+
+test_expect_success 'git reset clears CHERRY_PICK_HEAD' '
+       pristine_detach initial &&
+
+       test_must_fail git cherry-pick picked &&
+       git reset &&
+
+       test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
+'
+
+test_expect_success 'failed commit does not clear CHERRY_PICK_HEAD' '
+       pristine_detach initial &&
+
+       test_must_fail git cherry-pick picked &&
+       test_must_fail git commit &&
+
+       test_cmp_rev picked CHERRY_PICK_HEAD
+'
+
+test_expect_success 'cancelled commit does not clear CHERRY_PICK_HEAD' '
+       pristine_detach initial &&
 
-       git update-index --refresh &&
-       git diff-index --exit-code HEAD &&
+       test_must_fail git cherry-pick picked &&
+       echo resolved >foo &&
+       git add foo &&
+       git update-index --refresh -q &&
+       test_must_fail git diff-index --exit-code HEAD &&
+       (
+               GIT_EDITOR=false &&
+               export GIT_EDITOR &&
+               test_must_fail git commit
+       ) &&
+
+       test_cmp_rev picked CHERRY_PICK_HEAD
+'
+
+test_expect_success 'successful commit clears CHERRY_PICK_HEAD' '
+       pristine_detach initial &&
+
+       test_must_fail git cherry-pick picked &&
+       echo resolved >foo &&
+       git add foo &&
+       git commit &&
+
+       test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
+'
+
+test_expect_success 'failed cherry-pick produces dirty index' '
+       pristine_detach initial &&
 
        test_must_fail git cherry-pick picked &&
 
@@ -74,9 +143,7 @@ test_expect_success 'failed cherry-pick produces dirty index' '
 '
 
 test_expect_success 'failed cherry-pick registers participants in index' '
-
-       git read-tree -u --reset HEAD &&
-       git clean -d -f -f -q -x &&
+       pristine_detach initial &&
        {
                git checkout base -- foo &&
                git ls-files --stage foo &&
@@ -90,10 +157,7 @@ test_expect_success 'failed cherry-pick registers participants in index' '
                2 s/ 0  / 2     /
                3 s/ 0  / 3     /
        " < stages > expected &&
-       git checkout -f initial^0 &&
-
-       git update-index --refresh &&
-       git diff-index --exit-code HEAD &&
+       git read-tree -u --reset HEAD &&
 
        test_must_fail git cherry-pick picked &&
        git ls-files --stage --unmerged > actual &&
@@ -102,10 +166,7 @@ test_expect_success 'failed cherry-pick registers participants in index' '
 '
 
 test_expect_success 'failed cherry-pick describes conflict in work tree' '
-
-       git checkout -f initial^0 &&
-       git read-tree -u --reset HEAD &&
-       git clean -d -f -f -q -x &&
+       pristine_detach initial &&
        cat <<-EOF > expected &&
        <<<<<<< HEAD
        a
@@ -114,9 +175,6 @@ test_expect_success 'failed cherry-pick describes conflict in work tree' '
        >>>>>>> objid picked
        EOF
 
-       git update-index --refresh &&
-       git diff-index --exit-code HEAD &&
-
        test_must_fail git cherry-pick picked &&
 
        sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
@@ -124,11 +182,8 @@ test_expect_success 'failed cherry-pick describes conflict in work tree' '
 '
 
 test_expect_success 'diff3 -m style' '
-
+       pristine_detach initial &&
        git config merge.conflictstyle diff3 &&
-       git checkout -f initial^0 &&
-       git read-tree -u --reset HEAD &&
-       git clean -d -f -f -q -x &&
        cat <<-EOF > expected &&
        <<<<<<< HEAD
        a
@@ -139,9 +194,6 @@ test_expect_success 'diff3 -m style' '
        >>>>>>> objid picked
        EOF
 
-       git update-index --refresh &&
-       git diff-index --exit-code HEAD &&
-
        test_must_fail git cherry-pick picked &&
 
        sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
@@ -149,10 +201,8 @@ test_expect_success 'diff3 -m style' '
 '
 
 test_expect_success 'revert also handles conflicts sanely' '
-
        git config --unset merge.conflictstyle &&
-       git read-tree -u --reset HEAD &&
-       git clean -d -f -f -q -x &&
+       pristine_detach initial &&
        cat <<-EOF > expected &&
        <<<<<<< HEAD
        a
@@ -173,10 +223,7 @@ test_expect_success 'revert also handles conflicts sanely' '
                2 s/ 0  / 2     /
                3 s/ 0  / 3     /
        " < stages > expected-stages &&
-       git checkout -f initial^0 &&
-
-       git update-index --refresh &&
-       git diff-index --exit-code HEAD &&
+       git read-tree -u --reset HEAD &&
 
        head=$(git rev-parse HEAD) &&
        test_must_fail git revert picked &&
@@ -192,10 +239,8 @@ test_expect_success 'revert also handles conflicts sanely' '
 '
 
 test_expect_success 'revert conflict, diff3 -m style' '
+       pristine_detach initial &&
        git config merge.conflictstyle diff3 &&
-       git checkout -f initial^0 &&
-       git read-tree -u --reset HEAD &&
-       git clean -d -f -f -q -x &&
        cat <<-EOF > expected &&
        <<<<<<< HEAD
        a
@@ -206,9 +251,6 @@ test_expect_success 'revert conflict, diff3 -m style' '
        >>>>>>> parent of objid picked
        EOF
 
-       git update-index --refresh &&
-       git diff-index --exit-code HEAD &&
-
        test_must_fail git revert picked &&
 
        sed "s/[a-f0-9]*\.\.\./objid/" foo > actual &&
index ec7108358e7b7f54f0b5e7530c8368e4a56576af..7de42faf4887c6e8137c2498a96b41a4afe4e672 100755 (executable)
@@ -268,8 +268,12 @@ test_expect_success 'git add --dry-run of existing changed file' "
 
 test_expect_success 'git add --dry-run of non-existing file' "
        echo ignored-file >>.gitignore &&
-       test_must_fail git add --dry-run track-this ignored-file >actual 2>&1 &&
-       echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual
+       test_must_fail git add --dry-run track-this ignored-file >actual 2>&1
+"
+
+test_expect_success C_LOCALE_OUTPUT 'git add --dry-run of an existing file output' "
+       echo \"fatal: pathspec 'ignored-file' did not match any files\" >expect &&
+       test_cmp expect actual
 "
 
 cat >expect.err <<\EOF
@@ -283,7 +287,10 @@ add 'track-this'
 EOF
 
 test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
-       test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err &&
+       test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err
+'
+
+test_expect_success C_LOCALE_OUTPUT 'git add --dry-run --ignore-missing of non-existing file output' '
        test_cmp expect.out actual.out &&
        test_cmp expect.err actual.err
 '
index 6fd560ccf10db5d016a4f1dde9e5eacca70e6f5b..f62aaf5816f6ecf4e2c4e8fe5ae60925e61ccfcd 100755 (executable)
@@ -556,4 +556,23 @@ test_expect_success 'stash branch should not drop the stash if the branch exists
        git rev-parse stash@{0} --
 '
 
+test_expect_success 'stash apply shows status same as git status (relative to current directory)' '
+       git stash clear &&
+       echo 1 >subdir/subfile1 &&
+       echo 2 >subdir/subfile2 &&
+       git add subdir/subfile1 &&
+       git commit -m subdir &&
+       (
+               cd subdir &&
+               echo x >subfile1 &&
+               echo x >../file &&
+               git status >../expect &&
+               git stash &&
+               sane_unset GIT_MERGE_VERBOSITY &&
+               git stash apply
+       ) |
+       sed -e 1,2d >actual && # drop "Saved..." and "HEAD is now..."
+       test_cmp expect actual
+'
+
 test_done
index 71bac83dd5e42a19e3b1a7e869df0e7143371c99..cad85450b78891a98a0b60af1422c62c7288265c 100755 (executable)
@@ -64,7 +64,7 @@ test_expect_success \
     'validate the output.' \
     'compare_diff_patch current expected'
 
-test_expect_success 'favour same basenames over different ones' '
+test_expect_success C_LOCALE_OUTPUT 'favour same basenames over different ones' '
        cp path1 another-path &&
        git add another-path &&
        git commit -m 1 &&
@@ -73,7 +73,7 @@ test_expect_success 'favour same basenames over different ones' '
        git mv another-path subdir/path1 &&
        git status | grep "renamed: .*path1 -> subdir/path1"'
 
-test_expect_success  'favour same basenames even with minor differences' '
+test_expect_success C_LOCALE_OUTPUT  'favour same basenames even with minor differences' '
        git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
        git status | grep "renamed: .*path1 -> subdir/path1"'
 
index 94df7ae53a0ef47c0ef10ca6b3215ffdf38fa399..fbc8cd8f05f4debeb30b935c1b1db86e94e49f0e 100755 (executable)
@@ -70,4 +70,36 @@ test_expect_success 'diff-tree pathspec' '
        test_cmp expected current
 '
 
+EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+
+test_expect_success 'diff-tree with wildcard shows dir also matches' '
+       git diff-tree --name-only $EMPTY_TREE $tree -- "f*" >result &&
+       echo file0 >expected &&
+       test_cmp expected result
+'
+
+test_expect_success 'diff-tree -r with wildcard' '
+       git diff-tree -r --name-only $EMPTY_TREE $tree -- "*file1" >result &&
+       echo path1/file1 >expected &&
+       test_cmp expected result
+'
+
+test_expect_success 'diff-tree with wildcard shows dir also matches' '
+       git diff-tree --name-only $tree $tree2 -- "path1/f*" >result &&
+       echo path1 >expected &&
+       test_cmp expected result
+'
+
+test_expect_success 'diff-tree -r with wildcard from beginning' '
+       git diff-tree -r --name-only $tree $tree2 -- "path1/*file1" >result &&
+       echo path1/file1 >expected &&
+       test_cmp expected result
+'
+
+test_expect_success 'diff-tree -r with wildcard' '
+       git diff-tree -r --name-only $tree $tree2 -- "path1/f*" >result &&
+       echo path1/file1 >expected &&
+       test_cmp expected result
+'
+
 test_done
index b8f81d07c33d3596fef5f5a361f4774d5e357fca..5daa0f2a0c9c8cd6ed2c06e12c8fd421c178d4f0 100755 (executable)
@@ -210,6 +210,9 @@ log -m -p master
 log -SF master
 log -S F master
 log -SF -p master
+log -SF master --max-count=0
+log -SF master --max-count=1
+log -SF master --max-count=2
 log -GF master
 log -GF -p master
 log -GF -p --pickaxe-all master
diff --git a/t/t4013/diff.log_-SF_master_--max-count=0 b/t/t4013/diff.log_-SF_master_--max-count=0
new file mode 100644 (file)
index 0000000..c1fc6c8
--- /dev/null
@@ -0,0 +1,2 @@
+$ git log -SF master --max-count=0
+$
diff --git a/t/t4013/diff.log_-SF_master_--max-count=1 b/t/t4013/diff.log_-SF_master_--max-count=1
new file mode 100644 (file)
index 0000000..c981a03
--- /dev/null
@@ -0,0 +1,7 @@
+$ git log -SF master --max-count=1
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date:   Mon Jun 26 00:02:00 2006 +0000
+
+    Third
+$
diff --git a/t/t4013/diff.log_-SF_master_--max-count=2 b/t/t4013/diff.log_-SF_master_--max-count=2
new file mode 100644 (file)
index 0000000..a6c55fd
--- /dev/null
@@ -0,0 +1,7 @@
+$ git log -SF master --max-count=2
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date:   Mon Jun 26 00:02:00 2006 +0000
+
+    Third
+$
index 027c13d52cd701ba28e3c5e29c5431acfccdad73..c3cdb5205350985f3362268b0cd63bc59bee2444 100755 (executable)
@@ -614,7 +614,7 @@ echo "fatal: --name-only does not make sense" > expect.name-only
 echo "fatal: --name-status does not make sense" > expect.name-status
 echo "fatal: --check does not make sense" > expect.check
 
-test_expect_success 'options no longer allowed for format-patch' '
+test_expect_success C_LOCALE_OUTPUT 'options no longer allowed for format-patch' '
        test_must_fail git format-patch --name-only 2> output &&
        test_cmp expect.name-only output &&
        test_must_fail git format-patch --name-status 2> output &&
@@ -709,4 +709,88 @@ test_expect_success TTY 'format-patch --stdout paginates' '
        test_path_is_missing .git/pager_used
 '
 
+test_expect_success 'format-patch handles multi-line subjects' '
+       rm -rf patches/ &&
+       echo content >>file &&
+       for i in one two three; do echo $i; done >msg &&
+       git add file &&
+       git commit -F msg &&
+       git format-patch -o patches -1 &&
+       grep ^Subject: patches/0001-one.patch >actual &&
+       echo "Subject: [PATCH] one two three" >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'format-patch handles multi-line encoded subjects' '
+       rm -rf patches/ &&
+       echo content >>file &&
+       for i in en två tre; do echo $i; done >msg &&
+       git add file &&
+       git commit -F msg &&
+       git format-patch -o patches -1 &&
+       grep ^Subject: patches/0001-en.patch >actual &&
+       echo "Subject: [PATCH] =?UTF-8?q?en=20tv=C3=A5=20tre?=" >expect &&
+       test_cmp expect actual
+'
+
+M8="foo bar "
+M64=$M8$M8$M8$M8$M8$M8$M8$M8
+M512=$M64$M64$M64$M64$M64$M64$M64$M64
+cat >expect <<'EOF'
+Subject: [PATCH] foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
+ bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
+ bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
+ bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
+ bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
+ foo bar foo bar foo bar foo bar
+EOF
+test_expect_success 'format-patch wraps extremely long headers (ascii)' '
+       echo content >>file &&
+       git add file &&
+       git commit -m "$M512" &&
+       git format-patch --stdout -1 >patch &&
+       sed -n "/^Subject/p; /^ /p; /^$/q" <patch >subject &&
+       test_cmp expect subject
+'
+
+M8="föö bar "
+M64=$M8$M8$M8$M8$M8$M8$M8$M8
+M512=$M64$M64$M64$M64$M64$M64$M64$M64
+cat >expect <<'EOF'
+Subject: [PATCH] =?UTF-8?q?f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
+ =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar?=
+EOF
+test_expect_success 'format-patch wraps extremely long headers (rfc2047)' '
+       rm -rf patches/ &&
+       echo content >>file &&
+       git add file &&
+       git commit -m "$M512" &&
+       git format-patch --stdout -1 >patch &&
+       sed -n "/^Subject/p; /^ /p; /^$/q" <patch >subject &&
+       test_cmp expect subject
+'
+
 test_done
index 8096d8a337867b4afdc4b061fdc314fdd8eac185..37aeab0d5c7415a54384c90708626f6a5807acee 100755 (executable)
@@ -4,331 +4,307 @@ test_description='word diff colors'
 
 . ./test-lib.sh
 
-test_expect_success setup '
-
-       git config diff.color.old red &&
-       git config diff.color.new green &&
-       git config diff.color.func magenta
+cat >pre.simple <<-\EOF
+       h(4)
 
-'
+       a = b + c
+EOF
+cat >post.simple <<-\EOF
+       h(4),hh[44]
 
-word_diff () {
-       test_must_fail git diff --no-index "$@" pre post > output &&
-       test_decode_color <output >output.decrypted &&
-       test_cmp expect output.decrypted
-}
+       a = b + c
 
-cat > pre <<\EOF
-h(4)
+       aa = a
 
-a = b + c
+       aeff = aeff * ( aaa )
 EOF
+cat >expect.letter-runs-are-words <<-\EOF
+       <BOLD>diff --git a/pre b/post<RESET>
+       <BOLD>index 330b04f..5ed8eff 100644<RESET>
+       <BOLD>--- a/pre<RESET>
+       <BOLD>+++ b/post<RESET>
+       <CYAN>@@ -1,3 +1,7 @@<RESET>
+       h(4),<GREEN>hh<RESET>[44]
 
-cat > post <<\EOF
-h(4),hh[44]
-
-a = b + c
+       a = b + c<RESET>
 
-aa = a
+       <GREEN>aa = a<RESET>
 
-aeff = aeff * ( aaa )
+       <GREEN>aeff = aeff * ( aaa<RESET> )
 EOF
+cat >expect.non-whitespace-is-word <<-\EOF
+       <BOLD>diff --git a/pre b/post<RESET>
+       <BOLD>index 330b04f..5ed8eff 100644<RESET>
+       <BOLD>--- a/pre<RESET>
+       <BOLD>+++ b/post<RESET>
+       <CYAN>@@ -1,3 +1,7 @@<RESET>
+       h(4)<GREEN>,hh[44]<RESET>
 
-cat > expect <<\EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 330b04f..5ed8eff 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1,3 +1,7 @@<RESET>
-<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>
+       a = b + c<RESET>
 
-a = b + c<RESET>
+       <GREEN>aa = a<RESET>
 
-<GREEN>aa = a<RESET>
-
-<GREEN>aeff = aeff * ( aaa )<RESET>
+       <GREEN>aeff = aeff * ( aaa )<RESET>
 EOF
 
-test_expect_success 'word diff with runs of whitespace' '
+word_diff () {
+       test_must_fail git diff --no-index "$@" pre post >output &&
+       test_decode_color <output >output.decrypted &&
+       test_cmp expect output.decrypted
+}
 
-       word_diff --color-words
+test_language_driver () {
+       lang=$1
+       test_expect_success "diff driver '$lang'" '
+               cp "$TEST_DIRECTORY/t4034/'"$lang"'/pre" \
+                       "$TEST_DIRECTORY/t4034/'"$lang"'/post" \
+                       "$TEST_DIRECTORY/t4034/'"$lang"'/expect" . &&
+               echo "* diff='"$lang"'" >.gitattributes &&
+               word_diff --color-words
+       '
+}
 
+test_expect_success setup '
+       git config diff.color.old red &&
+       git config diff.color.new green &&
+       git config diff.color.func magenta
 '
 
-test_expect_success '--word-diff=color' '
-
-       word_diff --word-diff=color
-
+test_expect_success 'set up pre and post with runs of whitespace' '
+       cp pre.simple pre &&
+       cp post.simple post
 '
 
-test_expect_success '--color --word-diff=color' '
-
+test_expect_success 'word diff with runs of whitespace' '
+       cat >expect <<-\EOF &&
+               <BOLD>diff --git a/pre b/post<RESET>
+               <BOLD>index 330b04f..5ed8eff 100644<RESET>
+               <BOLD>--- a/pre<RESET>
+               <BOLD>+++ b/post<RESET>
+               <CYAN>@@ -1,3 +1,7 @@<RESET>
+               <RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>
+
+               a = b + c<RESET>
+
+               <GREEN>aa = a<RESET>
+
+               <GREEN>aeff = aeff * ( aaa )<RESET>
+       EOF
+       word_diff --color-words &&
+       word_diff --word-diff=color &&
        word_diff --color --word-diff=color
-
 '
 
-sed 's/#.*$//' > expect <<EOF
-diff --git a/pre b/post
-index 330b04f..5ed8eff 100644
---- a/pre
-+++ b/post
-@@ -1,3 +1,7 @@
--h(4)
-+h(4),hh[44]
-~
- # significant space
-~
- a = b + c
-~
-~
-+aa = a
-~
-~
-+aeff = aeff * ( aaa )
-~
-EOF
-
 test_expect_success '--word-diff=porcelain' '
-
+       sed 's/#.*$//' >expect <<-\EOF &&
+               diff --git a/pre b/post
+               index 330b04f..5ed8eff 100644
+               --- a/pre
+               +++ b/post
+               @@ -1,3 +1,7 @@
+               -h(4)
+               +h(4),hh[44]
+               ~
+                # significant space
+               ~
+                a = b + c
+               ~
+               ~
+               +aa = a
+               ~
+               ~
+               +aeff = aeff * ( aaa )
+               ~
+       EOF
        word_diff --word-diff=porcelain
-
 '
 
-cat > expect <<EOF
-diff --git a/pre b/post
-index 330b04f..5ed8eff 100644
---- a/pre
-+++ b/post
-@@ -1,3 +1,7 @@
-[-h(4)-]{+h(4),hh[44]+}
-
-a = b + c
-
-{+aa = a+}
-
-{+aeff = aeff * ( aaa )+}
-EOF
-
 test_expect_success '--word-diff=plain' '
+       cat >expect <<-\EOF &&
+               diff --git a/pre b/post
+               index 330b04f..5ed8eff 100644
+               --- a/pre
+               +++ b/post
+               @@ -1,3 +1,7 @@
+               [-h(4)-]{+h(4),hh[44]+}
 
-       word_diff --word-diff=plain
-
-'
+               a = b + c
 
-test_expect_success '--word-diff=plain --no-color' '
+               {+aa = a+}
 
+               {+aeff = aeff * ( aaa )+}
+       EOF
+       word_diff --word-diff=plain &&
        word_diff --word-diff=plain --no-color
-
 '
 
-cat > expect <<EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 330b04f..5ed8eff 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1,3 +1,7 @@<RESET>
-<RED>[-h(4)-]<RESET><GREEN>{+h(4),hh[44]+}<RESET>
-
-a = b + c<RESET>
-
-<GREEN>{+aa = a+}<RESET>
+test_expect_success '--word-diff=plain --color' '
+       cat >expect <<-\EOF &&
+               <BOLD>diff --git a/pre b/post<RESET>
+               <BOLD>index 330b04f..5ed8eff 100644<RESET>
+               <BOLD>--- a/pre<RESET>
+               <BOLD>+++ b/post<RESET>
+               <CYAN>@@ -1,3 +1,7 @@<RESET>
+               <RED>[-h(4)-]<RESET><GREEN>{+h(4),hh[44]+}<RESET>
 
-<GREEN>{+aeff = aeff * ( aaa )+}<RESET>
-EOF
+               a = b + c<RESET>
 
-test_expect_success '--word-diff=plain --color' '
+               <GREEN>{+aa = a+}<RESET>
 
+               <GREEN>{+aeff = aeff * ( aaa )+}<RESET>
+       EOF
        word_diff --word-diff=plain --color
-
 '
 
-cat > expect <<\EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 330b04f..5ed8eff 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1 +1 @@<RESET>
-<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>
-<CYAN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET>
-
-<GREEN>aa = a<RESET>
-
-<GREEN>aeff = aeff * ( aaa )<RESET>
-EOF
-
 test_expect_success 'word diff without context' '
-
+       cat >expect <<-\EOF &&
+               <BOLD>diff --git a/pre b/post<RESET>
+               <BOLD>index 330b04f..5ed8eff 100644<RESET>
+               <BOLD>--- a/pre<RESET>
+               <BOLD>+++ b/post<RESET>
+               <CYAN>@@ -1 +1 @@<RESET>
+               <RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>
+               <CYAN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET>
+
+               <GREEN>aa = a<RESET>
+
+               <GREEN>aeff = aeff * ( aaa )<RESET>
+       EOF
        word_diff --color-words --unified=0
-
 '
 
-cat > expect <<\EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 330b04f..5ed8eff 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1,3 +1,7 @@<RESET>
-h(4),<GREEN>hh<RESET>[44]
-
-a = b + c<RESET>
-
-<GREEN>aa = a<RESET>
-
-<GREEN>aeff = aeff * ( aaa<RESET> )
-EOF
-cp expect expect.letter-runs-are-words
-
 test_expect_success 'word diff with a regular expression' '
-
+       cp expect.letter-runs-are-words expect &&
        word_diff --color-words="[a-z]+"
-
 '
 
-test_expect_success 'set a diff driver' '
+test_expect_success 'set up a diff driver' '
        git config diff.testdriver.wordRegex "[^[:space:]]" &&
-       cat <<EOF > .gitattributes
-pre diff=testdriver
-post diff=testdriver
-EOF
+       cat <<-\EOF >.gitattributes
+               pre diff=testdriver
+               post diff=testdriver
+       EOF
 '
 
 test_expect_success 'option overrides .gitattributes' '
-
+       cp expect.letter-runs-are-words expect &&
        word_diff --color-words="[a-z]+"
-
 '
 
-cat > expect <<\EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 330b04f..5ed8eff 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1,3 +1,7 @@<RESET>
-h(4)<GREEN>,hh[44]<RESET>
-
-a = b + c<RESET>
-
-<GREEN>aa = a<RESET>
-
-<GREEN>aeff = aeff * ( aaa )<RESET>
-EOF
-cp expect expect.non-whitespace-is-word
-
 test_expect_success 'use regex supplied by driver' '
-
+       cp expect.non-whitespace-is-word expect &&
        word_diff --color-words
-
 '
 
-test_expect_success 'set diff.wordRegex option' '
+test_expect_success 'set up diff.wordRegex option' '
        git config diff.wordRegex "[[:alnum:]]+"
 '
 
-cp expect.letter-runs-are-words expect
-
 test_expect_success 'command-line overrides config' '
+       cp expect.letter-runs-are-words expect &&
        word_diff --color-words="[a-z]+"
 '
 
-cat > expect <<\EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 330b04f..5ed8eff 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1,3 +1,7 @@<RESET>
-h(4),<GREEN>{+hh+}<RESET>[44]
-
-a = b + c<RESET>
+test_expect_success 'command-line overrides config: --word-diff-regex' '
+       cat >expect <<-\EOF &&
+               <BOLD>diff --git a/pre b/post<RESET>
+               <BOLD>index 330b04f..5ed8eff 100644<RESET>
+               <BOLD>--- a/pre<RESET>
+               <BOLD>+++ b/post<RESET>
+               <CYAN>@@ -1,3 +1,7 @@<RESET>
+               h(4),<GREEN>{+hh+}<RESET>[44]
 
-<GREEN>{+aa = a+}<RESET>
+               a = b + c<RESET>
 
-<GREEN>{+aeff = aeff * ( aaa+}<RESET> )
-EOF
+               <GREEN>{+aa = a+}<RESET>
 
-test_expect_success 'command-line overrides config: --word-diff-regex' '
+               <GREEN>{+aeff = aeff * ( aaa+}<RESET> )
+       EOF
        word_diff --color --word-diff-regex="[a-z]+"
 '
 
-cp expect.non-whitespace-is-word expect
-
 test_expect_success '.gitattributes override config' '
+       cp expect.non-whitespace-is-word expect &&
        word_diff --color-words
 '
 
-test_expect_success 'remove diff driver regex' '
-       git config --unset diff.testdriver.wordRegex
+test_expect_success 'setup: remove diff driver regex' '
+       test_might_fail git config --unset diff.testdriver.wordRegex
 '
 
-cat > expect <<\EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 330b04f..5ed8eff 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1,3 +1,7 @@<RESET>
-h(4),<GREEN>hh[44<RESET>]
-
-a = b + c<RESET>
+test_expect_success 'use configured regex' '
+       cat >expect <<-\EOF &&
+               <BOLD>diff --git a/pre b/post<RESET>
+               <BOLD>index 330b04f..5ed8eff 100644<RESET>
+               <BOLD>--- a/pre<RESET>
+               <BOLD>+++ b/post<RESET>
+               <CYAN>@@ -1,3 +1,7 @@<RESET>
+               h(4),<GREEN>hh[44<RESET>]
 
-<GREEN>aa = a<RESET>
+               a = b + c<RESET>
 
-<GREEN>aeff = aeff * ( aaa<RESET> )
-EOF
+               <GREEN>aa = a<RESET>
 
-test_expect_success 'use configured regex' '
+               <GREEN>aeff = aeff * ( aaa<RESET> )
+       EOF
        word_diff --color-words
 '
 
-echo 'aaa (aaa)' > pre
-echo 'aaa (aaa) aaa' > post
-
-cat > expect <<\EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index c29453b..be22f37 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1 +1 @@<RESET>
-aaa (aaa) <GREEN>aaa<RESET>
-EOF
-
 test_expect_success 'test parsing words for newline' '
-
+       echo "aaa (aaa)" >pre &&
+       echo "aaa (aaa) aaa" >post &&
+       cat >expect <<-\EOF &&
+               <BOLD>diff --git a/pre b/post<RESET>
+               <BOLD>index c29453b..be22f37 100644<RESET>
+               <BOLD>--- a/pre<RESET>
+               <BOLD>+++ b/post<RESET>
+               <CYAN>@@ -1 +1 @@<RESET>
+               aaa (aaa) <GREEN>aaa<RESET>
+       EOF
        word_diff --color-words="a+"
-
-
 '
 
-echo '(:' > pre
-echo '(' > post
-
-cat > expect <<\EOF
-<BOLD>diff --git a/pre b/post<RESET>
-<BOLD>index 289cb9d..2d06f37 100644<RESET>
-<BOLD>--- a/pre<RESET>
-<BOLD>+++ b/post<RESET>
-<CYAN>@@ -1 +1 @@<RESET>
-(<RED>:<RESET>
-EOF
-
 test_expect_success 'test when words are only removed at the end' '
-
+       echo "(:" >pre &&
+       echo "(" >post &&
+       cat >expect <<-\EOF &&
+               <BOLD>diff --git a/pre b/post<RESET>
+               <BOLD>index 289cb9d..2d06f37 100644<RESET>
+               <BOLD>--- a/pre<RESET>
+               <BOLD>+++ b/post<RESET>
+               <CYAN>@@ -1 +1 @@<RESET>
+               (<RED>:<RESET>
+       EOF
        word_diff --color-words=.
-
 '
 
-cat > expect <<\EOF
-diff --git a/pre b/post
-index 289cb9d..2d06f37 100644
---- a/pre
-+++ b/post
-@@ -1 +1 @@
--(:
-+(
-EOF
-
 test_expect_success '--word-diff=none' '
-
+       echo "(:" >pre &&
+       echo "(" >post &&
+       cat >expect <<-\EOF &&
+               diff --git a/pre b/post
+               index 289cb9d..2d06f37 100644
+               --- a/pre
+               +++ b/post
+               @@ -1 +1 @@
+               -(:
+               +(
+       EOF
        word_diff --word-diff=plain --word-diff=none
-
 '
 
+test_language_driver bibtex
+test_language_driver cpp
+test_language_driver csharp
+test_language_driver fortran
+test_language_driver html
+test_language_driver java
+test_language_driver objc
+test_language_driver pascal
+test_language_driver perl
+test_language_driver php
+test_language_driver python
+test_language_driver ruby
+test_language_driver tex
+
 test_done
diff --git a/t/t4034/bibtex/expect b/t/t4034/bibtex/expect
new file mode 100644 (file)
index 0000000..a157774
--- /dev/null
@@ -0,0 +1,15 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 95cd55b..ddcba9b 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,9 +1,10 @@<RESET>
+@article{aldous1987uie,<RESET>
+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},<RESET>
+  author={Aldous, <RED>D.<RESET><GREEN>David<RESET>},
+  journal={Information Theory, IEEE Transactions on},<RESET>
+  volume={<RED>33<RESET><GREEN>Bogus.<RESET>},
+  number={<RED>2<RESET><GREEN>4<RESET>},
+  pages={219--223},<RESET>
+  year=<GREEN>1987,<RESET>
+<GREEN>  note={This is in fact a rather funny read since ethernet works well in practice. The<RESET> {<RED>1987<RESET><GREEN>\em pre} reference is the right one, however.<RESET>}<RED>,<RESET>
+}<RESET>
diff --git a/t/t4034/bibtex/post b/t/t4034/bibtex/post
new file mode 100644 (file)
index 0000000..ddcba9b
--- /dev/null
@@ -0,0 +1,10 @@
+@article{aldous1987uie,
+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},
+  author={Aldous, David},
+  journal={Information Theory, IEEE Transactions on},
+  volume={Bogus.},
+  number={4},
+  pages={219--223},
+  year=1987,
+  note={This is in fact a rather funny read since ethernet works well in practice. The {\em pre} reference is the right one, however.}
+}
diff --git a/t/t4034/bibtex/pre b/t/t4034/bibtex/pre
new file mode 100644 (file)
index 0000000..95cd55b
--- /dev/null
@@ -0,0 +1,9 @@
+@article{aldous1987uie,
+  title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},
+  author={Aldous, D.},
+  journal={Information Theory, IEEE Transactions on},
+  volume={33},
+  number={2},
+  pages={219--223},
+  year={1987},
+}
diff --git a/t/t4034/cpp/expect b/t/t4034/cpp/expect
new file mode 100644 (file)
index 0000000..37d1ea2
--- /dev/null
@@ -0,0 +1,36 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 23d5c8a..7e8c026 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,19 +1,19 @@<RESET>
+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }
+cout<<"Hello World<RED>!<RESET><GREEN>?<RESET>\n"<<endl;
+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'
+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>^<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>|<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>||<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z
+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>,y
+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>
diff --git a/t/t4034/cpp/post b/t/t4034/cpp/post
new file mode 100644 (file)
index 0000000..7e8c026
--- /dev/null
@@ -0,0 +1,19 @@
+Foo() : x(0&42) { bar(x); }
+cout<<"Hello World?\n"<<endl;
+(1) (-1e10) (0xabcdef) 'y'
+[x] x->y x.y
+!x ~x x++ x-- x*y x&y
+x*y x/y x%y
+x+y x-y
+x<<y x>>y
+x<y x<=y x>y x>=y
+x==y x!=y
+x&y
+x^y
+x|y
+x&&y
+x||y
+x?y:z
+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
+x,y
+x::y
diff --git a/t/t4034/cpp/pre b/t/t4034/cpp/pre
new file mode 100644 (file)
index 0000000..23d5c8a
--- /dev/null
@@ -0,0 +1,19 @@
+Foo():x(0&&1){}
+cout<<"Hello World!\n"<<endl;
+1 -1e10 0xabcdef 'x'
+[a] a->b a.b
+!a ~a a++ a-- a*b a&b
+a*b a/b a%b
+a+b a-b
+a<<b a>>b
+a<b a<=b a>b a>=b
+a==b a!=b
+a&b
+a^b
+a|b
+a&&b
+a||b
+a?b:z
+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
+a,y
+a::b
diff --git a/t/t4034/csharp/expect b/t/t4034/csharp/expect
new file mode 100644 (file)
index 0000000..e5d1dd2
--- /dev/null
@@ -0,0 +1,35 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 9106d63..dd5f421 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,18 +1,18 @@<RESET>
+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }
+cout<<"Hello World<RED>!<RESET><GREEN>?<RESET>\n"<<endl;
+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'
+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>^<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>|<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>||<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z
+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>,y
diff --git a/t/t4034/csharp/post b/t/t4034/csharp/post
new file mode 100644 (file)
index 0000000..dd5f421
--- /dev/null
@@ -0,0 +1,18 @@
+Foo() : x(0&42) { bar(x); }
+cout<<"Hello World?\n"<<endl;
+(1) (-1e10) (0xabcdef) 'y'
+[x] x->y x.y
+!x ~x x++ x-- x*y x&y
+x*y x/y x%y
+x+y x-y
+x<<y x>>y
+x<y x<=y x>y x>=y
+x==y x!=y
+x&y
+x^y
+x|y
+x&&y
+x||y
+x?y:z
+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
+x,y
diff --git a/t/t4034/csharp/pre b/t/t4034/csharp/pre
new file mode 100644 (file)
index 0000000..9106d63
--- /dev/null
@@ -0,0 +1,18 @@
+Foo():x(0&&1){}
+cout<<"Hello World!\n"<<endl;
+1 -1e10 0xabcdef 'x'
+[a] a->b a.b
+!a ~a a++ a-- a*b a&b
+a*b a/b a%b
+a+b a-b
+a<<b a>>b
+a<b a<=b a>b a>=b
+a==b a!=b
+a&b
+a^b
+a|b
+a&&b
+a||b
+a?b:z
+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
+a,y
diff --git a/t/t4034/fortran/expect b/t/t4034/fortran/expect
new file mode 100644 (file)
index 0000000..b233dbd
--- /dev/null
@@ -0,0 +1,10 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 87f0d0b..d308da2 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,5 +1,5 @@<RESET>
+print *, "Hello World<RED>!<RESET><GREEN>?<RESET>"
+
+DO10I = 1,10<RESET>
+<RED>DO10I<RESET><GREEN>DO 10 I<RESET> = 1,10
+<RED>DO10I<RESET><GREEN>DO 1 0 I<RESET> = 1,10
diff --git a/t/t4034/fortran/post b/t/t4034/fortran/post
new file mode 100644 (file)
index 0000000..d308da2
--- /dev/null
@@ -0,0 +1,5 @@
+print *, "Hello World?"
+
+DO10I = 1,10
+DO 10 I = 1,10
+DO 1 0 I = 1,10
diff --git a/t/t4034/fortran/pre b/t/t4034/fortran/pre
new file mode 100644 (file)
index 0000000..87f0d0b
--- /dev/null
@@ -0,0 +1,5 @@
+print *, "Hello World!"
+
+DO10I = 1,10
+DO10I = 1,10
+DO10I = 1,10
diff --git a/t/t4034/html/expect b/t/t4034/html/expect
new file mode 100644 (file)
index 0000000..447b49a
--- /dev/null
@@ -0,0 +1,8 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 8ca4aea..46921e5 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,3 +1,3 @@<RESET>
+<tag <GREEN>newattr="newvalue"<RESET>><GREEN>added<RESET> content</tag>
+<tag attr=<RED>"value"<RESET><GREEN>"newvalue"<RESET>><RED>content<RESET><GREEN>changed<RESET></tag>
+<<RED>tag<RESET><GREEN>newtag<RESET>>content <RED>&entity;<RESET><GREEN>&newentity;<RESET><<RED>/tag<RESET><GREEN>/newtag<RESET>>
diff --git a/t/t4034/html/post b/t/t4034/html/post
new file mode 100644 (file)
index 0000000..46921e5
--- /dev/null
@@ -0,0 +1,3 @@
+<tag newattr="newvalue">added content</tag>
+<tag attr="newvalue">changed</tag>
+<newtag>content &newentity;</newtag>
diff --git a/t/t4034/html/pre b/t/t4034/html/pre
new file mode 100644 (file)
index 0000000..8ca4aea
--- /dev/null
@@ -0,0 +1,3 @@
+<tag>content</tag>
+<tag attr="value">content</tag>
+<tag>content &entity;</tag>
diff --git a/t/t4034/java/expect b/t/t4034/java/expect
new file mode 100644 (file)
index 0000000..37d1ea2
--- /dev/null
@@ -0,0 +1,36 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 23d5c8a..7e8c026 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,19 +1,19 @@<RESET>
+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }
+cout<<"Hello World<RED>!<RESET><GREEN>?<RESET>\n"<<endl;
+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'
+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>^<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>|<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>||<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z
+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>,y
+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>
diff --git a/t/t4034/java/post b/t/t4034/java/post
new file mode 100644 (file)
index 0000000..7e8c026
--- /dev/null
@@ -0,0 +1,19 @@
+Foo() : x(0&42) { bar(x); }
+cout<<"Hello World?\n"<<endl;
+(1) (-1e10) (0xabcdef) 'y'
+[x] x->y x.y
+!x ~x x++ x-- x*y x&y
+x*y x/y x%y
+x+y x-y
+x<<y x>>y
+x<y x<=y x>y x>=y
+x==y x!=y
+x&y
+x^y
+x|y
+x&&y
+x||y
+x?y:z
+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
+x,y
+x::y
diff --git a/t/t4034/java/pre b/t/t4034/java/pre
new file mode 100644 (file)
index 0000000..23d5c8a
--- /dev/null
@@ -0,0 +1,19 @@
+Foo():x(0&&1){}
+cout<<"Hello World!\n"<<endl;
+1 -1e10 0xabcdef 'x'
+[a] a->b a.b
+!a ~a a++ a-- a*b a&b
+a*b a/b a%b
+a+b a-b
+a<<b a>>b
+a<b a<=b a>b a>=b
+a==b a!=b
+a&b
+a^b
+a|b
+a&&b
+a||b
+a?b:z
+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
+a,y
+a::b
diff --git a/t/t4034/objc/expect b/t/t4034/objc/expect
new file mode 100644 (file)
index 0000000..e5d1dd2
--- /dev/null
@@ -0,0 +1,35 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 9106d63..dd5f421 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,18 +1,18 @@<RESET>
+Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) { <GREEN>bar(x);<RESET> }
+cout<<"Hello World<RED>!<RESET><GREEN>?<RESET>\n"<<endl;
+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'
+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>^<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>|<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>||<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z
+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>,y
diff --git a/t/t4034/objc/post b/t/t4034/objc/post
new file mode 100644 (file)
index 0000000..dd5f421
--- /dev/null
@@ -0,0 +1,18 @@
+Foo() : x(0&42) { bar(x); }
+cout<<"Hello World?\n"<<endl;
+(1) (-1e10) (0xabcdef) 'y'
+[x] x->y x.y
+!x ~x x++ x-- x*y x&y
+x*y x/y x%y
+x+y x-y
+x<<y x>>y
+x<y x<=y x>y x>=y
+x==y x!=y
+x&y
+x^y
+x|y
+x&&y
+x||y
+x?y:z
+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
+x,y
diff --git a/t/t4034/objc/pre b/t/t4034/objc/pre
new file mode 100644 (file)
index 0000000..9106d63
--- /dev/null
@@ -0,0 +1,18 @@
+Foo():x(0&&1){}
+cout<<"Hello World!\n"<<endl;
+1 -1e10 0xabcdef 'x'
+[a] a->b a.b
+!a ~a a++ a-- a*b a&b
+a*b a/b a%b
+a+b a-b
+a<<b a>>b
+a<b a<=b a>b a>=b
+a==b a!=b
+a&b
+a^b
+a|b
+a&&b
+a||b
+a?b:z
+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
+a,y
diff --git a/t/t4034/pascal/expect b/t/t4034/pascal/expect
new file mode 100644 (file)
index 0000000..2ce4230
--- /dev/null
@@ -0,0 +1,35 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 077046c..8865e6b 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,18 +1,18 @@<RESET>
+writeln("Hello World<RED>!<RESET><GREEN>?<RESET>");
+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'
+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>^<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>|<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>||<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z
+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>,y
+<RED>a<RESET><GREEN>x<RESET>::<RED>b<RESET><GREEN>y<RESET>
diff --git a/t/t4034/pascal/post b/t/t4034/pascal/post
new file mode 100644 (file)
index 0000000..8865e6b
--- /dev/null
@@ -0,0 +1,18 @@
+writeln("Hello World?");
+(1) (-1e10) (0xabcdef) 'y'
+[x] x->y x.y
+!x ~x x++ x-- x*y x&y
+x*y x/y x%y
+x+y x-y
+x<<y x>>y
+x<y x<=y x>y x>=y
+x==y x!=y
+x&y
+x^y
+x|y
+x&&y
+x||y
+x?y:z
+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
+x,y
+x::y
diff --git a/t/t4034/pascal/pre b/t/t4034/pascal/pre
new file mode 100644 (file)
index 0000000..077046c
--- /dev/null
@@ -0,0 +1,18 @@
+writeln("Hello World!");
+1 -1e10 0xabcdef 'x'
+[a] a->b a.b
+!a ~a a++ a-- a*b a&b
+a*b a/b a%b
+a+b a-b
+a<<b a>>b
+a<b a<=b a>b a>=b
+a==b a!=b
+a&b
+a^b
+a|b
+a&&b
+a||b
+a?b:z
+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
+a,y
+a::b
diff --git a/t/t4034/perl/expect b/t/t4034/perl/expect
new file mode 100644 (file)
index 0000000..a1deb6b
--- /dev/null
@@ -0,0 +1,13 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index f6610d3..e8b72ef 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -4,8 +4,8 @@<RESET>
+
+package Frotz;<RESET>
+sub new {<RESET>
+       my <GREEN>(<RESET>$class<GREEN>, %opts)<RESET> = <RED>shift<RESET><GREEN>@_<RESET>;
+       return bless { <GREEN>xyzzy => "nitfol", %opts<RESET> }, $class;
+}<RESET>
+
+__END__<RESET>
diff --git a/t/t4034/perl/post b/t/t4034/perl/post
new file mode 100644 (file)
index 0000000..e8b72ef
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+use strict;
+
+package Frotz;
+sub new {
+       my ($class, %opts) = @_;
+       return bless { xyzzy => "nitfol", %opts }, $class;
+}
+
+__END__
+=head1 NAME
+
+frotz - Frotz
+
+=head1 SYNOPSIS
+
+  use frotz;
+
+  $nitfol = new Frotz();
+
+=cut
diff --git a/t/t4034/perl/pre b/t/t4034/perl/pre
new file mode 100644 (file)
index 0000000..f6610d3
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+use strict;
+
+package Frotz;
+sub new {
+       my $class = shift;
+       return bless {}, $class;
+}
+
+__END__
+=head1 NAME
+
+frotz - Frotz
+
+=head1 SYNOPSIS
+
+  use frotz;
+
+  $nitfol = new Frotz();
+
+=cut
diff --git a/t/t4034/php/expect b/t/t4034/php/expect
new file mode 100644 (file)
index 0000000..0404408
--- /dev/null
@@ -0,0 +1,35 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index cf6e06b..4420a49 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,18 +1,18 @@<RESET>
+<GREEN>(<RESET>$var<GREEN>)<RESET> $ var
+<?="Hello World<RED>!<RESET><GREEN>?<RESET>"?>
+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'
+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>^<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>|<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>||<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z
+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>,y
diff --git a/t/t4034/php/post b/t/t4034/php/post
new file mode 100644 (file)
index 0000000..4420a49
--- /dev/null
@@ -0,0 +1,18 @@
+($var) $ var
+<?="Hello World?"?>
+(1) (-1e10) (0xabcdef) 'y'
+[x] x->y x.y
+!x ~x x++ x-- x*y x&y
+x*y x/y x%y
+x+y x-y
+x<<y x>>y
+x<y x<=y x>y x>=y
+x==y x!=y
+x&y
+x^y
+x|y
+x&&y
+x||y
+x?y:z
+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
+x,y
diff --git a/t/t4034/php/pre b/t/t4034/php/pre
new file mode 100644 (file)
index 0000000..cf6e06b
--- /dev/null
@@ -0,0 +1,18 @@
+$var $var
+<?= "Hello World!" ?>
+1 -1e10 0xabcdef 'x'
+[a] a->b a.b
+!a ~a a++ a-- a*b a&b
+a*b a/b a%b
+a+b a-b
+a<<b a>>b
+a<b a<=b a>b a>=b
+a==b a!=b
+a&b
+a^b
+a|b
+a&&b
+a||b
+a?b:z
+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
+a,y
diff --git a/t/t4034/python/expect b/t/t4034/python/expect
new file mode 100644 (file)
index 0000000..8abb8a4
--- /dev/null
@@ -0,0 +1,34 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 438f776..68baf34 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,17 +1,17 @@<RESET>
+print<RED>u<RESET> "Hello World<RED>!<RESET><GREEN>?<RESET>\n"<GREEN>; print<RESET>
+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'
+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>^<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>|<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>||<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z
+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>,y
diff --git a/t/t4034/python/post b/t/t4034/python/post
new file mode 100644 (file)
index 0000000..68baf34
--- /dev/null
@@ -0,0 +1,17 @@
+print "Hello World?\n"; print
+(1) (-1e10) (0xabcdef) u'y'
+[x] x->y x.y
+!x ~x x++ x-- x*y x&y
+x*y x/y x%y
+x+y x-y
+x<<y x>>y
+x<y x<=y x>y x>=y
+x==y x!=y
+x&y
+x^y
+x|y
+x&&y
+x||y
+x?y:z
+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
+x,y
diff --git a/t/t4034/python/pre b/t/t4034/python/pre
new file mode 100644 (file)
index 0000000..438f776
--- /dev/null
@@ -0,0 +1,17 @@
+print u"Hello World!\n"
+1 -1e10 0xabcdef 'x'
+[a] a->b a.b
+!a ~a a++ a-- a*b a&b
+a*b a/b a%b
+a+b a-b
+a<<b a>>b
+a<b a<=b a>b a>=b
+a==b a!=b
+a&b
+a^b
+a|b
+a&&b
+a||b
+a?b:z
+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
+a,y
diff --git a/t/t4034/ruby/expect b/t/t4034/ruby/expect
new file mode 100644 (file)
index 0000000..16e1dd5
--- /dev/null
@@ -0,0 +1,34 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 30ed9a1..7678f14 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,17 +1,17 @@<RESET>
+10.downto(1) {|<RED>x<RESET><GREEN>y<RESET>| puts <RED>x<RESET><GREEN>y<RESET>}
+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'
+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>
+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>^<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>|<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>&&<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>||<RED>b<RESET>
+<RED>a?b<RESET><GREEN>y<RESET>
+<GREEN>x?y<RESET>:z
+<RED>a<RESET><GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET>
+<RED>a<RESET><GREEN>y<RESET>
+<GREEN>x<RESET>,y
diff --git a/t/t4034/ruby/post b/t/t4034/ruby/post
new file mode 100644 (file)
index 0000000..7678f14
--- /dev/null
@@ -0,0 +1,17 @@
+10.downto(1) {|y| puts y}
+(1) (-1e10) (0xabcdef) 'y'
+[x] x->y x.y
+!x ~x x++ x-- x*y x&y
+x*y x/y x%y
+x+y x-y
+x<<y x>>y
+x<y x<=y x>y x>=y
+x==y x!=y
+x&y
+x^y
+x|y
+x&&y
+x||y
+x?y:z
+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y
+x,y
diff --git a/t/t4034/ruby/pre b/t/t4034/ruby/pre
new file mode 100644 (file)
index 0000000..30ed9a1
--- /dev/null
@@ -0,0 +1,17 @@
+10.downto(1) {|x| puts x}
+1 -1e10 0xabcdef 'x'
+[a] a->b a.b
+!a ~a a++ a-- a*b a&b
+a*b a/b a%b
+a+b a-b
+a<<b a>>b
+a<b a<=b a>b a>=b
+a==b a!=b
+a&b
+a^b
+a|b
+a&&b
+a||b
+a?b:z
+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b
+a,y
diff --git a/t/t4034/tex/expect b/t/t4034/tex/expect
new file mode 100644 (file)
index 0000000..604969b
--- /dev/null
@@ -0,0 +1,9 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 2b2dfcb..65cab61 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,4 +1,4 @@<RESET>
+\section{Something <GREEN>new<RESET>}
+<RED>\emph<RESET><GREEN>\textbf<RESET>{Macro style}
+{<RED>\em<RESET><GREEN>\bfseries<RESET> State toggle style}
+\\[<RED>1em<RESET><GREEN>1cm<RESET>]
diff --git a/t/t4034/tex/post b/t/t4034/tex/post
new file mode 100644 (file)
index 0000000..65cab61
--- /dev/null
@@ -0,0 +1,4 @@
+\section{Something new}
+\textbf{Macro style}
+{\bfseries State toggle style}
+\\[1cm]
diff --git a/t/t4034/tex/pre b/t/t4034/tex/pre
new file mode 100644 (file)
index 0000000..2b2dfcb
--- /dev/null
@@ -0,0 +1,4 @@
+\section{Something}
+\emph{Macro style}
+{\em State toggle style}
+\\[1em]
index a30b03bcf27ba360c3761ade77ddf0ed00600470..abc49348b196cf0fec232b6f2399356e4fe324d5 100755 (executable)
@@ -60,4 +60,11 @@ test_expect_success 'diff-files -b -p --exit-code' '
        git diff-files -b -p --exit-code
 '
 
+test_expect_success 'diff-files --diff-filter --quiet' '
+       git reset --hard &&
+       rm a/d &&
+       echo x >>b/e &&
+       test_must_fail git diff-files --diff-filter=M --quiet
+'
+
 test_done
diff --git a/t/t5501-fetch-push-alternates.sh b/t/t5501-fetch-push-alternates.sh
new file mode 100755 (executable)
index 0000000..b5ced84
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+test_description='fetch/push involving alternates'
+. ./test-lib.sh
+
+count_objects () {
+       loose=0 inpack=0
+       eval "$(
+               git count-objects -v |
+               sed -n -e 's/^count: \(.*\)/loose=\1/p' \
+                   -e 's/^in-pack: \(.*\)/inpack=\1/p'
+       )" &&
+       echo $(( $loose + $inpack ))
+}
+
+
+test_expect_success setup '
+       (
+               git init original &&
+               cd original &&
+               i=0 &&
+               while test $i -le 100
+               do
+                       echo "$i" >count &&
+                       git add count &&
+                       git commit -m "$i" || exit
+                       i=$(($i + 1))
+               done
+       ) &&
+       (
+               git clone --reference=original "file:///$(pwd)/original" one &&
+               cd one &&
+               echo Z >count &&
+               git add count &&
+               git commit -m Z &&
+               count_objects >../one.count
+       ) &&
+       A=$(pwd)/original/.git/objects &&
+       git init receiver &&
+       echo "$A" >receiver/.git/objects/info/alternates &&
+       git init fetcher &&
+       echo "$A" >fetcher/.git/objects/info/alternates
+'
+
+test_expect_success 'pushing into a repository with the same alternate' '
+       (
+               cd one &&
+               git push ../receiver master:refs/heads/it
+       ) &&
+       (
+               cd receiver &&
+               count_objects >../receiver.count
+       ) &&
+       test_cmp one.count receiver.count
+'
+
+test_expect_success 'fetching from a repository with the same alternate' '
+       (
+               cd fetcher &&
+               git fetch ../one master:refs/heads/it &&
+               count_objects >../fetcher.count
+       ) &&
+       test_cmp one.count fetcher.count
+'
+
+test_done
index 0470a81be0edaf883788d313778ef6865ed34c6f..0e5eb678ce6b2f4fad79c39947455e5284313ba4 100755 (executable)
@@ -46,6 +46,17 @@ test_expect_success 'pulling into void using master:master' '
        test_cmp file cloned-uho/file
 '
 
+test_expect_success 'pulling into void does not overwrite untracked files' '
+       git init cloned-untracked &&
+       (
+               cd cloned-untracked &&
+               echo untracked >file &&
+               test_must_fail git pull .. master &&
+               echo untracked >expect &&
+               test_cmp expect file
+       )
+'
+
 test_expect_success 'test . as a remote' '
 
        git branch copy master &&
index a5f458533fd071c13550a72bf251e2e10c109637..8f1237987944b6b7e59b2b24ed785daf3cbba040 100755 (executable)
@@ -66,7 +66,10 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
        (
                cd downstream &&
                git fetch --recurse-submodules >../actual.out 2>../actual.err
-       ) &&
+       )
+'
+
+test_expect_success C_LOCALE_OUTPUT "fetch --recurse-submodules recurses into submodules: output" '
        test_cmp expect.out actual.out &&
        test_cmp expect.err actual.err
 '
@@ -95,7 +98,10 @@ test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses i
                cd downstream &&
                git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
                git fetch >../actual.out 2>../actual.err
-       ) &&
+       )
+'
+
+test_expect_success C_LOCALE_OUTPUT "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
        test_cmp expect.out actual.out &&
        test_cmp expect.err actual.err
 '
@@ -126,7 +132,10 @@ test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setti
                git fetch --recurse-submodules >../actual.out 2>../actual.err &&
                git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
                git config --unset submodule.submodule.fetchRecurseSubmodules
-       ) &&
+       )
+'
+
+test_expect_success C_LOCALE_OUTPUT "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config: output" '
        test_cmp expect.out actual.out &&
        test_cmp expect.err actual.err
 '
@@ -145,13 +154,22 @@ test_expect_success "--dry-run propagates to submodules" '
        (
                cd downstream &&
                git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
-       ) &&
+       )
+'
+
+test_expect_success C_LOCALE_OUTPUT "--dry-run propagates to submodules: output" '
        test_cmp expect.out actual.out &&
-       test_cmp expect.err actual.err &&
+       test_cmp expect.err actual.err
+'
+
+test_expect_success "Without --dry-run propagates to submodules" '
        (
                cd downstream &&
                git fetch --recurse-submodules >../actual.out 2>../actual.err
-       ) &&
+       )
+'
+
+test_expect_success C_LOCALE_OUTPUT "Without --dry-run propagates to submodules: output" '
        test_cmp expect.out actual.out &&
        test_cmp expect.err actual.err
 '
@@ -162,7 +180,10 @@ test_expect_success "recurseSubmodules=true propagates into submodules" '
                cd downstream &&
                git config fetch.recurseSubmodules true
                git fetch >../actual.out 2>../actual.err
-       ) &&
+       )
+'
+
+test_expect_success C_LOCALE_OUTPUT "recurseSubmodules=true propagates into submodules: output" '
        test_cmp expect.out actual.out &&
        test_cmp expect.err actual.err
 '
@@ -176,7 +197,10 @@ test_expect_success "--recurse-submodules overrides config in submodule" '
                        git config fetch.recurseSubmodules false
                ) &&
                git fetch --recurse-submodules >../actual.out 2>../actual.err
-       ) &&
+       )
+'
+
+test_expect_success C_LOCALE_OUTPUT "--recurse-submodules overrides config in submodule: output" '
        test_cmp expect.out actual.out &&
        test_cmp expect.err actual.err
 '
index b0c2a2c3aea811ec023423bdb486de5412fa79c5..0492877d516b8f33a8fd1555ec77a2aa3b34352c 100755 (executable)
@@ -128,11 +128,14 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
 
        # push master too; this ensures there is at least one '"'push'"' command to
        # the remote helper and triggers interaction with the helper.
-       test_must_fail git push -v origin +master master:retsam >output 2>&1 &&
+       test_must_fail git push -v origin +master master:retsam >output 2>&1'
 
+test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: remote output' '
        grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
-       grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output &&
+       grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output
+'
 
+test_expect_success C_LOCALE_OUTPUT 'push fails for non-fast-forward refs unmatched by remote helper: our output' '
        grep "To prevent you from losing history, non-fast-forward updates were rejected" \
                output
 '
index 987e0c846309a8a49dbe31ce292edd55342217b3..5a068b21e4aeac79863df657d6388ec4c2732d55 100755 (executable)
@@ -31,7 +31,7 @@ test_expect_success 'clone with excess parameters (2)' '
 
 '
 
-test_expect_success 'output from clone' '
+test_expect_success C_LOCALE_OUTPUT 'output from clone' '
        rm -fr dst &&
        git clone -n "file://$(pwd)/src" dst >output &&
        test $(grep Clon output | wc -l) = 1
@@ -164,7 +164,6 @@ test_expect_success 'clone a void' '
 test_expect_success 'clone respects global branch.autosetuprebase' '
        (
                test_config="$HOME/.gitconfig" &&
-               unset GIT_CONFIG_NOGLOBAL &&
                git config -f "$test_config" branch.autosetuprebase remote &&
                rm -fr dst &&
                git clone src dst &&
@@ -192,4 +191,17 @@ test_expect_success 'do not respect url-encoding of non-url path' '
        git clone x+y xy-regular
 '
 
+test_expect_success 'clone separate gitdir' '
+       rm -rf dst &&
+       git clone --separate-git-dir realgitdir src dst &&
+       echo "gitdir: `pwd`/realgitdir" >expected &&
+       test_cmp expected dst/.git &&
+       test -d realgitdir/refs
+'
+
+test_expect_success 'clone separate gitdir where target already exists' '
+       rm -rf dst &&
+       test_must_fail git clone --separate-git-dir realgitdir src dst
+'
+
 test_done
diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh
new file mode 100755 (executable)
index 0000000..b10685a
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+test_description='miscellaneous rev-list tests'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+       echo content1 >wanted_file &&
+       echo content2 >unwanted_file &&
+       git add wanted_file unwanted_file &&
+       git commit -m one
+'
+
+test_expect_success 'rev-list --objects heeds pathspecs' '
+       git rev-list --objects HEAD -- wanted_file >output &&
+       grep wanted_file output &&
+       ! grep unwanted_file output
+'
+
+test_expect_success 'rev-list --objects with pathspecs and deeper paths' '
+       mkdir foo &&
+       >foo/file &&
+       git add foo/file &&
+       git commit -m two &&
+
+       git rev-list --objects HEAD -- foo >output &&
+       grep foo/file output &&
+
+       git rev-list --objects HEAD -- foo/file >output &&
+       grep foo/file output &&
+       ! grep unwanted_file output
+'
+
+test_expect_success 'rev-list --objects with pathspecs and copied files' '
+       git checkout --orphan junio-testcase &&
+       git rm -rf . &&
+
+       mkdir two &&
+       echo frotz >one &&
+       cp one two/three &&
+       git add one two/three &&
+       test_tick &&
+       git commit -m that &&
+
+       ONE=$(git rev-parse HEAD:one)
+       git rev-list --objects HEAD two >output &&
+       grep "$ONE two/three" output &&
+       ! grep one output
+'
+
+test_done
index 5dabf1c5e354c28cc593bd0ea8e4b0d5f0d56d67..3e8c42ee0b93cff3be39f42a411e9b32d16c5d5d 100755 (executable)
@@ -1,51 +1,96 @@
 #!/bin/sh
 
-test_description='git rev-list trivial path optimization test'
+test_description='git rev-list trivial path optimization test
+
+   d/z1
+   b0                             b1
+   o------------------------*----o master
+  /                        /
+ o---------o----o----o----o side
+ a0        c0   c1   a1   c2
+ d/f0      d/f1
+ d/z0
+
+'
 
 . ./test-lib.sh
 
 test_expect_success setup '
-echo Hello > a &&
-git add a &&
-git commit -m "Initial commit" a &&
-initial=$(git rev-parse --verify HEAD)
+       echo Hello >a &&
+       mkdir d &&
+       echo World >d/f &&
+       echo World >d/z &&
+       git add a d &&
+       test_tick &&
+       git commit -m "Initial commit" &&
+       git rev-parse --verify HEAD &&
+       git tag initial
 '
 
 test_expect_success path-optimization '
-    commit=$(echo "Unchanged tree" | git commit-tree "HEAD^{tree}" -p HEAD) &&
-    test $(git rev-list $commit | wc -l) = 2 &&
-    test $(git rev-list $commit -- . | wc -l) = 1
+       test_tick &&
+       commit=$(echo "Unchanged tree" | git commit-tree "HEAD^{tree}" -p HEAD) &&
+       test $(git rev-list $commit | wc -l) = 2 &&
+       test $(git rev-list $commit -- . | wc -l) = 1
 '
 
 test_expect_success 'further setup' '
        git checkout -b side &&
        echo Irrelevant >c &&
-       git add c &&
+       echo Irrelevant >d/f &&
+       git add c d/f &&
+       test_tick &&
        git commit -m "Side makes an irrelevant commit" &&
+       git tag side_c0 &&
        echo "More Irrelevancy" >c &&
        git add c &&
+       test_tick &&
        git commit -m "Side makes another irrelevant commit" &&
        echo Bye >a &&
        git add a &&
+       test_tick &&
        git commit -m "Side touches a" &&
-       side=$(git rev-parse --verify HEAD) &&
+       git tag side_a1 &&
        echo "Yet more Irrelevancy" >c &&
        git add c &&
+       test_tick &&
        git commit -m "Side makes yet another irrelevant commit" &&
        git checkout master &&
        echo Another >b &&
-       git add b &&
+       echo Munged >d/z &&
+       git add b d/z &&
+       test_tick &&
        git commit -m "Master touches b" &&
+       git tag master_b0 &&
        git merge side &&
        echo Touched >b &&
        git add b &&
+       test_tick &&
        git commit -m "Master touches b again"
 '
 
 test_expect_success 'path optimization 2' '
-       ( echo "$side"; echo "$initial" ) >expected &&
+       git rev-parse side_a1 initial >expected &&
        git rev-list HEAD -- a >actual &&
        test_cmp expected actual
 '
 
+test_expect_success 'pathspec with leading path' '
+       git rev-parse master^ master_b0 side_c0 initial >expected &&
+       git rev-list HEAD -- d >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'pathspec with glob (1)' '
+       git rev-parse master^ master_b0 side_c0 initial >expected &&
+       git rev-list HEAD -- "d/*" >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'pathspec with glob (2)' '
+       git rev-parse side_c0 initial >expected &&
+       git rev-list HEAD -- "d/[a-m]*" >actual &&
+       test_cmp expected actual
+'
+
 test_done
index b565638e92655c12c841c29a108516a8b13cf8d2..cacf3de6c9f31889fd8df0bc0cebbbc74e3525bd 100755 (executable)
@@ -4,13 +4,14 @@ test_description='test git rev-list --cherry-pick -- file'
 
 . ./test-lib.sh
 
-# A---B
+# A---B---D---F
 #  \
 #   \
-#    C
+#    C---E
 #
 # B changes a file foo.c, adding a line of text.  C changes foo.c as
 # well as bar.c, but the change in foo.c was identical to change B.
+# D and C change bar in the same way, E and F differently.
 
 test_expect_success setup '
        echo Hallo > foo &&
@@ -25,11 +26,26 @@ test_expect_success setup '
        test_tick &&
        git commit -m "C" &&
        git tag C &&
+       echo Dello > bar &&
+       git add bar &&
+       test_tick &&
+       git commit -m "E" &&
+       git tag E &&
        git checkout master &&
        git checkout branch foo &&
        test_tick &&
        git commit -m "B" &&
-       git tag B
+       git tag B &&
+       echo Cello > bar &&
+       git add bar &&
+       test_tick &&
+       git commit -m "D" &&
+       git tag D &&
+       echo Nello > bar &&
+       git add bar &&
+       test_tick &&
+       git commit -m "F" &&
+       git tag F
 '
 
 cat >expect <<EOF
@@ -53,8 +69,92 @@ test_expect_success '--cherry-pick foo comes up empty' '
        test -z "$(git rev-list --left-right --cherry-pick B...C -- foo)"
 '
 
+cat >expect <<EOF
+>tags/C
+EOF
+
 test_expect_success '--cherry-pick bar does not come up empty' '
-       ! test -z "$(git rev-list --left-right --cherry-pick B...C -- bar)"
+       git rev-list --left-right --cherry-pick B...C -- bar > actual &&
+       git name-rev --stdin --name-only --refs="*tags/*" \
+               < actual > actual.named &&
+       test_cmp actual.named expect
+'
+
+test_expect_success 'bar does not come up empty' '
+       git rev-list --left-right B...C -- bar > actual &&
+       git name-rev --stdin --name-only --refs="*tags/*" \
+               < actual > actual.named &&
+       test_cmp actual.named expect
+'
+
+cat >expect <<EOF
+<tags/F
+>tags/E
+EOF
+
+test_expect_success '--cherry-pick bar does not come up empty (II)' '
+       git rev-list --left-right --cherry-pick F...E -- bar > actual &&
+       git name-rev --stdin --name-only --refs="*tags/*" \
+               < actual > actual.named &&
+       test_cmp actual.named expect
+'
+
+cat >expect <<EOF
++tags/F
+=tags/D
++tags/E
+=tags/C
+EOF
+
+test_expect_success '--cherry-mark' '
+       git rev-list --cherry-mark F...E -- bar > actual &&
+       git name-rev --stdin --name-only --refs="*tags/*" \
+               < actual > actual.named &&
+       test_cmp actual.named expect
+'
+
+cat >expect <<EOF
+<tags/F
+=tags/D
+>tags/E
+=tags/C
+EOF
+
+test_expect_success '--cherry-mark --left-right' '
+       git rev-list --cherry-mark --left-right F...E -- bar > actual &&
+       git name-rev --stdin --name-only --refs="*tags/*" \
+               < actual > actual.named &&
+       test_cmp actual.named expect
+'
+
+cat >expect <<EOF
+tags/E
+EOF
+
+test_expect_success '--cherry-pick --right-only' '
+       git rev-list --cherry-pick --right-only F...E -- bar > actual &&
+       git name-rev --stdin --name-only --refs="*tags/*" \
+               < actual > actual.named &&
+       test_cmp actual.named expect
+'
+
+test_expect_success '--cherry-pick --left-only' '
+       git rev-list --cherry-pick --left-only E...F -- bar > actual &&
+       git name-rev --stdin --name-only --refs="*tags/*" \
+               < actual > actual.named &&
+       test_cmp actual.named expect
+'
+
+cat >expect <<EOF
++tags/E
+=tags/C
+EOF
+
+test_expect_success '--cherry' '
+       git rev-list --cherry F...E -- bar > actual &&
+       git name-rev --stdin --name-only --refs="*tags/*" \
+               < actual > actual.named &&
+       test_cmp actual.named expect
 '
 
 test_expect_success '--cherry-pick with independent, but identical branches' '
@@ -75,11 +175,8 @@ cat >expect <<EOF
 1      2
 EOF
 
-# Insert an extra commit to break the symmetry
 test_expect_success '--count --left-right' '
-       git checkout branch &&
-       test_commit D &&
-       git rev-list --count --left-right B...D > actual &&
+       git rev-list --count --left-right C...D > actual &&
        test_cmp expect actual
 '
 
index 52f7b277ceae3ae183bc6082c01af9f76bd39a86..30507407ff6375f96c632c7c3f62ae3d338ed5ea 100755 (executable)
@@ -1,14 +1,15 @@
 #!/bin/sh
 
-test_description='properly cull all ancestors'
+test_description='ancestor culling and limiting by parent number'
 
 . ./test-lib.sh
 
-commit () {
-       test_tick &&
-       echo $1 >file &&
-       git commit -a -m $1 &&
-       git tag $1
+check_revlist () {
+       rev_list_args="$1" &&
+       shift &&
+       git rev-parse "$@" >expect &&
+       git rev-list $rev_list_args --all >actual &&
+       test_cmp expect actual
 }
 
 test_expect_success setup '
@@ -16,13 +17,13 @@ test_expect_success setup '
        touch file &&
        git add file &&
 
-       commit one &&
+       test_commit one &&
 
        test_tick=$(($test_tick - 2400)) &&
 
-       commit two &&
-       commit three &&
-       commit four &&
+       test_commit two &&
+       test_commit three &&
+       test_commit four &&
 
        git log --pretty=oneline --abbrev-commit
 '
@@ -35,4 +36,101 @@ test_expect_success 'one is ancestor of others and should not be shown' '
 
 '
 
+test_expect_success 'setup roots, merges and octopuses' '
+
+       git checkout --orphan newroot &&
+       test_commit five &&
+       git checkout -b sidebranch two &&
+       test_commit six &&
+       git checkout -b anotherbranch three &&
+       test_commit seven &&
+       git checkout -b yetanotherbranch four &&
+       test_commit eight &&
+       git checkout master &&
+       test_merge normalmerge newroot &&
+       test_tick &&
+       git merge -m tripus sidebranch anotherbranch &&
+       git tag tripus &&
+       git checkout -b tetrabranch normalmerge &&
+       test_tick &&
+       git merge -m tetrapus sidebranch anotherbranch yetanotherbranch &&
+       git tag tetrapus &&
+       git checkout master
+'
+
+test_expect_success 'rev-list roots' '
+
+       check_revlist "--max-parents=0" one five
+'
+
+test_expect_success 'rev-list no merges' '
+
+       check_revlist "--max-parents=1" one eight seven six five four three two &&
+       check_revlist "--no-merges" one eight seven six five four three two
+'
+
+test_expect_success 'rev-list no octopuses' '
+
+       check_revlist "--max-parents=2" one normalmerge eight seven six five four three two
+'
+
+test_expect_success 'rev-list no roots' '
+
+       check_revlist "--min-parents=1" tetrapus tripus normalmerge eight seven six four three two
+'
+
+test_expect_success 'rev-list merges' '
+
+       check_revlist "--min-parents=2" tetrapus tripus normalmerge &&
+       check_revlist "--merges" tetrapus tripus normalmerge
+'
+
+test_expect_success 'rev-list octopus' '
+
+       check_revlist "--min-parents=3" tetrapus tripus
+'
+
+test_expect_success 'rev-list ordinary commits' '
+
+       check_revlist "--min-parents=1 --max-parents=1" eight seven six four three two
+'
+
+test_expect_success 'rev-list --merges --no-merges yields empty set' '
+
+       check_revlist "--min-parents=2 --no-merges" &&
+       check_revlist "--merges --no-merges" &&
+       check_revlist "--no-merges --merges"
+'
+
+test_expect_success 'rev-list override and infinities' '
+
+       check_revlist "--min-parents=2 --max-parents=1 --max-parents=3" tripus normalmerge &&
+       check_revlist "--min-parents=1 --min-parents=2 --max-parents=7" tetrapus tripus normalmerge &&
+       check_revlist "--min-parents=2 --max-parents=8" tetrapus tripus normalmerge &&
+       check_revlist "--min-parents=2 --max-parents=-1" tetrapus tripus normalmerge &&
+       check_revlist "--min-parents=2 --no-max-parents" tetrapus tripus normalmerge &&
+       check_revlist "--max-parents=0 --min-parents=1 --no-min-parents" one five
+'
+
+test_expect_success 'dodecapus' '
+
+       roots= &&
+       for i in 1 2 3 4 5 6 7 8 9 10 11
+       do
+               git checkout -b root$i five &&
+               test_commit $i &&
+               roots="$roots root$i" ||
+               return
+       done &&
+       git checkout master &&
+       test_tick &&
+       git merge -m dodecapus $roots &&
+       git tag dodecapus &&
+
+       check_revlist "--min-parents=4" dodecapus tetrapus &&
+       check_revlist "--min-parents=8" dodecapus &&
+       check_revlist "--min-parents=12" dodecapus &&
+       check_revlist "--min-parents=13" &&
+       check_revlist "--min-parents=4 --max-parents=11" tetrapus
+'
 test_done
index 92e02d5d77501b2a3ff52069931a534fc7bb24fd..2599ae50eb94051f66b4dc1de603aaf8cd1f79eb 100755 (executable)
@@ -17,13 +17,21 @@ test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink'
        git commit -m "dir to symlink"
 '
 
-test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' '
+test_expect_success SYMLINKS 'checkout does not clobber untracked symlink' '
        git checkout HEAD^0 &&
        git reset --hard master &&
        git rm --cached a/b &&
        git commit -m "untracked symlink remains" &&
-        git checkout start^0 &&
-        test -f a/b-2/c/d
+       test_must_fail git checkout start^0
+'
+
+test_expect_success SYMLINKS 'a/b-2/c/d is kept when clobbering symlink b' '
+       git checkout HEAD^0 &&
+       git reset --hard master &&
+       git rm --cached a/b &&
+       git commit -m "untracked symlink remains" &&
+       git checkout -f start^0 &&
+       test -f a/b-2/c/d
 '
 
 test_expect_success SYMLINKS 'checkout should not have deleted a/b-2/c/d' '
index 1e0447f615c55ecf98ae341553ea60f10a956ae3..6c3719141aa567b97de1228f53a6c49eaf139e8e 100755 (executable)
@@ -42,7 +42,7 @@ b3 behind 1
 b4 ahead 2
 EOF
 
-test_expect_success 'branch -v' '
+test_expect_success C_LOCALE_OUTPUT 'branch -v' '
        (
                cd test &&
                git branch -v
@@ -74,20 +74,20 @@ test_expect_success 'status' '
        grep "have 1 and 1 different" actual
 '
 
-test_expect_success 'status when tracking lightweight tags' '
+test_expect_success 'fail to track lightweight tags' '
        git checkout master &&
        git tag light &&
-       git branch --track lighttrack light >actual &&
-       grep "set up to track" actual &&
-       git checkout lighttrack
+       test_must_fail git branch --track lighttrack light >actual &&
+       test_must_fail grep "set up to track" actual &&
+       test_must_fail git checkout lighttrack
 '
 
-test_expect_success 'status when tracking annotated tags' '
+test_expect_success 'fail to track annotated tags' '
        git checkout master &&
        git tag -m heavy heavy &&
-       git branch --track heavytrack heavy >actual &&
-       grep "set up to track" actual &&
-       git checkout heavytrack
+       test_must_fail git branch --track heavytrack heavy >actual &&
+       test_must_fail grep "set up to track" actual &&
+       test_must_fail git checkout heavytrack
 '
 
 test_expect_success 'setup tracking with branch --set-upstream on existing branch' '
diff --git a/t/t6110-rev-list-sparse.sh b/t/t6110-rev-list-sparse.sh
new file mode 100755 (executable)
index 0000000..656ac7f
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+test_description='operations that cull histories in unusual ways'
+. ./test-lib.sh
+
+test_expect_success setup '
+       test_commit A &&
+       test_commit B &&
+       test_commit C &&
+       git checkout -b side HEAD^ &&
+       test_commit D &&
+       test_commit E &&
+       git merge master
+'
+
+test_expect_success 'rev-list --first-parent --boundary' '
+       git rev-list --first-parent --boundary HEAD^..
+'
+
+test_done
index 876d1ab7430c2054ddc69bd3712ff769de52e774..18269962458248034598d2bb15315f0d2a121027 100755 (executable)
@@ -123,7 +123,7 @@ cat - >err.expect <<EOF
 warning: tag 'A' is really 'Q' here
 EOF
 check_describe A-* HEAD
-test_expect_success 'warning was displayed for Q' '
+test_expect_success C_LOCALE_OUTPUT 'warning was displayed for Q' '
        test_cmp err.expect err.actual
 '
 test_expect_success 'rename tag Q back to A' '
index 3e7baaf89f9bada46fc084e568544ce9df833594..1dedfd0c836c06eb3d2f66aa8e4e7eac54368508 100755 (executable)
@@ -1121,6 +1121,7 @@ test_expect_success \
 '
 
 test_expect_success \
+       C_LOCALE_OUTPUT \
        'message in editor has initial comment: first line' '
        # check the first line --- should be empty
        echo >first.expect &&
index 582d0b54f1f1a32459727e59932e95c4b466951f..14fcb1c7f5d8366827bc6e3256f118a757d2e996 100755 (executable)
@@ -124,13 +124,13 @@ cat >expected <<EOF
 Would remove expected
 Would remove result
 EOF
-test_expect_success 'git-clean, absent case' '
+test_expect_success C_LOCALE_OUTPUT 'git-clean, absent case' '
        setup_absent &&
        git clean -n > result &&
        test_cmp expected result
 '
 
-test_expect_success 'git-clean, dirty case' '
+test_expect_success C_LOCALE_OUTPUT 'git-clean, dirty case' '
        setup_dirty &&
        git clean -n > result &&
        test_cmp expected result
index fcac4725982096af98414c5d40df2d4c14be9454..b4fcc86a10f15178da25da159e160b38d717f318 100755 (executable)
@@ -38,7 +38,7 @@ cat >expect <<EOF
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
 
-test_expect_success 'M/D conflict does not segfault' '
+test_expect_success C_LOCALE_OUTPUT 'M/D conflict does not segfault' '
        mkdir mdconflict &&
        (
                cd mdconflict &&
index b8cf2603a195af406d3606712e45fd1195c1588f..7be2ff38fc92088d4caff9ea13b1d78a1b040b40 100755 (executable)
@@ -423,7 +423,7 @@ Unstaged changes after reset:
 M      file2
 EOF
 
-test_expect_success '--mixed refreshes the index' '
+test_expect_success C_LOCALE_OUTPUT '--mixed refreshes the index' '
        echo 123 >> file2 &&
        git reset --mixed HEAD > output &&
        test_cmp expect output
index 70cdd8e618c648f7ee6550997d68c40d912c8db9..b42820ad6976590fe195637d5e85d1b4db963cda 100755 (executable)
@@ -233,7 +233,7 @@ test_expect_success '"reset --merge HEAD^" is ok with pending merge' '
 #           working index HEAD target         working index HEAD
 #           ----------------------------------------------------
 # file1:     X       U     B    C     --keep   (disallowed)
-test_expect_success '"reset --keep HEAD^" fails with pending merge' '
+test_expect_success C_LOCALE_OUTPUT '"reset --keep HEAD^" fails with pending merge' '
     git reset --hard third &&
     test_must_fail git merge branch1 &&
     test_must_fail git reset --keep HEAD^ 2>err.log &&
@@ -259,7 +259,7 @@ test_expect_success '"reset --merge HEAD" is ok with pending merge' '
 #           working index HEAD target         working index HEAD
 #           ----------------------------------------------------
 # file1:     X       U     B    B     --keep   (disallowed)
-test_expect_success '"reset --keep HEAD" fails with pending merge' '
+test_expect_success C_LOCALE_OUTPUT '"reset --keep HEAD" fails with pending merge' '
     git reset --hard third &&
     test_must_fail git merge branch1 &&
     test_must_fail git reset --keep HEAD 2>err.log &&
@@ -280,7 +280,7 @@ test_expect_success '--merge is ok with added/deleted merge' '
     git diff --exit-code --cached
 '
 
-test_expect_success '--keep fails with added/deleted merge' '
+test_expect_success C_LOCALE_OUTPUT '--keep fails with added/deleted merge' '
     git reset --hard third &&
     rm -f file2 &&
     test_must_fail git merge branch3 &&
index 1337fa5a2209d489c43f0a34c95a89053d3fd8bf..37ed0931d9499791a6b3336efb97385356df6157 100755 (executable)
@@ -223,7 +223,7 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
        test_cmp two expect
 '
 
-test_expect_success 'checkout to detach HEAD (with advice declined)' '
+test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD (with advice declined)' '
 
        git config advice.detachedHead false &&
        git checkout -f renamer && git clean -f &&
@@ -242,7 +242,7 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '
        fi
 '
 
-test_expect_success 'checkout to detach HEAD' '
+test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD' '
        git config advice.detachedHead true &&
        git checkout -f renamer && git clean -f &&
        git checkout renamer^ 2>messages &&
@@ -260,7 +260,7 @@ test_expect_success 'checkout to detach HEAD' '
        fi
 '
 
-test_expect_success 'checkout to detach HEAD with branchname^' '
+test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with branchname^' '
 
        git checkout -f master && git clean -f &&
        git checkout renamer^ &&
@@ -276,7 +276,7 @@ test_expect_success 'checkout to detach HEAD with branchname^' '
        fi
 '
 
-test_expect_success 'checkout to detach HEAD with :/message' '
+test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with :/message' '
 
        git checkout -f master && git clean -f &&
        git checkout ":/Initial" &&
@@ -292,7 +292,7 @@ test_expect_success 'checkout to detach HEAD with :/message' '
        fi
 '
 
-test_expect_success 'checkout to detach HEAD with HEAD^0' '
+test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with HEAD^0' '
 
        git checkout -f master && git clean -f &&
        git checkout HEAD^0 &&
@@ -408,6 +408,15 @@ test_expect_success 'checkout w/--track from non-branch HEAD fails' '
     test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
 '
 
+test_expect_success 'checkout w/--track from tag fails' '
+    git checkout master^0 &&
+    test_must_fail git symbolic-ref HEAD &&
+    test_must_fail git checkout --track -b track frotz &&
+    test_must_fail git rev-parse --verify track &&
+    test_must_fail git symbolic-ref HEAD &&
+    test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
+'
+
 test_expect_success 'detach a symbolic link HEAD' '
     git checkout master &&
     git config --bool core.prefersymlinkrefs yes &&
@@ -423,7 +432,6 @@ test_expect_success 'detach a symbolic link HEAD' '
 test_expect_success \
     'checkout with --track fakes a sensible -b <name>' '
     git update-ref refs/remotes/origin/koala/bear renamer &&
-    git update-ref refs/new/koala/bear renamer &&
 
     git checkout --track origin/koala/bear &&
     test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
@@ -439,12 +447,6 @@ test_expect_success \
 
     git checkout --track remotes/origin/koala/bear &&
     test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
-    test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
-
-    git checkout master && git branch -D koala/bear &&
-
-    git checkout --track refs/new/koala/bear &&
-    test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
     test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
 '
 
index 02f67b73b762850f3c7f0faf0886bf4011f57308..7e1be444027621e1ea94b0b9ed0e129fce922b02 100755 (executable)
@@ -110,7 +110,7 @@ test_expect_success 'git clean with prefix' '
 
 '
 
-test_expect_success 'git clean with relative prefix' '
+test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' '
 
        mkdir -p build docs &&
        touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@@ -125,7 +125,7 @@ test_expect_success 'git clean with relative prefix' '
        }
 '
 
-test_expect_success 'git clean with absolute path' '
+test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
 
        mkdir -p build docs &&
        touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@@ -377,7 +377,7 @@ test_expect_success 'clean.requireForce and -f' '
 
 '
 
-test_expect_success 'core.excludesfile' '
+test_expect_success C_LOCALE_OUTPUT 'core.excludesfile' '
 
        echo excludes >excludes &&
        echo included >included &&
index 5976f598fc7bf48120865eca3ceef74a151e717a..bcdf0847d0970f544e96afa0036ec12800422fd8 100755 (executable)
@@ -72,7 +72,7 @@ test_expect_success 'adding comments to a template should not commit' '
        )
 '
 
-test_expect_success 'adding real content to a template should commit' '
+test_expect_success C_LOCALE_OUTPUT 'adding real content to a template should commit' '
        (
                test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
                git commit --template "$TEMPLATE"
@@ -80,7 +80,7 @@ test_expect_success 'adding real content to a template should commit' '
        commit_msg_is "template linecommit message"
 '
 
-test_expect_success '-t option should be short for --template' '
+test_expect_success C_LOCALE_OUTPUT '-t option should be short for --template' '
        echo "short template" > "$TEMPLATE" &&
        echo "new content" >> foo &&
        git add foo &&
@@ -91,7 +91,7 @@ test_expect_success '-t option should be short for --template' '
        commit_msg_is "short templatecommit message"
 '
 
-test_expect_success 'config-specified template should commit' '
+test_expect_success C_LOCALE_OUTPUT 'config-specified template should commit' '
        echo "new template" > "$TEMPLATE" &&
        git config commit.template "$TEMPLATE" &&
        echo "more content" >> foo &&
@@ -290,7 +290,7 @@ test_expect_success 'commit --squash works with -c for same commit' '
        commit_msg_is "squash! edited commit"
 '
 
-test_expect_success 'commit --squash works with editor' '
+test_expect_success C_LOCALE_OUTPUT 'commit --squash works with editor' '
        commit_for_rebase_autosquash_setup &&
        test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
        git commit --squash HEAD~1 &&
index 8980738c7540b79eaa566d6054f3e76b202bd27e..a76c47419590ed16c53b8d4d82c2d92c11853154 100755 (executable)
@@ -14,8 +14,11 @@ test_tick
 test_expect_success \
        "initial status" \
        "echo 'bongo bongo' >file &&
-        git add file && \
-        git status | grep 'Initial commit'"
+        git add file"
+
+test_expect_success C_LOCALE_OUTPUT \
+       "Constructing initial commit" \
+       "git status | grep 'Initial commit'"
 
 test_expect_success \
        "fail initial amend" \
index 50da034cd3934d0509e67a6f20e514a18e5659d4..cfb569eaba657501cf0361bee8c3f7c172ed1c06 100755 (executable)
@@ -22,7 +22,10 @@ check_summary_oneline() {
        SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
        echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
 
-       test_cmp exp act
+       if test_have_prereq C_LOCALE_OUTPUT
+       then
+               test_cmp exp act
+       fi
 }
 
 test_expect_success 'output summary format' '
@@ -32,7 +35,10 @@ test_expect_success 'output summary format' '
        check_summary_oneline "root-commit" "initial" &&
 
        echo change >>file1 &&
-       git add file1 &&
+       git add file1
+'
+
+test_expect_success 'output summary format: root-commit' '
        check_summary_oneline "" "a change"
 '
 
@@ -215,30 +221,35 @@ test_expect_success 'cleanup commit messages (strip,-F)' '
 
 '
 
-echo "sample
-
-# Please enter the commit message for your changes. Lines starting
-# with '#' will be ignored, and an empty message aborts the commit." >expect
-
 test_expect_success 'cleanup commit messages (strip,-F,-e)' '
 
        echo >>negative &&
        { echo;echo sample;echo; } >text &&
        git commit -e -F text -a &&
-       head -n 4 .git/COMMIT_EDITMSG >actual &&
-       test_cmp expect actual
+       head -n 4 .git/COMMIT_EDITMSG >actual
+'
+
+echo "sample
+
+# Please enter the commit message for your changes. Lines starting
+# with '#' will be ignored, and an empty message aborts the commit." >expect
 
+test_expect_success C_LOCALE_OUTPUT 'cleanup commit messages (strip,-F,-e): output' '
+       test_cmp expect actual
 '
 
 echo "#
 # Author:    $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 #" >> expect
 
-test_expect_success 'author different from committer' '
+test_expect_success C_LOCALE_OUTPUT 'author different from committer' '
 
        echo >>negative &&
        git commit -e -m "sample"
-       head -n 7 .git/COMMIT_EDITMSG >actual &&
+       head -n 7 .git/COMMIT_EDITMSG >actual
+'
+
+test_expect_success C_LOCALE_OUTPUT 'author different from committer: output' '
        test_cmp expect actual
 '
 
@@ -248,7 +259,7 @@ rm -f expect.tmp
 echo "# Committer:
 #" >> expect
 
-test_expect_success 'committer is automatic' '
+test_expect_success C_LOCALE_OUTPUT 'committer is automatic' '
 
        echo >>negative &&
        (
@@ -258,7 +269,10 @@ test_expect_success 'committer is automatic' '
                test_must_fail git commit -e -m "sample"
        ) &&
        head -n 8 .git/COMMIT_EDITMSG | \
-       sed "s/^# Committer: .*/# Committer:/" >actual &&
+       sed "s/^# Committer: .*/# Committer:/" >actual
+'
+
+test_expect_success C_LOCALE_OUTPUT 'committer is automatic: output' '
        test_cmp expect actual
 '
 
@@ -370,66 +384,66 @@ try_commit () {
 
 try_commit_status_combo () {
 
-       test_expect_success 'commit' '
+       test_expect_success C_LOCALE_OUTPUT 'commit' '
                clear_config commit.status &&
                try_commit "" &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit' '
+       test_expect_success C_LOCALE_OUTPUT 'commit' '
                clear_config commit.status &&
                try_commit "" &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --status' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --status' '
                clear_config commit.status &&
                try_commit --status &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --no-status' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --no-status' '
                clear_config commit.status &&
                try_commit --no-status &&
                ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit with commit.status = yes' '
+       test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = yes' '
                clear_config commit.status &&
                git config commit.status yes &&
                try_commit "" &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit with commit.status = no' '
+       test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = no' '
                clear_config commit.status &&
                git config commit.status no &&
                try_commit "" &&
                ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --status with commit.status = yes' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = yes' '
                clear_config commit.status &&
                git config commit.status yes &&
                try_commit --status &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --no-status with commit.status = yes' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = yes' '
                clear_config commit.status &&
                git config commit.status yes &&
                try_commit --no-status &&
                ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --status with commit.status = no' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = no' '
                clear_config commit.status &&
                git config commit.status no &&
                try_commit --status &&
                grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
        '
 
-       test_expect_success 'commit --no-status with commit.status = no' '
+       test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = no' '
                clear_config commit.status &&
                git config commit.status no &&
                try_commit --no-status &&
index 3d4f85d74f6f378d76bde77e581273af010ba452..c56733253fe335af9cbd12d19e776e35bd335994 100755 (executable)
@@ -20,17 +20,17 @@ test_expect_success 'setup' '
        git commit -m "Add submodule sub"
 '
 
-test_expect_success 'status clean' '
+test_expect_success C_LOCALE_OUTPUT 'status clean' '
        git status >output &&
        grep "nothing to commit" output
 '
 
-test_expect_success 'commit --dry-run -a clean' '
+test_expect_success C_LOCALE_OUTPUT 'commit --dry-run -a clean' '
        test_must_fail git commit --dry-run -a >output &&
        grep "nothing to commit" output
 '
 
-test_expect_success 'status with modified file in submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status with modified file in submodule' '
        (cd sub && git reset --hard) &&
        echo "changed" >sub/foo &&
        git status >output &&
@@ -46,7 +46,7 @@ test_expect_success 'status with modified file in submodule (porcelain)' '
        EOF
 '
 
-test_expect_success 'status with added file in submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status with added file in submodule' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        git status >output &&
        grep "modified:   sub (modified content)" output
@@ -60,14 +60,14 @@ test_expect_success 'status with added file in submodule (porcelain)' '
        EOF
 '
 
-test_expect_success 'status with untracked file in submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status with untracked file in submodule' '
        (cd sub && git reset --hard) &&
        echo "content" >sub/new-file &&
        git status >output &&
        grep "modified:   sub (untracked content)" output
 '
 
-test_expect_success 'status -uno with untracked file in submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status -uno with untracked file in submodule' '
        git status -uno >output &&
        grep "^nothing to commit" output
 '
@@ -79,7 +79,7 @@ test_expect_success 'status with untracked file in submodule (porcelain)' '
        EOF
 '
 
-test_expect_success 'status with added and untracked file in submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status with added and untracked file in submodule' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        echo "content" >sub/new-file &&
        git status >output &&
@@ -95,7 +95,7 @@ test_expect_success 'status with added and untracked file in submodule (porcelai
        EOF
 '
 
-test_expect_success 'status with modified file in modified submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status with modified file in modified submodule' '
        (cd sub && git reset --hard) &&
        rm sub/new-file &&
        (cd sub && echo "next change" >foo && git commit -m "next change" foo) &&
@@ -113,7 +113,7 @@ test_expect_success 'status with modified file in modified submodule (porcelain)
        EOF
 '
 
-test_expect_success 'status with added file in modified submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status with added file in modified submodule' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        git status >output &&
        grep "modified:   sub (new commits, modified content)" output
@@ -127,7 +127,7 @@ test_expect_success 'status with added file in modified submodule (porcelain)' '
        EOF
 '
 
-test_expect_success 'status with untracked file in modified submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status with untracked file in modified submodule' '
        (cd sub && git reset --hard) &&
        echo "content" >sub/new-file &&
        git status >output &&
@@ -141,7 +141,7 @@ test_expect_success 'status with untracked file in modified submodule (porcelain
        EOF
 '
 
-test_expect_success 'status with added and untracked file in modified submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status with added and untracked file in modified submodule' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        echo "content" >sub/new-file &&
        git status >output &&
@@ -167,7 +167,7 @@ test_expect_success 'setup .git file for sub' '
         git commit -m "added .real to .gitignore" .gitignore
 '
 
-test_expect_success 'status with added file in modified submodule with .git file' '
+test_expect_success C_LOCALE_OUTPUT 'status with added file in modified submodule with .git file' '
        (cd sub && git reset --hard && echo >foo && git add foo) &&
        git status >output &&
        grep "modified:   sub (new commits, modified content)" output
@@ -177,12 +177,12 @@ test_expect_success 'rm submodule contents' '
        rm -rf sub/* sub/.git
 '
 
-test_expect_success 'status clean (empty submodule dir)' '
+test_expect_success C_LOCALE_OUTPUT 'status clean (empty submodule dir)' '
        git status >output &&
        grep "nothing to commit" output
 '
 
-test_expect_success 'status -a clean (empty submodule dir)' '
+test_expect_success C_LOCALE_OUTPUT 'status -a clean (empty submodule dir)' '
        test_must_fail git commit --dry-run -a >output &&
        grep "nothing to commit" output
 '
index f1dc5c3b6a36507e664e624bf9cebb1634bce335..a93e70fac446f0b062abe9109658d54b7c321819 100755 (executable)
@@ -55,7 +55,7 @@ test_expect_success 'setup' '
        git add dir2/added
 '
 
-test_expect_success 'status (1)' '
+test_expect_success C_LOCALE_OUTPUT 'status (1)' '
 
        grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
 
@@ -85,7 +85,7 @@ cat >expect <<\EOF
 #      untracked
 EOF
 
-test_expect_success 'status (2)' '
+test_expect_success C_LOCALE_OUTPUT 'status (2)' '
 
        git status >output &&
        test_cmp expect output
@@ -111,7 +111,7 @@ EOF
 
 git config advice.statusHints false
 
-test_expect_success 'status (advice.statusHints false)' '
+test_expect_success C_LOCALE_OUTPUT 'status (advice.statusHints false)' '
 
        git status >output &&
        test_cmp expect output
@@ -157,6 +157,12 @@ test_expect_success 'status -s -b' '
 
 '
 
+test_expect_success 'setup dir3' '
+       mkdir dir3 &&
+       : >dir3/untracked1 &&
+       : >dir3/untracked2
+'
+
 cat >expect <<EOF
 # On branch master
 # Changes to be committed:
@@ -172,16 +178,14 @@ cat >expect <<EOF
 #
 # Untracked files not listed (use -u option to show untracked files)
 EOF
-test_expect_success 'status -uno' '
-       mkdir dir3 &&
-       : >dir3/untracked1 &&
-       : >dir3/untracked2 &&
+test_expect_success C_LOCALE_OUTPUT 'status -uno' '
        git status -uno >output &&
        test_cmp expect output
 '
 
-test_expect_success 'status (status.showUntrackedFiles no)' '
+test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles no)' '
        git config status.showuntrackedfiles no
+       test_when_finished "git config --unset status.showuntrackedfiles" &&
        git status >output &&
        test_cmp expect output
 '
@@ -197,7 +201,7 @@ cat >expect <<EOF
 # Untracked files not listed
 EOF
 git config advice.statusHints false
-test_expect_success 'status -uno (advice.statusHints false)' '
+test_expect_success C_LOCALE_OUTPUT 'status -uno (advice.statusHints false)' '
        git status -uno >output &&
        test_cmp expect output
 '
@@ -208,7 +212,6 @@ cat >expect << EOF
 A  dir2/added
 EOF
 test_expect_success 'status -s -uno' '
-       git config --unset status.showuntrackedfiles
        git status -s -uno >output &&
        test_cmp expect output
 '
@@ -243,13 +246,14 @@ cat >expect <<EOF
 #      output
 #      untracked
 EOF
-test_expect_success 'status -unormal' '
+test_expect_success C_LOCALE_OUTPUT 'status -unormal' '
        git status -unormal >output &&
        test_cmp expect output
 '
 
-test_expect_success 'status (status.showUntrackedFiles normal)' '
+test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles normal)' '
        git config status.showuntrackedfiles normal
+       test_when_finished "git config --unset status.showuntrackedfiles" &&
        git status >output &&
        test_cmp expect output
 '
@@ -266,7 +270,6 @@ A  dir2/added
 ?? untracked
 EOF
 test_expect_success 'status -s -unormal' '
-       git config --unset status.showuntrackedfiles
        git status -s -unormal >output &&
        test_cmp expect output
 '
@@ -302,18 +305,21 @@ cat >expect <<EOF
 #      output
 #      untracked
 EOF
-test_expect_success 'status -uall' '
+test_expect_success C_LOCALE_OUTPUT 'status -uall' '
        git status -uall >output &&
        test_cmp expect output
 '
-test_expect_success 'status (status.showUntrackedFiles all)' '
+test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles all)' '
        git config status.showuntrackedfiles all
+       test_when_finished "git config --unset status.showuntrackedfiles" &&
        git status >output &&
-       rm -rf dir3 &&
-       git config --unset status.showuntrackedfiles &&
        test_cmp expect output
 '
 
+test_expect_success 'teardown dir3' '
+       rm -rf dir3
+'
+
 cat >expect <<EOF
  M dir1/modified
 A  dir2/added
@@ -361,7 +367,7 @@ cat >expect <<\EOF
 #      ../untracked
 EOF
 
-test_expect_success 'status with relative paths' '
+test_expect_success C_LOCALE_OUTPUT 'status with relative paths' '
 
        (cd dir1 && git status) >output &&
        test_cmp expect output
@@ -434,18 +440,19 @@ cat >expect <<\EOF
 #      <BLUE>untracked<RESET>
 EOF
 
-test_expect_success 'status with color.ui' '
+test_expect_success C_LOCALE_OUTPUT 'status with color.ui' '
 
        git config color.ui always &&
+       test_when_finished "git config --unset color.ui" &&
        git status | test_decode_color >output &&
        test_cmp expect output
 
 '
 
-test_expect_success 'status with color.status' '
+test_expect_success C_LOCALE_OUTPUT 'status with color.status' '
 
-       git config --unset color.ui &&
        git config color.status always &&
+       test_when_finished "git config --unset color.status" &&
        git status | test_decode_color >output &&
        test_cmp expect output
 
@@ -464,7 +471,6 @@ EOF
 
 test_expect_success 'status -s with color.ui' '
 
-       git config --unset color.status &&
        git config color.ui always &&
        git status -s | test_decode_color >output &&
        test_cmp expect output
@@ -564,9 +570,10 @@ cat >expect <<\EOF
 EOF
 
 
-test_expect_success 'status without relative paths' '
+test_expect_success C_LOCALE_OUTPUT 'status without relative paths' '
 
-       git config status.relativePaths false
+       git config status.relativePaths false &&
+       test_when_finished "git config --unset status.relativePaths" &&
        (cd dir1 && git status) >output &&
        test_cmp expect output
 
@@ -585,6 +592,8 @@ EOF
 
 test_expect_success 'status -s without relative paths' '
 
+       git config status.relativePaths false &&
+       test_when_finished "git config --unset status.relativePaths" &&
        (cd dir1 && git status -s) >output &&
        test_cmp expect output
 
@@ -607,7 +616,10 @@ cat <<EOF >expect
 #      untracked
 EOF
 test_expect_success 'dry-run of partial commit excluding new file in index' '
-       git commit --dry-run dir1/modified >output &&
+       git commit --dry-run dir1/modified >output
+'
+
+test_expect_success C_LOCALE_OUTPUT 'dry-run of partial commit excluding new file in index: output' '
        test_cmp expect output
 '
 
@@ -655,13 +667,13 @@ cat >expect <<EOF
 #      output
 #      untracked
 EOF
-test_expect_success 'status submodule summary is disabled by default' '
+test_expect_success C_LOCALE_OUTPUT 'status submodule summary is disabled by default' '
        git status >output &&
        test_cmp expect output
 '
 
 # we expect the same as the previous test
-test_expect_success 'status --untracked-files=all does not show submodule' '
+test_expect_success C_LOCALE_OUTPUT 'status --untracked-files=all does not show submodule' '
        git status --untracked-files=all >output &&
        test_cmp expect output
 '
@@ -719,7 +731,7 @@ cat >expect <<EOF
 #      output
 #      untracked
 EOF
-test_expect_success 'status submodule summary' '
+test_expect_success C_LOCALE_OUTPUT 'status submodule summary' '
        git config status.submodulesummary 10 &&
        git status >output &&
        test_cmp expect output
@@ -760,8 +772,11 @@ cat >expect <<EOF
 #      untracked
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
-test_expect_success 'status submodule summary (clean submodule)' '
-       git commit -m "commit submodule" &&
+test_expect_success 'status submodule summary (clean submodule): commit' '
+       git commit -m "commit submodule"
+'
+
+test_expect_success C_LOCALE_OUTPUT 'status submodule summary (clean submodule): output' '
        git config status.submodulesummary 10 &&
        test_must_fail git commit --dry-run >output &&
        test_cmp expect output &&
@@ -812,7 +827,7 @@ cat >expect <<EOF
 #      output
 #      untracked
 EOF
-test_expect_success 'commit --dry-run submodule summary (--amend)' '
+test_expect_success C_LOCALE_OUTPUT 'commit --dry-run submodule summary (--amend)' '
        git config status.submodulesummary 10 &&
        git commit --dry-run --amend >output &&
        test_cmp expect output
@@ -867,13 +882,13 @@ cat > expect << EOF
 #      untracked
 EOF
 
-test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
+test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=untracked suppresses submodules with untracked content' '
        echo modified > sm/untracked &&
        git status --ignore-submodules=untracked > output &&
        test_cmp expect output
 '
 
-test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
+test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=untracked suppresses submodules with untracked content' '
        git config diff.ignoreSubmodules dirty &&
        git status >output &&
        test_cmp expect output &&
@@ -885,7 +900,7 @@ test_expect_success '.gitmodules ignore=untracked suppresses submodules with unt
        git config --unset diff.ignoreSubmodules
 '
 
-test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
+test_expect_success C_LOCALE_OUTPUT '.git/config ignore=untracked suppresses submodules with untracked content' '
        git config --add -f .gitmodules submodule.subname.ignore none &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git config --add submodule.subname.ignore untracked &&
@@ -896,12 +911,12 @@ test_expect_success '.git/config ignore=untracked suppresses submodules with unt
        git config --remove-section -f .gitmodules submodule.subname
 '
 
-test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
+test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with untracked content' '
        git status --ignore-submodules=dirty > output &&
        test_cmp expect output
 '
 
-test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
+test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with untracked content' '
        git config diff.ignoreSubmodules dirty &&
        git status >output &&
        ! test -s actual &&
@@ -913,7 +928,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with untrack
        git config --unset diff.ignoreSubmodules
 '
 
-test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
+test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with untracked content' '
        git config --add -f .gitmodules submodule.subname.ignore none &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git config --add submodule.subname.ignore dirty &&
@@ -924,13 +939,13 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
+test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with modified content' '
        echo modified > sm/foo &&
        git status --ignore-submodules=dirty > output &&
        test_cmp expect output
 '
 
-test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
+test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with modified content' '
        git config --add -f .gitmodules submodule.subname.ignore dirty &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status > output &&
@@ -938,7 +953,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with modifie
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
+test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with modified content' '
        git config --add -f .gitmodules submodule.subname.ignore none &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git config --add submodule.subname.ignore dirty &&
@@ -981,12 +996,12 @@ cat > expect << EOF
 #      untracked
 EOF
 
-test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
+test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
        git status --ignore-submodules=untracked > output &&
        test_cmp expect output
 '
 
-test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
+test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
        git config --add -f .gitmodules submodule.subname.ignore untracked &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status > output &&
@@ -994,7 +1009,7 @@ test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules wi
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
+test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodules with modified content" '
        git config --add -f .gitmodules submodule.subname.ignore none &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git config --add submodule.subname.ignore untracked &&
@@ -1043,12 +1058,12 @@ cat > expect << EOF
 #      untracked
 EOF
 
-test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
+test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodule summary" '
        git status --ignore-submodules=untracked > output &&
        test_cmp expect output
 '
 
-test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
+test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodule summary" '
        git config --add -f .gitmodules submodule.subname.ignore untracked &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status > output &&
@@ -1056,7 +1071,7 @@ test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule sum
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
+test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodule summary" '
        git config --add -f .gitmodules submodule.subname.ignore none &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git config --add submodule.subname.ignore untracked &&
@@ -1067,11 +1082,11 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodule sum
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
+test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=dirty doesn't suppress submodule summary" '
        git status --ignore-submodules=dirty > output &&
        test_cmp expect output
 '
-test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
+test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=dirty doesn't suppress submodule summary" '
        git config --add -f .gitmodules submodule.subname.ignore dirty &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status > output &&
@@ -1079,7 +1094,7 @@ test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary
        git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
+test_expect_success C_LOCALE_OUTPUT ".git/config ignore=dirty doesn't suppress submodule summary" '
        git config --add -f .gitmodules submodule.subname.ignore none &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git config --add submodule.subname.ignore dirty &&
@@ -1111,7 +1126,7 @@ cat > expect << EOF
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
 
-test_expect_success "--ignore-submodules=all suppresses submodule summary" '
+test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=all suppresses submodule summary" '
        git status --ignore-submodules=all > output &&
        test_cmp expect output
 '
index 77b69200297e222319b5701c62312bee27b62ce9..b61fd3c3c4c949785a595dac0fdcc48f4f7faf93 100755 (executable)
@@ -157,4 +157,33 @@ test_expect_success '--reset-author should be rejected without -c/-C/--amend' '
        test_must_fail git commit -a --reset-author -m done
 '
 
+test_expect_success 'commit respects CHERRY_PICK_HEAD and MERGE_MSG' '
+       echo "cherry-pick 1a" >>foo &&
+       test_tick &&
+       git commit -am "cherry-pick 1" --author="Cherry <cherry@pick.er>" &&
+       git tag cherry-pick-head &&
+       git rev-parse cherry-pick-head >.git/CHERRY_PICK_HEAD &&
+       echo "This is a MERGE_MSG" >.git/MERGE_MSG &&
+       echo "cherry-pick 1b" >>foo &&
+       test_tick &&
+       git commit -a &&
+       author_header cherry-pick-head >expect &&
+       author_header HEAD >actual &&
+       test_cmp expect actual &&
+
+       echo "This is a MERGE_MSG" >expect &&
+       message_body HEAD >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success '--reset-author with CHERRY_PICK_HEAD' '
+       git rev-parse cherry-pick-head >.git/CHERRY_PICK_HEAD &&
+       echo "cherry-pick 2" >>foo &&
+       test_tick &&
+       git commit -am "cherry-pick 2" --reset-author &&
+       echo "author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE" >expect &&
+       author_header HEAD >actual &&
+       test_cmp expect actual
+'
+
 test_done
index b147a1bd69e96e48d3808028a3775a609471639a..87d5d788cb1884fdfe218ec30582f5d3da8b5d7d 100755 (executable)
@@ -495,7 +495,7 @@ test_expect_success 'merge fast-forward in a dirty tree' '
 
 test_debug 'git log --graph --decorate --oneline --all'
 
-test_expect_success 'in-index merge' '
+test_expect_success C_LOCALE_OUTPUT 'in-index merge' '
        git reset --hard c0 &&
        git merge --no-ff -s resolve c1 >out &&
        grep "Wonderful." out &&
index 4d5ce4e682c1ea69034c3f7789a8ac0c89b12466..ef84f04102ed067768c66ea9608b98d47851eb8b 100755 (executable)
@@ -122,7 +122,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '
        rm -f sub sub2
 '
 
-test_expect_failure SYMLINKS 'will not overwrite untracked symlink in leading path' '
+test_expect_success SYMLINKS 'will not overwrite untracked symlink in leading path' '
        git reset --hard c0 &&
        rm -rf sub &&
        mkdir sub2 &&
@@ -150,10 +150,37 @@ test_expect_success 'will not overwrite untracked file on unborn branch' '
        git rm -fr . &&
        git checkout --orphan new &&
        cp important c0.c &&
-       test_must_fail git merge c0 2>out &&
-       test_cmp out expect &&
+       test_must_fail git merge c0 2>out
+'
+
+test_expect_success C_LOCALE_OUTPUT 'will not overwrite untracked file on unborn branch: output' '
+       test_cmp out expect
+'
+
+test_expect_success 'will not overwrite untracked file on unborn branch .git/MERGE_HEAD sanity etc.' '
+       test_when_finished "rm c0.c" &&
        test_path_is_missing .git/MERGE_HEAD &&
        test_cmp important c0.c
 '
 
+test_expect_success 'failed merge leaves unborn branch in the womb' '
+       test_must_fail git rev-parse --verify HEAD
+'
+
+test_expect_success 'set up unborn branch and content' '
+       git symbolic-ref HEAD refs/heads/unborn &&
+       rm -f .git/index &&
+       echo foo > tracked-file &&
+       git add tracked-file &&
+       echo bar > untracked-file
+'
+
+test_expect_success 'will not clobber WT/index when merging into unborn' '
+       git merge master &&
+       grep foo tracked-file &&
+       git show :tracked-file >expect &&
+       grep foo expect &&
+       grep bar untracked-file
+'
+
 test_done
index d78bdec330cd8b9505aa92ff2e81e0f716b9a741..dc838c93bcb00a80ad56c4d1233009fe9220b90e 100755 (executable)
@@ -16,23 +16,33 @@ Testing basic merge tool invocation'
 test_expect_success 'setup' '
     git config rerere.enabled true &&
     echo master >file1 &&
+    echo master file11 >file11 &&
+    echo master file12 >file12 &&
+    echo master file13 >file13 &&
+    echo master file14 >file14 &&
     mkdir subdir &&
     echo master sub >subdir/file3 &&
-    git add file1 subdir/file3 &&
-    git commit -m "added file1" &&
+    git add file1 file1[1-4] subdir/file3 &&
+    git commit -m "add initial versions" &&
 
     git checkout -b branch1 master &&
     echo branch1 change >file1 &&
     echo branch1 newfile >file2 &&
+    echo branch1 change file11 >file11 &&
+    echo branch1 change file13 >file13 &&
     echo branch1 sub >subdir/file3 &&
-    git add file1 file2 subdir/file3 &&
+    git add file1 file11 file13 file2 subdir/file3 &&
+    git rm file12 &&
     git commit -m "branch1 changes" &&
 
     git checkout master &&
     echo master updated >file1 &&
     echo master new >file2 &&
+    echo master updated file12 >file12 &&
+    echo master updated file14 >file14 &&
     echo master new sub >subdir/file3 &&
-    git add file1 file2 subdir/file3 &&
+    git add file1 file12 file14 file2 subdir/file3 &&
+    git rm file11 &&
     git commit -m "master updates" &&
 
     git config merge.tool mytool &&
@@ -46,6 +56,8 @@ test_expect_success 'custom mergetool' '
     ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
+    ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
+    ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
     test "$(cat file1)" = "master updated" &&
     test "$(cat file2)" = "master new" &&
     test "$(cat subdir/file3)" = "master new sub" &&
@@ -59,6 +71,8 @@ test_expect_success 'mergetool crlf' '
     ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
+    ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
+    ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
     test "$(printf x | cat file1 -)" = "$(printf "master updated\r\nx")" &&
     test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" &&
     test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" &&
@@ -82,6 +96,8 @@ test_expect_success 'mergetool on file in parent dir' '
        cd subdir &&
        ( yes "" | git mergetool ../file1 >/dev/null 2>&1 ) &&
        ( yes "" | git mergetool ../file2 >/dev/null 2>&1 ) &&
+       ( yes "d" | git mergetool ../file11 >/dev/null 2>&1 ) &&
+       ( yes "d" | git mergetool ../file12 >/dev/null 2>&1 ) &&
        test "$(cat ../file1)" = "master updated" &&
        test "$(cat ../file2)" = "master new" &&
        git commit -m "branch1 resolved with mergetool - subdir"
@@ -92,6 +108,8 @@ test_expect_success 'mergetool skips autoresolved' '
     git checkout -b test4 branch1 &&
     test_must_fail git merge master &&
     test -n "$(git ls-files -u)" &&
+    ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
+    ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
     output="$(git mergetool --no-prompt)" &&
     test "$output" = "No files need merging" &&
     git reset --hard
@@ -102,13 +120,23 @@ test_expect_success 'mergetool merges all from subdir' '
        cd subdir &&
        git config rerere.enabled false &&
        test_must_fail git merge master &&
-       git mergetool --no-prompt &&
+       ( yes "d" "d" | git mergetool --no-prompt ) &&
        test "$(cat ../file1)" = "master updated" &&
        test "$(cat ../file2)" = "master new" &&
        test "$(cat file3)" = "master new sub" &&
-       git add ../file1 ../file2 file3 &&
        git commit -m "branch2 resolved by mergetool from subdir"
     )
 '
 
+test_expect_success 'mergetool skips resolved paths when rerere is active' '
+    git config rerere.enabled true &&
+    rm -rf .git/rr-cache &&
+    git checkout -b test5 branch1
+    test_must_fail git merge master >/dev/null 2>&1 &&
+    ( yes "d" "d" | git mergetool --no-prompt >/dev/null 2>&1 ) &&
+    output="$(yes "n" | git mergetool --no-prompt)" &&
+    test "$output" = "No files need merging" &&
+    git reset --hard
+'
+
 test_done
index 61890bc892d9fd37032f9ca05eab87de0e0dda03..cdb3f444cd4a5970df6f375382f5cea82ccaee06 100755 (executable)
@@ -46,8 +46,14 @@ test_expect_success 'setup' '
 pre_merge_head="$(git rev-parse HEAD)"
 
 test_expect_success 'fails without MERGE_HEAD (unstarted merge)' '
-       test_must_fail git merge --abort 2>output &&
-       grep -q MERGE_HEAD output &&
+       test_must_fail git merge --abort 2>output
+'
+
+test_expect_success C_LOCALE_OUTPUT 'fails without MERGE_HEAD (unstarted merge): fatal output' '
+       grep -q MERGE_HEAD output
+'
+
+test_expect_success 'fails without MERGE_HEAD (unstarted merge): .git/MERGE_HEAD sanity' '
        test ! -f .git/MERGE_HEAD &&
        test "$pre_merge_head" = "$(git rev-parse HEAD)"
 '
@@ -57,8 +63,14 @@ test_expect_success 'fails without MERGE_HEAD (completed merge)' '
        test ! -f .git/MERGE_HEAD &&
        # Merge successfully completed
        post_merge_head="$(git rev-parse HEAD)" &&
-       test_must_fail git merge --abort 2>output &&
-       grep -q MERGE_HEAD output &&
+       test_must_fail git merge --abort 2>output
+'
+
+test_expect_success C_LOCALE_OUTPUT 'fails without MERGE_HEAD (completed merge): output' '
+       grep -q MERGE_HEAD output
+'
+
+test_expect_success 'fails without MERGE_HEAD (completed merge): .git/MERGE_HEAD sanity' '
        test ! -f .git/MERGE_HEAD &&
        test "$post_merge_head" = "$(git rev-parse HEAD)"
 '
index c8777589ca1c89825b570cfc05405a39df39aaba..8184c264cf942bcd8e6c2f75b5526ddfdc5a11e9 100755 (executable)
@@ -59,7 +59,29 @@ do
                        echo ${HC}file:4:foo mmap bar_mmap
                        echo ${HC}file:5:foo_mmap bar mmap baz
                } >expected &&
-               git grep -n -w -e mmap $H >actual &&
+               git -c grep.linenumber=false grep -n -w -e mmap $H >actual &&
+               test_cmp expected actual
+       '
+
+       test_expect_success "grep -w $L" '
+               {
+                       echo ${HC}file:1:foo mmap bar
+                       echo ${HC}file:3:foo_mmap bar mmap
+                       echo ${HC}file:4:foo mmap bar_mmap
+                       echo ${HC}file:5:foo_mmap bar mmap baz
+               } >expected &&
+               git -c grep.linenumber=true grep -w -e mmap $H >actual &&
+               test_cmp expected actual
+       '
+
+       test_expect_success "grep -w $L" '
+               {
+                       echo ${HC}file:foo mmap bar
+                       echo ${HC}file:foo_mmap bar mmap
+                       echo ${HC}file:foo mmap bar_mmap
+                       echo ${HC}file:foo_mmap bar mmap baz
+               } >expected &&
+               git -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&
                test_cmp expected actual
        '
 
@@ -182,6 +204,24 @@ do
                test_cmp expected actual
        '
 
+       test_expect_success "grep --max-depth 0 -- . t $L" '
+               {
+                       echo ${HC}t/v:1:vvv
+                       echo ${HC}v:1:vvv
+               } >expected &&
+               git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
+               test_cmp expected actual
+       '
+
+       test_expect_success "grep --max-depth 0 -- t . $L" '
+               {
+                       echo ${HC}t/v:1:vvv
+                       echo ${HC}v:1:vvv
+               } >expected &&
+               git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
+               test_cmp expected actual
+       '
+
 done
 
 cat >expected <<EOF
@@ -285,6 +325,11 @@ test_expect_success 'grep -f, ignore empty lines' '
        test_cmp expected actual
 '
 
+test_expect_success 'grep -f, ignore empty lines, read patterns from stdin' '
+       git grep -f - <patterns >actual &&
+       test_cmp expected actual
+'
+
 cat >expected <<EOF
 y:y yy
 --
index 568a6f2b69ab5003c00f206806c3fe6289f63a98..aedf484feeb9da05054f18ab2f4913865048fe35 100755 (executable)
@@ -61,7 +61,7 @@ test_expect_success SIMPLEPAGER 'git grep -O' '
        test_cmp empty out
 '
 
-test_expect_success 'git grep -O --cached' '
+test_expect_success C_LOCALE_OUTPUT 'git grep -O --cached' '
        test_must_fail git grep --cached -O GREP_PATTERN >out 2>msg &&
        grep open-files-in-pager msg
 '
index 88a9751dd3c73a39a15ec3d18d3dddb7790706bb..6f6175a8f7d9b0c6e6334f89ff21b74f067d6532 100755 (executable)
@@ -9,6 +9,30 @@ reinit_git () {
        git init
 }
 
+properties () {
+       while test "$#" -ne 0
+       do
+               property="$1" &&
+               value="$2" &&
+               printf "%s\n" "K ${#property}" &&
+               printf "%s\n" "$property" &&
+               printf "%s\n" "V ${#value}" &&
+               printf "%s\n" "$value" &&
+               shift 2 ||
+               return 1
+       done
+}
+
+text_no_props () {
+       text="$1
+" &&
+       printf "%s\n" "Prop-content-length: 10" &&
+       printf "%s\n" "Text-content-length: ${#text}" &&
+       printf "%s\n" "Content-length: $((${#text} + 10))" &&
+       printf "%s\n" "" "PROPS-END" &&
+       printf "%s\n" "$text"
+}
+
 >empty
 
 test_expect_success 'empty dump' '
@@ -18,13 +42,794 @@ test_expect_success 'empty dump' '
        git fast-import <stream
 '
 
-test_expect_success 'v3 dumps not supported' '
+test_expect_success 'v4 dumps not supported' '
        reinit_git &&
-       echo "SVN-fs-dump-format-version: 3" >input &&
-       test_must_fail test-svn-fe input >stream &&
+       echo "SVN-fs-dump-format-version: 4" >v4.dump &&
+       test_must_fail test-svn-fe v4.dump >stream &&
        test_cmp empty stream
 '
 
+test_expect_failure 'empty revision' '
+       reinit_git &&
+       printf "rev <nobody, nobody@local>: %s\n" "" "" >expect &&
+       cat >emptyrev.dump <<-\EOF &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 0
+       Content-length: 0
+
+       Revision-number: 2
+       Prop-content-length: 0
+       Content-length: 0
+
+       EOF
+       test-svn-fe emptyrev.dump >stream &&
+       git fast-import <stream &&
+       git log -p --format="rev <%an, %ae>: %s" HEAD >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'empty properties' '
+       reinit_git &&
+       printf "rev <nobody, nobody@local>: %s\n" "" "" >expect &&
+       cat >emptyprop.dump <<-\EOF &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Revision-number: 2
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+       EOF
+       test-svn-fe emptyprop.dump >stream &&
+       git fast-import <stream &&
+       git log -p --format="rev <%an, %ae>: %s" HEAD >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'author name and commit message' '
+       reinit_git &&
+       echo "<author@example.com, author@example.com@local>" >expect.author &&
+       cat >message <<-\EOF &&
+       A concise summary of the change
+
+       A detailed description of the change, why it is needed, what
+       was broken and why applying this is the best course of action.
+
+       * file.c
+           Details pertaining to an individual file.
+       EOF
+       {
+               properties \
+                       svn:author author@example.com \
+                       svn:log "$(cat message)" &&
+               echo PROPS-END
+       } >props &&
+       {
+               echo "SVN-fs-dump-format-version: 3" &&
+               echo &&
+               echo "Revision-number: 1" &&
+               echo Prop-content-length: $(wc -c <props) &&
+               echo Content-length: $(wc -c <props) &&
+               echo &&
+               cat props
+       } >log.dump &&
+       test-svn-fe log.dump >stream &&
+       git fast-import <stream &&
+       git log -p --format="%B" HEAD >actual.log &&
+       git log --format="<%an, %ae>" >actual.author &&
+       test_cmp message actual.log &&
+       test_cmp expect.author actual.author
+'
+
+test_expect_success 'unsupported properties are ignored' '
+       reinit_git &&
+       echo author >expect &&
+       cat >extraprop.dump <<-\EOF &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 56
+       Content-length: 56
+
+       K 8
+       nonsense
+       V 1
+       y
+       K 10
+       svn:author
+       V 6
+       author
+       PROPS-END
+       EOF
+       test-svn-fe extraprop.dump >stream &&
+       git fast-import <stream &&
+       git log -p --format=%an HEAD >actual &&
+       test_cmp expect actual
+'
+
+test_expect_failure 'timestamp and empty file' '
+       echo author@example.com >expect.author &&
+       echo 1999-01-01 >expect.date &&
+       echo file >expect.files &&
+       reinit_git &&
+       {
+               properties \
+                       svn:author author@example.com \
+                       svn:date "1999-01-01T00:01:002.000000Z" \
+                       svn:log "add empty file" &&
+               echo PROPS-END
+       } >props &&
+       {
+               cat <<-EOF &&
+               SVN-fs-dump-format-version: 3
+
+               Revision-number: 1
+               EOF
+               echo Prop-content-length: $(wc -c <props) &&
+               echo Content-length: $(wc -c <props) &&
+               echo &&
+               cat props &&
+               cat <<-\EOF
+
+               Node-path: empty-file
+               Node-kind: file
+               Node-action: add
+               Content-length: 0
+
+               EOF
+       } >emptyfile.dump &&
+       test-svn-fe emptyfile.dump >stream &&
+       git fast-import <stream &&
+       git log --format=%an HEAD >actual.author &&
+       git log --date=short --format=%ad HEAD >actual.date &&
+       git ls-tree -r --name-only HEAD >actual.files &&
+       test_cmp expect.author actual.author &&
+       test_cmp expect.date actual.date &&
+       test_cmp expect.files actual.files &&
+       git checkout HEAD empty-file &&
+       test_cmp empty file
+'
+
+test_expect_success 'directory with files' '
+       reinit_git &&
+       printf "%s\n" directory/file1 directory/file2 >expect.files &&
+       echo hi >hi &&
+       echo hello >hello &&
+       {
+               properties \
+                       svn:author author@example.com \
+                       svn:date "1999-02-01T00:01:002.000000Z" \
+                       svn:log "add directory with some files in it" &&
+               echo PROPS-END
+       } >props &&
+       {
+               cat <<-EOF &&
+               SVN-fs-dump-format-version: 3
+
+               Revision-number: 1
+               EOF
+               echo Prop-content-length: $(wc -c <props) &&
+               echo Content-length: $(wc -c <props) &&
+               echo &&
+               cat props &&
+               cat <<-\EOF &&
+
+               Node-path: directory
+               Node-kind: dir
+               Node-action: add
+               Prop-content-length: 10
+               Content-length: 10
+
+               PROPS-END
+
+               Node-path: directory/file1
+               Node-kind: file
+               Node-action: add
+               EOF
+               text_no_props hello &&
+               cat <<-\EOF &&
+               Node-path: directory/file2
+               Node-kind: file
+               Node-action: add
+               EOF
+               text_no_props hi
+       } >directory.dump &&
+       test-svn-fe directory.dump >stream &&
+       git fast-import <stream &&
+
+       git ls-tree -r --name-only HEAD >actual.files &&
+       git checkout HEAD directory &&
+       test_cmp expect.files actual.files &&
+       test_cmp hello directory/file1 &&
+       test_cmp hi directory/file2
+'
+
+test_expect_success 'node without action' '
+       cat >inaction.dump <<-\EOF &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: directory
+       Node-kind: dir
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+       EOF
+       test_must_fail test-svn-fe inaction.dump
+'
+
+test_expect_success 'action: add node without text' '
+       cat >textless.dump <<-\EOF &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: textless
+       Node-kind: file
+       Node-action: add
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+       EOF
+       test_must_fail test-svn-fe textless.dump
+'
+
+test_expect_failure 'change file mode but keep old content' '
+       reinit_git &&
+       cat >expect <<-\EOF &&
+       OBJID
+       :120000 100644 OBJID OBJID T    greeting
+       OBJID
+       :100644 120000 OBJID OBJID T    greeting
+       OBJID
+       :000000 100644 OBJID OBJID A    greeting
+       EOF
+       echo "link hello" >expect.blob &&
+       echo hello >hello &&
+       cat >filemode.dump <<-\EOF &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: greeting
+       Node-kind: file
+       Node-action: add
+       Prop-content-length: 10
+       Text-content-length: 11
+       Content-length: 21
+
+       PROPS-END
+       link hello
+
+       Revision-number: 2
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: greeting
+       Node-kind: file
+       Node-action: change
+       Prop-content-length: 33
+       Content-length: 33
+
+       K 11
+       svn:special
+       V 1
+       *
+       PROPS-END
+
+       Revision-number: 3
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: greeting
+       Node-kind: file
+       Node-action: change
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+       EOF
+       test-svn-fe filemode.dump >stream &&
+       git fast-import <stream &&
+       {
+               git rev-list HEAD |
+               git diff-tree --root --stdin |
+               sed "s/$_x40/OBJID/g"
+       } >actual &&
+       git show HEAD:greeting >actual.blob &&
+       git show HEAD^:greeting >actual.target &&
+       test_cmp expect actual &&
+       test_cmp expect.blob actual.blob &&
+       test_cmp hello actual.target
+'
+
+test_expect_success 'NUL in property value' '
+       reinit_git &&
+       echo "commit message" >expect.message &&
+       {
+               properties \
+                       unimportant "something with a NUL (Q)" \
+                       svn:log "commit message"&&
+               echo PROPS-END
+       } |
+       q_to_nul >props &&
+       {
+               cat <<-\EOF &&
+               SVN-fs-dump-format-version: 3
+
+               Revision-number: 1
+               EOF
+               echo Prop-content-length: $(wc -c <props) &&
+               echo Content-length: $(wc -c <props) &&
+               echo &&
+               cat props
+       } >nulprop.dump &&
+       test-svn-fe nulprop.dump >stream &&
+       git fast-import <stream &&
+       git diff-tree --always -s --format=%s HEAD >actual.message &&
+       test_cmp expect.message actual.message
+'
+
+test_expect_success 'NUL in log message, file content, and property name' '
+       # Caveat: svnadmin 1.6.16 (r1073529) truncates at \0 in the
+       # svn:specialQnotreally example.
+       reinit_git &&
+       cat >expect <<-\EOF &&
+       OBJID
+       :100644 100644 OBJID OBJID M    greeting
+       OBJID
+       :000000 100644 OBJID OBJID A    greeting
+       EOF
+       printf "\n%s\n" "something with an ASCII NUL (Q)" >expect.message &&
+       printf "%s\n" "helQo" >expect.hello1 &&
+       printf "%s\n" "link hello" >expect.hello2 &&
+       {
+               properties svn:log "something with an ASCII NUL (Q)" &&
+               echo PROPS-END
+       } |
+       q_to_nul >props &&
+       {
+               q_to_nul <<-\EOF &&
+               SVN-fs-dump-format-version: 3
+
+               Revision-number: 1
+               Prop-content-length: 10
+               Content-length: 10
+
+               PROPS-END
+
+               Node-path: greeting
+               Node-kind: file
+               Node-action: add
+               Prop-content-length: 10
+               Text-content-length: 6
+               Content-length: 16
+
+               PROPS-END
+               helQo
+
+               Revision-number: 2
+               EOF
+               echo Prop-content-length: $(wc -c <props) &&
+               echo Content-length: $(wc -c <props) &&
+               echo &&
+               cat props &&
+               q_to_nul <<-\EOF
+
+               Node-path: greeting
+               Node-kind: file
+               Node-action: change
+               Prop-content-length: 43
+               Text-content-length: 11
+               Content-length: 54
+
+               K 21
+               svn:specialQnotreally
+               V 1
+               *
+               PROPS-END
+               link hello
+               EOF
+       } >8bitclean.dump &&
+       test-svn-fe 8bitclean.dump >stream &&
+       git fast-import <stream &&
+       {
+               git rev-list HEAD |
+               git diff-tree --root --stdin |
+               sed "s/$_x40/OBJID/g"
+       } >actual &&
+       {
+               git cat-file commit HEAD | nul_to_q &&
+               echo
+       } |
+       sed -ne "/^\$/,\$ p" >actual.message &&
+       git cat-file blob HEAD^:greeting | nul_to_q >actual.hello1 &&
+       git cat-file blob HEAD:greeting | nul_to_q >actual.hello2 &&
+       test_cmp expect actual &&
+       test_cmp expect.message actual.message &&
+       test_cmp expect.hello1 actual.hello1 &&
+       test_cmp expect.hello2 actual.hello2
+'
+
+test_expect_success 'change file mode and reiterate content' '
+       reinit_git &&
+       cat >expect <<-\EOF &&
+       OBJID
+       :120000 100644 OBJID OBJID T    greeting
+       OBJID
+       :100644 120000 OBJID OBJID T    greeting
+       OBJID
+       :000000 100644 OBJID OBJID A    greeting
+       EOF
+       echo "link hello" >expect.blob &&
+       echo hello >hello &&
+       cat >filemode.dump <<-\EOF &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: greeting
+       Node-kind: file
+       Node-action: add
+       Prop-content-length: 10
+       Text-content-length: 11
+       Content-length: 21
+
+       PROPS-END
+       link hello
+
+       Revision-number: 2
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: greeting
+       Node-kind: file
+       Node-action: change
+       Prop-content-length: 33
+       Text-content-length: 11
+       Content-length: 44
+
+       K 11
+       svn:special
+       V 1
+       *
+       PROPS-END
+       link hello
+
+       Revision-number: 3
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: greeting
+       Node-kind: file
+       Node-action: change
+       Prop-content-length: 10
+       Text-content-length: 11
+       Content-length: 21
+
+       PROPS-END
+       link hello
+       EOF
+       test-svn-fe filemode.dump >stream &&
+       git fast-import <stream &&
+       {
+               git rev-list HEAD |
+               git diff-tree --root --stdin |
+               sed "s/$_x40/OBJID/g"
+       } >actual &&
+       git show HEAD:greeting >actual.blob &&
+       git show HEAD^:greeting >actual.target &&
+       test_cmp expect actual &&
+       test_cmp expect.blob actual.blob &&
+       test_cmp hello actual.target
+'
+
+test_expect_success 'deltas not supported' '
+       {
+               # (old) h + (inline) ello + (old) \n
+               printf "SVNQ%b%b%s" "Q\003\006\005\004" "\001Q\0204\001\002" "ello" |
+               q_to_nul
+       } >delta &&
+       {
+               properties \
+                       svn:author author@example.com \
+                       svn:date "1999-01-05T00:01:002.000000Z" \
+                       svn:log "add greeting" &&
+               echo PROPS-END
+       } >props &&
+       {
+               properties \
+                       svn:author author@example.com \
+                       svn:date "1999-01-06T00:01:002.000000Z" \
+                       svn:log "change it" &&
+               echo PROPS-END
+       } >props2 &&
+       {
+               echo SVN-fs-dump-format-version: 3 &&
+               echo &&
+               echo Revision-number: 1 &&
+               echo Prop-content-length: $(wc -c <props) &&
+               echo Content-length: $(wc -c <props) &&
+               echo &&
+               cat props &&
+               cat <<-\EOF &&
+
+               Node-path: hello
+               Node-kind: file
+               Node-action: add
+               Prop-content-length: 10
+               Text-content-length: 3
+               Content-length: 13
+
+               PROPS-END
+               hi
+
+               EOF
+               echo Revision-number: 2 &&
+               echo Prop-content-length: $(wc -c <props2) &&
+               echo Content-length: $(wc -c <props2) &&
+               echo &&
+               cat props2 &&
+               cat <<-\EOF &&
+
+               Node-path: hello
+               Node-kind: file
+               Node-action: change
+               Text-delta: true
+               Prop-content-length: 10
+               EOF
+               echo Text-content-length: $(wc -c <delta) &&
+               echo Content-length: $((10 + $(wc -c <delta))) &&
+               echo &&
+               echo PROPS-END &&
+               cat delta
+       } >delta.dump &&
+       test_must_fail test-svn-fe delta.dump
+'
+
+test_expect_success 'property deltas supported' '
+       reinit_git &&
+       cat >expect <<-\EOF &&
+       OBJID
+       :100755 100644 OBJID OBJID M    script.sh
+       EOF
+       {
+               properties \
+                       svn:author author@example.com \
+                       svn:date "1999-03-06T00:01:002.000000Z" \
+                       svn:log "make an executable, or chmod -x it" &&
+               echo PROPS-END
+       } >revprops &&
+       {
+               echo SVN-fs-dump-format-version: 3 &&
+               echo &&
+               echo Revision-number: 1 &&
+               echo Prop-content-length: $(wc -c <revprops) &&
+               echo Content-length: $(wc -c <revprops) &&
+               echo &&
+               cat revprops &&
+               echo &&
+               cat <<-\EOF &&
+               Node-path: script.sh
+               Node-kind: file
+               Node-action: add
+               Text-content-length: 0
+               Prop-content-length: 39
+               Content-length: 39
+
+               K 14
+               svn:executable
+               V 4
+               true
+               PROPS-END
+
+               EOF
+               echo Revision-number: 2 &&
+               echo Prop-content-length: $(wc -c <revprops) &&
+               echo Content-length: $(wc -c <revprops) &&
+               echo &&
+               cat revprops &&
+               echo &&
+               cat <<-\EOF
+               Node-path: script.sh
+               Node-kind: file
+               Node-action: change
+               Prop-delta: true
+               Prop-content-length: 30
+               Content-length: 30
+
+               D 14
+               svn:executable
+               PROPS-END
+               EOF
+       } >propdelta.dump &&
+       test-svn-fe propdelta.dump >stream &&
+       git fast-import <stream &&
+       {
+               git rev-list HEAD |
+               git diff-tree --stdin |
+               sed "s/$_x40/OBJID/g"
+       } >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'properties on /' '
+       reinit_git &&
+       cat <<-\EOF >expect &&
+       OBJID
+       OBJID
+       :000000 100644 OBJID OBJID A    greeting
+       EOF
+       sed -e "s/X$//" <<-\EOF >changeroot.dump &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: greeting
+       Node-kind: file
+       Node-action: add
+       Text-content-length: 0
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Revision-number: 2
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: X
+       Node-kind: dir
+       Node-action: change
+       Prop-delta: true
+       Prop-content-length: 43
+       Content-length: 43
+
+       K 10
+       svn:ignore
+       V 11
+       build-area
+
+       PROPS-END
+       EOF
+       test-svn-fe changeroot.dump >stream &&
+       git fast-import <stream &&
+       {
+               git rev-list HEAD |
+               git diff-tree --root --always --stdin |
+               sed "s/$_x40/OBJID/g"
+       } >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'deltas for typechange' '
+       reinit_git &&
+       cat >expect <<-\EOF &&
+       OBJID
+       :120000 100644 OBJID OBJID T    test-file
+       OBJID
+       :100755 120000 OBJID OBJID T    test-file
+       OBJID
+       :000000 100755 OBJID OBJID A    test-file
+       EOF
+       cat >deleteprop.dump <<-\EOF &&
+       SVN-fs-dump-format-version: 3
+
+       Revision-number: 1
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: test-file
+       Node-kind: file
+       Node-action: add
+       Prop-delta: true
+       Prop-content-length: 35
+       Text-content-length: 17
+       Content-length: 52
+
+       K 14
+       svn:executable
+       V 0
+
+       PROPS-END
+       link testing 123
+
+       Revision-number: 2
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: test-file
+       Node-kind: file
+       Node-action: change
+       Prop-delta: true
+       Prop-content-length: 53
+       Text-content-length: 17
+       Content-length: 70
+
+       K 11
+       svn:special
+       V 1
+       *
+       D 14
+       svn:executable
+       PROPS-END
+       link testing 231
+
+       Revision-number: 3
+       Prop-content-length: 10
+       Content-length: 10
+
+       PROPS-END
+
+       Node-path: test-file
+       Node-kind: file
+       Node-action: change
+       Prop-delta: true
+       Prop-content-length: 27
+       Text-content-length: 17
+       Content-length: 44
+
+       D 11
+       svn:special
+       PROPS-END
+       link testing 321
+       EOF
+       test-svn-fe deleteprop.dump >stream &&
+       git fast-import <stream &&
+       {
+               git rev-list HEAD |
+               git diff-tree --root --stdin |
+               sed "s/$_x40/OBJID/g"
+       } >actual &&
+       test_cmp expect actual
+'
+
+
 test_expect_success 'set up svn repo' '
        svnconf=$PWD/svnconf &&
        mkdir -p "$svnconf" &&
index ec0a10661409d24c77bf2061bd8a554bfb565d74..b324c491c52eb0fa39d713cc5f227d134c1adb01 100755 (executable)
@@ -96,7 +96,6 @@ test_expect_success 'fresh clone with svn.authors-file in config' '
                rm -r "$GIT_DIR" &&
                test x = x"$(git config svn.authorsfile)" &&
                test_config="$HOME"/.gitconfig &&
-               unset GIT_CONFIG_NOGLOBAL &&
                unset GIT_DIR &&
                unset GIT_CONFIG &&
                git config --global \
index 986bc14d58c30201e75f3d95d9b8245e997b99e9..6b1ba6c858562b7c085951fb1d69d4d2371e866c 100755 (executable)
@@ -42,6 +42,14 @@ echo "$@"'
 
 >empty
 
+test_expect_success 'setup: have pipes?' '
+       rm -f frob &&
+       if mkfifo frob
+       then
+               test_set_prereq PIPE
+       fi
+'
+
 ###
 ### series A
 ###
@@ -898,6 +906,77 @@ test_expect_success \
         git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
         compare_diff_raw expect actual'
 
+test_expect_success PIPE 'N: read and copy directory' '
+       cat >expect <<-\EOF
+       :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100   file2/newf      file3/newf
+       :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100   file2/oldf      file3/oldf
+       EOF
+       git update-ref -d refs/heads/N4 &&
+       rm -f backflow &&
+       mkfifo backflow &&
+       (
+               exec <backflow &&
+               cat <<-EOF &&
+               commit refs/heads/N4
+               committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+               data <<COMMIT
+               copy by tree hash, part 2
+               COMMIT
+
+               from refs/heads/branch^0
+               ls "file2"
+               EOF
+               read mode type tree filename &&
+               echo "M 040000 $tree file3"
+       ) |
+       git fast-import --cat-blob-fd=3 3>backflow &&
+       git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
+       compare_diff_raw expect actual
+'
+
+test_expect_success PIPE 'N: empty directory reads as missing' '
+       cat <<-\EOF >expect &&
+       OBJNAME
+       :000000 100644 OBJNAME OBJNAME A        unrelated
+       EOF
+       echo "missing src" >expect.response &&
+       git update-ref -d refs/heads/read-empty &&
+       rm -f backflow &&
+       mkfifo backflow &&
+       (
+               exec <backflow &&
+               cat <<-EOF &&
+               commit refs/heads/read-empty
+               committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+               data <<COMMIT
+               read "empty" (missing) directory
+               COMMIT
+
+               M 100644 inline src/greeting
+               data <<BLOB
+               hello
+               BLOB
+               C src/greeting dst1/non-greeting
+               C src/greeting unrelated
+               # leave behind "empty" src directory
+               D src/greeting
+               ls "src"
+               EOF
+               read -r line &&
+               printf "%s\n" "$line" >response &&
+               cat <<-\EOF
+               D dst1
+               D dst2
+               EOF
+       ) |
+       git fast-import --cat-blob-fd=3 3>backflow &&
+       test_cmp expect.response response &&
+       git rev-list read-empty |
+       git diff-tree -r --root --stdin |
+       sed "s/$_x40/OBJNAME/g" >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success \
        'N: copy root directory by tree hash' \
        'cat >expect <<-\EOF &&
@@ -1748,6 +1827,61 @@ test_expect_success \
     'cat input | git fast-import --export-marks=other.marks &&
     grep :1 other.marks'
 
+test_expect_success 'R: catch typo in marks file name' '
+       test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
+       echo "feature import-marks=nonexistent.marks" |
+       test_must_fail git fast-import
+'
+
+test_expect_success 'R: import and output marks can be the same file' '
+       rm -f io.marks &&
+       blob=$(echo hi | git hash-object --stdin) &&
+       cat >expect <<-EOF &&
+       :1 $blob
+       :2 $blob
+       EOF
+       git fast-import --export-marks=io.marks <<-\EOF &&
+       blob
+       mark :1
+       data 3
+       hi
+
+       EOF
+       git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF &&
+       blob
+       mark :2
+       data 3
+       hi
+
+       EOF
+       test_cmp expect io.marks
+'
+
+test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '
+       rm -f io.marks &&
+       test_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF
+       blob
+       mark :1
+       data 3
+       hi
+
+       EOF
+'
+
+test_expect_success 'R: --import-marks-if-exists' '
+       rm -f io.marks &&
+       blob=$(echo hi | git hash-object --stdin) &&
+       echo ":1 $blob" >expect &&
+       git fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\EOF &&
+       blob
+       mark :1
+       data 3
+       hi
+
+       EOF
+       test_cmp expect io.marks
+'
+
 cat >input << EOF
 feature import-marks=marks.out
 feature export-marks=marks.new
@@ -1806,6 +1940,11 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '
     test_cmp marks.new non-relative.out
 '
 
+test_expect_success 'R: feature ls supported' '
+       echo "feature ls" |
+       git fast-import
+'
+
 test_expect_success 'R: feature cat-blob supported' '
        echo "feature cat-blob" |
        git fast-import
@@ -1931,14 +2070,6 @@ test_expect_success 'R: print two blobs to stdout' '
        test_cmp expect actual
 '
 
-test_expect_success 'setup: have pipes?' '
-       rm -f frob &&
-       if mkfifo frob
-       then
-               test_set_prereq PIPE
-       fi
-'
-
 test_expect_success PIPE 'R: copy using cat-file' '
        expect_id=$(git hash-object big) &&
        expect_len=$(wc -c <big) &&
index 35c151d7ead1181eb36c5a29c0bcc7aac4ec5c12..afac5b56a87f3dcc6467b8ad260e1b59d041eb03 100755 (executable)
@@ -446,6 +446,8 @@ test_expect_success \
 test_expect_success \
        'encode(commit): utf8' \
        '. "$TEST_DIRECTORY"/t3901-utf8.txt &&
+        test_when_finished "GIT_AUTHOR_NAME=\"A U Thor\"" &&
+        test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" &&
         echo "UTF-8" >> file &&
         git add file &&
         git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt &&
@@ -454,11 +456,13 @@ test_expect_success \
 test_expect_success \
        'encode(commit): iso-8859-1' \
        '. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
+        test_when_finished "GIT_AUTHOR_NAME=\"A U Thor\"" &&
+        test_when_finished "GIT_COMMITTER_NAME=\"C O Mitter\"" &&
         echo "ISO-8859-1" >> file &&
         git add file &&
         git config i18n.commitencoding ISO-8859-1 &&
+        test_when_finished "git config --unset i18n.commitencoding" &&
         git commit -F "$TEST_DIRECTORY"/t3900/ISO8859-1.txt &&
-        git config --unset i18n.commitencoding &&
         gitweb_run "p=.git;a=commit"'
 
 test_expect_success \
diff --git a/t/t9800-git-p4.sh b/t/t9800-git-p4.sh
new file mode 100755 (executable)
index 0000000..a523473
--- /dev/null
@@ -0,0 +1,139 @@
+#!/bin/sh
+
+test_description='git-p4 tests'
+
+. ./test-lib.sh
+
+( p4 -h && p4d -h ) >/dev/null 2>&1 || {
+       skip_all='skipping git-p4 tests; no p4 or p4d'
+       test_done
+}
+
+GITP4=$GIT_BUILD_DIR/contrib/fast-import/git-p4
+P4DPORT=10669
+
+db="$TRASH_DIRECTORY/db"
+cli="$TRASH_DIRECTORY/cli"
+git="$TRASH_DIRECTORY/git"
+
+test_debug 'echo p4d -q -d -r "$db" -p $P4DPORT'
+test_expect_success setup '
+       mkdir -p "$db" &&
+       p4d -q -d -r "$db" -p $P4DPORT &&
+       mkdir -p "$cli" &&
+       mkdir -p "$git" &&
+       export P4PORT=localhost:$P4DPORT
+'
+
+test_expect_success 'add p4 files' '
+       cd "$cli" &&
+       p4 client -i <<-EOF &&
+       Client: client
+       Description: client
+       Root: $cli
+       View: //depot/... //client/...
+       EOF
+       export P4CLIENT=client &&
+       echo file1 >file1 &&
+       p4 add file1 &&
+       p4 submit -d "file1" &&
+       echo file2 >file2 &&
+       p4 add file2 &&
+       p4 submit -d "file2" &&
+       cd "$TRASH_DIRECTORY"
+'
+
+test_expect_success 'basic git-p4 clone' '
+       "$GITP4" clone --dest="$git" //depot &&
+       cd "$git" &&
+       git log --oneline >lines &&
+       test_line_count = 1 lines &&
+       cd .. &&
+       rm -rf "$git" && mkdir "$git"
+'
+
+test_expect_success 'git-p4 clone @all' '
+       "$GITP4" clone --dest="$git" //depot@all &&
+       cd "$git" &&
+       git log --oneline >lines &&
+       test_line_count = 2 lines &&
+       cd .. &&
+       rm -rf "$git" && mkdir "$git"
+'
+
+test_expect_success 'git-p4 sync uninitialized repo' '
+       test_create_repo "$git" &&
+       cd "$git" &&
+       test_must_fail "$GITP4" sync &&
+       rm -rf "$git" && mkdir "$git"
+'
+
+#
+# Create a git repo by hand.  Add a commit so that HEAD is valid.
+# Test imports a new p4 repository into a new git branch.
+#
+test_expect_success 'git-p4 sync new branch' '
+       test_create_repo "$git" &&
+       cd "$git" &&
+       test_commit head &&
+       "$GITP4" sync --branch=refs/remotes/p4/depot //depot@all &&
+       git log --oneline p4/depot >lines &&
+       cat lines &&
+       test_line_count = 2 lines &&
+       cd .. &&
+       rm -rf "$git" && mkdir "$git"
+'
+
+test_expect_success 'exit when p4 fails to produce marshaled output' '
+       badp4dir="$TRASH_DIRECTORY/badp4dir" &&
+       mkdir -p "$badp4dir" &&
+       cat >"$badp4dir"/p4 <<-EOF &&
+       #!$SHELL_PATH
+       exit 1
+       EOF
+       chmod 755 "$badp4dir"/p4 &&
+       PATH="$badp4dir:$PATH" "$GITP4" clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
+       test $retval -eq 1 &&
+       test_must_fail grep -q Traceback errs
+'
+
+test_expect_success 'add p4 files with wildcards in the names' '
+       cd "$cli" &&
+       echo file-wild-hash >file-wild#hash &&
+       echo file-wild-star >file-wild\*star &&
+       echo file-wild-at >file-wild@at &&
+       echo file-wild-percent >file-wild%percent &&
+       p4 add -f file-wild* &&
+       p4 submit -d "file wildcards" &&
+       cd "$TRASH_DIRECTORY"
+'
+
+test_expect_success 'wildcard files git-p4 clone' '
+       "$GITP4" clone --dest="$git" //depot &&
+       cd "$git" &&
+       test -f file-wild#hash &&
+       test -f file-wild\*star &&
+       test -f file-wild@at &&
+       test -f file-wild%percent &&
+       cd "$TRASH_DIRECTORY" &&
+       rm -rf "$git" && mkdir "$git"
+'
+
+test_expect_success 'clone bare' '
+       "$GITP4" clone --dest="$git" --bare //depot &&
+       cd "$git" &&
+       test ! -d .git &&
+       bare=`git config --get core.bare` &&
+       test "$bare" = true &&
+       cd "$TRASH_DIRECTORY" &&
+       rm -rf "$git" && mkdir "$git"
+'
+
+test_expect_success 'shutdown' '
+       pid=`pgrep -f p4d` &&
+       test -n "$pid" &&
+       test_debug "ps wl `echo $pid`" &&
+       kill $pid
+'
+
+test_done
index c91e2324371edee46ebe3a49b540915e96469387..abc47f3abc5d925ed217d0d95f10bf078bc26034 100644 (file)
@@ -43,36 +43,25 @@ TERM=dumb
 export LANG LC_ALL PAGER TERM TZ
 EDITOR=:
 unset VISUAL
-unset GIT_EDITOR
-unset AUTHOR_DATE
-unset AUTHOR_EMAIL
-unset AUTHOR_NAME
-unset COMMIT_AUTHOR_EMAIL
-unset COMMIT_AUTHOR_NAME
 unset EMAIL
-unset GIT_ALTERNATE_OBJECT_DIRECTORIES
-unset GIT_AUTHOR_DATE
+unset $(perl -e '
+       my @env = keys %ENV;
+       my $ok = join("|", qw(
+               TRACE
+               DEBUG
+               USE_LOOKUP
+               TEST
+               .*_TEST
+               PROVE
+               VALGRIND
+       ));
+       my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
+       print join("\n", @vars);
+')
 GIT_AUTHOR_EMAIL=author@example.com
 GIT_AUTHOR_NAME='A U Thor'
-unset GIT_COMMITTER_DATE
 GIT_COMMITTER_EMAIL=committer@example.com
 GIT_COMMITTER_NAME='C O Mitter'
-unset GIT_DIFF_OPTS
-unset GIT_DIR
-unset GIT_WORK_TREE
-unset GIT_EXTERNAL_DIFF
-unset GIT_INDEX_FILE
-unset GIT_OBJECT_DIRECTORY
-unset GIT_CEILING_DIRECTORIES
-unset SHA1_FILE_DIRECTORIES
-unset SHA1_FILE_DIRECTORY
-unset GIT_NOTES_REF
-unset GIT_NOTES_DISPLAY_REF
-unset GIT_NOTES_REWRITE_REF
-unset GIT_NOTES_REWRITE_MODE
-unset GIT_REFLOG_ACTION
-unset GIT_CHERRY_PICK_HELP
-unset GIT_QUIET
 GIT_MERGE_VERBOSITY=5
 export GIT_MERGE_VERBOSITY
 export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
@@ -954,8 +943,8 @@ fi
 GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
 unset GIT_CONFIG
 GIT_CONFIG_NOSYSTEM=1
-GIT_CONFIG_NOGLOBAL=1
-export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL
+GIT_ATTR_NOSYSTEM=1
+export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM
 
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 
@@ -1079,6 +1068,15 @@ esac
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
 
+# Can we rely on git's output in the C locale?
+if test -n "$GETTEXT_POISON"
+then
+       GIT_GETTEXT_POISON=YesPlease
+       export GIT_GETTEXT_POISON
+else
+       test_set_prereq C_LOCALE_OUTPUT
+fi
+
 # test whether the filesystem supports symbolic links
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
 rm -f y
index c11bf7f96708c90c992423fc27b2eba73d0c34a0..7ec9b13c9b2ceb84fb6dd0dd229e9f6cb8c1a635 100644 (file)
@@ -1,14 +1,9 @@
 /*
  * test-line-buffer.c: code to exercise the svn importer's input helper
- *
- * Input format:
- *     number NL
- *     (number bytes) NL
- *     number NL
- *     ...
  */
 
 #include "git-compat-util.h"
+#include "strbuf.h"
 #include "vcs-svn/line_buffer.h"
 
 static uint32_t strtouint32(const char *s)
@@ -20,27 +15,78 @@ static uint32_t strtouint32(const char *s)
        return (uint32_t) n;
 }
 
+static void handle_command(const char *command, const char *arg, struct line_buffer *buf)
+{
+       switch (*command) {
+       case 'b':
+               if (!prefixcmp(command, "binary ")) {
+                       struct strbuf sb = STRBUF_INIT;
+                       strbuf_addch(&sb, '>');
+                       buffer_read_binary(buf, &sb, strtouint32(arg));
+                       fwrite(sb.buf, 1, sb.len, stdout);
+                       strbuf_release(&sb);
+                       return;
+               }
+       case 'c':
+               if (!prefixcmp(command, "copy ")) {
+                       buffer_copy_bytes(buf, strtouint32(arg));
+                       return;
+               }
+       case 's':
+               if (!prefixcmp(command, "skip ")) {
+                       buffer_skip_bytes(buf, strtouint32(arg));
+                       return;
+               }
+       default:
+               die("unrecognized command: %s", command);
+       }
+}
+
+static void handle_line(const char *line, struct line_buffer *stdin_buf)
+{
+       const char *arg = strchr(line, ' ');
+       if (!arg)
+               die("no argument in line: %s", line);
+       handle_command(line, arg + 1, stdin_buf);
+}
+
 int main(int argc, char *argv[])
 {
+       struct line_buffer stdin_buf = LINE_BUFFER_INIT;
+       struct line_buffer file_buf = LINE_BUFFER_INIT;
+       struct line_buffer *input = &stdin_buf;
+       const char *filename;
        char *s;
 
-       if (argc != 1)
-               usage("test-line-buffer < input.txt");
-       if (buffer_init(NULL))
+       if (argc == 1)
+               filename = NULL;
+       else if (argc == 2)
+               filename = argv[1];
+       else
+               usage("test-line-buffer [file | &fd] < script");
+
+       if (buffer_init(&stdin_buf, NULL))
                die_errno("open error");
-       while ((s = buffer_read_line())) {
-               s = buffer_read_string(strtouint32(s));
-               fputs(s, stdout);
-               fputc('\n', stdout);
-               buffer_skip_bytes(1);
-               if (!(s = buffer_read_line()))
-                       break;
-               buffer_copy_bytes(strtouint32(s) + 1);
+       if (filename) {
+               if (*filename == '&') {
+                       if (buffer_fdinit(&file_buf, strtouint32(filename + 1)))
+                               die_errno("error opening fd %s", filename + 1);
+               } else {
+                       if (buffer_init(&file_buf, filename))
+                               die_errno("error opening %s", filename);
+               }
+               input = &file_buf;
        }
-       if (buffer_deinit())
+
+       while ((s = buffer_read_line(&stdin_buf)))
+               handle_line(s, input);
+
+       if (filename && buffer_deinit(&file_buf))
+               die("error reading from %s", filename);
+       if (buffer_deinit(&stdin_buf))
                die("input error");
        if (ferror(stdout))
                die("output error");
-       buffer_reset();
+       buffer_reset(&stdin_buf);
        return 0;
 }
index d261398d6c50aeefa7450b99caae23ee5cdff0d0..e7671593df6bf014f3a9d8bd5173d1edcfd6545b 100644 (file)
@@ -11,9 +11,9 @@ int main(int argc, char **argv)
                return 0;
        }
 
-       if (argc >= 2 && !strcmp(argv[1], "make_absolute_path")) {
+       if (argc >= 2 && !strcmp(argv[1], "real_path")) {
                while (argc > 2) {
-                       puts(make_absolute_path(argv[2]));
+                       puts(real_path(argv[2]));
                        argc--;
                        argv++;
                }
index 667d3e5079bf06d540b214cd6f8e67922f141a02..8926bc52a9a6e2a16924664372a8af3ee2ed3136 100644 (file)
@@ -3,11 +3,10 @@
 
 int main(int argc, char **argv)
 {
-       const char *prefix;
        struct child_process cp;
        int nogit = 0;
 
-       prefix = setup_git_directory_gently(&nogit);
+       setup_git_directory_gently(&nogit);
        if (nogit)
                die("No git repo found");
        if (!strcmp(argv[1], "--setup-work-tree")) {
index 77cf78abcfd18532b1b75e5ad5efa21b27f1a28c..b42ba789b176160285844e49cb834d60170d9a54 100644 (file)
@@ -9,7 +9,8 @@ int main(int argc, char *argv[])
 {
        if (argc != 2)
                usage("test-svn-fe <file>");
-       svndump_init(argv[1]);
+       if (svndump_init(argv[1]))
+               return 1;
        svndump_read(NULL);
        svndump_deinit();
        svndump_reset();
index 589f838f82b568195232ea81346d0049261b86b1..7f4b76a95899cc28aa1d42598d1649f126980ed9 100644 (file)
@@ -1,5 +1,5 @@
 #include "cache.h"
-#include <pthread.h>
+#include "thread-utils.h"
 
 #if defined(hpux) || defined(__hpux) || defined(_hpux)
 #  include <sys/pstat.h>
diff --git a/trace.c b/trace.c
index 35d388dce44a4a8e3d6053dfd6abcb652771818a..d95341693fa9b27caed38ffe1308838bedb49f83 100644 (file)
--- a/trace.c
+++ b/trace.c
 #include "cache.h"
 #include "quote.h"
 
-/* Get a trace file descriptor from GIT_TRACE env variable. */
-static int get_trace_fd(int *need_close)
+/* Get a trace file descriptor from "key" env variable. */
+static int get_trace_fd(const char *key, int *need_close)
 {
-       char *trace = getenv("GIT_TRACE");
+       char *trace = getenv(key);
 
        if (!trace || !strcmp(trace, "") ||
            !strcmp(trace, "0") || !strcasecmp(trace, "false"))
@@ -50,10 +50,10 @@ static int get_trace_fd(int *need_close)
                return fd;
        }
 
-       fprintf(stderr, "What does '%s' for GIT_TRACE mean?\n", trace);
+       fprintf(stderr, "What does '%s' for %s mean?\n", trace, key);
        fprintf(stderr, "If you want to trace into a file, "
-               "then please set GIT_TRACE to an absolute pathname "
-               "(starting with /).\n");
+               "then please set %s to an absolute pathname "
+               "(starting with /).\n", key);
        fprintf(stderr, "Defaulting to tracing on stderr...\n");
 
        return STDERR_FILENO;
@@ -62,33 +62,44 @@ static int get_trace_fd(int *need_close)
 static const char err_msg[] = "Could not trace into fd given by "
        "GIT_TRACE environment variable";
 
-void trace_printf(const char *fmt, ...)
+void trace_vprintf(const char *key, const char *fmt, va_list ap)
 {
-       struct strbuf buf;
-       va_list ap;
-       int fd, len, need_close = 0;
+       struct strbuf buf = STRBUF_INIT;
 
-       fd = get_trace_fd(&need_close);
-       if (!fd)
+       if (!trace_want(key))
                return;
 
        set_try_to_free_routine(NULL);  /* is never reset */
-       strbuf_init(&buf, 64);
+       strbuf_vaddf(&buf, fmt, ap);
+       trace_strbuf(key, &buf);
+       strbuf_release(&buf);
+}
+
+static void trace_printf_key(const char *key, const char *fmt, ...)
+{
+       va_list ap;
        va_start(ap, fmt);
-       len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
+       trace_vprintf(key, fmt, ap);
        va_end(ap);
-       if (len >= strbuf_avail(&buf)) {
-               strbuf_grow(&buf, len - strbuf_avail(&buf) + 128);
-               va_start(ap, fmt);
-               len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
-               va_end(ap);
-               if (len >= strbuf_avail(&buf))
-                       die("broken vsnprintf");
-       }
-       strbuf_setlen(&buf, len);
+}
 
-       write_or_whine_pipe(fd, buf.buf, buf.len, err_msg);
-       strbuf_release(&buf);
+void trace_printf(const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       trace_vprintf("GIT_TRACE", fmt, ap);
+       va_end(ap);
+}
+
+void trace_strbuf(const char *key, const struct strbuf *buf)
+{
+       int fd, need_close = 0;
+
+       fd = get_trace_fd(key, &need_close);
+       if (!fd)
+               return;
+
+       write_or_whine_pipe(fd, buf->buf, buf->len, err_msg);
 
        if (need_close)
                close(fd);
@@ -96,28 +107,18 @@ void trace_printf(const char *fmt, ...)
 
 void trace_argv_printf(const char **argv, const char *fmt, ...)
 {
-       struct strbuf buf;
+       struct strbuf buf = STRBUF_INIT;
        va_list ap;
-       int fd, len, need_close = 0;
+       int fd, need_close = 0;
 
-       fd = get_trace_fd(&need_close);
+       fd = get_trace_fd("GIT_TRACE", &need_close);
        if (!fd)
                return;
 
        set_try_to_free_routine(NULL);  /* is never reset */
-       strbuf_init(&buf, 64);
        va_start(ap, fmt);
-       len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
+       strbuf_vaddf(&buf, fmt, ap);
        va_end(ap);
-       if (len >= strbuf_avail(&buf)) {
-               strbuf_grow(&buf, len - strbuf_avail(&buf) + 128);
-               va_start(ap, fmt);
-               len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
-               va_end(ap);
-               if (len >= strbuf_avail(&buf))
-                       die("broken vsnprintf");
-       }
-       strbuf_setlen(&buf, len);
 
        sq_quote_argv(&buf, argv, 0);
        strbuf_addch(&buf, '\n');
@@ -154,12 +155,11 @@ static const char *quote_crnl(const char *path)
 /* FIXME: move prefix to startup_info struct and get rid of this arg */
 void trace_repo_setup(const char *prefix)
 {
+       static const char *key = "GIT_TRACE_SETUP";
        const char *git_work_tree;
        char cwd[PATH_MAX];
-       char *trace = getenv("GIT_TRACE");
 
-       if (!trace || !strcmp(trace, "") ||
-           !strcmp(trace, "0") || !strcasecmp(trace, "false"))
+       if (!trace_want(key))
                return;
 
        if (!getcwd(cwd, PATH_MAX))
@@ -171,8 +171,18 @@ void trace_repo_setup(const char *prefix)
        if (!prefix)
                prefix = "(null)";
 
-       trace_printf("setup: git_dir: %s\n", quote_crnl(get_git_dir()));
-       trace_printf("setup: worktree: %s\n", quote_crnl(git_work_tree));
-       trace_printf("setup: cwd: %s\n", quote_crnl(cwd));
-       trace_printf("setup: prefix: %s\n", quote_crnl(prefix));
+       trace_printf_key(key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
+       trace_printf_key(key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
+       trace_printf_key(key, "setup: cwd: %s\n", quote_crnl(cwd));
+       trace_printf_key(key, "setup: prefix: %s\n", quote_crnl(prefix));
+}
+
+int trace_want(const char *key)
+{
+       const char *trace = getenv(key);
+
+       if (!trace || !strcmp(trace, "") ||
+           !strcmp(trace, "0") || !strcasecmp(trace, "false"))
+               return 0;
+       return 1;
 }
index 8866adf08898f5855dd1dea1db4286021ffb880c..660147f9e96be7b69379a9040c4220c141c7be4c 100644 (file)
@@ -76,7 +76,7 @@ static void write_constant(int fd, const char *str)
                die_errno("Full write to remote helper failed");
 }
 
-const char *remove_ext_force(const char *url)
+static const char *remove_ext_force(const char *url)
 {
        if (url) {
                const char *colon = strchr(url, ':');
@@ -561,10 +561,9 @@ static int push_refs_with_push(struct transport *transport,
        int mirror = flags & TRANSPORT_PUSH_MIRROR;
        struct helper_data *data = transport->data;
        struct strbuf buf = STRBUF_INIT;
-       struct child_process *helper;
        struct ref *ref;
 
-       helper = get_helper(transport);
+       get_helper(transport);
        if (!data->push)
                return 1;
 
@@ -972,7 +971,7 @@ static int udt_do_read(struct unidirectional_transfer *t)
  */
 static int udt_do_write(struct unidirectional_transfer *t)
 {
-       size_t bytes;
+       ssize_t bytes;
 
        if (t->bufuse == 0)
                return 0;       /* Nothing to write. */
index 00786606117feea4b33b7e632b8ff8a3c26de4e4..a02f79aae3d91ea4109d21a9ed9ca2d962125375 100644 (file)
@@ -192,7 +192,7 @@ static const char *rsync_url(const char *url)
 static struct ref *get_refs_via_rsync(struct transport *transport, int for_push)
 {
        struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;
-       struct ref dummy = {0}, *tail = &dummy;
+       struct ref dummy = {NULL}, *tail = &dummy;
        struct child_process rsync;
        const char *args[5];
        int temp_dir_len;
@@ -1189,3 +1189,37 @@ char *transport_anonymize_url(const char *url)
 literal_copy:
        return xstrdup(url);
 }
+
+int refs_from_alternate_cb(struct alternate_object_database *e, void *cb)
+{
+       char *other;
+       size_t len;
+       struct remote *remote;
+       struct transport *transport;
+       const struct ref *extra;
+       alternate_ref_fn *ref_fn = cb;
+
+       e->name[-1] = '\0';
+       other = xstrdup(real_path(e->base));
+       e->name[-1] = '/';
+       len = strlen(other);
+
+       while (other[len-1] == '/')
+               other[--len] = '\0';
+       if (len < 8 || memcmp(other + len - 8, "/objects", 8))
+               return 0;
+       /* Is this a git repository with refs? */
+       memcpy(other + len - 8, "/refs", 6);
+       if (!is_directory(other))
+               return 0;
+       other[len - 8] = '\0';
+       remote = remote_get(other);
+       transport = transport_get(remote, other);
+       for (extra = transport_get_remote_refs(transport);
+            extra;
+            extra = extra->next)
+               ref_fn(extra, NULL);
+       transport_disconnect(transport);
+       free(other);
+       return 0;
+}
index e803c0e7baf3785fac35fca64072e05e4f668a26..efb19688692b5f1be4fc085cc36d737ace2df417 100644 (file)
@@ -166,4 +166,7 @@ int transport_refs_pushed(struct ref *ref);
 void transport_print_push_status(const char *dest, struct ref *refs,
                  int verbose, int porcelain, int *nonfastforward);
 
+typedef void alternate_ref_fn(const struct ref *, void *);
+extern int refs_from_alternate_cb(struct alternate_object_database *e, void *cb);
+
 #endif
index 12c9a88884ec3bb70a1744e44235c578a44e08e6..76f83fcc27e50b12ddbc8f72badd8d29f5b4230d 100644 (file)
@@ -6,34 +6,17 @@
 #include "diffcore.h"
 #include "tree.h"
 
-static char *malloc_base(const char *base, int baselen, const char *path, int pathlen)
-{
-       char *newbase = xmalloc(baselen + pathlen + 2);
-       memcpy(newbase, base, baselen);
-       memcpy(newbase + baselen, path, pathlen);
-       memcpy(newbase + baselen + pathlen, "/", 2);
-       return newbase;
-}
+static void show_entry(struct diff_options *opt, const char *prefix,
+                      struct tree_desc *desc, struct strbuf *base);
 
-static char *malloc_fullname(const char *base, int baselen, const char *path, int pathlen)
-{
-       char *fullname = xmalloc(baselen + pathlen + 1);
-       memcpy(fullname, base, baselen);
-       memcpy(fullname + baselen, path, pathlen);
-       fullname[baselen + pathlen] = 0;
-       return fullname;
-}
-
-static void show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc,
-                      const char *base, int baselen);
-
-static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const char *base, int baselen, struct diff_options *opt)
+static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2,
+                             struct strbuf *base, struct diff_options *opt)
 {
        unsigned mode1, mode2;
        const char *path1, *path2;
        const unsigned char *sha1, *sha2;
        int cmp, pathlen1, pathlen2;
-       char *fullname;
+       int old_baselen = base->len;
 
        sha1 = tree_entry_extract(t1, &path1, &mode1);
        sha2 = tree_entry_extract(t2, &path2, &mode2);
@@ -42,11 +25,11 @@ static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const
        pathlen2 = tree_entry_len(path2, sha2);
        cmp = base_name_compare(path1, pathlen1, mode1, path2, pathlen2, mode2);
        if (cmp < 0) {
-               show_entry(opt, "-", t1, base, baselen);
+               show_entry(opt, "-", t1, base);
                return -1;
        }
        if (cmp > 0) {
-               show_entry(opt, "+", t2, base, baselen);
+               show_entry(opt, "+", t2, base);
                return 1;
        }
        if (!DIFF_OPT_TST(opt, FIND_COPIES_HARDER) && !hashcmp(sha1, sha2) && mode1 == mode2)
@@ -57,149 +40,29 @@ static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const
         * file, we need to consider it a remove and an add.
         */
        if (S_ISDIR(mode1) != S_ISDIR(mode2)) {
-               show_entry(opt, "-", t1, base, baselen);
-               show_entry(opt, "+", t2, base, baselen);
+               show_entry(opt, "-", t1, base);
+               show_entry(opt, "+", t2, base);
                return 0;
        }
 
+       strbuf_add(base, path1, pathlen1);
        if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode1)) {
-               int retval;
-               char *newbase = malloc_base(base, baselen, path1, pathlen1);
                if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE)) {
-                       newbase[baselen + pathlen1] = 0;
                        opt->change(opt, mode1, mode2,
-                                   sha1, sha2, newbase, 0, 0);
-                       newbase[baselen + pathlen1] = '/';
+                                   sha1, sha2, base->buf, 0, 0);
                }
-               retval = diff_tree_sha1(sha1, sha2, newbase, opt);
-               free(newbase);
-               return retval;
+               strbuf_addch(base, '/');
+               diff_tree_sha1(sha1, sha2, base->buf, opt);
+       } else {
+               opt->change(opt, mode1, mode2, sha1, sha2, base->buf, 0, 0);
        }
-
-       fullname = malloc_fullname(base, baselen, path1, pathlen1);
-       opt->change(opt, mode1, mode2, sha1, sha2, fullname, 0, 0);
-       free(fullname);
+       strbuf_setlen(base, old_baselen);
        return 0;
 }
 
-/*
- * Is a tree entry interesting given the pathspec we have?
- *
- * Pre-condition: baselen == 0 || base[baselen-1] == '/'
- *
- * Return:
- *  - 2 for "yes, and all subsequent entries will be"
- *  - 1 for yes
- *  - zero for no
- *  - negative for "no, and no subsequent entries will be either"
- */
-static int tree_entry_interesting(struct tree_desc *desc, const char *base, int baselen, struct diff_options *opt)
-{
-       const char *path;
-       const unsigned char *sha1;
-       unsigned mode;
-       int i;
-       int pathlen;
-       int never_interesting = -1;
-
-       if (!opt->nr_paths)
-               return 2;
-
-       sha1 = tree_entry_extract(desc, &path, &mode);
-
-       pathlen = tree_entry_len(path, sha1);
-
-       for (i = 0; i < opt->nr_paths; i++) {
-               const char *match = opt->paths[i];
-               int matchlen = opt->pathlens[i];
-               int m = -1; /* signals that we haven't called strncmp() */
-
-               if (baselen >= matchlen) {
-                       /* If it doesn't match, move along... */
-                       if (strncmp(base, match, matchlen))
-                               continue;
-
-                       /*
-                        * If the base is a subdirectory of a path which
-                        * was specified, all of them are interesting.
-                        */
-                       if (!matchlen ||
-                           base[matchlen] == '/' ||
-                           match[matchlen - 1] == '/')
-                               return 2;
-
-                       /* Just a random prefix match */
-                       continue;
-               }
-
-               /* Does the base match? */
-               if (strncmp(base, match, baselen))
-                       continue;
-
-               match += baselen;
-               matchlen -= baselen;
-
-               if (never_interesting) {
-                       /*
-                        * We have not seen any match that sorts later
-                        * than the current path.
-                        */
-
-                       /*
-                        * Does match sort strictly earlier than path
-                        * with their common parts?
-                        */
-                       m = strncmp(match, path,
-                                   (matchlen < pathlen) ? matchlen : pathlen);
-                       if (m < 0)
-                               continue;
-
-                       /*
-                        * If we come here even once, that means there is at
-                        * least one pathspec that would sort equal to or
-                        * later than the path we are currently looking at.
-                        * In other words, if we have never reached this point
-                        * after iterating all pathspecs, it means all
-                        * pathspecs are either outside of base, or inside the
-                        * base but sorts strictly earlier than the current
-                        * one.  In either case, they will never match the
-                        * subsequent entries.  In such a case, we initialized
-                        * the variable to -1 and that is what will be
-                        * returned, allowing the caller to terminate early.
-                        */
-                       never_interesting = 0;
-               }
-
-               if (pathlen > matchlen)
-                       continue;
-
-               if (matchlen > pathlen) {
-                       if (match[pathlen] != '/')
-                               continue;
-                       if (!S_ISDIR(mode))
-                               continue;
-               }
-
-               if (m == -1)
-                       /*
-                        * we cheated and did not do strncmp(), so we do
-                        * that here.
-                        */
-                       m = strncmp(match, path, pathlen);
-
-               /*
-                * If common part matched earlier then it is a hit,
-                * because we rejected the case where path is not a
-                * leading directory and is shorter than match.
-                */
-               if (!m)
-                       return 1;
-       }
-       return never_interesting; /* No matches */
-}
-
 /* A whole sub-tree went away or appeared */
-static void show_tree(struct diff_options *opt, const char *prefix, struct tree_desc *desc, const char *base, int baselen)
+static void show_tree(struct diff_options *opt, const char *prefix,
+                     struct tree_desc *desc, struct strbuf *base)
 {
        int all_interesting = 0;
        while (desc->size) {
@@ -208,31 +71,32 @@ static void show_tree(struct diff_options *opt, const char *prefix, struct tree_
                if (all_interesting)
                        show = 1;
                else {
-                       show = tree_entry_interesting(desc, base, baselen,
-                                                     opt);
+                       show = tree_entry_interesting(&desc->entry, base, 0,
+                                                     &opt->pathspec);
                        if (show == 2)
                                all_interesting = 1;
                }
                if (show < 0)
                        break;
                if (show)
-                       show_entry(opt, prefix, desc, base, baselen);
+                       show_entry(opt, prefix, desc, base);
                update_tree_entry(desc);
        }
 }
 
 /* A file entry went away or appeared */
-static void show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc,
-                      const char *base, int baselen)
+static void show_entry(struct diff_options *opt, const char *prefix,
+                      struct tree_desc *desc, struct strbuf *base)
 {
        unsigned mode;
        const char *path;
        const unsigned char *sha1 = tree_entry_extract(desc, &path, &mode);
        int pathlen = tree_entry_len(path, sha1);
+       int old_baselen = base->len;
 
+       strbuf_add(base, path, pathlen);
        if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode)) {
                enum object_type type;
-               char *newbase = malloc_base(base, baselen, path, pathlen);
                struct tree_desc inner;
                void *tree;
                unsigned long size;
@@ -241,28 +105,25 @@ static void show_entry(struct diff_options *opt, const char *prefix, struct tree
                if (!tree || type != OBJ_TREE)
                        die("corrupt tree sha %s", sha1_to_hex(sha1));
 
-               if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE)) {
-                       newbase[baselen + pathlen] = 0;
-                       opt->add_remove(opt, *prefix, mode, sha1, newbase, 0);
-                       newbase[baselen + pathlen] = '/';
-               }
+               if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE))
+                       opt->add_remove(opt, *prefix, mode, sha1, base->buf, 0);
 
-               init_tree_desc(&inner, tree, size);
-               show_tree(opt, prefix, &inner, newbase, baselen + 1 + pathlen);
+               strbuf_addch(base, '/');
 
+               init_tree_desc(&inner, tree, size);
+               show_tree(opt, prefix, &inner, base);
                free(tree);
-               free(newbase);
-       } else {
-               char *fullname = malloc_fullname(base, baselen, path, pathlen);
-               opt->add_remove(opt, prefix[0], mode, sha1, fullname, 0);
-               free(fullname);
-       }
+       } else
+               opt->add_remove(opt, prefix[0], mode, sha1, base->buf, 0);
+
+       strbuf_setlen(base, old_baselen);
 }
 
-static void skip_uninteresting(struct tree_desc *t, const char *base, int baselen, struct diff_options *opt, int *all_interesting)
+static void skip_uninteresting(struct tree_desc *t, struct strbuf *base,
+                              struct diff_options *opt, int *all_interesting)
 {
        while (t->size) {
-               int show = tree_entry_interesting(t, base, baselen, opt);
+               int show = tree_entry_interesting(&t->entry, base, 0, &opt->pathspec);
                if (show == 2)
                        *all_interesting = 1;
                if (!show) {
@@ -276,37 +137,44 @@ static void skip_uninteresting(struct tree_desc *t, const char *base, int basele
        }
 }
 
-int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, struct diff_options *opt)
+int diff_tree(struct tree_desc *t1, struct tree_desc *t2,
+             const char *base_str, struct diff_options *opt)
 {
-       int baselen = strlen(base);
+       struct strbuf base;
+       int baselen = strlen(base_str);
        int all_t1_interesting = 0;
        int all_t2_interesting = 0;
 
+       /* Enable recursion indefinitely */
+       opt->pathspec.recursive = DIFF_OPT_TST(opt, RECURSIVE);
+       opt->pathspec.max_depth = -1;
+
+       strbuf_init(&base, PATH_MAX);
+       strbuf_add(&base, base_str, baselen);
+
        for (;;) {
                if (DIFF_OPT_TST(opt, QUICK) &&
                    DIFF_OPT_TST(opt, HAS_CHANGES))
                        break;
-               if (opt->nr_paths) {
+               if (opt->pathspec.nr) {
                        if (!all_t1_interesting)
-                               skip_uninteresting(t1, base, baselen, opt,
-                                                  &all_t1_interesting);
+                               skip_uninteresting(t1, &base, opt, &all_t1_interesting);
                        if (!all_t2_interesting)
-                               skip_uninteresting(t2, base, baselen, opt,
-                                                  &all_t2_interesting);
+                               skip_uninteresting(t2, &base, opt, &all_t2_interesting);
                }
                if (!t1->size) {
                        if (!t2->size)
                                break;
-                       show_entry(opt, "+", t2, base, baselen);
+                       show_entry(opt, "+", t2, &base);
                        update_tree_entry(t2);
                        continue;
                }
                if (!t2->size) {
-                       show_entry(opt, "-", t1, base, baselen);
+                       show_entry(opt, "-", t1, &base);
                        update_tree_entry(t1);
                        continue;
                }
-               switch (compare_tree_entry(t1, t2, base, baselen, opt)) {
+               switch (compare_tree_entry(t1, t2, &base, opt)) {
                case -1:
                        update_tree_entry(t1);
                        continue;
@@ -319,6 +187,8 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, stru
                }
                die("git diff-tree: internal error");
        }
+
+       strbuf_release(&base);
        return 0;
 }
 
@@ -349,7 +219,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
        DIFF_OPT_SET(&diff_opts, RECURSIVE);
        DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
        diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
-       diff_opts.single_follow = opt->paths[0];
+       diff_opts.single_follow = opt->pathspec.raw[0];
        diff_opts.break_opt = opt->break_opt;
        paths[0] = NULL;
        diff_tree_setup_paths(paths, &diff_opts);
@@ -369,15 +239,16 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
                 * diff_queued_diff, we will also use that as the path in
                 * the future!
                 */
-               if ((p->status == 'R' || p->status == 'C') && !strcmp(p->two->path, opt->paths[0])) {
+               if ((p->status == 'R' || p->status == 'C') &&
+                   !strcmp(p->two->path, opt->pathspec.raw[0])) {
                        /* Switch the file-pairs around */
                        q->queue[i] = choice;
                        choice = p;
 
                        /* Update the path we use from now on.. */
                        diff_tree_release_paths(opt);
-                       opt->paths[0] = xstrdup(p->one->path);
-                       diff_tree_setup_paths(opt->paths, opt);
+                       opt->pathspec.raw[0] = xstrdup(p->one->path);
+                       diff_tree_setup_paths(opt->pathspec.raw, opt);
 
                        /*
                         * The caller expects us to return a set of vanilla
@@ -452,36 +323,12 @@ int diff_root_tree_sha1(const unsigned char *new, const char *base, struct diff_
        return retval;
 }
 
-static int count_paths(const char **paths)
-{
-       int i = 0;
-       while (*paths++)
-               i++;
-       return i;
-}
-
 void diff_tree_release_paths(struct diff_options *opt)
 {
-       free(opt->pathlens);
+       free_pathspec(&opt->pathspec);
 }
 
 void diff_tree_setup_paths(const char **p, struct diff_options *opt)
 {
-       opt->nr_paths = 0;
-       opt->pathlens = NULL;
-       opt->paths = NULL;
-
-       if (p) {
-               int i;
-
-               opt->paths = p;
-               opt->nr_paths = count_paths(p);
-               if (opt->nr_paths == 0) {
-                       opt->pathlens = NULL;
-                       return;
-               }
-               opt->pathlens = xmalloc(opt->nr_paths * sizeof(int));
-               for (i=0; i < opt->nr_paths; i++)
-                       opt->pathlens[i] = strlen(p[i]);
-       }
+       init_pathspec(&opt->pathspec, p);
 }
index a9bbf4e2354df5ce6b010873b419731343a12c7d..322becc3b4ad50b8e87fae8f6d5d38f7edc51f01 100644 (file)
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "tree-walk.h"
 #include "unpack-trees.h"
+#include "dir.h"
 #include "tree.h"
 
 static const char *get_mode(const char *str, unsigned int *modep)
@@ -455,3 +456,186 @@ int get_tree_entry(const unsigned char *tree_sha1, const char *name, unsigned ch
        free(tree);
        return retval;
 }
+
+static int match_entry(const struct name_entry *entry, int pathlen,
+                      const char *match, int matchlen,
+                      int *never_interesting)
+{
+       int m = -1; /* signals that we haven't called strncmp() */
+
+       if (*never_interesting) {
+               /*
+                * We have not seen any match that sorts later
+                * than the current path.
+                */
+
+               /*
+                * Does match sort strictly earlier than path
+                * with their common parts?
+                */
+               m = strncmp(match, entry->path,
+                           (matchlen < pathlen) ? matchlen : pathlen);
+               if (m < 0)
+                       return 0;
+
+               /*
+                * If we come here even once, that means there is at
+                * least one pathspec that would sort equal to or
+                * later than the path we are currently looking at.
+                * In other words, if we have never reached this point
+                * after iterating all pathspecs, it means all
+                * pathspecs are either outside of base, or inside the
+                * base but sorts strictly earlier than the current
+                * one.  In either case, they will never match the
+                * subsequent entries.  In such a case, we initialized
+                * the variable to -1 and that is what will be
+                * returned, allowing the caller to terminate early.
+                */
+               *never_interesting = 0;
+       }
+
+       if (pathlen > matchlen)
+               return 0;
+
+       if (matchlen > pathlen) {
+               if (match[pathlen] != '/')
+                       return 0;
+               if (!S_ISDIR(entry->mode))
+                       return 0;
+       }
+
+       if (m == -1)
+               /*
+                * we cheated and did not do strncmp(), so we do
+                * that here.
+                */
+               m = strncmp(match, entry->path, pathlen);
+
+       /*
+        * If common part matched earlier then it is a hit,
+        * because we rejected the case where path is not a
+        * leading directory and is shorter than match.
+        */
+       if (!m)
+               return 1;
+
+       return 0;
+}
+
+static int match_dir_prefix(const char *base, int baselen,
+                           const char *match, int matchlen)
+{
+       if (strncmp(base, match, matchlen))
+               return 0;
+
+       /*
+        * If the base is a subdirectory of a path which
+        * was specified, all of them are interesting.
+        */
+       if (!matchlen ||
+           base[matchlen] == '/' ||
+           match[matchlen - 1] == '/')
+               return 1;
+
+       /* Just a random prefix match */
+       return 0;
+}
+
+/*
+ * Is a tree entry interesting given the pathspec we have?
+ *
+ * Pre-condition: either baselen == base_offset (i.e. empty path)
+ * or base[baselen-1] == '/' (i.e. with trailing slash).
+ *
+ * Return:
+ *  - 2 for "yes, and all subsequent entries will be"
+ *  - 1 for yes
+ *  - zero for no
+ *  - negative for "no, and no subsequent entries will be either"
+ */
+int tree_entry_interesting(const struct name_entry *entry,
+                          struct strbuf *base, int base_offset,
+                          const struct pathspec *ps)
+{
+       int i;
+       int pathlen, baselen = base->len - base_offset;
+       int never_interesting = ps->has_wildcard ? 0 : -1;
+
+       if (!ps->nr) {
+               if (!ps->recursive || ps->max_depth == -1)
+                       return 2;
+               return !!within_depth(base->buf + base_offset, baselen,
+                                     !!S_ISDIR(entry->mode),
+                                     ps->max_depth);
+       }
+
+       pathlen = tree_entry_len(entry->path, entry->sha1);
+
+       for (i = ps->nr - 1; i >= 0; i--) {
+               const struct pathspec_item *item = ps->items+i;
+               const char *match = item->match;
+               const char *base_str = base->buf + base_offset;
+               int matchlen = item->len;
+
+               if (baselen >= matchlen) {
+                       /* If it doesn't match, move along... */
+                       if (!match_dir_prefix(base_str, baselen, match, matchlen))
+                               goto match_wildcards;
+
+                       if (!ps->recursive || ps->max_depth == -1)
+                               return 2;
+
+                       return !!within_depth(base_str + matchlen + 1,
+                                             baselen - matchlen - 1,
+                                             !!S_ISDIR(entry->mode),
+                                             ps->max_depth);
+               }
+
+               /* Does the base match? */
+               if (!strncmp(base_str, match, baselen)) {
+                       if (match_entry(entry, pathlen,
+                                       match + baselen, matchlen - baselen,
+                                       &never_interesting))
+                               return 1;
+
+                       if (ps->items[i].has_wildcard) {
+                               if (!fnmatch(match + baselen, entry->path, 0))
+                                       return 1;
+
+                               /*
+                                * Match all directories. We'll try to
+                                * match files later on.
+                                */
+                               if (ps->recursive && S_ISDIR(entry->mode))
+                                       return 1;
+                       }
+
+                       continue;
+               }
+
+match_wildcards:
+               if (!ps->items[i].has_wildcard)
+                       continue;
+
+               /*
+                * Concatenate base and entry->path into one and do
+                * fnmatch() on it.
+                */
+
+               strbuf_add(base, entry->path, pathlen);
+
+               if (!fnmatch(match, base->buf + base_offset, 0)) {
+                       strbuf_setlen(base, base_offset + baselen);
+                       return 1;
+               }
+               strbuf_setlen(base, base_offset + baselen);
+
+               /*
+                * Match all directories. We'll try to match files
+                * later on.
+                */
+               if (ps->recursive && S_ISDIR(entry->mode))
+                       return 1;
+       }
+       return never_interesting; /* No matches */
+}
index 7e3e0b5ad16710c06464726ac04d2b1c48af3708..39524b7dba6a1d0b63c4cd2b42db59a27a030b21 100644 (file)
@@ -60,4 +60,6 @@ static inline int traverse_path_len(const struct traverse_info *info, const stru
        return info->pathlen + tree_entry_len(n->path, n->sha1);
 }
 
+extern int tree_entry_interesting(const struct name_entry *, struct strbuf *, int, const struct pathspec *ps);
+
 #endif
index 1ca41b1a6986559a7c5ddc3983d751d75a0d23ff..500ebcfd545772fb17e5fb14bba42bf4be468b75 100644 (file)
@@ -16,7 +16,7 @@
  * situation better.  See how "git checkout" and "git merge" replaces
  * them using setup_unpack_trees_porcelain(), for example.
  */
-const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
+static const char *unpack_plumbing_errors[NB_UNPACK_TREES_ERROR_TYPES] = {
        /* ERROR_WOULD_OVERWRITE */
        "Entry '%s' would be overwritten by merge. Cannot merge.",
 
@@ -381,7 +381,7 @@ static void add_same_unmerged(struct cache_entry *ce,
 static int unpack_index_entry(struct cache_entry *ce,
                              struct unpack_trees_options *o)
 {
-       struct cache_entry *src[5] = { NULL };
+       struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
        int ret;
 
        src[0] = ce;
@@ -427,7 +427,10 @@ static int switch_cache_bottom(struct traverse_info *info)
        return ret;
 }
 
-static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info)
+static int traverse_trees_recursive(int n, unsigned long dirmask,
+                                   unsigned long df_conflicts,
+                                   struct name_entry *names,
+                                   struct traverse_info *info)
 {
        int i, ret, bottom;
        struct tree_desc t[MAX_UNPACK_TREES];
@@ -1105,6 +1108,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 
                }
                if (o->result.cache_nr && empty_worktree) {
+                       /* dubious---why should this fail??? */
                        ret = unpack_failed(o, "Sparse checkout leaves no entry on working directory");
                        goto done;
                }
@@ -1374,16 +1378,22 @@ static int verify_absent_1(struct cache_entry *ce,
                char path[PATH_MAX + 1];
                memcpy(path, ce->name, len);
                path[len] = 0;
-               lstat(path, &st);
+               if (lstat(path, &st))
+                       return error("cannot stat '%s': %s", path,
+                                       strerror(errno));
 
                return check_ok_to_remove(path, len, DT_UNKNOWN, NULL, &st,
                                error_type, o);
-       } else if (!lstat(ce->name, &st))
+       } else if (lstat(ce->name, &st)) {
+               if (errno != ENOENT)
+                       return error("cannot stat '%s': %s", ce->name,
+                                    strerror(errno));
+               return 0;
+       } else {
                return check_ok_to_remove(ce->name, ce_namelen(ce),
-                               ce_to_dtype(ce), ce, &st,
-                               error_type, o);
-
-       return 0;
+                                         ce_to_dtype(ce), ce, &st,
+                                         error_type, o);
+       }
 }
 
 static int verify_absent(struct cache_entry *ce,
index b40a43f27d0e16f0305153f984741938b3a6ab89..bba053f0aac8eef982d6779983dc6fd979d69d69 100644 (file)
@@ -27,6 +27,7 @@ static const char upload_pack_usage[] = "git upload-pack [--strict] [--timeout=<
 static unsigned long oldest_have;
 
 static int multi_ack, nr_our_refs;
+static int no_done;
 static int use_thin_pack, use_ofs_delta, use_include_tag;
 static int no_progress, daemon_mode;
 static int shallow_nr;
@@ -429,6 +430,9 @@ static int get_common_commits(void)
        static char line[1000];
        unsigned char sha1[20];
        char last_hex[41];
+       int got_common = 0;
+       int got_other = 0;
+       int sent_ready = 0;
 
        save_commit_buffer = 0;
 
@@ -437,25 +441,40 @@ static int get_common_commits(void)
                reset_timeout();
 
                if (!len) {
+                       if (multi_ack == 2 && got_common
+                           && !got_other && ok_to_give_up()) {
+                               sent_ready = 1;
+                               packet_write(1, "ACK %s ready\n", last_hex);
+                       }
                        if (have_obj.nr == 0 || multi_ack)
                                packet_write(1, "NAK\n");
+
+                       if (no_done && sent_ready) {
+                               packet_write(1, "ACK %s\n", last_hex);
+                               return 0;
+                       }
                        if (stateless_rpc)
                                exit(0);
+                       got_common = 0;
+                       got_other = 0;
                        continue;
                }
                strip(line, len);
                if (!prefixcmp(line, "have ")) {
                        switch (got_sha1(line+5, sha1)) {
                        case -1: /* they have what we do not */
+                               got_other = 1;
                                if (multi_ack && ok_to_give_up()) {
                                        const char *hex = sha1_to_hex(sha1);
-                                       if (multi_ack == 2)
+                                       if (multi_ack == 2) {
+                                               sent_ready = 1;
                                                packet_write(1, "ACK %s ready\n", hex);
-                                       else
+                                       else
                                                packet_write(1, "ACK %s continue\n", hex);
                                }
                                break;
                        default:
+                               got_common = 1;
                                memcpy(last_hex, sha1_to_hex(sha1), 41);
                                if (multi_ack == 2)
                                        packet_write(1, "ACK %s common\n", last_hex);
@@ -526,6 +545,8 @@ static void receive_needs(void)
                        multi_ack = 2;
                else if (strstr(line+45, "multi_ack"))
                        multi_ack = 1;
+               if (strstr(line+45, "no-done"))
+                       no_done = 1;
                if (strstr(line+45, "thin-pack"))
                        use_thin_pack = 1;
                if (strstr(line+45, "ofs-delta"))
@@ -626,8 +647,9 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo
                die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
 
        if (capabilities)
-               packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname,
-                       0, capabilities);
+               packet_write(1, "%s %s%c%s%s\n", sha1_to_hex(sha1), refname,
+                            0, capabilities,
+                            stateless_rpc ? " no-done" : "");
        else
                packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname);
        capabilities = NULL;
@@ -682,6 +704,7 @@ int main(int argc, char **argv)
        int i;
        int strict = 0;
 
+       packet_trace_identity("upload-pack");
        git_extract_argv0_path(argv[0]);
        read_replace_refs = 0;
 
diff --git a/url.c b/url.c
index 6a5495960f03ded65f0f5f8b8bd5c7cd98c0b05e..3e06fd34c46a00b41f4843ea87a151314ce0789c 100644 (file)
--- a/url.c
+++ b/url.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "url.h"
 
 int is_urlschemechar(int first_flag, int ch)
 {
diff --git a/usage.c b/usage.c
index ec4cf53b6bf16f7f9b3528a430891d6c68ef64cc..b5e67e3d0d4a46a69d72371f4c6a0002e40a0bf1 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -46,7 +46,7 @@ void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list param
        die_routine = routine;
 }
 
-void usagef(const char *err, ...)
+void NORETURN usagef(const char *err, ...)
 {
        va_list params;
 
@@ -55,12 +55,12 @@ void usagef(const char *err, ...)
        va_end(params);
 }
 
-void usage(const char *err)
+void NORETURN usage(const char *err)
 {
        usagef("%s", err);
 }
 
-void die(const char *err, ...)
+void NORETURN die(const char *err, ...)
 {
        va_list params;
 
@@ -69,7 +69,7 @@ void die(const char *err, ...)
        va_end(params);
 }
 
-void die_errno(const char *fmt, ...)
+void NORETURN die_errno(const char *fmt, ...)
 {
        va_list params;
        char fmt_with_err[1024];
index 9ebf231ea5ee2e7fd1f71c9557a6537d29428d8d..1ff47977d549992ada8c1236187d4516b648ee7d 100644 (file)
@@ -8,9 +8,11 @@ static int ndrivers;
 static int drivers_alloc;
 
 #define PATTERNS(name, pattern, word_regex)                    \
-       { name, NULL, -1, { pattern, REG_EXTENDED }, word_regex }
+       { name, NULL, -1, { pattern, REG_EXTENDED },            \
+         word_regex "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+" }
 #define IPATTERN(name, pattern, word_regex)                    \
-       { name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, word_regex }
+       { name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, \
+         word_regex "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+" }
 static struct userdiff_driver builtin_drivers[] = {
 IPATTERN("fortran",
         "!^([C*]|[ \t]*!)\n"
@@ -24,10 +26,9 @@ IPATTERN("fortran",
          * Don't worry about format statements without leading digits since
          * they would have been matched above as a variable anyway. */
         "|[-+]?[0-9.]+([AaIiDdEeFfLlTtXx][Ss]?[-+]?[0-9.]*)?(_[a-zA-Z0-9][a-zA-Z0-9_]*)?"
-        "|//|\\*\\*|::|[/<>=]="
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|//|\\*\\*|::|[/<>=]="),
 PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$",
-        "[^<>= \t]+|[^[:space:]]|[\x80-\xff]+"),
+        "[^<>= \t]+"),
 PATTERNS("java",
         "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
         "^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$",
@@ -35,8 +36,7 @@ PATTERNS("java",
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
         "|[-+*/<>%&^|=!]="
-        "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"),
 PATTERNS("objc",
         /* Negate C statements that can look like functions */
         "!^[ \t]*(do|for|if|else|return|switch|while)\n"
@@ -49,8 +49,7 @@ PATTERNS("objc",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
-        "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
 PATTERNS("pascal",
         "^(((class[ \t]+)?(procedure|function)|constructor|destructor|interface|"
                "implementation|initialization|finalization)[ \t]*.*)$"
@@ -59,8 +58,7 @@ PATTERNS("pascal",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"
-        "|<>|<=|>=|:=|\\.\\."
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|<>|<=|>=|:=|\\.\\."),
 PATTERNS("perl",
         "^[ \t]*package .*;\n"
         "^[ \t]*sub .* \\{\n"
@@ -76,33 +74,29 @@ PATTERNS("perl",
         "|&&|\\|\\||//|\\+\\+|--|\\*\\*|\\.\\.\\.?"
         "|[-+*/%.^&<>=!|]="
         "|=~|!~"
-        "|<<|<>|<=>|>>"
-        "|[^[:space:]]"),
+        "|<<|<>|<=>|>>"),
 PATTERNS("php",
         "^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
         "^[\t ]*(class.*)$",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"
-        "|[-+*/<>%&^|=!.]=|--|\\+\\+|<<=?|>>=?|===|&&|\\|\\||::|->"
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|[-+*/<>%&^|=!.]=|--|\\+\\+|<<=?|>>=?|===|&&|\\|\\||::|->"),
 PATTERNS("python", "^[ \t]*((class|def)[ \t].*)$",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
-        "|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"),
         /* -- */
 PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
         /* -- */
         "(@|@@|\\$)?[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?."
-        "|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"),
 PATTERNS("bibtex", "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
         "[={}\"]|[^={}\" \t]+"),
 PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
-        "\\\\[a-zA-Z@]+|\\\\.|[a-zA-Z0-9\x80-\xff]+|[^[:space:]]"),
+        "\\\\[a-zA-Z@]+|\\\\.|[a-zA-Z0-9\x80-\xff]+"),
 PATTERNS("cpp",
         /* Jump targets or access declarations */
         "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:.*$\n"
@@ -113,8 +107,7 @@ PATTERNS("cpp",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
-        "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
 PATTERNS("csharp",
         /* Keywords */
         "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
@@ -129,8 +122,7 @@ PATTERNS("csharp",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
-        "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
-        "|[^[:space:]]|[\x80-\xff]+"),
+        "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
 { "default", NULL, -1, { NULL, 0 } },
 };
 #undef PATTERNS
diff --git a/utf8.c b/utf8.c
index 84cfc72e6db144880febad0a4ffa64800919fb6d..8acbc660d31a3552a4451749353139e0dcd371bd 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -405,6 +405,15 @@ new_line:
        }
 }
 
+int strbuf_add_wrapped_bytes(struct strbuf *buf, const char *data, int len,
+                            int indent, int indent2, int width)
+{
+       char *tmp = xstrndup(data, len);
+       int r = strbuf_add_wrapped_text(buf, tmp, indent, indent2, width);
+       free(tmp);
+       return r;
+}
+
 int is_encoding_utf8(const char *name)
 {
        if (!name)
diff --git a/utf8.h b/utf8.h
index ebc4d2fa85113c971ab4c4eaa52537a688a03745..81f2c82fabcf63e3bb02c15beb4a0409afd9ab7b 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -10,6 +10,8 @@ int is_encoding_utf8(const char *name);
 
 int strbuf_add_wrapped_text(struct strbuf *buf,
                const char *text, int indent, int indent2, int width);
+int strbuf_add_wrapped_bytes(struct strbuf *buf, const char *data, int len,
+                            int indent, int indent2, int width);
 
 #ifndef NO_ICONV
 char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding);
index 6cfa256a3702332205faab546a405f6810cc16bd..99ed70b88a5aaacbb48a9463f19ec198d7bedf84 100644 (file)
@@ -31,27 +31,30 @@ void fast_export_modify(uint32_t depth, uint32_t *path, uint32_t mode,
 }
 
 static char gitsvnline[MAX_GITSVN_LINE_LEN];
-void fast_export_commit(uint32_t revision, uint32_t author, char *log,
-                       uint32_t uuid, uint32_t url,
+void fast_export_commit(uint32_t revision, const char *author,
+                       const struct strbuf *log,
+                       const char *uuid, const char *url,
                        unsigned long timestamp)
 {
+       static const struct strbuf empty = STRBUF_INIT;
        if (!log)
-               log = "";
-       if (~uuid && ~url) {
+               log = &empty;
+       if (*uuid && *url) {
                snprintf(gitsvnline, MAX_GITSVN_LINE_LEN,
                                "\n\ngit-svn-id: %s@%"PRIu32" %s\n",
-                                pool_fetch(url), revision, pool_fetch(uuid));
+                                url, revision, uuid);
        } else {
                *gitsvnline = '\0';
        }
        printf("commit refs/heads/master\n");
        printf("committer %s <%s@%s> %ld +0000\n",
-                  ~author ? pool_fetch(author) : "nobody",
-                  ~author ? pool_fetch(author) : "nobody",
-                  ~uuid ? pool_fetch(uuid) : "local", timestamp);
-       printf("data %"PRIu32"\n%s%s\n",
-                  (uint32_t) (strlen(log) + strlen(gitsvnline)),
-                  log, gitsvnline);
+                  *author ? author : "nobody",
+                  *author ? author : "nobody",
+                  *uuid ? uuid : "local", timestamp);
+       printf("data %"PRIuMAX"\n",
+               (uintmax_t) (log->len + strlen(gitsvnline)));
+       fwrite(log->buf, log->len, 1, stdout);
+       printf("%s\n", gitsvnline);
        if (!first_commit_done) {
                if (revision > 1)
                        printf("from refs/heads/master^0\n");
@@ -63,14 +66,23 @@ void fast_export_commit(uint32_t revision, uint32_t author, char *log,
        printf("progress Imported commit %"PRIu32".\n\n", revision);
 }
 
-void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len)
+static void die_short_read(struct line_buffer *input)
+{
+       if (buffer_ferror(input))
+               die_errno("error reading dump file");
+       die("invalid dump: unexpected end of file");
+}
+
+void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len, struct line_buffer *input)
 {
        if (mode == REPO_MODE_LNK) {
                /* svn symlink blobs start with "link " */
-               buffer_skip_bytes(5);
                len -= 5;
+               if (buffer_skip_bytes(input, 5) != 5)
+                       die_short_read(input);
        }
        printf("blob\nmark :%"PRIu32"\ndata %"PRIu32"\n", mark, len);
-       buffer_copy_bytes(len);
+       if (buffer_copy_bytes(input, len) != len)
+               die_short_read(input);
        fputc('\n', stdout);
 }
index 2aaaea53d57bcc6a5280765dd39edf7fc5569c19..33a8fe996f5fc025f587c1d09ae3f81e1786dbbb 100644 (file)
@@ -1,11 +1,16 @@
 #ifndef FAST_EXPORT_H_
 #define FAST_EXPORT_H_
 
+#include "line_buffer.h"
+struct strbuf;
+
 void fast_export_delete(uint32_t depth, uint32_t *path);
 void fast_export_modify(uint32_t depth, uint32_t *path, uint32_t mode,
                        uint32_t mark);
-void fast_export_commit(uint32_t revision, uint32_t author, char *log,
-                       uint32_t uuid, uint32_t url, unsigned long timestamp);
-void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len);
+void fast_export_commit(uint32_t revision, const char *author,
+                       const struct strbuf *log, const char *uuid,
+                       const char *url, unsigned long timestamp);
+void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len,
+                     struct line_buffer *input);
 
 #endif
index 1543567093fad603e09ba61b2fc47ec232b4cae2..c39038723ed4a90f99f70a694eae58ba488556b6 100644 (file)
@@ -5,47 +5,81 @@
 
 #include "git-compat-util.h"
 #include "line_buffer.h"
-#include "obj_pool.h"
+#include "strbuf.h"
 
-#define LINE_BUFFER_LEN 10000
 #define COPY_BUFFER_LEN 4096
 
-/* Create memory pool for char sequence of known length */
-obj_pool_gen(blob, char, 4096)
+int buffer_init(struct line_buffer *buf, const char *filename)
+{
+       buf->infile = filename ? fopen(filename, "r") : stdin;
+       if (!buf->infile)
+               return -1;
+       return 0;
+}
 
-static char line_buffer[LINE_BUFFER_LEN];
-static char byte_buffer[COPY_BUFFER_LEN];
-static FILE *infile;
+int buffer_fdinit(struct line_buffer *buf, int fd)
+{
+       buf->infile = fdopen(fd, "r");
+       if (!buf->infile)
+               return -1;
+       return 0;
+}
 
-int buffer_init(const char *filename)
+int buffer_tmpfile_init(struct line_buffer *buf)
 {
-       infile = filename ? fopen(filename, "r") : stdin;
-       if (!infile)
+       buf->infile = tmpfile();
+       if (!buf->infile)
                return -1;
        return 0;
 }
 
-int buffer_deinit(void)
+int buffer_deinit(struct line_buffer *buf)
 {
        int err;
-       if (infile == stdin)
-               return ferror(infile);
-       err = ferror(infile);
-       err |= fclose(infile);
+       if (buf->infile == stdin)
+               return ferror(buf->infile);
+       err = ferror(buf->infile);
+       err |= fclose(buf->infile);
        return err;
 }
 
+FILE *buffer_tmpfile_rewind(struct line_buffer *buf)
+{
+       rewind(buf->infile);
+       return buf->infile;
+}
+
+long buffer_tmpfile_prepare_to_read(struct line_buffer *buf)
+{
+       long pos = ftell(buf->infile);
+       if (pos < 0)
+               return error("ftell error: %s", strerror(errno));
+       if (fseek(buf->infile, 0, SEEK_SET))
+               return error("seek error: %s", strerror(errno));
+       return pos;
+}
+
+int buffer_ferror(struct line_buffer *buf)
+{
+       return ferror(buf->infile);
+}
+
+int buffer_read_char(struct line_buffer *buf)
+{
+       return fgetc(buf->infile);
+}
+
 /* Read a line without trailing newline. */
-char *buffer_read_line(void)
+char *buffer_read_line(struct line_buffer *buf)
 {
        char *end;
-       if (!fgets(line_buffer, sizeof(line_buffer), infile))
+       if (!fgets(buf->line_buffer, sizeof(buf->line_buffer), buf->infile))
                /* Error or data exhausted. */
                return NULL;
-       end = line_buffer + strlen(line_buffer);
+       end = buf->line_buffer + strlen(buf->line_buffer);
        if (end[-1] == '\n')
                end[-1] = '\0';
-       else if (feof(infile))
+       else if (feof(buf->infile))
                ; /* No newline at end of file.  That's fine. */
        else
                /*
@@ -54,44 +88,43 @@ char *buffer_read_line(void)
                 * but for now let's return an error.
                 */
                return NULL;
-       return line_buffer;
+       return buf->line_buffer;
 }
 
-char *buffer_read_string(uint32_t len)
+void buffer_read_binary(struct line_buffer *buf,
+                               struct strbuf *sb, uint32_t size)
 {
-       char *s;
-       blob_free(blob_pool.size);
-       s = blob_pointer(blob_alloc(len + 1));
-       s[fread(s, 1, len, infile)] = '\0';
-       return ferror(infile) ? NULL : s;
+       strbuf_fread(sb, size, buf->infile);
 }
 
-void buffer_copy_bytes(uint32_t len)
+off_t buffer_copy_bytes(struct line_buffer *buf, off_t nbytes)
 {
-       uint32_t in;
-       while (len > 0 && !feof(infile) && !ferror(infile)) {
-               in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;
-               in = fread(byte_buffer, 1, in, infile);
-               len -= in;
+       char byte_buffer[COPY_BUFFER_LEN];
+       off_t done = 0;
+       while (done < nbytes && !feof(buf->infile) && !ferror(buf->infile)) {
+               off_t len = nbytes - done;
+               size_t in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;
+               in = fread(byte_buffer, 1, in, buf->infile);
+               done += in;
                fwrite(byte_buffer, 1, in, stdout);
-               if (ferror(stdout)) {
-                       buffer_skip_bytes(len);
-                       return;
-               }
+               if (ferror(stdout))
+                       return done + buffer_skip_bytes(buf, nbytes - done);
        }
+       return done;
 }
 
-void buffer_skip_bytes(uint32_t len)
+off_t buffer_skip_bytes(struct line_buffer *buf, off_t nbytes)
 {
-       uint32_t in;
-       while (len > 0 && !feof(infile) && !ferror(infile)) {
-               in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;
-               in = fread(byte_buffer, 1, in, infile);
-               len -= in;
+       char byte_buffer[COPY_BUFFER_LEN];
+       off_t done = 0;
+       while (done < nbytes && !feof(buf->infile) && !ferror(buf->infile)) {
+               off_t len = nbytes - done;
+               size_t in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;
+               done += fread(byte_buffer, 1, in, buf->infile);
        }
+       return done;
 }
 
-void buffer_reset(void)
+void buffer_reset(struct line_buffer *buf)
 {
-       blob_reset();
 }
index 9c78ae11a1e0774611b61a5407fab6cabfec226a..d0b22dda76e8a193f15fa5483abd217cdde101da 100644 (file)
@@ -1,12 +1,31 @@
 #ifndef LINE_BUFFER_H_
 #define LINE_BUFFER_H_
 
-int buffer_init(const char *filename);
-int buffer_deinit(void);
-char *buffer_read_line(void);
-char *buffer_read_string(uint32_t len);
-void buffer_copy_bytes(uint32_t len);
-void buffer_skip_bytes(uint32_t len);
-void buffer_reset(void);
+#include "strbuf.h"
+
+#define LINE_BUFFER_LEN 10000
+
+struct line_buffer {
+       char line_buffer[LINE_BUFFER_LEN];
+       FILE *infile;
+};
+#define LINE_BUFFER_INIT { "", NULL }
+
+int buffer_init(struct line_buffer *buf, const char *filename);
+int buffer_fdinit(struct line_buffer *buf, int fd);
+int buffer_deinit(struct line_buffer *buf);
+void buffer_reset(struct line_buffer *buf);
+
+int buffer_tmpfile_init(struct line_buffer *buf);
+FILE *buffer_tmpfile_rewind(struct line_buffer *buf);  /* prepare to write. */
+long buffer_tmpfile_prepare_to_read(struct line_buffer *buf);
+
+int buffer_ferror(struct line_buffer *buf);
+char *buffer_read_line(struct line_buffer *buf);
+int buffer_read_char(struct line_buffer *buf);
+void buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, uint32_t len);
+/* Returns number of bytes read (not necessarily written). */
+off_t buffer_copy_bytes(struct line_buffer *buf, off_t len);
+off_t buffer_skip_bytes(struct line_buffer *buf, off_t len);
 
 #endif
index 8906fb1f505e125ea58fd7a15c4f13bb0dc78f27..8e139eb22df0f44ba0b805b374943dd5d12e8437 100644 (file)
@@ -14,22 +14,46 @@ Calling sequence
 
 The calling program:
 
+ - initializes a `struct line_buffer` to LINE_BUFFER_INIT
  - specifies a file to read with `buffer_init`
- - processes input with `buffer_read_line`, `buffer_read_string`,
-   `buffer_skip_bytes`, and `buffer_copy_bytes`
+ - processes input with `buffer_read_line`, `buffer_skip_bytes`,
+   and `buffer_copy_bytes`
  - closes the file with `buffer_deinit`, perhaps to start over and
    read another file.
 
-Before exiting, the caller can use `buffer_reset` to deallocate
-resources for the benefit of profiling tools.
+When finished, the caller can use `buffer_reset` to deallocate
+resources.
+
+Using temporary files
+---------------------
+
+Temporary files provide a place to store data that should not outlive
+the calling program.  A program
+
+ - initializes a `struct line_buffer` to LINE_BUFFER_INIT
+ - requests a temporary file with `buffer_tmpfile_init`
+ - acquires an output handle by calling `buffer_tmpfile_rewind`
+ - uses standard I/O functions like `fprintf` and `fwrite` to fill
+   the temporary file
+ - declares writing is over with `buffer_tmpfile_prepare_to_read`
+ - can re-read what was written with `buffer_read_line`,
+   `buffer_copy_bytes`, and so on
+ - can reuse the temporary file by calling `buffer_tmpfile_rewind`
+   again
+ - removes the temporary file with `buffer_deinit`, perhaps to
+   reuse the line_buffer for some other file.
+
+When finished, the calling program can use `buffer_reset` to deallocate
+resources.
 
 Functions
 ---------
 
-`buffer_init`::
-       Open the named file for input.  If filename is NULL,
-       start reading from stdin.  On failure, returns -1 (with
-       errno indicating the nature of the failure).
+`buffer_init`, `buffer_fdinit`::
+       Open the named file or file descriptor for input.
+       buffer_init(buf, NULL) prepares to read from stdin.
+       On failure, returns -1 (with errno indicating the nature
+       of the failure).
 
 `buffer_deinit`::
        Stop reading from the current file (closing it unless
@@ -40,19 +64,14 @@ Functions
        Read a line and strip off the trailing newline.
        On failure or end of file, returns NULL.
 
-`buffer_read_string`::
-       Read `len` characters of input or up to the end of the
-       file, whichever comes first.  Returns NULL on error.
-       Returns whatever characters were read (possibly "")
-       for end of file.
-
 `buffer_copy_bytes`::
        Read `len` bytes of input and dump them to the standard output
        stream.  Returns early for error or end of file.
 
 `buffer_skip_bytes`::
        Discards `len` bytes from the input stream (stopping early
-       if necessary because of an error or eof).
+       if necessary because of an error or eof).  Return value is
+       the number of bytes successfully read.
 
 `buffer_reset`::
        Deallocates non-static buffers.
index e3d1fa35444dd693ab8723a030b9fc6265cad8bc..a21d89de97404479ecf2ca46824f61acb7af56e6 100644 (file)
@@ -38,7 +38,7 @@ static uint32_t mark;
 static int repo_dirent_name_cmp(const void *a, const void *b);
 
 /* Treap for directory entries */
-trp_gen(static, dent_, struct repo_dirent, children, dent, repo_dirent_name_cmp);
+trp_gen(static, dent_, struct repo_dirent, children, dent, repo_dirent_name_cmp)
 
 uint32_t next_blob_mark(void)
 {
@@ -87,7 +87,8 @@ static struct repo_dir *repo_clone_dir(struct repo_dir *orig_dir)
        return dir_pointer(new_o);
 }
 
-static struct repo_dirent *repo_read_dirent(uint32_t revision, uint32_t *path)
+static struct repo_dirent *repo_read_dirent(uint32_t revision,
+                                           const uint32_t *path)
 {
        uint32_t name = 0;
        struct repo_dirent *key = dent_pointer(dent_alloc(1));
@@ -105,7 +106,7 @@ static struct repo_dirent *repo_read_dirent(uint32_t revision, uint32_t *path)
        return dent;
 }
 
-static void repo_write_dirent(uint32_t *path, uint32_t mode,
+static void repo_write_dirent(const uint32_t *path, uint32_t mode,
                              uint32_t content_offset, uint32_t del)
 {
        uint32_t name, revision, dir_o = ~0, parent_dir_o = ~0;
@@ -157,42 +158,37 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode,
                dent_remove(&dir_pointer(parent_dir_o)->entries, dent);
 }
 
-uint32_t repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst)
+uint32_t repo_read_path(const uint32_t *path)
 {
-       uint32_t mode = 0, content_offset = 0;
-       struct repo_dirent *src_dent;
-       src_dent = repo_read_dirent(revision, src);
-       if (src_dent != NULL) {
-               mode = src_dent->mode;
-               content_offset = src_dent->content_offset;
-               repo_write_dirent(dst, mode, content_offset, 0);
-       }
-       return mode;
+       uint32_t content_offset = 0;
+       struct repo_dirent *dent = repo_read_dirent(active_commit, path);
+       if (dent != NULL)
+               content_offset = dent->content_offset;
+       return content_offset;
 }
 
-void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark)
+uint32_t repo_read_mode(const uint32_t *path)
 {
-       repo_write_dirent(path, mode, blob_mark, 0);
+       struct repo_dirent *dent = repo_read_dirent(active_commit, path);
+       if (dent == NULL)
+               die("invalid dump: path to be modified is missing");
+       return dent->mode;
 }
 
-uint32_t repo_replace(uint32_t *path, uint32_t blob_mark)
+void repo_copy(uint32_t revision, const uint32_t *src, const uint32_t *dst)
 {
-       uint32_t mode = 0;
+       uint32_t mode = 0, content_offset = 0;
        struct repo_dirent *src_dent;
-       src_dent = repo_read_dirent(active_commit, path);
+       src_dent = repo_read_dirent(revision, src);
        if (src_dent != NULL) {
                mode = src_dent->mode;
-               repo_write_dirent(path, mode, blob_mark, 0);
+               content_offset = src_dent->content_offset;
+               repo_write_dirent(dst, mode, content_offset, 0);
        }
-       return mode;
 }
 
-void repo_modify(uint32_t *path, uint32_t mode, uint32_t blob_mark)
+void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark)
 {
-       struct repo_dirent *src_dent;
-       src_dent = repo_read_dirent(active_commit, path);
-       if (src_dent != NULL && blob_mark == 0)
-               blob_mark = src_dent->content_offset;
        repo_write_dirent(path, mode, blob_mark, 0);
 }
 
@@ -282,8 +278,9 @@ void repo_diff(uint32_t r1, uint32_t r2)
                    repo_commit_root_dir(commit_pointer(r2)));
 }
 
-void repo_commit(uint32_t revision, uint32_t author, char *log, uint32_t uuid,
-                uint32_t url, unsigned long timestamp)
+void repo_commit(uint32_t revision, const char *author,
+               const struct strbuf *log, const char *uuid, const char *url,
+               unsigned long timestamp)
 {
        fast_export_commit(revision, author, log, uuid, url, timestamp);
        dent_commit();
index 5476175922740eaba663533a58deedfa981de659..37bde2e37484071998edbe790d38d7b19eb24fb5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef REPO_TREE_H_
 #define REPO_TREE_H_
 
-#include "git-compat-util.h"
+struct strbuf;
 
 #define REPO_MODE_DIR 0040000
 #define REPO_MODE_BLB 0100644
 #define REPO_MAX_PATH_DEPTH 1000
 
 uint32_t next_blob_mark(void);
-uint32_t repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst);
+void repo_copy(uint32_t revision, const uint32_t *src, const uint32_t *dst);
 void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark);
-uint32_t repo_replace(uint32_t *path, uint32_t blob_mark);
-void repo_modify(uint32_t *path, uint32_t mode, uint32_t blob_mark);
+uint32_t repo_read_path(const uint32_t *path);
+uint32_t repo_read_mode(const uint32_t *path);
 void repo_delete(uint32_t *path);
-void repo_commit(uint32_t revision, uint32_t author, char *log, uint32_t uuid,
-                uint32_t url, long unsigned timestamp);
+void repo_commit(uint32_t revision, const char *author,
+               const struct strbuf *log, const char *uuid, const char *url,
+               long unsigned timestamp);
 void repo_diff(uint32_t r1, uint32_t r2);
 void repo_init(void);
 void repo_reset(void);
index f5b1da836e01bd17254b50ab3c88bae01eee200d..8af8d54d6ef41a2e84e500bd0d1a5523e59f8a32 100644 (file)
@@ -30,7 +30,7 @@ static int node_cmp(struct node *a, struct node *b)
 }
 
 /* Build a Treap from the node structure (a trp_node w/ offset) */
-trp_gen(static, tree_, struct node, children, node, node_cmp);
+trp_gen(static, tree_, struct node, children, node, node_cmp)
 
 const char *pool_fetch(uint32_t entry)
 {
index 2ad2c307dd6e8f4bddf5cbd9c588973a085bf870..572a99596657b85cbda372a9107a43c6c2fb44b2 100644 (file)
 #include "repo_tree.h"
 #include "fast_export.h"
 #include "line_buffer.h"
-#include "obj_pool.h"
 #include "string_pool.h"
+#include "strbuf.h"
+
+/*
+ * Compare start of string to literal of equal length;
+ * must be guarded by length test.
+ */
+#define constcmp(s, ref) memcmp(s, ref, sizeof(ref) - 1)
 
 #define NODEACT_REPLACE 4
 #define NODEACT_DELETE 3
 #define LENGTH_UNKNOWN (~0)
 #define DATE_RFC2822_LEN 31
 
-/* Create memory pool for log messages */
-obj_pool_gen(log, char, 4096)
-
-static char* log_copy(uint32_t length, char *log)
-{
-       char *buffer;
-       log_free(log_pool.size);
-       buffer = log_pointer(log_alloc(length));
-       strncpy(buffer, log, length);
-       return buffer;
-}
+static struct line_buffer input = LINE_BUFFER_INIT;
 
 static struct {
-       uint32_t action, propLength, textLength, srcRev, srcMode, mark, type;
+       uint32_t action, propLength, textLength, srcRev, type;
        uint32_t src[REPO_MAX_PATH_DEPTH], dst[REPO_MAX_PATH_DEPTH];
+       uint32_t text_delta, prop_delta;
 } node_ctx;
 
 static struct {
-       uint32_t revision, author;
+       uint32_t revision;
        unsigned long timestamp;
-       char *log;
+       struct strbuf log, author;
 } rev_ctx;
 
 static struct {
-       uint32_t version, uuid, url;
+       uint32_t version;
+       struct strbuf uuid, url;
 } dump_ctx;
 
-static struct {
-       uint32_t svn_log, svn_author, svn_date, svn_executable, svn_special, uuid,
-               revision_number, node_path, node_kind, node_action,
-               node_copyfrom_path, node_copyfrom_rev, text_content_length,
-               prop_content_length, content_length, svn_fs_dump_format_version;
-} keys;
-
 static void reset_node_ctx(char *fname)
 {
        node_ctx.type = 0;
@@ -69,126 +60,223 @@ static void reset_node_ctx(char *fname)
        node_ctx.textLength = LENGTH_UNKNOWN;
        node_ctx.src[0] = ~0;
        node_ctx.srcRev = 0;
-       node_ctx.srcMode = 0;
        pool_tok_seq(REPO_MAX_PATH_DEPTH, node_ctx.dst, "/", fname);
-       node_ctx.mark = 0;
+       node_ctx.text_delta = 0;
+       node_ctx.prop_delta = 0;
 }
 
 static void reset_rev_ctx(uint32_t revision)
 {
        rev_ctx.revision = revision;
        rev_ctx.timestamp = 0;
-       rev_ctx.log = NULL;
-       rev_ctx.author = ~0;
+       strbuf_reset(&rev_ctx.log);
+       strbuf_reset(&rev_ctx.author);
 }
 
-static void reset_dump_ctx(uint32_t url)
+static void reset_dump_ctx(const char *url)
 {
-       dump_ctx.url = url;
+       strbuf_reset(&dump_ctx.url);
+       if (url)
+               strbuf_addstr(&dump_ctx.url, url);
        dump_ctx.version = 1;
-       dump_ctx.uuid = ~0;
+       strbuf_reset(&dump_ctx.uuid);
+}
+
+static void handle_property(const struct strbuf *key_buf,
+                               struct strbuf *val,
+                               uint32_t *type_set)
+{
+       const char *key = key_buf->buf;
+       size_t keylen = key_buf->len;
+
+       switch (keylen + 1) {
+       case sizeof("svn:log"):
+               if (constcmp(key, "svn:log"))
+                       break;
+               if (!val)
+                       die("invalid dump: unsets svn:log");
+               strbuf_swap(&rev_ctx.log, val);
+               break;
+       case sizeof("svn:author"):
+               if (constcmp(key, "svn:author"))
+                       break;
+               if (!val)
+                       strbuf_reset(&rev_ctx.author);
+               else
+                       strbuf_swap(&rev_ctx.author, val);
+               break;
+       case sizeof("svn:date"):
+               if (constcmp(key, "svn:date"))
+                       break;
+               if (!val)
+                       die("invalid dump: unsets svn:date");
+               if (parse_date_basic(val->buf, &rev_ctx.timestamp, NULL))
+                       warning("invalid timestamp: %s", val->buf);
+               break;
+       case sizeof("svn:executable"):
+       case sizeof("svn:special"):
+               if (keylen == strlen("svn:executable") &&
+                   constcmp(key, "svn:executable"))
+                       break;
+               if (keylen == strlen("svn:special") &&
+                   constcmp(key, "svn:special"))
+                       break;
+               if (*type_set) {
+                       if (!val)
+                               return;
+                       die("invalid dump: sets type twice");
+               }
+               if (!val) {
+                       node_ctx.type = REPO_MODE_BLB;
+                       return;
+               }
+               *type_set = 1;
+               node_ctx.type = keylen == strlen("svn:executable") ?
+                               REPO_MODE_EXE :
+                               REPO_MODE_LNK;
+       }
 }
 
-static void init_keys(void)
+static void die_short_read(void)
 {
-       keys.svn_log = pool_intern("svn:log");
-       keys.svn_author = pool_intern("svn:author");
-       keys.svn_date = pool_intern("svn:date");
-       keys.svn_executable = pool_intern("svn:executable");
-       keys.svn_special = pool_intern("svn:special");
-       keys.uuid = pool_intern("UUID");
-       keys.revision_number = pool_intern("Revision-number");
-       keys.node_path = pool_intern("Node-path");
-       keys.node_kind = pool_intern("Node-kind");
-       keys.node_action = pool_intern("Node-action");
-       keys.node_copyfrom_path = pool_intern("Node-copyfrom-path");
-       keys.node_copyfrom_rev = pool_intern("Node-copyfrom-rev");
-       keys.text_content_length = pool_intern("Text-content-length");
-       keys.prop_content_length = pool_intern("Prop-content-length");
-       keys.content_length = pool_intern("Content-length");
-       keys.svn_fs_dump_format_version = pool_intern("SVN-fs-dump-format-version");
+       if (buffer_ferror(&input))
+               die_errno("error reading dump file");
+       die("invalid dump: unexpected end of file");
 }
 
 static void read_props(void)
 {
-       uint32_t len;
-       uint32_t key = ~0;
-       char *val = NULL;
-       char *t;
-       while ((t = buffer_read_line()) && strcmp(t, "PROPS-END")) {
-               if (!strncmp(t, "K ", 2)) {
-                       len = atoi(&t[2]);
-                       key = pool_intern(buffer_read_string(len));
-                       buffer_read_line();
-               } else if (!strncmp(t, "V ", 2)) {
-                       len = atoi(&t[2]);
-                       val = buffer_read_string(len);
-                       if (key == keys.svn_log) {
-                               /* Value length excludes terminating nul. */
-                               rev_ctx.log = log_copy(len + 1, val);
-                       } else if (key == keys.svn_author) {
-                               rev_ctx.author = pool_intern(val);
-                       } else if (key == keys.svn_date) {
-                               if (parse_date_basic(val, &rev_ctx.timestamp, NULL))
-                                       fprintf(stderr, "Invalid timestamp: %s\n", val);
-                       } else if (key == keys.svn_executable) {
-                               node_ctx.type = REPO_MODE_EXE;
-                       } else if (key == keys.svn_special) {
-                               node_ctx.type = REPO_MODE_LNK;
-                       }
-                       key = ~0;
-                       buffer_read_line();
+       static struct strbuf key = STRBUF_INIT;
+       static struct strbuf val = STRBUF_INIT;
+       const char *t;
+       /*
+        * NEEDSWORK: to support simple mode changes like
+        *      K 11
+        *      svn:special
+        *      V 1
+        *      *
+        *      D 14
+        *      svn:executable
+        * we keep track of whether a mode has been set and reset to
+        * plain file only if not.  We should be keeping track of the
+        * symlink and executable bits separately instead.
+        */
+       uint32_t type_set = 0;
+       while ((t = buffer_read_line(&input)) && strcmp(t, "PROPS-END")) {
+               uint32_t len;
+               const char type = t[0];
+               int ch;
+
+               if (!type || t[1] != ' ')
+                       die("invalid property line: %s\n", t);
+               len = atoi(&t[2]);
+               strbuf_reset(&val);
+               buffer_read_binary(&input, &val, len);
+               if (val.len < len)
+                       die_short_read();
+
+               /* Discard trailing newline. */
+               ch = buffer_read_char(&input);
+               if (ch == EOF)
+                       die_short_read();
+               if (ch != '\n')
+                       die("invalid dump: expected newline after %s", val.buf);
+
+               switch (type) {
+               case 'K':
+                       strbuf_swap(&key, &val);
+                       continue;
+               case 'D':
+                       handle_property(&val, NULL, &type_set);
+                       continue;
+               case 'V':
+                       handle_property(&key, &val, &type_set);
+                       strbuf_reset(&key);
+                       continue;
+               default:
+                       die("invalid property line: %s\n", t);
                }
        }
 }
 
 static void handle_node(void)
 {
-       if (node_ctx.propLength != LENGTH_UNKNOWN && node_ctx.propLength)
-               read_props();
-
-       if (node_ctx.srcRev)
-               node_ctx.srcMode = repo_copy(node_ctx.srcRev, node_ctx.src, node_ctx.dst);
-
-       if (node_ctx.textLength != LENGTH_UNKNOWN &&
-           node_ctx.type != REPO_MODE_DIR)
-               node_ctx.mark = next_blob_mark();
+       uint32_t mark = 0;
+       const uint32_t type = node_ctx.type;
+       const int have_props = node_ctx.propLength != LENGTH_UNKNOWN;
+       const int have_text = node_ctx.textLength != LENGTH_UNKNOWN;
 
+       if (node_ctx.text_delta)
+               die("text deltas not supported");
+       if (have_text)
+               mark = next_blob_mark();
        if (node_ctx.action == NODEACT_DELETE) {
+               if (have_text || have_props || node_ctx.srcRev)
+                       die("invalid dump: deletion node has "
+                               "copyfrom info, text, or properties");
+               repo_delete(node_ctx.dst);
+               return;
+       }
+       if (node_ctx.action == NODEACT_REPLACE) {
                repo_delete(node_ctx.dst);
-       } else if (node_ctx.action == NODEACT_CHANGE ||
-                          node_ctx.action == NODEACT_REPLACE) {
-               if (node_ctx.action == NODEACT_REPLACE &&
-                   node_ctx.type == REPO_MODE_DIR)
-                       repo_replace(node_ctx.dst, node_ctx.mark);
-               else if (node_ctx.propLength != LENGTH_UNKNOWN)
-                       repo_modify(node_ctx.dst, node_ctx.type, node_ctx.mark);
-               else if (node_ctx.textLength != LENGTH_UNKNOWN)
-                       node_ctx.srcMode = repo_replace(node_ctx.dst, node_ctx.mark);
+               node_ctx.action = NODEACT_ADD;
+       }
+       if (node_ctx.srcRev) {
+               repo_copy(node_ctx.srcRev, node_ctx.src, node_ctx.dst);
+               if (node_ctx.action == NODEACT_ADD)
+                       node_ctx.action = NODEACT_CHANGE;
+       }
+       if (have_text && type == REPO_MODE_DIR)
+               die("invalid dump: directories cannot have text attached");
+
+       /*
+        * Decide on the new content (mark) and mode (node_ctx.type).
+        */
+       if (node_ctx.action == NODEACT_CHANGE && !~*node_ctx.dst) {
+               if (type != REPO_MODE_DIR)
+                       die("invalid dump: root of tree is not a regular file");
+       } else if (node_ctx.action == NODEACT_CHANGE) {
+               uint32_t mode;
+               if (!have_text)
+                       mark = repo_read_path(node_ctx.dst);
+               mode = repo_read_mode(node_ctx.dst);
+               if (mode == REPO_MODE_DIR && type != REPO_MODE_DIR)
+                       die("invalid dump: cannot modify a directory into a file");
+               if (mode != REPO_MODE_DIR && type == REPO_MODE_DIR)
+                       die("invalid dump: cannot modify a file into a directory");
+               node_ctx.type = mode;
        } else if (node_ctx.action == NODEACT_ADD) {
-               if (node_ctx.srcRev && node_ctx.propLength != LENGTH_UNKNOWN)
-                       repo_modify(node_ctx.dst, node_ctx.type, node_ctx.mark);
-               else if (node_ctx.srcRev && node_ctx.textLength != LENGTH_UNKNOWN)
-                       node_ctx.srcMode = repo_replace(node_ctx.dst, node_ctx.mark);
-               else if ((node_ctx.type == REPO_MODE_DIR && !node_ctx.srcRev) ||
-                        node_ctx.textLength != LENGTH_UNKNOWN)
-                       repo_add(node_ctx.dst, node_ctx.type, node_ctx.mark);
+               if (!have_text && type != REPO_MODE_DIR)
+                       die("invalid dump: adds node without text");
+       } else {
+               die("invalid dump: Node-path block lacks Node-action");
        }
 
-       if (node_ctx.propLength == LENGTH_UNKNOWN && node_ctx.srcMode)
-               node_ctx.type = node_ctx.srcMode;
+       /*
+        * Adjust mode to reflect properties.
+        */
+       if (have_props) {
+               if (!node_ctx.prop_delta)
+                       node_ctx.type = type;
+               if (node_ctx.propLength)
+                       read_props();
+       }
 
-       if (node_ctx.mark)
-               fast_export_blob(node_ctx.type, node_ctx.mark, node_ctx.textLength);
-       else if (node_ctx.textLength != LENGTH_UNKNOWN)
-               buffer_skip_bytes(node_ctx.textLength);
+       /*
+        * Save the result.
+        */
+       repo_add(node_ctx.dst, node_ctx.type, mark);
+       if (have_text)
+               fast_export_blob(node_ctx.type, mark,
+                                node_ctx.textLength, &input);
 }
 
 static void handle_revision(void)
 {
        if (rev_ctx.revision)
-               repo_commit(rev_ctx.revision, rev_ctx.author, rev_ctx.log,
-                       dump_ctx.uuid, dump_ctx.url, rev_ctx.timestamp);
+               repo_commit(rev_ctx.revision, rev_ctx.author.buf,
+                       &rev_ctx.log, dump_ctx.uuid.buf, dump_ctx.url.buf,
+                       rev_ctx.timestamp);
 }
 
 void svndump_read(const char *url)
@@ -197,44 +285,65 @@ void svndump_read(const char *url)
        char *t;
        uint32_t active_ctx = DUMP_CTX;
        uint32_t len;
-       uint32_t key;
 
-       reset_dump_ctx(pool_intern(url));
-       while ((t = buffer_read_line())) {
-               val = strstr(t, ": ");
+       reset_dump_ctx(url);
+       while ((t = buffer_read_line(&input))) {
+               val = strchr(t, ':');
                if (!val)
                        continue;
-               *val++ = '\0';
-               *val++ = '\0';
-               key = pool_intern(t);
+               val++;
+               if (*val != ' ')
+                       continue;
+               val++;
 
-               if (key == keys.svn_fs_dump_format_version) {
+               /* strlen(key) + 1 */
+               switch (val - t - 1) {
+               case sizeof("SVN-fs-dump-format-version"):
+                       if (constcmp(t, "SVN-fs-dump-format-version"))
+                               continue;
                        dump_ctx.version = atoi(val);
-                       if (dump_ctx.version > 2)
-                               die("expected svn dump format version <= 2, found %"PRIu32,
+                       if (dump_ctx.version > 3)
+                               die("expected svn dump format version <= 3, found %"PRIu32,
                                    dump_ctx.version);
-               } else if (key == keys.uuid) {
-                       dump_ctx.uuid = pool_intern(val);
-               } else if (key == keys.revision_number) {
+                       break;
+               case sizeof("UUID"):
+                       if (constcmp(t, "UUID"))
+                               continue;
+                       strbuf_reset(&dump_ctx.uuid);
+                       strbuf_addstr(&dump_ctx.uuid, val);
+                       break;
+               case sizeof("Revision-number"):
+                       if (constcmp(t, "Revision-number"))
+                               continue;
                        if (active_ctx == NODE_CTX)
                                handle_node();
                        if (active_ctx != DUMP_CTX)
                                handle_revision();
                        active_ctx = REV_CTX;
                        reset_rev_ctx(atoi(val));
-               } else if (key == keys.node_path) {
-                       if (active_ctx == NODE_CTX)
-                               handle_node();
-                       active_ctx = NODE_CTX;
-                       reset_node_ctx(val);
-               } else if (key == keys.node_kind) {
+                       break;
+               case sizeof("Node-path"):
+                       if (prefixcmp(t, "Node-"))
+                               continue;
+                       if (!constcmp(t + strlen("Node-"), "path")) {
+                               if (active_ctx == NODE_CTX)
+                                       handle_node();
+                               active_ctx = NODE_CTX;
+                               reset_node_ctx(val);
+                               break;
+                       }
+                       if (constcmp(t + strlen("Node-"), "kind"))
+                               continue;
                        if (!strcmp(val, "dir"))
                                node_ctx.type = REPO_MODE_DIR;
                        else if (!strcmp(val, "file"))
                                node_ctx.type = REPO_MODE_BLB;
                        else
                                fprintf(stderr, "Unknown node-kind: %s\n", val);
-               } else if (key == keys.node_action) {
+                       break;
+               case sizeof("Node-action"):
+                       if (constcmp(t, "Node-action"))
+                               continue;
                        if (!strcmp(val, "delete")) {
                                node_ctx.action = NODEACT_DELETE;
                        } else if (!strcmp(val, "add")) {
@@ -247,17 +356,44 @@ void svndump_read(const char *url)
                                fprintf(stderr, "Unknown node-action: %s\n", val);
                                node_ctx.action = NODEACT_UNKNOWN;
                        }
-               } else if (key == keys.node_copyfrom_path) {
+                       break;
+               case sizeof("Node-copyfrom-path"):
+                       if (constcmp(t, "Node-copyfrom-path"))
+                               continue;
                        pool_tok_seq(REPO_MAX_PATH_DEPTH, node_ctx.src, "/", val);
-               } else if (key == keys.node_copyfrom_rev) {
+                       break;
+               case sizeof("Node-copyfrom-rev"):
+                       if (constcmp(t, "Node-copyfrom-rev"))
+                               continue;
                        node_ctx.srcRev = atoi(val);
-               } else if (key == keys.text_content_length) {
-                       node_ctx.textLength = atoi(val);
-               } else if (key == keys.prop_content_length) {
+                       break;
+               case sizeof("Text-content-length"):
+                       if (!constcmp(t, "Text-content-length")) {
+                               node_ctx.textLength = atoi(val);
+                               break;
+                       }
+                       if (constcmp(t, "Prop-content-length"))
+                               continue;
                        node_ctx.propLength = atoi(val);
-               } else if (key == keys.content_length) {
+                       break;
+               case sizeof("Text-delta"):
+                       if (!constcmp(t, "Text-delta")) {
+                               node_ctx.text_delta = !strcmp(val, "true");
+                               break;
+                       }
+                       if (constcmp(t, "Prop-delta"))
+                               continue;
+                       node_ctx.prop_delta = !strcmp(val, "true");
+                       break;
+               case sizeof("Content-length"):
+                       if (constcmp(t, "Content-length"))
+                               continue;
                        len = atoi(val);
-                       buffer_read_line();
+                       t = buffer_read_line(&input);
+                       if (!t)
+                               die_short_read();
+                       if (*t)
+                               die("invalid dump: expected blank line after content length header");
                        if (active_ctx == REV_CTX) {
                                read_props();
                        } else if (active_ctx == NODE_CTX) {
@@ -265,34 +401,42 @@ void svndump_read(const char *url)
                                active_ctx = REV_CTX;
                        } else {
                                fprintf(stderr, "Unexpected content length header: %"PRIu32"\n", len);
-                               buffer_skip_bytes(len);
+                               if (buffer_skip_bytes(&input, len) != len)
+                                       die_short_read();
                        }
                }
        }
+       if (buffer_ferror(&input))
+               die_short_read();
        if (active_ctx == NODE_CTX)
                handle_node();
        if (active_ctx != DUMP_CTX)
                handle_revision();
 }
 
-void svndump_init(const char *filename)
+int svndump_init(const char *filename)
 {
-       buffer_init(filename);
+       if (buffer_init(&input, filename))
+               return error("cannot open %s: %s", filename, strerror(errno));
        repo_init();
-       reset_dump_ctx(~0);
+       strbuf_init(&dump_ctx.uuid, 4096);
+       strbuf_init(&dump_ctx.url, 4096);
+       strbuf_init(&rev_ctx.log, 4096);
+       strbuf_init(&rev_ctx.author, 4096);
+       reset_dump_ctx(NULL);
        reset_rev_ctx(0);
        reset_node_ctx(NULL);
-       init_keys();
+       return 0;
 }
 
 void svndump_deinit(void)
 {
-       log_reset();
        repo_reset();
-       reset_dump_ctx(~0);
+       reset_dump_ctx(NULL);
        reset_rev_ctx(0);
        reset_node_ctx(NULL);
-       if (buffer_deinit())
+       strbuf_release(&rev_ctx.log);
+       if (buffer_deinit(&input))
                fprintf(stderr, "Input error\n");
        if (ferror(stdout))
                fprintf(stderr, "Output error\n");
@@ -300,10 +444,10 @@ void svndump_deinit(void)
 
 void svndump_reset(void)
 {
-       log_reset();
-       buffer_reset();
+       buffer_reset(&input);
        repo_reset();
-       reset_dump_ctx(~0);
-       reset_rev_ctx(0);
-       reset_node_ctx(NULL);
+       strbuf_release(&dump_ctx.uuid);
+       strbuf_release(&dump_ctx.url);
+       strbuf_release(&rev_ctx.log);
+       strbuf_release(&rev_ctx.author);
 }
index 93c412f14a4ca48b9de18325c09d69f051d97647..df9ceb0e8d473b65fc22ac142d3856dc4f9980e0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SVNDUMP_H_
 #define SVNDUMP_H_
 
-void svndump_init(const char *filename);
+int svndump_init(const char *filename);
 void svndump_read(const char *url);
 void svndump_deinit(void);
 void svndump_reset(void);
index 4c147d6c48c000bab636fad3edc2fe7da6670948..28290002b9f6434d716a39612f3afc9958c292af 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -209,7 +209,7 @@ int xmkstemp(char *template)
                if (!template[0])
                        template = origtemplate;
 
-               nonrelative_template = make_nonrelative_path(template);
+               nonrelative_template = absolute_path(template);
                errno = saved_errno;
                die_errno("Unable to create temporary file '%s'",
                        nonrelative_template);
@@ -344,7 +344,7 @@ int xmkstemp_mode(char *template, int mode)
                if (!template[0])
                        template = origtemplate;
 
-               nonrelative_template = make_nonrelative_path(template);
+               nonrelative_template = absolute_path(template);
                errno = saved_errno;
                die_errno("Unable to create temporary file '%s'",
                        nonrelative_template);
index 123582b6cbdff90f4665fbf8db2c92d701680e4d..9f4e0ba9c17120ca2903b30b95b6d8fbcc62cd9c 100644 (file)
@@ -32,6 +32,80 @@ static const char *color(int slot, struct wt_status *s)
        return c;
 }
 
+static void status_vprintf(struct wt_status *s, int at_bol, const char *color,
+               const char *fmt, va_list ap, const char *trail)
+{
+       struct strbuf sb = STRBUF_INIT;
+       struct strbuf linebuf = STRBUF_INIT;
+       const char *line, *eol;
+
+       strbuf_vaddf(&sb, fmt, ap);
+       if (!sb.len) {
+               strbuf_addch(&sb, '#');
+               if (!trail)
+                       strbuf_addch(&sb, ' ');
+               color_print_strbuf(s->fp, color, &sb);
+               if (trail)
+                       fprintf(s->fp, "%s", trail);
+               strbuf_release(&sb);
+               return;
+       }
+       for (line = sb.buf; *line; line = eol + 1) {
+               eol = strchr(line, '\n');
+
+               strbuf_reset(&linebuf);
+               if (at_bol) {
+                       strbuf_addch(&linebuf, '#');
+                       if (*line != '\n' && *line != '\t')
+                               strbuf_addch(&linebuf, ' ');
+               }
+               if (eol)
+                       strbuf_add(&linebuf, line, eol - line);
+               else
+                       strbuf_addstr(&linebuf, line);
+               color_print_strbuf(s->fp, color, &linebuf);
+               if (eol)
+                       fprintf(s->fp, "\n");
+               else
+                       break;
+               at_bol = 1;
+       }
+       if (trail)
+               fprintf(s->fp, "%s", trail);
+       strbuf_release(&linebuf);
+       strbuf_release(&sb);
+}
+
+void status_printf_ln(struct wt_status *s, const char *color,
+                       const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       status_vprintf(s, 1, color, fmt, ap, "\n");
+       va_end(ap);
+}
+
+void status_printf(struct wt_status *s, const char *color,
+                       const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       status_vprintf(s, 1, color, fmt, ap, NULL);
+       va_end(ap);
+}
+
+void status_printf_more(struct wt_status *s, const char *color,
+                       const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       status_vprintf(s, 0, color, fmt, ap, NULL);
+       va_end(ap);
+}
+
 void wt_status_prepare(struct wt_status *s)
 {
        unsigned char sha1[20];
@@ -57,33 +131,33 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
 {
        const char *c = color(WT_STATUS_HEADER, s);
 
-       color_fprintf_ln(s->fp, c, "# Unmerged paths:");
+       status_printf_ln(s, c, _("Unmerged paths:"));
        if (!advice_status_hints)
                return;
-       if (s->in_merge)
+       if (s->whence != FROM_COMMIT)
                ;
        else if (!s->is_initial)
-               color_fprintf_ln(s->fp, c, "#   (use \"git reset %s <file>...\" to unstage)", s->reference);
+               status_printf_ln(s, c, _("  (use \"git reset %s <file>...\" to unstage)"), s->reference);
        else
-               color_fprintf_ln(s->fp, c, "#   (use \"git rm --cached <file>...\" to unstage)");
-       color_fprintf_ln(s->fp, c, "#   (use \"git add/rm <file>...\" as appropriate to mark resolution)");
-       color_fprintf_ln(s->fp, c, "#");
+               status_printf_ln(s, c, _("  (use \"git rm --cached <file>...\" to unstage)"));
+       status_printf_ln(s, c, _("  (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
+       status_printf_ln(s, c, "");
 }
 
 static void wt_status_print_cached_header(struct wt_status *s)
 {
        const char *c = color(WT_STATUS_HEADER, s);
 
-       color_fprintf_ln(s->fp, c, "# Changes to be committed:");
+       status_printf_ln(s, c, _("Changes to be committed:"));
        if (!advice_status_hints)
                return;
-       if (s->in_merge)
+       if (s->whence != FROM_COMMIT)
                ; /* NEEDSWORK: use "git reset --unresolve"??? */
        else if (!s->is_initial)
-               color_fprintf_ln(s->fp, c, "#   (use \"git reset %s <file>...\" to unstage)", s->reference);
+               status_printf_ln(s, c, _("  (use \"git reset %s <file>...\" to unstage)"), s->reference);
        else
-               color_fprintf_ln(s->fp, c, "#   (use \"git rm --cached <file>...\" to unstage)");
-       color_fprintf_ln(s->fp, c, "#");
+               status_printf_ln(s, c, _("  (use \"git rm --cached <file>...\" to unstage)"));
+       status_printf_ln(s, c, "");
 }
 
 static void wt_status_print_dirty_header(struct wt_status *s,
@@ -92,17 +166,17 @@ static void wt_status_print_dirty_header(struct wt_status *s,
 {
        const char *c = color(WT_STATUS_HEADER, s);
 
-       color_fprintf_ln(s->fp, c, "# Changes not staged for commit:");
+       status_printf_ln(s, c, _("Changes not staged for commit:"));
        if (!advice_status_hints)
                return;
        if (!has_deleted)
-               color_fprintf_ln(s->fp, c, "#   (use \"git add <file>...\" to update what will be committed)");
+               status_printf_ln(s, c, _("  (use \"git add <file>...\" to update what will be committed)"));
        else
-               color_fprintf_ln(s->fp, c, "#   (use \"git add/rm <file>...\" to update what will be committed)");
-       color_fprintf_ln(s->fp, c, "#   (use \"git checkout -- <file>...\" to discard changes in working directory)");
+               status_printf_ln(s, c, _("  (use \"git add/rm <file>...\" to update what will be committed)"));
+       status_printf_ln(s, c, _("  (use \"git checkout -- <file>...\" to discard changes in working directory)"));
        if (has_dirty_submodules)
-               color_fprintf_ln(s->fp, c, "#   (commit or discard the untracked or modified content in submodules)");
-       color_fprintf_ln(s->fp, c, "#");
+               status_printf_ln(s, c, _("  (commit or discard the untracked or modified content in submodules)"));
+       status_printf_ln(s, c, "");
 }
 
 static void wt_status_print_other_header(struct wt_status *s,
@@ -110,16 +184,16 @@ static void wt_status_print_other_header(struct wt_status *s,
                                         const char *how)
 {
        const char *c = color(WT_STATUS_HEADER, s);
-       color_fprintf_ln(s->fp, c, "# %s files:", what);
+       status_printf_ln(s, c, _("%s files:"), what);
        if (!advice_status_hints)
                return;
-       color_fprintf_ln(s->fp, c, "#   (use \"git %s <file>...\" to include in what will be committed)", how);
-       color_fprintf_ln(s->fp, c, "#");
+       status_printf_ln(s, c, _("  (use \"git %s <file>...\" to include in what will be committed)"), how);
+       status_printf_ln(s, c, "");
 }
 
 static void wt_status_print_trailer(struct wt_status *s)
 {
-       color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
+       status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
 }
 
 #define quote_path quote_path_relative
@@ -130,20 +204,20 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
        const char *c = color(WT_STATUS_UNMERGED, s);
        struct wt_status_change_data *d = it->util;
        struct strbuf onebuf = STRBUF_INIT;
-       const char *one, *how = "bug";
+       const char *one, *how = _("bug");
 
        one = quote_path(it->string, -1, &onebuf, s->prefix);
-       color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "#\t");
+       status_printf(s, color(WT_STATUS_HEADER, s), "\t");
        switch (d->stagemask) {
-       case 1: how = "both deleted:"; break;
-       case 2: how = "added by us:"; break;
-       case 3: how = "deleted by them:"; break;
-       case 4: how = "added by them:"; break;
-       case 5: how = "deleted by us:"; break;
-       case 6: how = "both added:"; break;
-       case 7: how = "both modified:"; break;
-       }
-       color_fprintf(s->fp, c, "%-20s%s\n", how, one);
+       case 1: how = _("both deleted:"); break;
+       case 2: how = _("added by us:"); break;
+       case 3: how = _("deleted by them:"); break;
+       case 4: how = _("added by them:"); break;
+       case 5: how = _("deleted by us:"); break;
+       case 6: how = _("both added:"); break;
+       case 7: how = _("both modified:"); break;
+       }
+       status_printf_more(s, c, "%-20s%s\n", how, one);
        strbuf_release(&onebuf);
 }
 
@@ -171,11 +245,11 @@ static void wt_status_print_change_data(struct wt_status *s,
                if (d->new_submodule_commits || d->dirty_submodule) {
                        strbuf_addstr(&extra, " (");
                        if (d->new_submodule_commits)
-                               strbuf_addf(&extra, "new commits, ");
+                               strbuf_addf(&extra, _("new commits, "));
                        if (d->dirty_submodule & DIRTY_SUBMODULE_MODIFIED)
-                               strbuf_addf(&extra, "modified content, ");
+                               strbuf_addf(&extra, _("modified content, "));
                        if (d->dirty_submodule & DIRTY_SUBMODULE_UNTRACKED)
-                               strbuf_addf(&extra, "untracked content, ");
+                               strbuf_addf(&extra, _("untracked content, "));
                        strbuf_setlen(&extra, extra.len - 2);
                        strbuf_addch(&extra, ')');
                }
@@ -186,40 +260,40 @@ static void wt_status_print_change_data(struct wt_status *s,
        one = quote_path(one_name, -1, &onebuf, s->prefix);
        two = quote_path(two_name, -1, &twobuf, s->prefix);
 
-       color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "#\t");
+       status_printf(s, color(WT_STATUS_HEADER, s), "\t");
        switch (status) {
        case DIFF_STATUS_ADDED:
-               color_fprintf(s->fp, c, "new file:   %s", one);
+               status_printf_more(s, c, _("new file:   %s"), one);
                break;
        case DIFF_STATUS_COPIED:
-               color_fprintf(s->fp, c, "copied:     %s -> %s", one, two);
+               status_printf_more(s, c, _("copied:     %s -> %s"), one, two);
                break;
        case DIFF_STATUS_DELETED:
-               color_fprintf(s->fp, c, "deleted:    %s", one);
+               status_printf_more(s, c, _("deleted:    %s"), one);
                break;
        case DIFF_STATUS_MODIFIED:
-               color_fprintf(s->fp, c, "modified:   %s", one);
+               status_printf_more(s, c, _("modified:   %s"), one);
                break;
        case DIFF_STATUS_RENAMED:
-               color_fprintf(s->fp, c, "renamed:    %s -> %s", one, two);
+               status_printf_more(s, c, _("renamed:    %s -> %s"), one, two);
                break;
        case DIFF_STATUS_TYPE_CHANGED:
-               color_fprintf(s->fp, c, "typechange: %s", one);
+               status_printf_more(s, c, _("typechange: %s"), one);
                break;
        case DIFF_STATUS_UNKNOWN:
-               color_fprintf(s->fp, c, "unknown:    %s", one);
+               status_printf_more(s, c, _("unknown:    %s"), one);
                break;
        case DIFF_STATUS_UNMERGED:
-               color_fprintf(s->fp, c, "unmerged:   %s", one);
+               status_printf_more(s, c, _("unmerged:   %s"), one);
                break;
        default:
-               die("bug: unhandled diff status %c", status);
+               die(_("bug: unhandled diff status %c"), status);
        }
        if (extra.len) {
-               color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "%s", extra.buf);
+               status_printf_more(s, color(WT_STATUS_HEADER, s), "%s", extra.buf);
                strbuf_release(&extra);
        }
-       fprintf(s->fp, "\n");
+       status_printf_more(s, GIT_COLOR_NORMAL, "\n");
        strbuf_release(&onebuf);
        strbuf_release(&twobuf);
 }
@@ -323,7 +397,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
     }
        rev.diffopt.format_callback = wt_status_collect_changed_cb;
        rev.diffopt.format_callback_data = s;
-       rev.prune_data = s->pathspec;
+       init_pathspec(&rev.prune_data, s->pathspec);
        run_diff_files(&rev, 0);
 }
 
@@ -348,20 +422,22 @@ static void wt_status_collect_changes_index(struct wt_status *s)
        rev.diffopt.detect_rename = 1;
        rev.diffopt.rename_limit = 200;
        rev.diffopt.break_opt = 0;
-       rev.prune_data = s->pathspec;
+       init_pathspec(&rev.prune_data, s->pathspec);
        run_diff_index(&rev, 1);
 }
 
 static void wt_status_collect_changes_initial(struct wt_status *s)
 {
+       struct pathspec pathspec;
        int i;
 
+       init_pathspec(&pathspec, s->pathspec);
        for (i = 0; i < active_nr; i++) {
                struct string_list_item *it;
                struct wt_status_change_data *d;
                struct cache_entry *ce = active_cache[i];
 
-               if (!ce_path_match(ce, s->pathspec))
+               if (!ce_path_match(ce, &pathspec))
                        continue;
                it = string_list_insert(&s->change, ce->name);
                d = it->util;
@@ -376,6 +452,7 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
                else
                        d->index_status = DIFF_STATUS_ADDED;
        }
+       free_pathspec(&pathspec);
 }
 
 static void wt_status_collect_untracked(struct wt_status *s)
@@ -573,9 +650,9 @@ static void wt_status_print_other(struct wt_status *s,
        for (i = 0; i < l->nr; i++) {
                struct string_list_item *it;
                it = &(l->items[i]);
-               color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "#\t");
-               color_fprintf_ln(s->fp, color(WT_STATUS_UNTRACKED, s), "%s",
-                                quote_path(it->string, strlen(it->string),
+               status_printf(s, color(WT_STATUS_HEADER, s), "\t");
+               status_printf_more(s, color(WT_STATUS_UNTRACKED, s),
+                       "%s\n", quote_path(it->string, strlen(it->string),
                                            &buf, s->prefix));
        }
        strbuf_release(&buf);
@@ -633,26 +710,26 @@ void wt_status_print(struct wt_status *s)
        const char *branch_status_color = color(WT_STATUS_HEADER, s);
 
        if (s->branch) {
-               const char *on_what = "On branch ";
+               const char *on_what = _("On branch ");
                const char *branch_name = s->branch;
                if (!prefixcmp(branch_name, "refs/heads/"))
                        branch_name += 11;
                else if (!strcmp(branch_name, "HEAD")) {
                        branch_name = "";
                        branch_status_color = color(WT_STATUS_NOBRANCH, s);
-                       on_what = "Not currently on any branch.";
+                       on_what = _("Not currently on any branch.");
                }
-               color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "# ");
-               color_fprintf(s->fp, branch_status_color, "%s", on_what);
-               color_fprintf_ln(s->fp, branch_color, "%s", branch_name);
+               status_printf(s, color(WT_STATUS_HEADER, s), "");
+               status_printf_more(s, branch_status_color, "%s", on_what);
+               status_printf_more(s, branch_color, "%s\n", branch_name);
                if (!s->is_initial)
                        wt_status_print_tracking(s);
        }
 
        if (s->is_initial) {
-               color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
-               color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "# Initial commit");
-               color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
+               status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
+               status_printf_ln(s, color(WT_STATUS_HEADER, s), _("Initial commit"));
+               status_printf_ln(s, color(WT_STATUS_HEADER, s), "");
        }
 
        wt_status_print_updated(s);
@@ -665,38 +742,38 @@ void wt_status_print(struct wt_status *s)
                wt_status_print_submodule_summary(s, 1);  /* unstaged */
        }
        if (s->show_untracked_files) {
-               wt_status_print_other(s, &s->untracked, "Untracked", "add");
+               wt_status_print_other(s, &s->untracked, _("Untracked"), "add");
                if (s->show_ignored_files)
-                       wt_status_print_other(s, &s->ignored, "Ignored", "add -f");
+                       wt_status_print_other(s, &s->ignored, _("Ignored"), "add -f");
        } else if (s->commitable)
-               fprintf(s->fp, "# Untracked files not listed%s\n",
+               status_printf_ln(s, GIT_COLOR_NORMAL, _("Untracked files not listed%s"),
                        advice_status_hints
-                       ? " (use -u option to show untracked files)" : "");
+                       ? _(" (use -u option to show untracked files)") : "");
 
        if (s->verbose)
                wt_status_print_verbose(s);
        if (!s->commitable) {
                if (s->amend)
-                       fprintf(s->fp, "# No changes\n");
+                       status_printf_ln(s, GIT_COLOR_NORMAL, _("No changes"));
                else if (s->nowarn)
                        ; /* nothing */
                else if (s->workdir_dirty)
-                       printf("no changes added to commit%s\n",
+                       printf(_("no changes added to commit%s\n"),
                                advice_status_hints
-                               ? " (use \"git add\" and/or \"git commit -a\")" : "");
+                               ? _(" (use \"git add\" and/or \"git commit -a\")") : "");
                else if (s->untracked.nr)
-                       printf("nothing added to commit but untracked files present%s\n",
+                       printf(_("nothing added to commit but untracked files present%s\n"),
                                advice_status_hints
-                               ? " (use \"git add\" to track)" : "");
+                               ? _(" (use \"git add\" to track)") : "");
                else if (s->is_initial)
-                       printf("nothing to commit%s\n", advice_status_hints
-                               ? " (create/copy files and use \"git add\" to track)" : "");
+                       printf(_("nothing to commit%s\n"), advice_status_hints
+                               ? _(" (create/copy files and use \"git add\" to track)") : "");
                else if (!s->show_untracked_files)
-                       printf("nothing to commit%s\n", advice_status_hints
-                               ? " (use -u to show untracked files)" : "");
+                       printf(_("nothing to commit%s\n"), advice_status_hints
+                               ? _(" (use -u to show untracked files)") : "");
                else
-                       printf("nothing to commit%s\n", advice_status_hints
-                               ? " (working directory clean)" : "");
+                       printf(_("nothing to commit%s\n"), advice_status_hints
+                               ? _(" (working directory clean)") : "");
        }
 }
 
@@ -804,13 +881,13 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
        if (!prefixcmp(branch_name, "refs/heads/"))
                branch_name += 11;
        else if (!strcmp(branch_name, "HEAD")) {
-               branch_name = "HEAD (no branch)";
+               branch_name = _("HEAD (no branch)");
                branch_color_local = color(WT_STATUS_NOBRANCH, s);
        }
 
        branch = branch_get(s->branch + 11);
        if (s->is_initial)
-               color_fprintf(s->fp, header_color, "Initial commit on ");
+               color_fprintf(s->fp, header_color, _("Initial commit on "));
        if (!stat_tracking_info(branch, &num_ours, &num_theirs)) {
                color_fprintf_ln(s->fp, branch_color_local,
                        "%s", branch_name);
@@ -825,15 +902,15 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
 
        color_fprintf(s->fp, header_color, " [");
        if (!num_ours) {
-               color_fprintf(s->fp, header_color, "behind ");
+               color_fprintf(s->fp, header_color, _("behind "));
                color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
        } else if (!num_theirs) {
-               color_fprintf(s->fp, header_color, "ahead ");
+               color_fprintf(s->fp, header_color, _("ahead "));
                color_fprintf(s->fp, branch_color_local, "%d", num_ours);
        } else {
-               color_fprintf(s->fp, header_color, "ahead ");
+               color_fprintf(s->fp, header_color, _("ahead "));
                color_fprintf(s->fp, branch_color_local, "%d", num_ours);
-               color_fprintf(s->fp, header_color, ", behind ");
+               color_fprintf(s->fp, header_color, _(", behind "));
                color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
        }
 
index 20b17cf4393b8f9acce93320fb97998ad7cd609b..682b4c8f7da2c58f741a958f6488a48fd7b483b4 100644 (file)
@@ -24,6 +24,13 @@ enum untracked_status_type {
        SHOW_ALL_UNTRACKED_FILES
 };
 
+/* from where does this commit originate */
+enum commit_whence {
+       FROM_COMMIT,     /* normal */
+       FROM_MERGE,      /* commit came from merge */
+       FROM_CHERRY_PICK /* commit came from cherry-pick */
+};
+
 struct wt_status_change_data {
        int worktree_status;
        int index_status;
@@ -40,7 +47,7 @@ struct wt_status {
        const char **pathspec;
        int verbose;
        int amend;
-       int in_merge;
+       enum commit_whence whence;
        int nowarn;
        int use_color;
        int relative_paths;
@@ -68,4 +75,11 @@ void wt_status_collect(struct wt_status *s);
 void wt_shortstatus_print(struct wt_status *s, int null_termination, int show_branch);
 void wt_porcelain_print(struct wt_status *s, int null_termination);
 
+void status_printf_ln(struct wt_status *s, const char *color, const char *fmt, ...)
+       ;
+void status_printf(struct wt_status *s, const char *color, const char *fmt, ...)
+       ;
+void status_printf_more(struct wt_status *s, const char *color, const char *fmt, ...)
+       __attribute__((format(printf, 3, 4)));
+
 #endif /* STATUS_H */