git
10 years agocheckout.c: use ref_exists instead of file_exist
Ronnie Sahlberg [Tue, 6 May 2014 22:45:53 +0000 (15:45 -0700)] 
checkout.c: use ref_exists instead of file_exist

Change checkout.c to check if a ref exists instead of checking if a loose ref
file exists when deciding if to delete an orphaned log file. Otherwise, if a
ref only exists as a packed ref without a corresponding loose ref for the
currently checked out branch, we risk that the reflog will be deleted when we
switch to a different branch.

Update the reflog tests to check for this bug.

The following reproduces the bug:
$ git init-db
$ git config core.logallrefupdates true
$ git commit -m Initial --allow-empty
    [master (root-commit) bb11abe] Initial
$ git reflog master
    [8561dcb master@{0}: commit (initial): Initial]
$ find .git/{refs,logs} -type f | grep master
    [.git/refs/heads/master]
    [.git/logs/refs/heads/master]
$ git branch foo
$ git pack-refs --all
$ find .git/{refs,logs} -type f | grep master
    [.git/logs/refs/heads/master]
$ git checkout foo
$ find .git/{refs,logs} -type f | grep master
    ... reflog file is missing ...
$ git reflog master
    ... nothing ...

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorefs.c: add new functions reflog_exists and delete_reflog
Ronnie Sahlberg [Tue, 6 May 2014 22:45:52 +0000 (15:45 -0700)] 
refs.c: add new functions reflog_exists and delete_reflog

Add two new functions, reflog_exists and delete_reflog, to hide the internal
reflog implementation (that they are files under .git/logs/...) from callers.
Update checkout.c to use these functions in update_refs_for_switch instead of
building pathnames and calling out to file access functions. Update reflog.c
to use these to check if the reflog exists. Now there are still many places
in reflog.c where we are still leaking the reflog storage implementation but
this at least reduces the number of such dependencies by one. Finally
change two places in refs.c itself to use the new function to check if a ref
exists or not isntead of build-path-and-stat(). Now, this is strictly not all
that important since these are in parts of refs that are implementing the
actual file storage backend but on the other hand it will not hurt either.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoRevert "submodules: fix ambiguous absolute paths under Windows"
Stepan Kasal [Thu, 8 May 2014 20:36:57 +0000 (22:36 +0200)] 
Revert "submodules: fix ambiguous absolute paths under Windows"

This reverts commit 4dce7d9b408b2935b85721b54a2010eda7ec1be9,
which was originally done to help Windows but was almost
immediately reverted in msysGit, and the codebase kept this
unnecessary divergence for almost two years.

Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoSync with maint
Junio C Hamano [Thu, 8 May 2014 18:59:51 +0000 (11:59 -0700)] 
Sync with maint

* maint:
  shell doc: remove stray "+" in example
  Start preparing for 1.9.3

10 years agoshell doc: remove stray "+" in example
Jonathan Nieder [Wed, 7 May 2014 23:44:01 +0000 (16:44 -0700)] 
shell doc: remove stray "+" in example

The git-shell(1) manpage says

EXAMPLE
       To disable interactive logins, displaying a greeting
instead:

+

   $ chsh -s /usr/bin/git-shell
   $ mkdir $HOME/git-shell-commands
[...]

The stray "+" has been there ever since the example was added in
v1.8.3-rc0~210^2 (shell: new no-interactive-login command to print a
custom message, 2013-03-09).  The "+" sign between paragraphs is
needed in asciidoc to attach extra paragraphs to a list item but here
it is not needed and ends up rendered as a literal "+".  Remove it.

A quick search with "grep -e '<p>+' /usr/share/doc/git/html/*.html"
doesn't find any other instances of this problem.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Thu, 8 May 2014 17:25:37 +0000 (10:25 -0700)] 
Merge git://github.com/git-l10n/git-po

* 'master' of git://github.com/git-l10n/git-po:
  l10n: Fix a couple of typos in the Swedish translation

10 years agoStart preparing for 1.9.3
Junio C Hamano [Thu, 8 May 2014 17:05:22 +0000 (10:05 -0700)] 
Start preparing for 1.9.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'cl/p4-use-diff-tree' into maint
Junio C Hamano [Thu, 8 May 2014 17:01:32 +0000 (10:01 -0700)] 
Merge branch 'cl/p4-use-diff-tree' into maint

"git p4" dealing with changes in binary files were broken by a
change in 1.9 release.

* cl/p4-use-diff-tree:
  git-p4: format-patch to diff-tree change breaks binary patches

10 years agoMerge branch 'rh/prompt-pcmode-avoid-eval-on-refname' into maint
Junio C Hamano [Thu, 8 May 2014 17:01:18 +0000 (10:01 -0700)] 
Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname' into maint

The shell prompt script (in contrib/), when using the PROMPT_COMMAND
interface, used an unsafe construct when showing the branch name in
$PS1.

* rh/prompt-pcmode-avoid-eval-on-refname:
  git-prompt.sh: don't put unsanitized branch names in $PS1

10 years agoMerge branch 'km/avoid-non-function-return-in-rebase' into maint
Junio C Hamano [Thu, 8 May 2014 17:01:06 +0000 (10:01 -0700)] 
Merge branch 'km/avoid-non-function-return-in-rebase' into maint

"git rebase" used a POSIX shell construct FreeBSD /bin/sh does not
work well with.

* km/avoid-non-function-return-in-rebase:
  Revert "rebase: fix run_specific_rebase's use of "return" on FreeBSD"
  rebase: avoid non-function use of "return" on FreeBSD

10 years agoMerge branch 'tb/unicode-6.3-zero-width' into maint
Junio C Hamano [Thu, 8 May 2014 17:00:45 +0000 (10:00 -0700)] 
Merge branch 'tb/unicode-6.3-zero-width' into maint

Some more Unicode codepoints defined in Unicode 6.3 as having zero
width have been taught to our display column counting logic.

* tb/unicode-6.3-zero-width:
  utf8.c: partially update to version 6.3

10 years agoMerge branch 'km/avoid-bs-in-shell-glob' into maint
Junio C Hamano [Thu, 8 May 2014 17:00:36 +0000 (10:00 -0700)] 
Merge branch 'km/avoid-bs-in-shell-glob' into maint

Some tests used shell constructs that did not work well on FreeBSD

* km/avoid-bs-in-shell-glob:
  test: fix t5560 on FreeBSD

10 years agoMerge branch 'km/avoid-cp-a' into maint
Junio C Hamano [Thu, 8 May 2014 16:59:41 +0000 (09:59 -0700)] 
Merge branch 'km/avoid-cp-a' into maint

Some tests used shell constructs that did not work well on FreeBSD

* km/avoid-cp-a:
  test: fix t7001 cp to use POSIX options

10 years agoUpdate draft release notes for 2.0
Junio C Hamano [Wed, 7 May 2014 22:50:15 +0000 (15:50 -0700)] 
Update draft release notes for 2.0

Describe one last minute one-liner fix for regression introduced in
1.9, and fix a grave mischaracterization on a recent remote-hg/bzr
change, pointed out by Felipe.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'cl/p4-use-diff-tree'
Junio C Hamano [Wed, 7 May 2014 21:39:29 +0000 (14:39 -0700)] 
Merge branch 'cl/p4-use-diff-tree'

Fixes a regression in 1.9.0 with an obviously correct single-liner.

* cl/p4-use-diff-tree:
  git-p4: format-patch to diff-tree change breaks binary patches

10 years agobuiltin/tag.c: show tag name to hint in the message editor
Thorsten Glaser [Thu, 29 Aug 2013 22:03:10 +0000 (00:03 +0200)] 
builtin/tag.c: show tag name to hint in the message editor

Display the tag name about to be added to the user during interactive
editing.

Signed-off-by: Thorsten Glaser <tg@debian.org>
Signed-off-by: Richard Hartmann <richih@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agomerge-recursive.c: fix case-changing merge bug
David Turner [Fri, 2 May 2014 00:21:09 +0000 (20:21 -0400)] 
merge-recursive.c: fix case-changing merge bug

On a case-insensitive filesystem, when merging, a file would be
wrongly deleted from the working tree if an incoming commit had
renamed it changing only its case.  When merging a rename, the file
with the old name would be deleted -- but since the filesystem
considers the old name to be the same as the new name, the new
file would in fact be deleted.

We avoid this by not deleting files that have a case-clone in the
index at stage 0.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopager: remove 'S' from $LESS by default
Matthieu Moy [Wed, 30 Apr 2014 07:35:25 +0000 (09:35 +0200)] 
pager: remove 'S' from $LESS by default

By default, Git used to set $LESS to -FRSX if $LESS was not set by
the user. The FRX flags actually make sense for Git (F and X because
sometimes the output Git pipes to less is short, and R because Git
pipes colored output). The S flag (chop long lines), on the other
hand, is not related to Git and is a matter of user preference. Git
should not decide for the user to change LESS's default.

More specifically, the S flag harms users who review untrusted code
within a pager, since a patch looking like:

    -old code;
    +new good code; [... lots of tabs ...] malicious code;

would appear identical to:

    -old code;
    +new good code;

Users who prefer the old behavior can still set the $LESS environment
variable to -FRSX explicitly, or set core.pager to 'less -S'.

The documentation in config.txt is made a bit longer to keep both an
example setting the 'S' flag (needed to recover the old behavior)
and an example showing how to unset a flag set by Git.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosilence a bunch of format-zero-length warnings
Felipe Contreras [Sun, 4 May 2014 06:12:55 +0000 (01:12 -0500)] 
silence a bunch of format-zero-length warnings

This can be observed in many versions of gcc and still exists with 4.9.0:

  wt-status.c: In function ‘wt_status_print_unmerged_header’:
  wt-status.c:191:2: warning: zero-length gnu_printf format string [-Wformat-zero-length]
    status_printf_ln(s, c, "");
    ^

The user have long been told to pass -Wno-format-zero-length, but a
patch that avoids warning altogether is not too noisy, so let's do
so.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogrep: use run-command's "dir" option for --open-files-in-pager
Jeff King [Wed, 7 May 2014 03:00:37 +0000 (23:00 -0400)] 
grep: use run-command's "dir" option for --open-files-in-pager

Git generally changes directory to the repository root on
startup.  When running "grep --open-files-in-pager" from a
subdirectory, we chdir back to the original directory before
running the pager, so that we can feed the relative
pathnames to the pager.

We currently do this chdir manually, but we can ask
run_command to do it for us. This is fewer lines of code,
and as a bonus, the chdir is limited to the child process,
which avoids any unexpected surprises for code running after
the pager (there isn't any currently, but this is
future-proofing).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-p4: format-patch to diff-tree change breaks binary patches
Tolga Ceylan [Wed, 7 May 2014 05:48:54 +0000 (22:48 -0700)] 
git-p4: format-patch to diff-tree change breaks binary patches

When applying binary patches a full index is required. format-patch
already handles this, but diff-tree needs '--full-index' argument
to always output full index. When git-p4 runs git-apply to test
the patch, git-apply rejects the patch due to abbreviated blob
object names. This is the error message git-apply emits in this
case:

    error: cannot apply binary patch to '<filename>' without full index line
    error: <filename>: patch does not apply

Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agol10n: Fix a couple of typos in the Swedish translation
Peter Krefting [Wed, 7 May 2014 06:06:37 +0000 (07:06 +0100)] 
l10n: Fix a couple of typos in the Swedish translation

Thanks-to: Anders Jonsson <anders.jonsson@norsjovallen.se>
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
10 years agoRelNotes/2.0.0: Grammar and typo fixes
Øyvind A. Holm [Sat, 3 May 2014 19:08:50 +0000 (21:08 +0200)] 
RelNotes/2.0.0: Grammar and typo fixes

Signed-off-by: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/subtree/Makefile: clean up rule for "clean"
James Denholm [Tue, 6 May 2014 12:41:49 +0000 (22:41 +1000)] 
contrib/subtree/Makefile: clean up rule for "clean"

git:Documentation/Makefile and others establish "RM ?= rm -f" as a
convention for rm calls in clean rules, hence follow this convention
instead of simply forcing clean to use rm.

subproj and mainline no longer need to be removed in clean, as they are
no longer created in git:contrib/subtree by "make test". Hence, remove
the rm call for those folders.

Other makefiles don't remove "*~" files, remove the rm call to prevent
unexpected behaviour in the future. Similarly, clean doesn't remove the
installable file, so rectify this.

Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: James Denholm <nod.helm@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/subtree/Makefile: clean up rules to generate documentation
James Denholm [Tue, 6 May 2014 12:41:48 +0000 (22:41 +1000)] 
contrib/subtree/Makefile: clean up rules to generate documentation

git:Documentation/Makefile establishes asciidoc/xmlto calls as being
handled through their appropriate variables, Hence, change to bring into
congruency with.

Similarly, MANPAGE_XSL exists in git:Documentation/Makefile, while
MANPAGE_NORMAL_XSL does not outside contrib/subtree. Hence, replace
MANPAGE_NORMAL_XSL with MANPAGE_XSL.

Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: James Denholm <nod.helm@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/subtree/Makefile: s/libexecdir/gitexecdir/
James Denholm [Tue, 6 May 2014 12:41:47 +0000 (22:41 +1000)] 
contrib/subtree/Makefile: s/libexecdir/gitexecdir/

$(libexecdir) isn't used anywhere else in the project, while
$(gitexecdir) is the standard in the other appropriate makefiles. Hence,
replace the former with the latter.

Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: James Denholm <nod.helm@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/subtree/Makefile: use GIT-VERSION-FILE
James Denholm [Tue, 6 May 2014 12:41:46 +0000 (22:41 +1000)] 
contrib/subtree/Makefile: use GIT-VERSION-FILE

GVF is already being used in most/all other makefiles in the project,
and has been for _quite_ a while. Hence, drop file-unique gitver and
replace with GIT_VERSION.

Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: James Denholm <nod.helm@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoapi-strbuf.txt: add docs for _trim and _ltrim
Brian Gesiak [Wed, 30 Apr 2014 08:58:07 +0000 (17:58 +0900)] 
api-strbuf.txt: add docs for _trim and _ltrim

API documentation for strbuf does not document strbuf_trim() or
strbuf_ltrim(). Add documentation for these two functions.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agostrbuf: use _rtrim and _ltrim in strbuf_trim
Brian Gesiak [Wed, 30 Apr 2014 08:58:06 +0000 (17:58 +0900)] 
strbuf: use _rtrim and _ltrim in strbuf_trim

strbuf_trim() strips whitespace from the end, then the beginning of
a strbuf.  Those operations are duplicated in strbuf_rtrim() and
strbuf_ltrim().

Replace strbuf_trim() implementation with calls to strbuf_rtrim(),
then strbuf_ltrim().

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoBump core.deltaBaseCacheLimit to 96m
David Kastrup [Sun, 4 May 2014 17:13:57 +0000 (19:13 +0200)] 
Bump core.deltaBaseCacheLimit to 96m

The default of 16m causes serious thrashing for large delta chains
combined with large files.

Here are some benchmarks (pu variant of git blame):

time git blame -C src/xdisp.c >/dev/null

for a repository of Emacs repacked with git gc --aggressive (v1.9,
resulting in a window size of 250) located on an SSD drive.  The file in
question has about 30000 lines, 1Mb of size, and a history with about
2500 commits.

    16m (previous default):
    real 3m33.936s
    user 2m15.396s
    sys 1m17.352s

    32m:
    real 3m1.319s
    user 2m8.660s
    sys 0m51.904s

    64m:
    real 2m20.636s
    user 1m55.780s
    sys 0m23.964s

    96m:
    real 2m5.668s
    user 1m50.784s
    sys 0m14.288s

    128m:
    real 2m4.337s
    user 1m50.764s
    sys 0m12.832s

    192m:
    real 2m3.567s
    user 1m49.508s
    sys 0m13.312s

Signed-off-by: David Kastrup <dak@gnu.org>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agolet clang use the constant-return error() macro
Jeff King [Tue, 6 May 2014 15:17:50 +0000 (11:17 -0400)] 
let clang use the constant-return error() macro

Commit e208f9c converted error() into a macro to make its
constant return value more apparent to calling code.  Commit
5ded807 prevents us using this macro with clang, since
clang's -Wunused-value is smart enough to realize that the
constant "-1" is useless in some contexts.

However, since the last commit puts the constant behind an
inline function call, this is enough to prevent the
-Wunused-value warning on both modern gcc and clang. So we
can now re-enable the macro when compiling with clang.

Tested with clang 3.3, 3.4, and 3.5.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoinline constant return from error() function
Jeff King [Tue, 6 May 2014 15:14:42 +0000 (11:14 -0400)] 
inline constant return from error() function

Commit e208f9c introduced a macro to turn error() calls
into:

  (error(), -1)

to make the constant return value more visible to the
calling code (and thus let the compiler make better
decisions about the code).

This works well for code like:

  return error(...);

but the "-1" is superfluous in code that just calls error()
without caring about the return value. In older versions of
gcc, that was fine, but gcc 4.9 complains with -Wunused-value.

We can work around this by encapsulating the constant return
value in a static inline function, as gcc specifically
avoids complaining about unused function returns unless the
function has been specifically marked with the
warn_unused_result attribute.

We also use the same trick for config_error_nonbool and
opterror, which learned the same error technique in a469a10.

Reported-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoconfig: preserve config file permissions on edits
Eric Wong [Tue, 6 May 2014 00:17:14 +0000 (00:17 +0000)] 
config: preserve config file permissions on edits

Users may already store sensitive data such as imap.pass in
.git/config; making the file world-readable when "git config"
is called to edit means their password would be compromised
on a shared system.

[v2: updated for section renames, as noted by Junio]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/subtree/Makefile: scrap unused $(gitdir)
James Denholm [Tue, 6 May 2014 12:41:45 +0000 (22:41 +1000)] 
contrib/subtree/Makefile: scrap unused $(gitdir)

In 7ff8463dba0d74fc07a766bed457ae7afcc902b5, the references to gitdir
were removed but the assignment itself wasn't. Hence, drop the gitdir
assignment.

Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: James Denholm <nod.helm@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMSVC: link dynamically to the CRT
Karsten Blees [Fri, 7 Jan 2011 16:20:21 +0000 (17:20 +0100)] 
MSVC: link dynamically to the CRT

Dynamic linking is generally preferred over static linking, and MSVCRT.dll
has been integral part of Windows for a long time.

This also fixes linker warnings for _malloc and _free in zlib.lib, which
seems to be compiled for MSVCRT.dll already.

The DLL version also exports some of the CRT initialization functions,
which are hidden in the static libcmt.lib (e.g. __wgetmainargs, required by
subsequent Unicode patches).

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Acked-by: Marat Radchenko <marat@slonopotamus.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit: accept more date formats for "--date"
Jeff King [Fri, 2 May 2014 01:12:42 +0000 (21:12 -0400)] 
commit: accept more date formats for "--date"

Right now we pass off the string found by "--date" straight
to the fmt_ident function, which will use our strict
parse_date to normalize it. However, this means obvious
things like "--date=now" or "--date=2.days.ago" will not
work.

Instead, let's fallback to the approxidate function to
handle this for us. Note that we must try parse_date
ourselves first, even though approxidate will try strict
parsing itself. The reason is that approxidate throws away
any timezone information it sees from the strict parsing,
and we want to preserve it. So asking for:

  git commit --date="@1234567890 -0700"

continues to set the date in -0700, regardless of what the
local timezone is.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit: print "Date" line when the user has set date
Jeff King [Fri, 2 May 2014 01:10:01 +0000 (21:10 -0400)] 
commit: print "Date" line when the user has set date

When we make a commit and the author is not the same as the
committer (e.g., because you used "-c $commit" or
"--author=$somebody"), we print the author's name and email
in both the commit-message template and as part of the
commit summary. This is a safety check to give the user a
chance to confirm that we are doing what they expect.

This patch brings the same safety for the "date" field,
which may be set by "-c" or by using "--date".  Note that we
explicitly do not set it for $GIT_AUTHOR_DATE, as it is
probably not of interest when "git commit" is being fed its
parameters by a script.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopretty: make show_ident_date public
Jeff King [Fri, 2 May 2014 01:07:22 +0000 (21:07 -0400)] 
pretty: make show_ident_date public

We use this function internally to format "Date" lines in
commit logs, but other parts of the code will want it, too.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit: use split_ident_line to compare author/committer
Jeff King [Fri, 2 May 2014 01:06:57 +0000 (21:06 -0400)] 
commit: use split_ident_line to compare author/committer

Instead of string-wise comparing the author/committer lines
with their timestamps truncated, we can use split_ident_line
and ident_cmp. These functions are more robust than our
ad-hoc parsing, though in practice it should not matter, as
we just generated these ident lines ourselves.

However, this will also allow us easy access to the
timestamp and tz fields in future patches.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: on splitting a long line
Junio C Hamano [Fri, 2 May 2014 20:42:39 +0000 (13:42 -0700)] 
CodingGuidelines: on splitting a long line

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: on comparison
Junio C Hamano [Wed, 30 Apr 2014 21:26:23 +0000 (14:26 -0700)] 
CodingGuidelines: on comparison

There are arguments for writing a conditional as "a < b" rather than
"b > a", or vice versa.  Let's give guidance on which we prefer.

See http://thread.gmane.org/gmane.comp.version-control.git/3903/focus=4126
for the original discussion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: do not call the conditional statement "if()"
Junio C Hamano [Wed, 30 Apr 2014 21:25:47 +0000 (14:25 -0700)] 
CodingGuidelines: do not call the conditional statement "if()"

The point immediately before it is about having SP after the control
keyword.  Spell it out as 'an "if" statement' instead.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: give an example for shell function preamble
Junio C Hamano [Wed, 30 Apr 2014 21:25:11 +0000 (14:25 -0700)] 
CodingGuidelines: give an example for shell function preamble

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: give an example for control statements
Junio C Hamano [Wed, 30 Apr 2014 21:24:52 +0000 (14:24 -0700)] 
CodingGuidelines: give an example for control statements

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: give an example for redirection
Junio C Hamano [Wed, 30 Apr 2014 21:24:24 +0000 (14:24 -0700)] 
CodingGuidelines: give an example for redirection

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: give an example for case/esac statement
Junio C Hamano [Wed, 30 Apr 2014 21:24:08 +0000 (14:24 -0700)] 
CodingGuidelines: give an example for case/esac statement

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: once it is in, it is not worth the code churn
Junio C Hamano [Wed, 30 Apr 2014 21:23:26 +0000 (14:23 -0700)] 
CodingGuidelines: once it is in, it is not worth the code churn

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 2.0-rc2 v2.0.0-rc2
Junio C Hamano [Fri, 2 May 2014 20:15:52 +0000 (13:15 -0700)] 
Git 2.0-rc2

10 years agoMerge branch 'mw/symlinks'
Junio C Hamano [Fri, 2 May 2014 20:11:02 +0000 (13:11 -0700)] 
Merge branch 'mw/symlinks'

A finishing touch fix to a new change already in 'master'.

* mw/symlinks:
  setup: fix windows path buffer over-stepping

10 years agoMerge branch 'km/git-svn-workaround-older-getopt-long'
Junio C Hamano [Fri, 2 May 2014 20:10:58 +0000 (13:10 -0700)] 
Merge branch 'km/git-svn-workaround-older-getopt-long'

* km/git-svn-workaround-older-getopt-long:
  t9117: use --prefix "" instead of --prefix=""

10 years agoMerge branch 'rh/prompt-pcmode-avoid-eval-on-refname'
Junio C Hamano [Fri, 2 May 2014 20:10:53 +0000 (13:10 -0700)] 
Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname'

* rh/prompt-pcmode-avoid-eval-on-refname:
  git-prompt.sh: don't put unsanitized branch names in $PS1

10 years agoMerge branch 'mk/doc-git-gui-display-untracked'
Junio C Hamano [Fri, 2 May 2014 20:10:47 +0000 (13:10 -0700)] 
Merge branch 'mk/doc-git-gui-display-untracked'

* mk/doc-git-gui-display-untracked:
  Documentation: git-gui: describe gui.displayuntracked

10 years agodocs: document RUN_SETUP_GENTLY and clarify RUN_SETUP
David Turner [Tue, 29 Apr 2014 19:21:34 +0000 (15:21 -0400)] 
docs: document RUN_SETUP_GENTLY and clarify RUN_SETUP

We only said what happens when we find the Git directory under
RUN_SETUP, without saying what happens otherwise.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot5000-tar-tree.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:23:07 +0000 (09:23 -0700)] 
t5000-tar-tree.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4204-patch-id.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:23:06 +0000 (09:23 -0700)] 
t4204-patch-id.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4119-apply-config.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:23:05 +0000 (09:23 -0700)] 
t4119-apply-config.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4116-apply-reverse.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:23:04 +0000 (09:23 -0700)] 
t4116-apply-reverse.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4057-diff-combined-paths.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:23:03 +0000 (09:23 -0700)] 
t4057-diff-combined-paths.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4038-diff-combined.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:23:02 +0000 (09:23 -0700)] 
t4038-diff-combined.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4036-format-patch-signer-mime.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:23:01 +0000 (09:23 -0700)] 
t4036-format-patch-signer-mime.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4014-format-patch.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:23:00 +0000 (09:23 -0700)] 
t4014-format-patch.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4013-diff-various.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:22:59 +0000 (09:22 -0700)] 
t4013-diff-various.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4012-diff-binary.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:22:58 +0000 (09:22 -0700)] 
t4012-diff-binary.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4010-diff-pathspec.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:22:57 +0000 (09:22 -0700)] 
t4010-diff-pathspec.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot4006-diff-mode.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:22:56 +0000 (09:22 -0700)] 
t4006-diff-mode.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot3910-mac-os-precompose.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:22:55 +0000 (09:22 -0700)] 
t3910-mac-os-precompose.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot3905-stash-include-untracked.sh: use the $( ... ) construct for command substitution
Elia Pinto [Wed, 30 Apr 2014 16:22:54 +0000 (09:22 -0700)] 
t3905-stash-include-untracked.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Wed, 30 Apr 2014 18:01:42 +0000 (11:01 -0700)] 
Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
  l10n: de.po: improve hint for autocorrected command execution
  l10n: de.po: translate 45 new messages
  l10n: de.po: correct translation of "completed" after resolving deltas
  l10n: zh_CN.po: translate 46 new messages (2229t0f0u)
  l10n: fr translation for v2.0.0rc0 (2228t)
  l10n: Update Swedish translation (2228t0f0u)
  l10n: vi.po (2228t): Update and minor fix
  l10n: git.pot: v2.0.0 round 1 (45 new, 28 removed)

10 years agoRevert the whole "ask curl-config" topic for now
Junio C Hamano [Wed, 30 Apr 2014 17:58:10 +0000 (10:58 -0700)] 
Revert the whole "ask curl-config" topic for now

Postpone this a bit during the feature freeze and retry the effort
in the next cycle.

10 years agorerere: fix for merge.conflictstyle
Felipe Contreras [Wed, 30 Apr 2014 04:08:29 +0000 (23:08 -0500)] 
rerere: fix for merge.conflictstyle

If we use a different conflict style `git rerere forget` is not able
to find the matching conflict SHA-1 because the diff generated is
actually different from what `git merge` generated, due to the
XDL_MERGE_* option differences among the codepaths.

The fix is to call git_xmerge_config() so that git_xmerge_style is set
properly and the diffs match.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot1050-large.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:37 +0000 (05:57 -0700)] 
t1050-large.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot1020-subdirectory.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:36 +0000 (05:57 -0700)] 
t1020-subdirectory.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:35 +0000 (05:57 -0700)] 
t1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot1003-read-tree-prefix.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:34 +0000 (05:57 -0700)] 
t1003-read-tree-prefix.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:33 +0000 (05:57 -0700)] 
t1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:32 +0000 (05:57 -0700)] 
t1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot1000-read-tree-m-3way.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:31 +0000 (05:57 -0700)] 
t1000-read-tree-m-3way.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0300-credentials.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:30 +0000 (05:57 -0700)] 
t0300-credentials.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0030-stripspace.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:29 +0000 (05:57 -0700)] 
t0030-stripspace.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0026-eol-config.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:28 +0000 (05:57 -0700)] 
t0026-eol-config.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0025-crlf-auto.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:27 +0000 (05:57 -0700)] 
t0025-crlf-auto.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0020-crlf.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:26 +0000 (05:57 -0700)] 
t0020-crlf.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0010-racy-git.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:25 +0000 (05:57 -0700)] 
t0010-racy-git.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0001-init.sh: use the $( ... ) construct for command substitution
Elia Pinto [Mon, 28 Apr 2014 12:57:24 +0000 (05:57 -0700)] 
t0001-init.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoimap-send: use git-credential
Dan Albert [Tue, 29 Apr 2014 03:00:04 +0000 (20:00 -0700)] 
imap-send: use git-credential

git-imap-send was directly prompting for a password rather than using
git-credential. git-send-email, on the other hand, supports git-credential.

This is a necessary improvement for users that use two factor authentication, as
they should not be expected to remember all of their app specific passwords.

Signed-off-by: Dan Albert <danalbert@google.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot3910: show failure of core.precomposeunicode with decomposed filenames
Jeff King [Mon, 28 Apr 2014 16:16:31 +0000 (12:16 -0400)] 
t3910: show failure of core.precomposeunicode with decomposed filenames

If you have existing decomposed filenames in your git
repository (e.g., that were created with older versions of
git that did not precompose unicode), a modern git with
core.precomposeunicode set does not handle them well.

The problem is that we normalize the paths coming from the
disk into their precomposed form, and then compare them
against the literal bytes in the index. This makes things
better if you have the precomposed form in the index. It
makes things worse if you actually have the decomposed form
in the index.

As a result, paths with decomposed filenames may have their
precomposed variants listed as untracked files (even though
the precomposed variants do not exist on-disk at all).

This patch just adds a test to demonstrate the breakage.
Some possible fixes are:

  1. Tell everyone that NFD in the git repo is wrong, and
     they should make a new commit to normalize all their
     in-repo files to be precomposed.

     This is probably not the right thing to do, because it
     still doesn't fix checkouts of old history. And it
     spreads the problem to people on byte-preserving
     filesystems (like ext4), because now they have to start
     precomposing their filenames as they are adde to git.

  2. Do all index filename comparisons using a UTF-8 aware
     comparison function when core.precomposeunicode is set.
     This would probably have bad performance, and somewhat
     defeats the point of converting the filenames at the
     readdir level in the first place.

  3. Convert index filenames to their precomposed form when
     we read the index from disk. This would be efficient,
     but we would have to be careful not to write the
     precomposed forms back out to disk.

  4. Introduce some infrastructure to efficiently match up
     the precomposed/decomposed forms. We already do
     something similar for case-insensitive files using
     name-hash.c. We might be able to adapt that strategy
     here.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocompat/poll: sleep 1 millisecond to avoid busy wait
Theodore Leblond [Wed, 16 May 2012 13:52:49 +0000 (06:52 -0700)] 
compat/poll: sleep 1 millisecond to avoid busy wait

SwitchToThread() only gives away the rest of the current time slice
to another thread in the current process. So if the thread that feeds
the file decscriptor we're polling is not in the current process, we
get busy-waiting.

I played around with this quite a bit. After trying some more complex
schemes, I found that what worked best is to just sleep 1 millisecond
between iterations. Though it's a very short time, it still completely
eliminates the busy wait condition, without hurting perf.

There code uses SleepEx(1, TRUE) to sleep. See this page for a good
discussion of why that is better than calling SwitchToThread, which
is what was used previously:
http://stackoverflow.com/questions/1383943/switchtothread-vs-sleep1

Note that calling SleepEx(0, TRUE) does *not* solve the busy wait.

The most striking case was when testing on a UNC share with a large repo,
on a single CPU machine. Without the fix, it took 4 minutes 15 seconds,
and with the fix it took just 1:08! I think it's because git-upload-pack's
busy wait was eating the CPU away from the git process that's doing the
real work. With multi-proc, the timing is not much different, but tons of
CPU time is still wasted, which can be a killer on a server that needs to
do bunch of other things.

I also tested the very fast local case, and didn't see any measurable
difference. On a big repo with 4500 files, the upload-pack took about 2
seconds with and without the fix.

[jc: this was first accepted in msysgit tree in May 2012 via a pull
request and Paolo Bonzini has also accepted the same fix to Gnulib
around the same time; see $gmane/247518 for a bit more detail]

Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agol10n: de.po: improve hint for autocorrected command execution
Ralf Thielow [Fri, 25 Apr 2014 20:16:43 +0000 (22:16 +0200)] 
l10n: de.po: improve hint for autocorrected command execution

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
10 years agol10n: de.po: translate 45 new messages
Ralf Thielow [Tue, 1 Apr 2014 18:25:20 +0000 (20:25 +0200)] 
l10n: de.po: translate 45 new messages

Translate 45 new messages came from git.pot update in 5e078fc
(l10n: git.pot: v2.0.0 round 1 (45 new, 28 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Thomas Rast <tr@thomasrast.ch>
10 years agol10n: de.po: correct translation of "completed" after resolving deltas
Ralf Thielow [Sat, 12 Apr 2014 19:39:10 +0000 (21:39 +0200)] 
l10n: de.po: correct translation of "completed" after resolving deltas

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
10 years agopager: do allow spawning pager recursively
Jörn Engel [Mon, 21 Apr 2014 20:46:22 +0000 (16:46 -0400)] 
pager: do allow spawning pager recursively

This reverts commit 88e8f908f2b0c56f9ccf8134d8ff9f689af9cc84, which
tried to allow

    GIT_PAGER="git -p column --mode='dense color'" git -p branch

and still wanted to avoid "git -p column" to invoke itself.  However,
this falls into "don't do that -p then" category.

In particular, inside "git log", with results going through less, a
potentially interesting commit may be found and from there inside
"less", the user may want to execute "git show <commit>".  Before
the commit being reverted, this used to show the patch in less but
it no longer does.

Signed-off-by: Jörn Engel <joern@logfs.org>
Reviewed-by: Jeff King <peff@peff.net>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Acked-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'db/make-with-curl'
Junio C Hamano [Mon, 28 Apr 2014 22:48:12 +0000 (15:48 -0700)] 
Merge branch 'db/make-with-curl'

It turns out that some platforms do ship without curl-config even
though they build with the hardcoded default -lcurl and rely on it
to work.

* db/make-with-curl:
  Makefile: default to -lcurl when no CURL_CONFIG or CURLDIR

10 years agoMerge branch 'jk/external-diff-use-argv-array' (early part)
Junio C Hamano [Mon, 28 Apr 2014 22:47:35 +0000 (15:47 -0700)] 
Merge branch 'jk/external-diff-use-argv-array' (early part)

Crash fix for codepath that miscounted the necessary size for an
array when spawning an external diff program.

* 'jk/external-diff-use-argv-array' (early part):
  run_external_diff: use an argv_array for the command line

10 years agoblame: large-scale performance rewrite
David Kastrup [Fri, 25 Apr 2014 23:56:49 +0000 (01:56 +0200)] 
blame: large-scale performance rewrite

The previous implementation used a single sorted linear list of blame
entries for organizing all partial or completed work.  Every subtask had
to scan the whole list, with most entries not being relevant to the
task.  The resulting run-time was quadratic to the number of separate
chunks.

This change gives every subtask its own data to work with.  Subtasks are
organized into "struct origin" chains hanging off particular commits.
Commits are organized into a priority queue, processing them in commit
date order in order to keep most of the work affecting a particular blob
collated even in the presence of an extensive merge history.

For large files with a diversified history, a speedup by a factor of 3
or more is not unusual.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMakefile: default to -lcurl when no CURL_CONFIG or CURLDIR
Dave Borowitz [Mon, 28 Apr 2014 21:01:23 +0000 (14:01 -0700)] 
Makefile: default to -lcurl when no CURL_CONFIG or CURLDIR

The original implementation of CURL_CONFIG support did not match the
original behavior of using -lcurl when CURLDIR was not set. This broke
implementations that were lacking curl-config but did have libcurl
installed along system libraries, such as MSysGit. In other words, the
assumption that curl-config is always installed was incorrect.

Instead, if CURL_CONFIG is empty or returns an empty result (e.g. due
to curl-config being missing), use the old behavior of falling back to
-lcurl.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit: do not complain of empty messages from -C
Jeff King [Fri, 25 Apr 2014 23:11:15 +0000 (19:11 -0400)] 
commit: do not complain of empty messages from -C

When we pick another commit's message, we die() immediately
if we find that it's empty and we are not going to run an
editor (i.e., when running "-C" instead of "-c").  However,
this check is redundant and harmful.

It's redundant because we will already notice the empty
message later, after we would have run the editor, and die
there (just as we would for a regular, not "-C" case, where
the user provided an empty message in the editor).

It's harmful for a few reasons:

  1. It does not respect --allow-empty-message. As a result,
     a "git rebase -i" cannot "pick" such a commit. So you
     cannot even go back in time to fix it with a "reword"
     or "edit" instruction.

  2. It does not take into account other ways besides the
     editor to modify the message. For example, "git commit
     -C empty-commit -m foo" could take the author
     information from empty-commit, but add a message to it.
     There's more to do to make that work correctly (and
     right now we explicitly forbid "-C with -m"), but this
     removes one roadblock.

  3. The existing check is not enough to prevent segfaults.
     We try to find the "\n\n" header/body boundary in the
     commit. If it is at the end of the string (i.e., no
     body), _or_ if we cannot find it at all (i.e., a
     truncated commit object), we consider the message
     empty. With "-C", that's OK; we die in either case. But
     with "-c", we continue on, and in the case of a
     truncated commit may end up dereferencing NULL+2.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 2.0-rc1 v2.0.0-rc1
Junio C Hamano [Fri, 25 Apr 2014 17:03:41 +0000 (10:03 -0700)] 
Git 2.0-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit tag --contains: avoid stack overflow
Jean-Jacques Lafay [Thu, 24 Apr 2014 12:24:39 +0000 (14:24 +0200)] 
git tag --contains: avoid stack overflow

In large repos, the recursion implementation of contains(commit,
commit_list) may result in a stack overflow. Replace the recursion with
a loop to fix it.

This problem is more apparent on Windows than on Linux, where the stack
is more limited by default.

See also this thread on the msysGit list:

https://groups.google.com/d/topic/msysgit/FqT6boJrb2g/discussion

[jes: re-written to imitate the original recursion more closely]

Thomas Braun pointed out several documentation shortcomings.

Tests are run only if ulimit -s is available.  This means they cannot
be run on Windows.

Signed-off-by: Jean-Jacques Lafay <jeanjacques.lafay@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Stepan Kasal <kasal@ucw.cz>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosetup: fix windows path buffer over-stepping
Martin Erik Werner [Thu, 24 Apr 2014 13:06:09 +0000 (15:06 +0200)] 
setup: fix windows path buffer over-stepping

Fix a buffer over-stepping issue triggered by providing an absolute path
that is similar to the work tree path.

abspath_part_inside_repo() may currently increment the path pointer by
offset_1st_component() + wtlen, which is too much, since
offset_1st_component() is a subset of wtlen.

For the *nix-style prefix '/', this does (by luck) not cause any issues,
since offset_1st_component() is 1 and there will always be a '/' or '\0'
that can "absorb" this.

In the case of DOS-style prefixes though, the offset_1st_component() is
3 and this can potentially over-step the string buffer. For example if

    work_tree = "c:/r"
    path      = "c:/rl"

Then wtlen is 4, and incrementing the path pointer by (3 + 4) would
end up 2 bytes outside a string buffer of length 6.

Similarly if

    work_tree = "c:/r"
    path      = "c:/rl/d/a"

Then (since the loop starts by also incrementing the pointer one step),
this would mean that the function would miss checking if "c:/rl/d" could
be the work_tree, arguably this is unlikely though, since it would only
be possible with symlinks on windows.

Fix this by simply avoiding to increment by offset_1st_component() and
wtlen at the same time.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jk/pack-bitmap'
Junio C Hamano [Thu, 24 Apr 2014 19:31:50 +0000 (12:31 -0700)] 
Merge branch 'jk/pack-bitmap'

A last minute (and hopefully the last) fix to avoid coredumps due
to an incorrect pointer arithmetic.

* jk/pack-bitmap:
  ewah_bitmap.c: do not assume size_t and eword_t are the same size