git.git
11 years agoi18n: leave \n out of translated diffstat
Nguyễn Thái Ngọc Duy [Thu, 26 Jul 2012 12:52:36 +0000 (19:52 +0700)]
i18n: leave \n out of translated diffstat

GETTEXT_POISON scrapes everything in translated strings, including \n.
t4205.12 however needs this \n in matching the end result. Keep this
\n out of translation to make t4205.12 happy.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jc/test-lib-source-build-options-early'
Junio C Hamano [Wed, 25 Jul 2012 22:47:08 +0000 (15:47 -0700)]
Merge branch 'jc/test-lib-source-build-options-early'

Reorders t/test-lib.sh so that we dot-source GIT-BUILD-OPTIONS that
records the shell and Perl the user told us to use with Git a lot
early, so that test-lib.sh script itself can use "$PERL_PATH" in
one of its early operations.

* jc/test-lib-source-build-options-early:
  test-lib: reorder and include GIT-BUILD-OPTIONS a lot earlier

11 years agoMerge branch 'mm/config-xdg'
Junio C Hamano [Wed, 25 Jul 2012 22:47:04 +0000 (15:47 -0700)]
Merge branch 'mm/config-xdg'

Finishing touches to the XDG support (new feature for 1.7.12) and
tests.

* mm/config-xdg:
  t1306: check that XDG_CONFIG_HOME works
  ignore: make sure we have an xdg path before using it
  attr: make sure we have an xdg path before using it
  test-lib.sh: unset XDG_CONFIG_HOME

11 years agoMerge branch 'cw/rebase-i-root'
Junio C Hamano [Wed, 25 Jul 2012 22:46:59 +0000 (15:46 -0700)]
Merge branch 'cw/rebase-i-root'

Finishing touches to the "rebase -i --root" (new feature for
1.7.12).

* cw/rebase-i-root:
  rebase -i: handle fixup of root commit correctly

11 years agoMerge branch 'mh/maint-revisions-doc'
Junio C Hamano [Wed, 25 Jul 2012 22:46:06 +0000 (15:46 -0700)]
Merge branch 'mh/maint-revisions-doc'

* mh/maint-revisions-doc:
  Enumerate revision range specifiers in the documentation
  Make <refname> documentation more consistent.

11 years agocheckout: don't confuse ref and object flags
Jeff King [Wed, 25 Jul 2012 21:57:30 +0000 (17:57 -0400)]
checkout: don't confuse ref and object flags

When we are leaving a detached HEAD, we do a revision traversal to
check whether we are orphaning any commits, marking the commit we're
leaving as the start of the traversal, and all existing refs as
uninteresting.

Prior to commit 468224e5, we did so by calling for_each_ref, and
feeding each resulting refname to setup_revisions.  Commit 468224e5
refactored this to simply mark the pending objects, saving an extra
lookup.

However, it confused the "flags" parameter to the each_ref_fn
clalback, which is about the flags we found while looking up the ref
with the object flag.  Because REF_ISSYMREF ("this ref is a symbolic
ref, e.g. refs/remotes/origin/HEAD") happens to be the same bit
pattern as SEEN ("we have picked this object up from the pending
list and moved it to revs.commits list"), we incorrectly reported
that a commit previously at the detached HEAD will become
unreachable if the only ref that can reach the commit happens to be
pointed at by a symbolic ref.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-submodule: work with GIT_DIR/GIT_WORK_TREE
Daniel Graña [Sun, 22 Jul 2012 14:49:44 +0000 (11:49 -0300)]
git-submodule: work with GIT_DIR/GIT_WORK_TREE

The combination of GIT_DIR and GIT_WORK_TREE can be used to manage
files in one directory hierarchy while keeping the repository that
keeps track of them outside the directory hierarchy.  For example:

    git init --bare /path/to/there
    alias dotfiles="GIT_DIR=/path/to/there GIT_WORK_TREE=/path/to/here git"

    cd /path/to/here
    dotfiles add file
    dotfiles commit -a -m "add /path/to/here/file"
    ...

lets you manage files under /path/to/here/ in the repository located
at /path/to/there.

git-submodule however fails to add submodules, as it is confused by
GIT_DIR and GIT_WORK_TREE environment variables when it tries to
work in the submodule, like so:

    dotfiles submodule add http://path.to/submodule
    fatal: working tree '/path/to/here' already exists.

Simply unsetting the environment where the command works on the
submodule is sufficient to fix this, as it has set things up so
that GIT_DIR and GIT_WORK_TREE do not even have to point at the
repository and the working tree of the submodule.

Signed-off-by: Daniel Graña <dangra@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agohelp.c::exclude_cmds(): plug a leak
Junio C Hamano [Wed, 25 Jul 2012 18:01:12 +0000 (11:01 -0700)]
help.c::exclude_cmds(): plug a leak

Command name removed from the list of commands via the exclusion
were overwritten and lost without being freed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agohelp.c::uniq: plug a leak
Jeff King [Wed, 25 Jul 2012 16:16:19 +0000 (00:16 +0800)]
help.c::uniq: plug a leak

We observe that the j-1 element can serve the same purpose as the i-1
element that we use in the strcmp(); it is either:

  1. Exactly i-1, when the loop begins (and until we see a duplicate).

  2. The same pointer that was stored at i-1 (if it was not a duplicate,
     and we just copied it into place).

  3. A pointer to an equivalent string (i.e., we rejected i-1 _because_
     it was identical to j-1).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoi18n: rebase: mark messages for translation
Jiang Xin [Wed, 25 Jul 2012 14:53:08 +0000 (22:53 +0800)]
i18n: rebase: mark messages for translation

Mark messages in git-rebase.sh for translation.  While doing this
Jonathan noticed that the comma usage and sentence structure of the
resolvemsg was not quite right, so correct that and its cousins in
git-am.sh and t/t0201-gettext-fallbacks.sh at the same time.

Some tests would start to fail with GETTEXT_POISON turned on after
this update.  Use test_i18ncmp and test_i18ngrep where appropriate
to mark strings that should only be checked in the C locale output
to avoid such issues.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoi18n: New keywords for xgettext extraction from sh
Jiang Xin [Wed, 25 Jul 2012 14:53:07 +0000 (22:53 +0800)]
i18n: New keywords for xgettext extraction from sh

Since we have additional shell wrappers (gettextln and eval_gettextln)
for gettext, we need to take into account these wrappers when running
'make pot' to extract messages from shell scripts.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoEnumerate revision range specifiers in the documentation
Junio C Hamano [Tue, 24 Jul 2012 22:03:50 +0000 (15:03 -0700)]
Enumerate revision range specifiers in the documentation

It was a bit hard to learn how <rev>^@, <rev>^! and various other
forms of range specifiers are used, because they were discussed
mostly in the prose part of the documentation, unlike various forms
of extended SHA-1 expressions that are listed in an enumerated list.

Also add a few more examples showing use of <rev>, <rev>..<rev> and
<rev>^! forms, stolen from a patch by Max Horn.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoUpdate draft release notes to 1.7.12
Junio C Hamano [Tue, 24 Jul 2012 21:08:43 +0000 (14:08 -0700)]
Update draft release notes to 1.7.12

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jc/mergetool-tool-help'
Junio C Hamano [Tue, 24 Jul 2012 21:05:26 +0000 (14:05 -0700)]
Merge branch 'jc/mergetool-tool-help'

"git mergetool" did not support --tool-help option to give the list
of supported backends, like "git difftool" does.

* jc/mergetool-tool-help:
  mergetool: support --tool-help option like difftool does

11 years agoMerge branch 'jk/maint-commit-document-editmsg'
Junio C Hamano [Tue, 24 Jul 2012 21:05:22 +0000 (14:05 -0700)]
Merge branch 'jk/maint-commit-document-editmsg'

Document $GIT_DIR/COMMIT_EDITMSG file.

* jk/maint-commit-document-editmsg:
  commit: document the temporary commit message file

11 years agoMerge branch 'jk/maint-commit-check-committer-early'
Junio C Hamano [Tue, 24 Jul 2012 21:05:18 +0000 (14:05 -0700)]
Merge branch 'jk/maint-commit-check-committer-early'

"git commit --amend" let the user edit the log message and then died
when the human-readable committer name was given insufficiently by
getpwent(3).

* jk/maint-commit-check-committer-early:
  commit: check committer identity more strictly

11 years agoMerge branch 'jk/maint-advise-vaddf'
Junio C Hamano [Tue, 24 Jul 2012 21:05:08 +0000 (14:05 -0700)]
Merge branch 'jk/maint-advise-vaddf'

The advise() function did not use varargs correctly to format
its message.

* jk/maint-advise-vaddf:
  advice: pass varargs to strbuf_vaddf, not strbuf_addf

11 years agot/lib-httpd: handle running under --valgrind
Jeff King [Tue, 24 Jul 2012 13:43:59 +0000 (09:43 -0400)]
t/lib-httpd: handle running under --valgrind

Running the http tests with valgrind does not work for two
reasons:

  1. Apache complains about following the symbolic link from
     git-http-backend to valgrind.sh.

  2. Apache does not pass through the GIT_VALGRIND variable
     to the backend CGI.

This patch fixes both problems. Unfortunately, there is a
slight hack we need to handle passing environment variables
through Apache. If we just tell it:

  PassEnv GIT_VALGRIND

then Apache will complain when GIT_VALGRIND is not set. If
we try:

  SetEnv GIT_VALGRIND ${GIT_VALGRIND}

then when GIT_VALGRIND is not set, it will pass through the
literal "${GIT_VALGRIND}". Instead, we now unconditionally
pass through GIT_VALGRIND from lib-httpd.sh into apache,
even if it is empty.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorebase -i: handle fixup of root commit correctly
Chris Webb [Tue, 24 Jul 2012 12:17:03 +0000 (13:17 +0100)]
rebase -i: handle fixup of root commit correctly

There is a bug with git rebase -i --root when a fixup or squash line is
applied to the new root. We attempt to amend the commit onto which they
apply with git reset --soft HEAD^ followed by a normal commit. Unlike a
real commit --amend, this sequence will fail against a root commit as it
has no parent.

Fix rebase -i to use commit --amend for fixup and squash instead, and
add a test for the case of a fixup of the root commit.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot1306: check that XDG_CONFIG_HOME works
Jeff King [Tue, 24 Jul 2012 12:27:10 +0000 (08:27 -0400)]
t1306: check that XDG_CONFIG_HOME works

This should override $HOME/.config, but we never actually tested it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoignore: make sure we have an xdg path before using it
Matthieu Moy [Tue, 24 Jul 2012 12:26:51 +0000 (14:26 +0200)]
ignore: make sure we have an xdg path before using it

Commit e3ebc35 (config: fix several access(NULL) calls, 2012-07-12) was
fixing access(NULL) calls when trying to access $HOME/.config/git/config,
but missed the ones when trying to access $HOME/.config/git/ignore. Fix
and test this.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoattr: make sure we have an xdg path before using it
Jeff King [Tue, 24 Jul 2012 11:53:57 +0000 (07:53 -0400)]
attr: make sure we have an xdg path before using it

If we don't have a core.attributesfile configured, we fall
back to checking XDG config, which is usually
$HOME/.config/git/attributes.

However, if $HOME is unset, then home_config_paths will return
NULL, and we end up calling fopen(NULL).

Depending on your system, this may or may not cause the
accompanying test to fail (e.g., on Linux and glibc, the
address will go straight to open, which will return EFAULT).
However, valgrind will reliably notice the error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotest-lib.sh: unset XDG_CONFIG_HOME
Jeff King [Tue, 24 Jul 2012 11:53:05 +0000 (07:53 -0400)]
test-lib.sh: unset XDG_CONFIG_HOME

Now that git respects XDG_CONFIG_HOME for some lookups, we
must be sure to cleanse the test environment. Otherwise, the
user's XDG_CONFIG_HOME could influence the test results.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoGit 1.7.12-rc0 v1.7.12-rc0
Junio C Hamano [Tue, 24 Jul 2012 04:02:06 +0000 (21:02 -0700)]
Git 1.7.12-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jn/block-sha1'
Junio C Hamano [Tue, 24 Jul 2012 03:56:46 +0000 (20:56 -0700)]
Merge branch 'jn/block-sha1'

The code to load a word one-byte-at-a-time was optimized into a
word-wide load instruction even when the pointer was not aligned,
which caused issues on architectures that do not like unaligned
access.

* jn/block-sha1:
  Makefile: BLK_SHA1 does not require fast htonl() and unaligned loads
  block-sha1: put expanded macro parameters in parentheses
  block-sha1: avoid pointer conversion that violates alignment constraints

11 years agoMerge branch 'jn/make-assembly-in-right-directory'
Junio C Hamano [Tue, 24 Jul 2012 03:56:39 +0000 (20:56 -0700)]
Merge branch 'jn/make-assembly-in-right-directory'

* jn/make-assembly-in-right-directory:
  Makefile: fix location of listing produced by "make subdir/foo.s"

11 years agoMerge branch 'th/difftool-diffall'
Junio C Hamano [Tue, 24 Jul 2012 03:56:17 +0000 (20:56 -0700)]
Merge branch 'th/difftool-diffall'

Finishing touches to difftool --dirdiff.

* th/difftool-diffall:
  difftool: only copy back files modified during directory diff

11 years agoMerge branch 'sl/autoconf'
Junio C Hamano [Tue, 24 Jul 2012 03:56:13 +0000 (20:56 -0700)]
Merge branch 'sl/autoconf'

* sl/autoconf:
  build: reconfigure automatically if configure.ac changes
  build: "make clean" should not remove configure-generated files
  autoconf: use AC_CONFIG_COMMANDS instead of ad-hoc 'config.mak.append'
  autoconf: remove few redundant semicolons
  autoconf: remove some redundant shell indirections
  autoconf: GIT_CONF_APPEND_LINE -> GIT_CONF_SUBST
  autoconf: GIT_CONF_APPEND_LINE: change signature

11 years agoMerge branch 'jv/maint-no-ext-diff'
Junio C Hamano [Tue, 24 Jul 2012 03:56:03 +0000 (20:56 -0700)]
Merge branch 'jv/maint-no-ext-diff'

"git diff --no-ext-diff" did not output anything for a typechange
filepair when GIT_EXTERNAL_DIFF is in effect.

* jv/maint-no-ext-diff:
  diff: test precedence of external diff drivers
  diff: correctly disable external_diff with --no-ext-diff

11 years agoMerge branch 'kk/maint-commit-tree'
Junio C Hamano [Tue, 24 Jul 2012 03:55:53 +0000 (20:55 -0700)]
Merge branch 'kk/maint-commit-tree'

* kk/maint-commit-tree:
  Revert "git-commit-tree(1): update synopsis"
  commit-tree: resurrect command line parsing updates

11 years agoMerge branch 'jk/mediawiki-credential'
Junio C Hamano [Tue, 24 Jul 2012 03:55:33 +0000 (20:55 -0700)]
Merge branch 'jk/mediawiki-credential'

* jk/mediawiki-credential:
  mw-to-git: use git-credential's URL parser
  credential: convert "url" attribute into its parsed subparts
  mw-to-git: check blank credential attributes via length
  docs/credential: minor clarity fixups

11 years agoMerge branch 'mm/mediawiki-usability'
Junio C Hamano [Tue, 24 Jul 2012 03:55:25 +0000 (20:55 -0700)]
Merge branch 'mm/mediawiki-usability'

* mm/mediawiki-usability:
  git-remote-mediawiki: allow page names with a ':'
  git-remote-mediawiki: fix incorrect test usage in test
  git-remote-mediawiki: properly deal with invalid remote revisions
  git-remote-mediawiki: show progress information when getting last remote revision
  git-remote-mediawiki: show progress information when listing pages
  git-remote-mediawiki: use --force when adding notes
  git-remote-mediawiki: get rid of O(N^2) loop
  git-remote-mediawiki: make mediafiles export optional
  git-remote-mediawiki: actually send empty comment when they're empty
  git-remote-mediawiki: don't split namespaces with spaces

11 years agoMerge branch 'sn/doc-typofix'
Junio C Hamano [Tue, 24 Jul 2012 03:55:21 +0000 (20:55 -0700)]
Merge branch 'sn/doc-typofix'

* sn/doc-typofix:
  doc: A few minor copy edits.

11 years agoMerge branch 'tg/ce-namelen-field'
Junio C Hamano [Tue, 24 Jul 2012 03:55:16 +0000 (20:55 -0700)]
Merge branch 'tg/ce-namelen-field'

Split lower bits of ce_flags field and creates a new ce_namelen
field in the in-core index structure.

* tg/ce-namelen-field:
  Strip namelen out of ce_flags into a ce_namelen field

11 years agoMerge branch 'nk/maint-gitweb-log-by-lines'
Junio C Hamano [Tue, 24 Jul 2012 03:55:07 +0000 (20:55 -0700)]
Merge branch 'nk/maint-gitweb-log-by-lines'

Teach gitweb to pay attention to various forms of credits that are
similar to "Signed-off-by:" lines.

* nk/maint-gitweb-log-by-lines:
  gitweb: Add support to Link: tag
  gitweb: Handle other types of tag in git_print_log
  gitweb: Cleanup git_print_log()

11 years agocommit: document the temporary commit message file
Jeff King [Mon, 23 Jul 2012 21:13:12 +0000 (17:13 -0400)]
commit: document the temporary commit message file

We do not document COMMIT_EDITMSG at all, but users may want
to know about it for two reasons:

  1. They may want to tell their editor to configure itself
     for formatting a commit message.

  2. If a commit is aborted by an error, the user may want
     to recover the commit message they typed.

Let's put a note in git-commit(1).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomergetool: support --tool-help option like difftool does
Junio C Hamano [Mon, 23 Jul 2012 21:16:12 +0000 (14:16 -0700)]
mergetool: support --tool-help option like difftool does

This way we do not have to risk the list of tools going out of sync
between the implementation and the documentation.

In the same spirit as bf73fc2 (difftool: print list of valid tools
with '--tool-help', 2012-03-29), trim the list of merge backends in
the documentation.  We do not want to have a complete list of valid
tools; we only want a list to help people guess what kind of things
the tools do to be specified there, and refer them to --tool-help
for a complete list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocommit: check committer identity more strictly
Jeff King [Mon, 23 Jul 2012 18:50:35 +0000 (14:50 -0400)]
commit: check committer identity more strictly

The identity of the committer will ultimately be pulled from
the ident code by commit_tree(). However, we make an attempt
to check the author and committer identity early, before the
user has done any manual work like inputting a commit
message. That lets us abort without them having to worry
about salvaging the work from .git/COMMIT_EDITMSG.

The early check for committer ident does not use the
IDENT_STRICT flag, meaning that it would not find an empty
name field. The motivation was presumably because we did not
want to be too restrictive, as later calls might be more lax
(for example, when we create the reflog entry, we do not
care too much about a real name). However, because
commit_tree will always get a strict identity to put in the
commit object itself, there is no point in being lax only to
die later (and in fact it is harmful, because the user will
have wasted time typing their commit message).

Incidentally, this bug was masked prior to 060d4bb, as the
initial loose call would taint the later strict call. So the
commit would succeed (albeit with a bogus committer line in
the commit object), and nobody noticed that our early check
did not match the later one.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoadvice: pass varargs to strbuf_vaddf, not strbuf_addf
Jeff King [Mon, 23 Jul 2012 18:48:57 +0000 (14:48 -0400)]
advice: pass varargs to strbuf_vaddf, not strbuf_addf

The advise() function takes a variable number of arguments
and converts them into a va_list object to pass to strbuf
for handling. However, we accidentally called strbuf_addf
(that takes a variable number of arguments) instead of
strbuf_vaddf (that takes a va_list).

This bug dates back to v1.7.8.1-1-g23cb5bf, but we never
noticed because none of the current callers passes a string
with a format specifier in it. And the compiler did not
notice because the format string is not available at
compile time.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMakefile: BLK_SHA1 does not require fast htonl() and unaligned loads
Jonathan Nieder [Mon, 23 Jul 2012 06:29:14 +0000 (01:29 -0500)]
Makefile: BLK_SHA1 does not require fast htonl() and unaligned loads

block-sha1/ is fast on most known platforms.  Clarify the Makefile to
be less misleading about that.

Early versions of block-sha1/ explicitly relied on fast htonl() and
fast 32-bit loads with arbitrary alignment.  Now it uses those on some
arches but the default behavior is byte-at-a-time access for the sake
of arches like ARM, Alpha, and their kin and it is still pretty fast
on these arches (fast enough to supersede the mozilla SHA1
implementation and the hand-written ARM assembler implementation that
were bundled before).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMakefile: fix location of listing produced by "make subdir/foo.s"
Jonathan Nieder [Sun, 22 Jul 2012 23:47:26 +0000 (18:47 -0500)]
Makefile: fix location of listing produced by "make subdir/foo.s"

When I invoke "make block-sha1/sha1.s", 'make' runs $(CC) -S without
specifying where it should put its output and the output ends up in
./sha1.s.  Confusing.

Add an -o option to the .s rule to fix this.  We were already doing
that for most compiler invocations but had forgotten it for the
assembler listings.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoblock-sha1: put expanded macro parameters in parentheses
Jonathan Nieder [Sun, 22 Jul 2012 23:40:54 +0000 (18:40 -0500)]
block-sha1: put expanded macro parameters in parentheses

't' is currently always a numeric constant, but it can't hurt to
prepare for the day that it becomes useful for a caller to pass in a
more complex expression.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoblock-sha1: avoid pointer conversion that violates alignment constraints
Jonathan Nieder [Sun, 22 Jul 2012 23:39:54 +0000 (18:39 -0500)]
block-sha1: avoid pointer conversion that violates alignment constraints

With 660231aa (block-sha1: support for architectures with memory
alignment restrictions, 2009-08-12), blk_SHA1_Update was modified to
access 32-bit chunks of memory one byte at a time on arches that
prefer that:

#define get_be32(p)    ( \
(*((unsigned char *)(p) + 0) << 24) | \
(*((unsigned char *)(p) + 1) << 16) | \
(*((unsigned char *)(p) + 2) <<  8) | \
(*((unsigned char *)(p) + 3) <<  0) )

The code previously accessed these values by just using htonl(*p).

Unfortunately, Michael noticed on an Alpha machine that git was using
plain 32-bit reads anyway.  As soon as we convert a pointer to int *,
the compiler can assume that the object pointed to is correctly
aligned as an int (C99 section 6.3.2.3 "pointer conversions"
paragraph 7), and gcc takes full advantage by using a single 32-bit
load, resulting in a whole bunch of unaligned access traps.

So we need to obey the alignment constraints even when only dealing
with pointers instead of actual values.  Do so by changing the type
of 'data' to void *.  This patch renames 'data' to 'block' at the same
time to make sure all references are updated to reflect the new type.

Reported-tested-and-explained-by: Michael Cree <mcree@orcon.net.nz>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoUpdate draft release notes to 1.7.12
Junio C Hamano [Sun, 22 Jul 2012 20:20:24 +0000 (13:20 -0700)]
Update draft release notes to 1.7.12

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoSync with 1.7.11.3
Junio C Hamano [Sun, 22 Jul 2012 20:08:22 +0000 (13:08 -0700)]
Sync with 1.7.11.3

11 years agoGit 1.7.11.3 v1.7.11.3
Junio C Hamano [Sun, 22 Jul 2012 20:07:40 +0000 (13:07 -0700)]
Git 1.7.11.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jk/push-delete-ref-error-message' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:04:25 +0000 (13:04 -0700)]
Merge branch 'jk/push-delete-ref-error-message' into maint

The error message from "git push $there :bogo" (and its equivalent
"git push $there --delete bogo") mentioned that we tried and failed
to guess what ref is being deleted based on the LHS of the refspec,
which we don't.

* jk/push-delete-ref-error-message:
  push: don't guess at qualifying remote refs on deletion

11 years agoMerge branch 'ar/clone-honor-umask-at-top' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:04:05 +0000 (13:04 -0700)]
Merge branch 'ar/clone-honor-umask-at-top' into maint

A handful of files and directories we create had tighter than
necessary permission bits when the user wanted to have group
writability (e.g. by setting "umask 002").

* ar/clone-honor-umask-at-top:
  add: create ADD_EDIT.patch with mode 0666
  rerere: make rr-cache fanout directory honor umask
  Restore umasks influence on the permissions of work tree created by clone

11 years agoMerge branch 'cw/amend-commit-without-message' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:03:52 +0000 (13:03 -0700)]
Merge branch 'cw/amend-commit-without-message' into maint

"commit --amend" used to refuse amending a commit with an empty log
message, with or without "--allow-empty-message".

* cw/amend-commit-without-message:
  Allow edit of empty message with commit --amend

11 years agoMerge branch 'jk/maint-commit-amend-only-no-paths' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:03:29 +0000 (13:03 -0700)]
Merge branch 'jk/maint-commit-amend-only-no-paths' into maint

"git commit --amend --only --" was meant to allow "Clever" people to
rewrite the commit message without making any change even when they
have already changes for the next commit added to their index, but
it never worked as advertised since it was introduced in 1.3.0 era.

* jk/maint-commit-amend-only-no-paths:
  commit: fix "--amend --only" with no pathspec

11 years agoMerge branch 'tg/maint-cache-name-compare' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:01:56 +0000 (13:01 -0700)]
Merge branch 'tg/maint-cache-name-compare' into maint

Even though the index can record pathnames longer than 1<<12 bytes,
in some places we were not comparing them in full, potentially
replacing index entries instead of adding.

* tg/maint-cache-name-compare:
  cache_name_compare(): do not truncate while comparing paths

11 years agoMerge branch 'tr/maint-show-walk' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:01:40 +0000 (13:01 -0700)]
Merge branch 'tr/maint-show-walk' into maint

"git show"'s auto-walking behaviour was an unreliable and
unpredictable hack; it now behaves just like "git log" does when it
walks.

* tr/maint-show-walk:
  show: fix "range implies walking"
  Demonstrate git-show is broken with ranges

11 years agoMerge branch 'jc/refactor-diff-stdin' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:01:22 +0000 (13:01 -0700)]
Merge branch 'jc/refactor-diff-stdin' into maint

"git diff", "git status" and anything that internally uses the
comparison machinery was utterly broken when the difference
involved a file with "-" as its name.  This was due to the way "git
diff --no-index" was incorrectly bolted on to the system, making
any comparison that involves a file "-" at the root level
incorrectly read from the standard input.

* jc/refactor-diff-stdin:
  diff-index.c: "git diff" has no need to read blob from the standard input
  diff-index.c: unify handling of command line paths
  diff-index.c: do not pretend paths are pathspecs

11 years agoMerge branch 'mz/empty-rebase-test' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:00:55 +0000 (13:00 -0700)]
Merge branch 'mz/empty-rebase-test' into maint

We did not have test to make sure "git rebase" without extra options
filters out an empty commit in the original history.

* mz/empty-rebase-test:
  add test case for rebase of empty commit

11 years agoMerge branch 'js/fast-export-paths-with-spaces' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:00:45 +0000 (13:00 -0700)]
Merge branch 'js/fast-export-paths-with-spaces' into maint

"git fast-export" produced an input stream for fast-import without
properly quoting pathnames when they contain SPs in them.

* js/fast-export-paths-with-spaces:
  fast-export: quote paths with spaces

11 years agoMerge branch 'cw/no-detaching-an-unborn' into maint
Junio C Hamano [Sun, 22 Jul 2012 20:00:31 +0000 (13:00 -0700)]
Merge branch 'cw/no-detaching-an-unborn' into maint

"git checkout --detach", when you are still on an unborn branch,
should be forbidden, but it wasn't.

* cw/no-detaching-an-unborn:
  git-checkout: disallow --detach on unborn branch

11 years agoMerge branch 'vr/use-our-perl-in-tests' into maint
Junio C Hamano [Sun, 22 Jul 2012 19:59:56 +0000 (12:59 -0700)]
Merge branch 'vr/use-our-perl-in-tests' into maint

Some implementations of Perl terminates "lines" with CRLF even when
the script is operating on just a sequence of bytes.  Make sure to
use "$PERL_PATH", the version of Perl the user told Git to use, in
our tests to avoid unnecessary breakages in tests.

* vr/use-our-perl-in-tests:
  t/README: add a bit more Don'ts
  tests: enclose $PERL_PATH in double quotes
  t/test-lib.sh: export PERL_PATH for use in scripts
  t: Replace 'perl' by $PERL_PATH

11 years agoMerge git://bogomips.org/git-svn
Junio C Hamano [Sun, 22 Jul 2012 19:56:49 +0000 (12:56 -0700)]
Merge git://bogomips.org/git-svn

* git://bogomips.org/git-svn:
  git-svn: don't create master if another head exists

11 years agoMerge branch 'jk/revision-walk-stop-at-max-count'
Junio C Hamano [Sun, 22 Jul 2012 19:56:30 +0000 (12:56 -0700)]
Merge branch 'jk/revision-walk-stop-at-max-count'

"git log -n 1 -- rarely-touched-path" was spending unnecessary
cycles after showing the first change to find the next one, only to
discard it.

* jk/revision-walk-stop-at-max-count:
  revision: avoid work after --max-count is reached

11 years agoMerge branch 'mm/config-xdg'
Junio C Hamano [Sun, 22 Jul 2012 19:56:27 +0000 (12:56 -0700)]
Merge branch 'mm/config-xdg'

* mm/config-xdg:
  config: fix several access(NULL) calls

11 years agoMerge branch 'as/t4012-style-updates'
Junio C Hamano [Sun, 22 Jul 2012 19:56:24 +0000 (12:56 -0700)]
Merge branch 'as/t4012-style-updates'

* as/t4012-style-updates:
  t4012: Use test_must_fail instead of if-else
  t4012: use 'printf' instead of 'dd' to generate a binary file
  t4012: Re-indent test snippets
  t4012: Make --shortstat test more robust
  t4012: Break up pipe into serial redirections
  t4012: Actually quote the sed script
  t4012: Unquote git command fragment in test title
  t4012: modernize style for quoting

11 years agoMerge branch 'pg/maint-1.7.9-am-where-is-patch'
Junio C Hamano [Sun, 22 Jul 2012 19:56:02 +0000 (12:56 -0700)]
Merge branch 'pg/maint-1.7.9-am-where-is-patch'

When "git am" failed, old timers knew to check .git/rebase-apply/patch
to see what went wrong, but we never told the users about it.

* pg/maint-1.7.9-am-where-is-patch:
  am: indicate where a failed patch is to be found

11 years agoMerge branch 'jl/maint-1.7.10-recurse-submodules-with-symlink'
Junio C Hamano [Sun, 22 Jul 2012 19:55:47 +0000 (12:55 -0700)]
Merge branch 'jl/maint-1.7.10-recurse-submodules-with-symlink'

When "git submodule add" clones a submodule repository, it can get
confused where to store the resulting submodule repository in the
superproject's .git/ directory when there is a symbolic link in the
path to the current directory.

* jl/maint-1.7.10-recurse-submodules-with-symlink:
  submodules: don't stumble over symbolic links when cloning recursively

11 years agoMerge branch 'ms/daemon-doc-typo'
Junio C Hamano [Sun, 22 Jul 2012 19:55:40 +0000 (12:55 -0700)]
Merge branch 'ms/daemon-doc-typo'

* ms/daemon-doc-typo:
  Documentation/git-daemon: add missing word

11 years agoMerge branch 'lk/more-helpful-status-hints'
Junio C Hamano [Sun, 22 Jul 2012 19:55:33 +0000 (12:55 -0700)]
Merge branch 'lk/more-helpful-status-hints'

* lk/more-helpful-status-hints:
  status: color in-progress message like other header messages

11 years agoMerge branch 'jc/sha1-name-more'
Junio C Hamano [Sun, 22 Jul 2012 19:55:07 +0000 (12:55 -0700)]
Merge branch 'jc/sha1-name-more'

Teaches the object name parser things like a "git describe" output
is always a commit object, "A" in "git log A" must be a committish,
and "A" and "B" in "git log A...B" both must be committish, etc., to
prolong the lifetime of abbreviated object names.

* jc/sha1-name-more: (27 commits)
  t1512: match the "other" object names
  t1512: ignore whitespaces in wc -l output
  rev-parse --disambiguate=<prefix>
  rev-parse: A and B in "rev-parse A..B" refer to committish
  reset: the command takes committish
  commit-tree: the command wants a tree and commits
  apply: --build-fake-ancestor expects blobs
  sha1_name.c: add support for disambiguating other types
  revision.c: the "log" family, except for "show", takes committish
  revision.c: allow handle_revision_arg() to take other flags
  sha1_name.c: introduce get_sha1_committish()
  sha1_name.c: teach lookup context to get_sha1_with_context()
  sha1_name.c: many short names can only be committish
  sha1_name.c: get_sha1_1() takes lookup flags
  sha1_name.c: get_describe_name() by definition groks only commits
  sha1_name.c: teach get_short_sha1() a commit-only option
  sha1_name.c: allow get_short_sha1() to take other flags
  get_sha1(): fix error status regression
  sha1_name.c: restructure disambiguation of short names
  sha1_name.c: correct misnamed "canonical" and "res"
  ...

11 years agoMerge branch 'jc/maint-filter-branch-epoch-date'
Junio C Hamano [Sun, 22 Jul 2012 19:54:08 +0000 (12:54 -0700)]
Merge branch 'jc/maint-filter-branch-epoch-date'

In 1.7.9 era, we taught "git rebase" about the raw timestamp format
but we did not teach the same trick to "filter-branch", which rolled
a similar logic on its own.  Because of this, "filter-branch" failed
to rewrite commits with ancient timestamps.

* jc/maint-filter-branch-epoch-date:
  t7003: add test to filter a branch with a commit at epoch
  date.c: Fix off by one error in object-header date parsing
  filter-branch: do not forget the '@' prefix to force git-timestamp

11 years agodifftool: only copy back files modified during directory diff
Tim Henigan [Thu, 19 Jul 2012 08:27:09 +0000 (01:27 -0700)]
difftool: only copy back files modified during directory diff

When 'difftool --dir-diff' is used to compare working tree files,
it always copies files from the tmp dir back to the working tree
when the diff tool is closed, even if the files were not modified
by the diff tool.

This causes the file timestamp to change. Files should only be
copied from the tmp dir back to the working copy if they were
actually modified.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuild: reconfigure automatically if configure.ac changes
Stefano Lattarini [Thu, 19 Jul 2012 07:50:02 +0000 (09:50 +0200)]
build: reconfigure automatically if configure.ac changes

This provides a reduced but still useful sibling of the Automake's
"automatic Makefile rebuild" feature.  It's important to note that
we take care to enable the new rules only if the tree that has already
be configured with './configure', so that users relying on manual
configuration won't be negatively impacted.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuild: "make clean" should not remove configure-generated files
Stefano Lattarini [Thu, 19 Jul 2012 07:50:01 +0000 (09:50 +0200)]
build: "make clean" should not remove configure-generated files

Those filed hold variables, settings and information set by the
configuration process run by './configure'; in Autotools-based
build system that kind of stuff should only be removed by
"make distclean".  Having it removed by "make clean" is not only
inconsistent, but causes real confusion for that part of the Git
audience that is used to the Autotools semantics; for example,
an autotools old-timer that has run:

    ./configure --prefix /opt/git

in the past, without running "make distclean" afterwards, would
expect a "make install" issued after a "make clean" to rebuild and
install git in '/opt/git'; but with the current behaviour, the
"make clean" invocation removes (among the other things) the file
'config.mak.autogen', so that the "make install" falls back to the
default prefix of '$HOME', thus installing git in the user's home
directory -- definitely unexpected.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoautoconf: use AC_CONFIG_COMMANDS instead of ad-hoc 'config.mak.append'
Stefano Lattarini [Thu, 19 Jul 2012 07:50:00 +0000 (09:50 +0200)]
autoconf: use AC_CONFIG_COMMANDS instead of ad-hoc 'config.mak.append'

This will allow "./config.status --recheck; ./config.status" to work
correctly as a mean of reconfiguring the tree with the same configure
argument used in the previous "./configure" invocation.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoautoconf: remove few redundant semicolons
Stefano Lattarini [Thu, 19 Jul 2012 07:49:59 +0000 (09:49 +0200)]
autoconf: remove few redundant semicolons

They are merely useless now, but would get in the way of future changes.

No semantic change is intended.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoautoconf: remove some redundant shell indirections
Stefano Lattarini [Thu, 19 Jul 2012 07:49:58 +0000 (09:49 +0200)]
autoconf: remove some redundant shell indirections

They are merely useless now, but would get in the way of future changes.

No semantic change is intended.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoautoconf: GIT_CONF_APPEND_LINE -> GIT_CONF_SUBST
Stefano Lattarini [Thu, 19 Jul 2012 07:49:57 +0000 (09:49 +0200)]
autoconf: GIT_CONF_APPEND_LINE -> GIT_CONF_SUBST

The new name fits better with the macro signature, and underlines the
similarities with the autoconf-provided macro AC_SUBST (which will be
made even more pronounced in planned future commits).

Once again, no semantic change is intended, and indeed no change to the
generated configure script is expected.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoautoconf: GIT_CONF_APPEND_LINE: change signature
Stefano Lattarini [Thu, 19 Jul 2012 07:49:56 +0000 (09:49 +0200)]
autoconf: GIT_CONF_APPEND_LINE: change signature

Change one-argument GIT_CONF_APPEND_LINE([VAR=VAL]) to
GIT_CONF_APPEND_LINE([VAR], [VAL]), that is more similar to the usual
AC_SUBST macro; this is only a preparatory change in view of future
refactorings.

No semantic change is intended.  In fact, the generated configure file
doesn't change at all.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodiff: test precedence of external diff drivers
Jeff King [Thu, 19 Jul 2012 11:49:38 +0000 (07:49 -0400)]
diff: test precedence of external diff drivers

There are three ways to specify an external diff command:
GIT_EXTERNAL_DIFF in the environment, diff.external in the
config, or a "diff" gitattribute. The current order of
precedence is:

  1. gitattribute

  2. GIT_EXTERNAL_DIFF

  3. diff.external

Usually our rule is that environment variables should take
precedence over on-disk config (i.e., option 2 should come
before option 1). However, this situation is trickier than
some, because option 1 is more specific to the individual
file than option 2 (which affects all files), so it might be
preferable. So the current behavior can be seen as
implementing "do the specific thing if we can, but fall back
to this general thing".

This is probably not what we would do if we were writing git
from scratch, but it has been this way for several years,
and is not worth changing. So let's at least document that
this is the way it's supposed to work with a test.

While we're there, let's also make sure that diff.external
(which was not previously tested at all) works by running it
through the same tests as GIT_EXTERNAL_DIFF.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-svn: don't create master if another head exists
Marcin Owsiany [Sun, 24 Jun 2012 21:40:05 +0000 (22:40 +0100)]
git-svn: don't create master if another head exists

git-svn insists on creating the "master" head (unless it exists) on every
"fetch". It is useful that it gets created initially, when no head exists
- users expect this git convention of having a "master" branch on initial
clone.

However creating it when there already is another head does not provide any
value - the ref is never updated, so it just gets stale after a while.  Also,
some users find it annoying that it gets recreated, especially when they would
like the git branch names to follow SVN repository branch names. More
background in http://thread.gmane.org/gmane.comp.version-control.git/115030

Make git-svn skip the "master" creation if HEAD already points at a valid head.
This means "master" does get created on initial "clone" but does not get
recreated once a user deletes it.

Also, make post_fetch_checkout work with any head that is pointed to by HEAD,
not just "master".

Also, use fatal error handling consistent with the rest of the program for
post_fetch_checkout.

Signed-off-by: Marcin Owsiany <marcin@owsiany.pl>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
11 years agomw-to-git: use git-credential's URL parser
Jeff King [Wed, 18 Jul 2012 13:03:08 +0000 (09:03 -0400)]
mw-to-git: use git-credential's URL parser

We can just feed our URL straight to git-credential and it
will parse it for us, saving us some code.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocredential: convert "url" attribute into its parsed subparts
Jeff King [Wed, 18 Jul 2012 12:06:26 +0000 (08:06 -0400)]
credential: convert "url" attribute into its parsed subparts

The git-credential command requires that you feed it a
broken-down credential, which means that the client needs to
parse a URL itself. Since we have our own URL-parsing
routines, we can easily allow the caller to just give us the
URL as-is, saving them some code.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomw-to-git: check blank credential attributes via length
Jeff King [Wed, 18 Jul 2012 12:04:30 +0000 (08:04 -0400)]
mw-to-git: check blank credential attributes via length

When writing a credential to git-credential, we omit fields
that do not have a true value. This will skip empty or
undefined fields (which we want), but will also accidentally
skip usernames or passwords which happen to have a non-true
value (e.g., "0"). Be more careful by checking for non-zero
length.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodocs/credential: minor clarity fixups
Jeff King [Wed, 18 Jul 2012 12:04:02 +0000 (08:04 -0400)]
docs/credential: minor clarity fixups

The text in git-credential(1) was copied from
technical/api-credentials, so it still talks about the
input/output format as coming from git to the helper. Since
the surrounding text already indicates that this format is
used for reading and writing with git credential, we can
just remove the extraneous confusing bits.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodiff: correctly disable external_diff with --no-ext-diff
Junio C Hamano [Wed, 18 Jul 2012 05:08:59 +0000 (22:08 -0700)]
diff: correctly disable external_diff with --no-ext-diff

Upon seeing a type-change filepair, "diff --no-ext-diff" does not
show the usual "deletion followed by addition" split patch and does
not run the external diff driver either.

This is because the logic to disable external diff was placed at a
wrong level in the callchain.  run_diff_cmd() decides to show the
split patch only when external diff driver is not configured or
specified via GIT_EXTERNAL_DIFF environment, but this is done before
checking if --no-ext-diff was given.  To make things worse,
run_diff_cmd() checks --no-ext-diff and disables the output for such
a filepair completely, as the callchain below it (e.g. builtin_diff)
does not want to handle typechange filepairs.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoRevert "git-commit-tree(1): update synopsis"
Junio C Hamano [Tue, 17 Jul 2012 20:11:03 +0000 (13:11 -0700)]
Revert "git-commit-tree(1): update synopsis"

This reverts commit d28436736a078a429213003a9472e8caeb86c286, which
was done without realizing that the updated command line argument
order was lost by mistake.

11 years agoMerge branch 'kk/maint-1.7.9-commit-tree' into kk/maint-commit-tree
Junio C Hamano [Tue, 17 Jul 2012 20:10:49 +0000 (13:10 -0700)]
Merge branch 'kk/maint-1.7.9-commit-tree' into kk/maint-commit-tree

* kk/maint-1.7.9-commit-tree:
  commit-tree: resurrect command line parsing updates

11 years agocommit-tree: resurrect command line parsing updates
Junio C Hamano [Tue, 17 Jul 2012 20:05:13 +0000 (13:05 -0700)]
commit-tree: resurrect command line parsing updates

79a9312 (commit-tree: update the command line parsing, 2011-11-09)
updated the command line parser to understand the usual "flags first
and then non-flag arguments" order, in addition to the original and
a bit unusual "tree comes first and then zero or more -p <parent>".

Unfortunately, ba3c69a (commit: teach --gpg-sign option, 2011-10-05)
broke it by mistake.  Resurrect it, and protect the feature with a
test from future breakages.

Noticed by Keshav Kini
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: allow page names with a ':'
Matthieu Moy [Tue, 17 Jul 2012 14:06:00 +0000 (16:06 +0200)]
git-remote-mediawiki: allow page names with a ':'

Traditionnally, pages named Foo:Bar are page 'Bar' in namespace 'Foo'.
However, it is also possible to call a page Foo:Bar if 'Foo' is not a
namespace. In this case, the actual name of the page is 'Foo:Bar', in the
main namespace. Since we can't tell with only the filename, query the
wiki for a namespace 'Foo' in these cases, but deal with the case where
no such namespace is found.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: fix incorrect test usage in test
Matthieu Moy [Tue, 17 Jul 2012 14:05:59 +0000 (16:05 +0200)]
git-remote-mediawiki: fix incorrect test usage in test

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot4012: Use test_must_fail instead of if-else
Alexander Strasser [Mon, 16 Jul 2012 20:47:22 +0000 (22:47 +0200)]
t4012: Use test_must_fail instead of if-else

Make the code less bulky and easier to read. Also do not overlook
failures like e.g. git failing because of unexpected signals.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot4012: use 'printf' instead of 'dd' to generate a binary file
Johannes Sixt [Mon, 16 Jul 2012 20:46:56 +0000 (22:46 +0200)]
t4012: use 'printf' instead of 'dd' to generate a binary file

For some reason, 'echo X | dd bs=1k seek=1' creates a file with 2050 bytes
on Windows instead of the expected 1026 bytes, so that a test fails. Since
the actual contents of the file are irrelevant as long as there is at
least one zero byte so that the diff machinery recognizes it as binary,
use printf to generate it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot4012: Re-indent test snippets
Alexander Strasser [Mon, 16 Jul 2012 20:45:40 +0000 (22:45 +0200)]
t4012: Re-indent test snippets

Most one-level indents were 1 HT (horizontal tab) followed by 1 SP.
Remove the SP.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot4012: Make --shortstat test more robust
Alexander Strasser [Mon, 16 Jul 2012 20:45:10 +0000 (22:45 +0200)]
t4012: Make --shortstat test more robust

The --shortstat test depends on the same scenario as the --stat
test. Use the part of the same expected result for the --stat test
to avoid duplicating it manually.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot4012: Break up pipe into serial redirections
Alexander Strasser [Mon, 16 Jul 2012 20:44:30 +0000 (22:44 +0200)]
t4012: Break up pipe into serial redirections

Do not hide possible git errors by masking its process
exit status.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot4012: Actually quote the sed script
Alexander Strasser [Mon, 16 Jul 2012 20:43:58 +0000 (22:43 +0200)]
t4012: Actually quote the sed script

The nested quoting is not needed in this cases, thus the previous
version did work just fine. Nevertheless the usage is misleading,
so just achieve nested quoting by using double quotes instead. Lower
the probability of breakage in the future and make the code easier
to read.

NOTE: Just dropping the single quotes around the sed arguments would
      have also been possible.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: properly deal with invalid remote revisions
Matthieu Moy [Mon, 16 Jul 2012 19:46:42 +0000 (21:46 +0200)]
git-remote-mediawiki: properly deal with invalid remote revisions

Some wiki, including https://git.wiki.kernel.org/ have invalid revision
numbers (i.e. the actual revision numbers are non-contiguous). Don't die
when encountering one.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: show progress information when getting last remote revision
Matthieu Moy [Mon, 16 Jul 2012 19:46:41 +0000 (21:46 +0200)]
git-remote-mediawiki: show progress information when getting last remote revision

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: show progress information when listing pages
Matthieu Moy [Mon, 16 Jul 2012 19:46:40 +0000 (21:46 +0200)]
git-remote-mediawiki: show progress information when listing pages

Initial phases of push and pull with git-remote-mediawiki can be long on
a large wiki. Let the user know what's going on.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: use --force when adding notes
Matthieu Moy [Mon, 16 Jul 2012 19:46:39 +0000 (21:46 +0200)]
git-remote-mediawiki: use --force when adding notes

When notes are created to record a push, it normally doesn't exist yet.
However, when a push is interrupted and then restarted, it may happen
that a commit already has notes attached, and we want to reflect the newly
created remote revision, hence use 'git notes add -f' to override the
existing one

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: get rid of O(N^2) loop
Matthieu Moy [Mon, 16 Jul 2012 19:46:38 +0000 (21:46 +0200)]
git-remote-mediawiki: get rid of O(N^2) loop

The algorithm to find a path from the local revision to the remote one
was calling "git rev-list" and parsing its output N times. Run rev-list
only once, and fill a hashtable with the result to optimize the body of
the loop.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: make mediafiles export optional
Matthieu Moy [Mon, 16 Jul 2012 19:46:37 +0000 (21:46 +0200)]
git-remote-mediawiki: make mediafiles export optional

It is possible to use git-remote-mediawiki on a tree with both .mw files
and other files. Before git-remote-mediawiki learnt how to export
mediafiles, such mixed trees allowed the user to maintain both the wiki
and other files for the same project in the same repository. With the
newly added support for exporting mediafiles, pushing such mixed trees
would upload unrelated files as mediafiles, which may not be desired.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-remote-mediawiki: actually send empty comment when they're empty
Matthieu Moy [Mon, 16 Jul 2012 12:00:47 +0000 (14:00 +0200)]
git-remote-mediawiki: actually send empty comment when they're empty

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>