git
8 years agotree-diff: catch integer overflow in combine_diff_path allocation
Jeff King [Fri, 19 Feb 2016 11:21:30 +0000 (06:21 -0500)] 
tree-diff: catch integer overflow in combine_diff_path allocation

A combine_diff_path struct has two "flex" members allocated
alongside the struct: a string to hold the pathname, and an
array of parent pointers. We use an "int" to compute this,
meaning we may easily overflow it if the pathname is
extremely long.

We can fix this by using size_t, and checking for overflow
with the st_add helper.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoadd helpers for detecting size_t overflow
Jeff King [Fri, 19 Feb 2016 11:21:19 +0000 (06:21 -0500)] 
add helpers for detecting size_t overflow

Performing computations on size_t variables that we feed to
xmalloc and friends can be dangerous, as an integer overflow
can cause us to allocate a much smaller chunk than we
realized.

We already have unsigned_add_overflows(), but let's add
unsigned_mult_overflows() to that. Furthermore, rather than
have each site manually check and die on overflow, we can
provide some helpers that will:

  - promote the arguments to size_t, so that we know we are
    doing our computation in the same size of integer that
    will ultimately be fed to xmalloc

  - check and die on overflow

  - return the result so that computations can be done in
    the parameter list of xmalloc.

These functions are a lot uglier to use than normal
arithmetic operators (you have to do "st_add(foo, bar)"
instead of "foo + bar"). To at least limit the damage, we
also provide multi-valued versions. So rather than:

  st_add(st_add(a, b), st_add(c, d));

you can write:

  st_add4(a, b, c, d);

This isn't nearly as elegant as a varargs function, but it's
a lot harder to get it wrong. You don't have to remember to
add a sentinel value at the end, and the compiler will
complain if you get the number of arguments wrong. This
patch adds only the numbered variants required to convert
the current code base; we can easily add more later if
needed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoreflog_expire_cfg: NUL-terminate pattern field
Jeff King [Fri, 19 Feb 2016 11:21:08 +0000 (06:21 -0500)] 
reflog_expire_cfg: NUL-terminate pattern field

You can tweak the reflog expiration for a particular subset
of refs by configuring gc.foo.reflogexpire. We keep a linked
list of reflog_expire_cfg structs, each of which holds the
pattern and a "len" field for the length of the pattern. The
pattern itself is _not_ NUL-terminated.

However, we feed the pattern directly to wildmatch(), which
expects a NUL-terminated string, meaning it may keep reading
random junk after our struct.

We can fix this by allocating an extra byte for the NUL
(which is already zero because we use xcalloc). Let's also
drop the misleading "len" field, which is no longer
necessary. The existing use of "len" can be converted to use
strncmp().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoGit 2.7.1 v2.7.1
Junio C Hamano [Fri, 5 Feb 2016 22:53:52 +0000 (14:53 -0800)] 
Git 2.7.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'lv/add-doc-working-tree' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:22 +0000 (14:54 -0800)] 
Merge branch 'lv/add-doc-working-tree' into maint

* lv/add-doc-working-tree:
  git-add doc: do not say working directory when you mean working tree

8 years agoMerge branch 'ss/clone-depth-single-doc' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:21 +0000 (14:54 -0800)] 
Merge branch 'ss/clone-depth-single-doc' into maint

Documentation for "git fetch --depth" has been updated for clarity.

* ss/clone-depth-single-doc:
  docs: clarify that --depth for git-fetch works with newly initialized repos
  docs: say "commits" in the --depth option wording for git-clone
  docs: clarify that passing --depth to git-clone implies --single-branch

8 years agoMerge branch 'sg/t6050-failing-editor-test-fix' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:20 +0000 (14:54 -0800)] 
Merge branch 'sg/t6050-failing-editor-test-fix' into maint

* sg/t6050-failing-editor-test-fix:
  t6050-replace: make failing editor test more robust

8 years agoMerge branch 'ew/for-each-ref-doc' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:19 +0000 (14:54 -0800)] 
Merge branch 'ew/for-each-ref-doc' into maint

* ew/for-each-ref-doc:
  for-each-ref: document `creatordate` and `creator` fields

8 years agoMerge branch 'ss/user-manual' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:18 +0000 (14:54 -0800)] 
Merge branch 'ss/user-manual' into maint

Drop a few old "todo" items by deciding that the change one of them
suggests is not such a good idea, and doing the change the other
one suggested to do.

* ss/user-manual:
  user-manual: add addition gitweb information
  user-manual: add section documenting shallow clones
  glossary: define the term shallow clone
  user-manual: remove temporary branch entry from todo list

8 years agoMerge branch 'jk/ref-cache-non-repository-optim' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:17 +0000 (14:54 -0800)] 
Merge branch 'jk/ref-cache-non-repository-optim' into maint

The underlying machinery used by "ls-files -o" and other commands
have been taught not to create empty submodule ref cache for a
directory that is not a submodule.  This removes a ton of wasted
CPU cycles.

* jk/ref-cache-non-repository-optim:
  resolve_gitlink_ref: ignore non-repository paths
  clean: make is_git_repository a public function

8 years agoMerge branch 'js/dirname-basename' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:17 +0000 (14:54 -0800)] 
Merge branch 'js/dirname-basename' into maint

dirname() emulation has been added, as Msys2 lacks it.

* js/dirname-basename:
  mingw: avoid linking to the C library's isalpha()
  t0060: loosen overly strict expectations
  t0060: verify that basename() and dirname() work as expected
  compat/basename.c: provide a dirname() compatibility function
  compat/basename: make basename() conform to POSIX
  Refactor skipping DOS drive prefixes

8 years agoMerge branch 'tb/complete-word-diff-regex' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:17 +0000 (14:54 -0800)] 
Merge branch 'tb/complete-word-diff-regex' into maint

* tb/complete-word-diff-regex:
  completion: complete "diff --word-diff-regex="

8 years agoMerge branch 'pw/completion-stash' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:16 +0000 (14:54 -0800)] 
Merge branch 'pw/completion-stash' into maint

* pw/completion-stash:
  completion: update completion arguments for stash

8 years agoMerge branch 'pw/completion-show-branch' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:16 +0000 (14:54 -0800)] 
Merge branch 'pw/completion-show-branch' into maint

* pw/completion-show-branch:
  completion: complete show-branch "--date-order"

8 years agoMerge branch 'jk/completion-rebase' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:16 +0000 (14:54 -0800)] 
Merge branch 'jk/completion-rebase' into maint

* jk/completion-rebase:
  completion: add missing git-rebase options

8 years agoMerge branch 'nd/diff-with-path-params' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:15 +0000 (14:54 -0800)] 
Merge branch 'nd/diff-with-path-params' into maint

A few options of "git diff" did not work well when the command was
run from a subdirectory.

* nd/diff-with-path-params:
  diff: make -O and --output work in subdirectory
  diff-no-index: do not take a redundant prefix argument

8 years agoMerge branch 'dw/subtree-split-do-not-drop-merge' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:15 +0000 (14:54 -0800)] 
Merge branch 'dw/subtree-split-do-not-drop-merge' into maint

The "split" subcommand of "git subtree" (in contrib/) incorrectly
skipped merges when it shouldn't, which was corrected.

* dw/subtree-split-do-not-drop-merge:
  contrib/subtree: fix "subtree split" skipped-merge bug

8 years agoMerge branch 'ew/svn-1.9.0-auth' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:15 +0000 (14:54 -0800)] 
Merge branch 'ew/svn-1.9.0-auth' into maint

* ew/svn-1.9.0-auth:
  git-svn: fix auth parameter handling on SVN 1.9.0+

8 years agoMerge branch 'jk/list-tag-2.7-regression' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:15 +0000 (14:54 -0800)] 
Merge branch 'jk/list-tag-2.7-regression' into maint

"git tag" started listing a tag "foo" as "tags/foo" when a branch
named "foo" exists in the same repository; remove this unnecessary
disambiguation, which is a regression introduced in v2.7.0.

* jk/list-tag-2.7-regression:
  tag: do not show ambiguous tag names as "tags/foo"
  t6300: use test_atom for some un-modern tests

8 years agoMerge branch 'jk/sanity' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:14 +0000 (14:54 -0800)] 
Merge branch 'jk/sanity' into maint

The description for SANITY prerequisite the test suite uses has
been clarified both in the comment and in the implementation.

* jk/sanity:
  test-lib: clarify and tighten SANITY

8 years agoMerge branch 'jk/filter-branch-no-index' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:13 +0000 (14:54 -0800)] 
Merge branch 'jk/filter-branch-no-index' into maint

A recent optimization to filter-branch in v2.7.0 introduced a
regression when --prune-empty filter is used, which has been
corrected.

* jk/filter-branch-no-index:
  filter-branch: resolve $commit^{tree} in no-index case

8 years agoMerge branch 'js/close-packs-before-gc' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:13 +0000 (14:54 -0800)] 
Merge branch 'js/close-packs-before-gc' into maint

Many codepaths that run "gc --auto" before exiting kept packfiles
mapped and left the file descriptors to them open, which was not
friendly to systems that cannot remove files that are open.  They
now close the packs before doing so.

* js/close-packs-before-gc:
  receive-pack: release pack files before garbage-collecting
  merge: release pack files before garbage-collecting
  am: release pack files before garbage-collecting
  fetch: release pack files before garbage-collecting

8 years agoMerge branch 'jk/ok-to-fail-gc-auto-in-rebase' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:13 +0000 (14:54 -0800)] 
Merge branch 'jk/ok-to-fail-gc-auto-in-rebase' into maint

"git rebase", unlike all other callers of "gc --auto", did not
ignore the exit code from "gc --auto".

* jk/ok-to-fail-gc-auto-in-rebase:
  rebase: ignore failures from "gc --auto"

8 years agoMerge branch 'ho/gitweb-squelch-undef-warning' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:12 +0000 (14:54 -0800)] 
Merge branch 'ho/gitweb-squelch-undef-warning' into maint

Asking gitweb for a nonexistent commit left a warning in the server
log.

Somebody may want to follow this up with a new test, perhaps?
IIRC, we do test that no Perl warnings are given to the server log,
so this should have been caught if our test coverage were good.

* ho/gitweb-squelch-undef-warning:
  gitweb: squelch "uninitialized value" warning

8 years agoMerge branch 'js/fopen-harder' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:11 +0000 (14:54 -0800)] 
Merge branch 'js/fopen-harder' into maint

Some codepaths used fopen(3) when opening a fixed path in $GIT_DIR
(e.g. COMMIT_EDITMSG) that is meant to be left after the command is
done.  This however did not work well if the repository is set to
be shared with core.sharedRepository and the umask of the previous
user is tighter.  They have been made to work better by calling
unlink(2) and retrying after fopen(3) fails with EPERM.

* js/fopen-harder:
  Handle more file writes correctly in shared repos
  commit: allow editing the commit message even in shared repos

8 years agoMerge branch 'nd/exclusion-regression-fix' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:11 +0000 (14:54 -0800)] 
Merge branch 'nd/exclusion-regression-fix' into maint

The ignore mechanism saw a few regressions around untracked file
listing and sparse checkout selection areas in 2.7.0; the change
that is responsible for the regression has been reverted.

* nd/exclusion-regression-fix:
  Revert "dir.c: don't exclude whole dir prematurely if neg pattern may match"

8 years agoMerge branch 'dk/reflog-walk-with-non-commit' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:10 +0000 (14:54 -0800)] 
Merge branch 'dk/reflog-walk-with-non-commit' into maint

"git reflog" incorrectly assumed that all objects that used to be
at the tip of a ref must be commits, which caused it to segfault.

* dk/reflog-walk-with-non-commit:
  reflog-walk: don't segfault on non-commit sha1's in the reflog

8 years agoMerge branch 'dw/signoff-doc' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:09 +0000 (14:54 -0800)] 
Merge branch 'dw/signoff-doc' into maint

The documentation has been updated to hint the connection between
the '--signoff' option and DCO.

* dw/signoff-doc:
  Expand documentation describing --signoff

8 years agoMerge branch 'jk/clang-pedantic' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:09 +0000 (14:54 -0800)] 
Merge branch 'jk/clang-pedantic' into maint

A few unportable C construct have been spotted by clang compiler
and have been fixed.

* jk/clang-pedantic:
  bswap: add NO_UNALIGNED_LOADS define
  avoid shifting signed integers 31 bits

8 years agoMerge branch 'ew/send-email-mutt-alias-fix' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:09 +0000 (14:54 -0800)] 
Merge branch 'ew/send-email-mutt-alias-fix' into maint

"git send-email" was confused by escaped quotes stored in the alias
files saved by "mutt", which has been corrected.

* ew/send-email-mutt-alias-fix:
  git-send-email: do not double-escape quotes from mutt

8 years agoMerge branch 'nd/dir-exclude-cleanup' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:08 +0000 (14:54 -0800)] 
Merge branch 'nd/dir-exclude-cleanup' into maint

The "exclude_list" structure has the usual "alloc, nr" pair of
fields to be used by ALLOC_GROW(), but clear_exclude_list() forgot
to reset 'alloc' to 0 when it cleared 'nr' to discard the managed
array.

* nd/dir-exclude-cleanup:
  dir.c: clean the entire struct in clear_exclude_list()

8 years agoMerge branch 'nd/stop-setenv-work-tree' into maint
Junio C Hamano [Fri, 5 Feb 2016 22:54:07 +0000 (14:54 -0800)] 
Merge branch 'nd/stop-setenv-work-tree' into maint

An earlier change in 2.5.x-era broke users' hooks and aliases by
exporting GIT_WORK_TREE to point at the root of the working tree,
interfering when they tried to use a different working tree without
setting GIT_WORK_TREE environment themselves.

* nd/stop-setenv-work-tree:
  Revert "setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR"

8 years agogit-svn: fix auth parameter handling on SVN 1.9.0+
Eric Wong [Sat, 16 Jan 2016 10:17:19 +0000 (10:17 +0000)] 
git-svn: fix auth parameter handling on SVN 1.9.0+

For users with "store-passwords = no" set in the "[auth]" section of
their ~/.subversion/config, SVN 1.9.0+ would fail with the
following message when attempting to call svn_auth_set_parameter:

  Value is not a string (or undef) at Git/SVN/Ra.pm

Ironically, this breakage was caused by r1553823 in subversion:

  "Make svn_auth_set_parameter() usable from Perl bindings."

Since 2007 (602015e0e6ec), git-svn has used a workaround to make
svn_auth_set_parameter usable internally.  However this workaround
breaks under SVN 1.9+, which deals properly with the type mapping
and fails to recognize our workaround.

For pre-1.9.0 SVN, we continue to use the existing workaround for
the lack of proper type mapping in the bindings.

Tested under subversion 1.6.17 and 1.9.3.

I've also verified r1553823 was not backported to SVN 1.8.x:

  BRANCH=http://svn.apache.org/repos/asf/subversion/branches/1.8.x
  svn log -v $BRANCH/subversion/bindings/swig/core.i

ref: https://bugs.debian.org/797705
Cc: 797705@bugs.debian.org
Reported-by: Thierry Vignaud <thierry.vignaud@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Tested-by: Thierry Vignaud <thierry.vignaud@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotag: do not show ambiguous tag names as "tags/foo"
Jeff King [Tue, 26 Jan 2016 03:00:05 +0000 (22:00 -0500)] 
tag: do not show ambiguous tag names as "tags/foo"

Since b7cc53e9 (tag.c: use 'ref-filter' APIs, 2015-07-11),
git-tag has started showing tags with ambiguous names (i.e.,
when both "heads/foo" and "tags/foo" exists) as "tags/foo"
instead of just "foo". This is both:

  - pointless; the output of "git tag" includes only
    refs/tags, so we know that "foo" means the one in
    "refs/tags".

and

  - ambiguous; in the original output, we know that the line
    "foo" means that "refs/tags/foo" exists. In the new
    output, it is unclear whether we mean "refs/tags/foo" or
    "refs/tags/tags/foo".

The reason this happens is that commit b7cc53e9 switched
git-tag to use ref-filter's "%(refname:short)" output
formatting, which was adapted from for-each-ref. This more
general code does not know that we care only about tags, and
uses shorten_unambiguous_ref to get the short-name. We need
to tell it that we care only about "refs/tags/", and it
should shorten with respect to that value.

In theory, the ref-filter code could figure this out by us
passing FILTER_REFS_TAGS. But there are two complications
there:

  1. The handling of refname:short is deep in formatting
     code that does not even have our ref_filter struct, let
     alone the arguments to the filter_ref struct.

  2. In git v2.7.0, we expose the formatting language to the
     user. If we follow this path, it will mean that
     "%(refname:short)" behaves differently for "tag" versus
     "for-each-ref" (including "for-each-ref refs/tags/"),
     which can lead to confusion.

Instead, let's add a new modifier to the formatting
language, "strip", to remove a specific set of prefix
components. This fixes "git tag", and lets users invoke the
same behavior from their own custom formats (for "tag" or
"for-each-ref") while leaving ":short" with its same
consistent meaning in all places.

We introduce a test in t7004 for "git tag", which fails
without this patch. We also add a similar test in t3203 for
"git branch", which does not actually fail. But since it is
likely that "branch" will eventually use the same formatting
code, the test helps defend against future regressions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompletion: update completion arguments for stash
Paul Wagland [Tue, 26 Jan 2016 09:37:19 +0000 (10:37 +0100)] 
completion: update completion arguments for stash

Add --all and --include-untracked to the git stash save completions.
Add --quiet to the git stash drop completions.
Update git stash branch so that the first argument expands out to the
possible branch names, and the other arguments expand to the stash
names.

Signed-off-by: Paul Wagland <paul@kungfoocoder.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompletion: complete show-branch "--date-order"
Paul Wagland [Sat, 23 Jan 2016 01:25:54 +0000 (02:25 +0100)] 
completion: complete show-branch "--date-order"

Signed-off-by: Paul Wagland <paul@kungfoocoder.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompletion: add missing git-rebase options
John Keeping [Thu, 21 Jan 2016 20:52:24 +0000 (20:52 +0000)] 
completion: add missing git-rebase options

This adds the --no-* variants where those are documented in
git-rebase(1).

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agomingw: avoid linking to the C library's isalpha()
Johannes Sixt [Mon, 25 Jan 2016 21:47:56 +0000 (22:47 +0100)] 
mingw: avoid linking to the C library's isalpha()

The implementation of mingw_skip_dos_drive_prefix() calls isalpha() via
has_dos_drive_prefix(). Since the definition occurs long before isalpha()
is defined in git-compat-util.h, my build environment reports:

    CC alloc.o
In file included from git-compat-util.h:186,
                 from cache.h:4,
                 from alloc.c:12:
compat/mingw.h: In function 'mingw_skip_dos_drive_prefix':
compat/mingw.h:365: warning: implicit declaration of function 'isalpha'

Dscho does not see a similar warning in his build and suspects that
ctype.h is included somehow behind the scenes. This implies that his build
links to the C library's isalpha() and does not use git's isalpha().

To fix both the warning in my build and the inconsistency in Dscho's
build, move the function definition to mingw.c. Then it picks up git's
isalpha() because git-compat-util.h is included at the top of the file.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot6300: use test_atom for some un-modern tests
Jeff King [Sun, 24 Jan 2016 23:08:18 +0000 (18:08 -0500)] 
t6300: use test_atom for some un-modern tests

Because this script has to test so many formatters, we have
the nice "test_atom" helper, but we don't use it
consistently. Let's do so. This is shorter, gets rid of some
tests that have their "expected" setup outside of a
test_expect_success block, and lets us organize the changes
better (e.g., putting "refname:short" near "refname").

We also expand the "%(push)" tests a little to match the
"%(upstream)" ones.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoresolve_gitlink_ref: ignore non-repository paths
Jeff King [Fri, 22 Jan 2016 22:29:30 +0000 (17:29 -0500)] 
resolve_gitlink_ref: ignore non-repository paths

When we want to look up a submodule ref, we use
get_ref_cache(path) to find or auto-create its ref cache.
But if we feed a path that isn't actually a git repository,
we blindly create the ref cache, and then may die deeper in
the code when we try to access it. This is a problem because
many callers speculatively feed us a path that looks vaguely
like a repository, and expect us to tell them when it is
not.

This patch teaches resolve_gitlink_ref to reject
non-repository paths without creating a ref_cache. This
avoids the die(), and also performs better if you have a
large number of these faux-submodule directories (because
the ref_cache lookup is linear, under the assumption that
there won't be a large number of submodules).

To accomplish this, we also break get_ref_cache into two
pieces: the lookup and auto-creation (the latter is lumped
into create_ref_cache). This lets us first cheaply ask our
cache "is it a submodule we know about?" If so, we can avoid
repeating our filesystem lookup. So lookups of real
submodules are not penalized; they examine the submodule's
.git directory only once.

The test in t3000 demonstrates a case where this improves
correctness (we used to just die). The new perf case in
p7300 shows off the speed improvement in an admittedly
pathological repository:

Test                  HEAD^               HEAD
----------------------------------------------------------------
7300.4: ls-files -o   66.97(66.15+0.87)   0.33(0.08+0.24) -99.5%

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoclean: make is_git_repository a public function
Jeff King [Fri, 22 Jan 2016 22:27:33 +0000 (17:27 -0500)] 
clean: make is_git_repository a public function

We have always had is_git_directory(), for looking at a
specific directory to see if it contains a git repo. In
0179ca7 (clean: improve performance when removing lots of
directories, 2015-06-15), we added is_git_repository() which
checks for a non-bare repository by looking at its ".git"
entry.

However, the fix in 0179ca7 needs to be applied other
places, too. Let's make this new helper globally available.
We need to give it a better name, though, to avoid confusion
with is_git_directory(). This patch does that, documents
both functions with a comment to reduce confusion, and
removes the clean-specific references in the comments.

Based-on-a-patch-by: Andreas Krey <a.krey@gmx.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodiff: make -O and --output work in subdirectory
Duy Nguyen [Thu, 21 Jan 2016 11:48:44 +0000 (18:48 +0700)] 
diff: make -O and --output work in subdirectory

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodiff-no-index: do not take a redundant prefix argument
Nguyễn Thái Ngọc Duy [Wed, 20 Jan 2016 11:06:02 +0000 (18:06 +0700)] 
diff-no-index: do not take a redundant prefix argument

Prefix is already set up in "revs". The same prefix should be used for
all options parsing. So kill the last argument. This patch does not
actually change anything because the only caller does use the same
prefix for init_revisions() and diff_no_index().

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-add doc: do not say working directory when you mean working tree
Lars Vogel [Thu, 21 Jan 2016 10:09:15 +0000 (11:09 +0100)] 
git-add doc: do not say working directory when you mean working tree

The usage of working directory is inconsistent in the git add help.
Also http://git-scm.com/docs/git-clone speaks only about working tree.
Remaining entry found by "git grep -B1 '^directory' git-add.txt" really
relates to a directory.

Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompletion: complete "diff --word-diff-regex="
Thomas Braun [Wed, 20 Jan 2016 17:34:58 +0000 (18:34 +0100)] 
completion: complete "diff --word-diff-regex="

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocontrib/subtree: fix "subtree split" skipped-merge bug
Dave Ware [Fri, 15 Jan 2016 00:41:43 +0000 (13:41 +1300)] 
contrib/subtree: fix "subtree split" skipped-merge bug

'git subtree split' can incorrectly skip a merge even when both parents
act on the subtree, provided the merge results in a tree identical to
one of the parents. Fix by copying the merge if at least one parent is
non-identical, and the non-identical parent is not an ancestor of the
identical parent.

Also, add a test case which checks that a descendant remains a
descendent on the subtree in this case.

Signed-off-by: Dave Ware <davidw@realtimegenomics.com>
Reviewed-by: David A. Greene <greened@obbligato.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofilter-branch: resolve $commit^{tree} in no-index case
Jeff King [Tue, 19 Jan 2016 22:07:22 +0000 (17:07 -0500)] 
filter-branch: resolve $commit^{tree} in no-index case

Commit 348d4f2 (filter-branch: skip index read/write when
possible, 2015-11-06) taught filter-branch to optimize out
the final "git write-tree" when we know we haven't touched
the tree with any of our filters. It does by simply putting
the literal text "$commit^{tree}" into the "$tree" variable,
avoiding a useless rev-parse call.

However, when we pass this to git_commit_non_empty_tree(),
it gets confused; it resolves "$commit^{tree}" itself, and
compares our string to the 40-hex sha1, which obviously
doesn't match. As a result, "--prune-empty" (or any custom
filter using git_commit_non_empty_tree) will fail to drop
an empty commit (when filter-branch is used without a tree
or index filter).

Let's resolve $tree to the 40-hex ourselves, so that
git_commit_non_empty_tree can work. Unfortunately, this is a
bit slower due to the extra process overhead:

  $ cd t/perf && ./run 348d4f2 HEAD p7000-filter-branch.sh
  [...]
  Test                  348d4f2           HEAD
  --------------------------------------------------------------
  7000.2: noop filter   3.76(0.24+0.26)   4.54(0.28+0.24) +20.7%

We could try to make git_commit_non_empty_tree more clever.
However, the value of $tree here is technically
user-visible. The user can provide arbitrary shell code at
this stage, which could itself have a similar assumption to
what is in git_commit_non_empty_tree. So the conservative
choice to fix this regression is to take the 20% hit and
give the pre-348d4f2 behavior. We still end up much faster
than before the optimization:

  $ cd t/perf && ./run 348d4f2^ HEAD p7000-filter-branch.sh
  [...]
  Test                  348d4f2^          HEAD
  --------------------------------------------------------------
  7000.2: noop filter   9.51(4.32+0.40)   4.51(0.28+0.23) -52.6%

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotest-lib: clarify and tighten SANITY
Junio C Hamano [Tue, 19 Jan 2016 22:09:37 +0000 (14:09 -0800)] 
test-lib: clarify and tighten SANITY

f400e51c (test-lib.sh: set prerequisite SANITY by testing what we
really need, 2015-01-27) improved the way SANITY prerequisite was
determined, but made the resulting code (incorrectly) imply that
SANITY is all about effects of permission bits of the containing
directory has on the files contained in it by the comment it added,
its log message and the actual tests.

State what SANITY is about more clearly in the comment, and test
that a file whose permission bits says should be unreadble truly
cannot be read.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot0060: loosen overly strict expectations
Johannes Schindelin [Thu, 14 Jan 2016 06:48:27 +0000 (07:48 +0100)] 
t0060: loosen overly strict expectations

The dirname() tests file were developed and tested on only the five
platforms available to the developer at the time, namely: Linux (both 32
and 64bit), Windows XP 32-bit (MSVC), MinGW 32-bit and Cygwin 32-bit.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/basename.html
(i.e. the POSIX spec) says, in part:

If the string pointed to by path consists entirely of the '/'
character, basename() shall return a pointer to the string "/".
If the string pointed to by path is exactly "//", it is
implementation-defined whether "/" or "//" is returned.

The thinking behind testing precise, OS-dependent output values was to
document that different setups produce different values. However, as the
test failures on MacOSX illustrated eloquently: hardcoding pretty much each
and every setup's expectations is pretty fragile.

This is not limited to the "//" vs "/" case, of course, other inputs are
also allowed to produce multiple outputs by the POSIX specs.

So let's just test for all allowed values and be done with it. This still
documents that Git cannot rely on one particular output value in those
cases, so the intention of the original tests is still met.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorebase: ignore failures from "gc --auto"
Jeff King [Wed, 13 Jan 2016 18:47:18 +0000 (13:47 -0500)] 
rebase: ignore failures from "gc --auto"

After rebasing, we call "gc --auto" to clean up if we
created a lot of loose objects. However, we do so inside an
&&-chain. If "gc --auto" fails (e.g., because a previous
background gc blocked us by leaving "gc.log" in place),
then:

  1. We will fail to clean up the state directory, leaving
     the user stuck in the rebase forever (even "git am
     --abort" doesn't work, because it calls "gc --auto"!).

  2. In some cases, we may return a bogus exit code from
     rebase, indicating failure when everything except the
     auto-gc succeeded.

We can fix this by ignoring the exit code of "gc --auto".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoreceive-pack: release pack files before garbage-collecting
Johannes Schindelin [Wed, 13 Jan 2016 17:20:26 +0000 (18:20 +0100)] 
receive-pack: release pack files before garbage-collecting

Before auto-gc'ing, we need to make sure that the pack files are
released in case they need to be repacked and garbage-collected.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agomerge: release pack files before garbage-collecting
Johannes Schindelin [Wed, 13 Jan 2016 17:20:21 +0000 (18:20 +0100)] 
merge: release pack files before garbage-collecting

Before auto-gc'ing, we need to make sure that the pack files are
released in case they need to be repacked and garbage-collected.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoam: release pack files before garbage-collecting
Johannes Schindelin [Wed, 13 Jan 2016 17:20:16 +0000 (18:20 +0100)] 
am: release pack files before garbage-collecting

Before auto-gc'ing, we need to make sure that the pack files are
released in case they need to be repacked and garbage-collected.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofetch: release pack files before garbage-collecting
Johannes Schindelin [Wed, 13 Jan 2016 17:20:11 +0000 (18:20 +0100)] 
fetch: release pack files before garbage-collecting

Before auto-gc'ing, we need to make sure that the pack files are
released in case they need to be repacked and garbage-collected.

This fixes https://github.com/git-for-windows/git/issues/500

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'maint' of git://github.com/git-l10n/git-po into maint
Junio C Hamano [Tue, 12 Jan 2016 23:05:05 +0000 (15:05 -0800)] 
Merge branch 'maint' of git://github.com/git-l10n/git-po into maint

* 'maint' of git://github.com/git-l10n/git-po:
  l10n: ko.po: Add Korean translation

8 years agogitweb: squelch "uninitialized value" warning
Øyvind A. Holm [Tue, 12 Jan 2016 03:31:56 +0000 (04:31 +0100)] 
gitweb: squelch "uninitialized value" warning

git_object() chomps $type that is read from "cat-file -t", but
it does so before checking if $type is defined, resulting in
a Perl warning in the server error log:

  gitweb.cgi: Use of uninitialized value $type in scalar chomp at
  [...]/gitweb.cgi line 7579., referer: [...]

when trying to access a non-existing commit, for example:

  http://HOST/?p=PROJECT.git;a=commit;h=NON_EXISTING_COMMIT

Check the value in $type before chomping.  This will cause us to
call href with its action parameter set to undef when formulating
the URL to redirect to, but that is harmless, as the function treats
a parameter that set to undef as if it does not exist.

Signed-off-by: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot0060: verify that basename() and dirname() work as expected
Johannes Schindelin [Tue, 12 Jan 2016 07:57:57 +0000 (08:57 +0100)] 
t0060: verify that basename() and dirname() work as expected

Unfortunately, some libgen implementations yield outcomes different
from what Git expects. For example, mingw-w64-crt provides a basename()
function, that shortens `path0/` to `path`!

So let's verify that the basename() and dirname() functions we use
conform to what Git expects.

Derived-from-code-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompat/basename.c: provide a dirname() compatibility function
Johannes Schindelin [Tue, 12 Jan 2016 07:57:36 +0000 (08:57 +0100)] 
compat/basename.c: provide a dirname() compatibility function

When there is no `libgen.h` to our disposal, we miss the `dirname()`
function.  Earlier we added basename() compatibility function for
the same reason at e1c06886 (compat: add a basename() compatibility
function, 2009-05-31).

So far, we only had one user of that function: credential-cache--daemon
(which was only compiled when Unix sockets are available, anyway). But
now we also have `builtin/am.c` as user, so we need it.

Since `dirname()` is a sibling of `basename()`, we simply put our very
own `gitdirname()` implementation next to `gitbasename()` and use it
if `NO_LIBGEN_H` has been set.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocompat/basename: make basename() conform to POSIX
Johannes Schindelin [Tue, 12 Jan 2016 07:57:30 +0000 (08:57 +0100)] 
compat/basename: make basename() conform to POSIX

According to POSIX, basename("/path/") should return "path", not
"path/". Likewise, basename(NULL) and basename("") should both
return "." to conform.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoRefactor skipping DOS drive prefixes
Johannes Schindelin [Tue, 12 Jan 2016 07:57:22 +0000 (08:57 +0100)] 
Refactor skipping DOS drive prefixes

Junio noticed that there is an implicit assumption in pretty much
all the code calling has_dos_drive_prefix(): it forces all of its
callsites to hardcode the knowledge that the DOS drive prefix is
always two bytes long.

While this assumption is pretty safe, we can still make the code
more readable and less error-prone by introducing a function that
skips the DOS drive prefix safely.

While at it, we change the has_dos_drive_prefix() return value: it
now returns the number of bytes to be skipped if there is a DOS
drive prefix.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoHandle more file writes correctly in shared repos
Johannes Schindelin [Mon, 11 Jan 2016 18:35:54 +0000 (19:35 +0100)] 
Handle more file writes correctly in shared repos

In shared repositories, we have to be careful when writing files whose
permissions do not allow users other than the owner to write them.

In particular, we force the marks file of fast-export and the FETCH_HEAD
when fetching to be rewritten from scratch.

This commit does not touch other calls to fopen() that want to
write files:

 - commands that write to working tree files (core.sharedRepository
   does not affect permission bits of working tree files),
   e.g. .rej file created by "apply --reject", result of applying a
   previous conflict resolution by "rerere", "git merge-file".

 - git am, when splitting mails (git-am correctly cleans up its directory
   after finishing, so there is no need to share those files between users)

 - git submodule clone, when writing the .git file, because the file
   will not be overwritten

 - git_terminal_prompt() in compat/terminal.c, because it is not writing to
   a file at all

 - git diff --output, because the output file is clearly not intended to be
   shared between the users of the current repository

 - git fast-import, when writing a crash report, because the reports' file
   names are unique due to an embedded process ID

 - mailinfo() in mailinfo.c, because the output is clearly not intended to
   be shared between the users of the current repository

 - check_or_regenerate_marks() in remote-testsvn.c, because this is only
   used for Git's internal testing

 - git fsck, when writing lost&found blobs (this should probably be
   changed, but left as a low-hanging fruit for future contributors).

Note that this patch does not touch callers of write_file() and
write_file_gently(), which would benefit from the same scrutiny as
to usage in shared repositories.  Most notable users are branch,
daemon, submodule & worktree, and a worrisome call in transport.c
when updating one ref (which ignores the shared flag).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodocs: clarify that --depth for git-fetch works with newly initialized repos
Sebastian Schuberth [Fri, 8 Jan 2016 09:32:52 +0000 (10:32 +0100)] 
docs: clarify that --depth for git-fetch works with newly initialized repos

The original wording sounded as if --depth could only be used to deepen or
shorten the history of existing repos. However, that is not the case. In a
workflow like

    $ git init
    $ git remote add origin https://github.com/git/git.git
    $ git fetch --depth=1

The newly initialized repo is properly created as a shallow repo.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodocs: say "commits" in the --depth option wording for git-clone
Sebastian Schuberth [Fri, 8 Jan 2016 09:18:21 +0000 (10:18 +0100)] 
docs: say "commits" in the --depth option wording for git-clone

It is not wrong to talk about "revisions" here, but in this context
revisions are always commits, and that is how we already name it in the
git-fetch docs. So align the docs by always referring to "commits".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoRevert "dir.c: don't exclude whole dir prematurely if neg pattern may match"
Nguyễn Thái Ngọc Duy [Fri, 8 Jan 2016 12:05:25 +0000 (19:05 +0700)] 
Revert "dir.c: don't exclude whole dir prematurely if neg pattern may match"

This reverts commit 57534ee77d22e725d971ee89c77dc6aad61c573f. The
feature added in that commit requires that patterns behave the same way
from anywhere. But some patterns can behave differently depending on
current "working" directory. The conditions to catch and avoid these
patterns are too loose. The untracked listing[1] and sparse-checkout
selection[2] can become incorrect as a result.

  [1] http://article.gmane.org/gmane.comp.version-control.git/283520
  [2] http://article.gmane.org/gmane.comp.version-control.git/283532

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocommit: allow editing the commit message even in shared repos
Johannes Schindelin [Wed, 6 Jan 2016 13:09:43 +0000 (14:09 +0100)] 
commit: allow editing the commit message even in shared repos

It was pointed out by Yaroslav Halchenko that the file containing the
commit message is writable only by the owner, which means that we have
to rewrite it from scratch in a shared repository.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodocs: clarify that passing --depth to git-clone implies --single-branch
Sebastian Schuberth [Wed, 6 Jan 2016 13:06:47 +0000 (14:06 +0100)] 
docs: clarify that passing --depth to git-clone implies --single-branch

It is confusing to document how --depth behaves as part of the
--single-branch docs. Better move that part to the --depth docs, saying
that it implies --single-branch by default.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoExpand documentation describing --signoff
David A. Wheeler [Tue, 5 Jan 2016 19:20:26 +0000 (14:20 -0500)] 
Expand documentation describing --signoff

Modify various document (man page) files to explain
in more detail what --signoff means.

This was inspired by https://lwn.net/Articles/669976/ where
paulj noted, "adding [the] '-s' argument to [a] git commit
doesn't really mean you have even heard of the DCO...".
Extending git's documentation will make it easier to argue
that developers understood --signoff when they use it.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoreflog-walk: don't segfault on non-commit sha1's in the reflog
Dennis Kaarsemaker [Tue, 5 Jan 2016 21:12:10 +0000 (22:12 +0100)] 
reflog-walk: don't segfault on non-commit sha1's in the reflog

git reflog (ab)uses the log machinery to display its list of log
entries. To do so it must fake commit parent information for the log
walker.

For refs in refs/heads this is no problem, as they should only ever
point to commits. Tags and other refs however can point to anything,
thus their reflog may contain non-commit objects.

To avoid segfaulting, we check whether reflog entries are commits before
feeding them to the log walker and skip any non-commits. This means that
git reflog output will be incomplete for such refs, but that's one step
up from segfaulting. A more complete solution would be to decouple git
reflog from the log walker machinery.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot6050-replace: make failing editor test more robust
SZEDER Gábor [Tue, 5 Jan 2016 10:33:30 +0000 (11:33 +0100)] 
t6050-replace: make failing editor test more robust

'git replace --edit' should error out when the invoked editor fails,
but the test checking this behavior would not notice if this weren't
the case.

The test in question, ever since it was added in 85f98fc037ae
(replace: add tests for --edit, 2014-05-17), has simulated a failing
editor in an unconventional way:

  test_must_fail env GIT_EDITOR='./fakeeditor;false' git replace --edit

I presume the reason for this unconventional editor was the fact that
'git replace --edit' requires the edited object to be different from
the original, but a mere 'false' as editor would leave the object
unchanged and 'git replace --edit' would error out anyway complaining
about the new and the original object files being the same.  Running
'fakeeditor' before 'false' was supposed to ensure that the object
file is modified and thus 'git replace --edit' errors out because of
the failed editor.

However, this editor doesn't actually modify the edited object,
because start_command() turns this editor into:

  /bin/sh -c './fakeeditor;false "$@"' './fakeeditor;false' \
          '.../.git/REPLACE_EDITOBJ'

This means that the test's fakeeditor script doesn't even get the path
of the object to be edited as argument, triggering error messages from
the commands executed inside the script ('sed' and 'mv'), and
ultimately leaving the object file unchanged.

If a patch were to remove the die() from the error path after
launch_editor(), the test would not catch it, because 'git replace'
would continue execution past launch_editor() and would error out a
bit later due to the unchanged edited object.  Though 'git replace'
would error out for the wrong reason, this would satisfy
'test_must_fail' just as well, and the test would succeed leaving the
undesired change unnoticed.

Create a proper failing fake editor script for this test to ensure
that the edited object is in fact modified and 'git replace --edit'
won't error out because the new and original object files are the
same.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofor-each-ref: document `creatordate` and `creator` fields
Eric Wong [Tue, 5 Jan 2016 03:51:57 +0000 (03:51 +0000)] 
for-each-ref: document `creatordate` and `creator` fields

These were introduced back in 2006 at 3175aa1ec28c but
never documented.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoGit 2.7 v2.7.0
Junio C Hamano [Mon, 4 Jan 2016 22:08:04 +0000 (14:08 -0800)] 
Git 2.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoSync with 2.6.5
Junio C Hamano [Mon, 4 Jan 2016 22:06:59 +0000 (14:06 -0800)] 
Sync with 2.6.5

8 years agoGit 2.6.5 v2.6.5
Junio C Hamano [Mon, 4 Jan 2016 22:06:00 +0000 (14:06 -0800)] 
Git 2.6.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/pending-keep-tag-name' into maint
Junio C Hamano [Mon, 4 Jan 2016 22:03:07 +0000 (14:03 -0800)] 
Merge branch 'jk/pending-keep-tag-name' into maint

History traversal with "git log --source" that starts with an
annotated tag failed to report the tag as "source", due to an
old regression in the command line parser back in v2.2 days.

* jk/pending-keep-tag-name:
  revision.c: propagate tag names from pending array

8 years agoMerge branch 'jk/symbolic-ref-maint' into maint
Junio C Hamano [Mon, 4 Jan 2016 22:02:58 +0000 (14:02 -0800)] 
Merge branch 'jk/symbolic-ref-maint' into maint

"git symbolic-ref" forgot to report a failure with its exit status.

* jk/symbolic-ref-maint:
  t1401: test reflog creation for git-symbolic-ref
  symbolic-ref: propagate error code from create_symref()

8 years agoMerge branch 'jk/ident-loosen-getpwuid' into maint
Junio C Hamano [Mon, 4 Jan 2016 22:02:57 +0000 (14:02 -0800)] 
Merge branch 'jk/ident-loosen-getpwuid' into maint

When getpwuid() on the system returned NULL (e.g. the user is not
in the /etc/passwd file or other uid-to-name mappings), the
codepath to find who the user is to record it in the reflog barfed
and died.  Loosen the check in this codepath, which already accepts
questionable ident string (e.g. host part of the e-mail address is
obviously bogus), and in general when we operate fmt_ident() function
in non-strict mode.

* jk/ident-loosen-getpwuid:
  ident: loosen getpwuid error in non-strict mode
  ident: keep a flag for bogus default_email
  ident: make xgetpwuid_self() a static local helper

8 years agoMerge branch 'jk/send-email-ssl-errors' into maint
Junio C Hamano [Mon, 4 Jan 2016 22:02:55 +0000 (14:02 -0800)] 
Merge branch 'jk/send-email-ssl-errors' into maint

Improve error reporting when SMTP TLS fails.

* jk/send-email-ssl-errors:
  send-email: enable SSL level 1 debug output

8 years agoMerge branch 'sg/completion-no-column' into maint
Junio C Hamano [Mon, 4 Jan 2016 22:02:45 +0000 (14:02 -0800)] 
Merge branch 'sg/completion-no-column' into maint

The completion script (in contrib/) used to list "git column"
(which is not an end-user facing command) as one of the choices

* sg/completion-no-column:
  completion: remove 'git column' from porcelain commands

8 years agogit-send-email: do not double-escape quotes from mutt
Eric Wong [Mon, 4 Jan 2016 20:53:30 +0000 (20:53 +0000)] 
git-send-email: do not double-escape quotes from mutt

mutt saves aliases with escaped quotes in the form of:

alias dot \"Dot U. Sir\" <somebody@example.org>

When we pass through our sanitize_address routine,
we end up with double-escaping:

 To: "\\\"Dot U. Sir\\\" <somebody@example.org>

Remove the escaping in mutt only for now, as I am not sure
if other mailers can do this or if this is better fixed in
sanitize_address.

Cc: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobswap: add NO_UNALIGNED_LOADS define
Jeff King [Tue, 29 Dec 2015 06:36:00 +0000 (01:36 -0500)] 
bswap: add NO_UNALIGNED_LOADS define

The byte-swapping code automatically decides, based on the
platform, whether it is sensible to cast and do a potentially
unaligned ntohl(), or to pick individual bytes out of an
array.

It can be handy to override this decision, though, when
turning on compiler flags that will complain about unaligned
loads (such as -fsanitize=undefined). This patch adds a
macro check to make this possible.

There's no nice Makefile knob here; this is for prodding at
Git's internals, and anybody using it can set
"-DNO_UNALIGNED_LOADS" in the same place they are setting up
"-fsanitize".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoavoid shifting signed integers 31 bits
Jeff King [Tue, 29 Dec 2015 06:35:46 +0000 (01:35 -0500)] 
avoid shifting signed integers 31 bits

We sometimes use 32-bit unsigned integers as bit-fields.
It's fine to access the MSB, because it's unsigned. However,
doing so as "1 << 31" is wrong, because the constant "1" is
a signed int, and we shift into the sign bit, causing
undefined behavior.

We can fix this by using "1U" as the constant.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agol10n: ko.po: Add Korean translation
Changwoo Ryu [Sun, 3 Jan 2016 10:07:29 +0000 (19:07 +0900)] 
l10n: ko.po: Add Korean translation

Signed-off-by: Changwoo Ryu <cwryu@debian.org>
Signed-off-by: Hyunjun Kim <yoloseem@users.noreply.github.com>
8 years agoMerge tag 'l10n-2.7.0-rnd2+de' of git://github.com/git-l10n/git-po
Junio C Hamano [Sat, 2 Jan 2016 19:31:43 +0000 (11:31 -0800)] 
Merge tag 'l10n-2.7.0-rnd2+de' of git://github.com/git-l10n/git-po

l10n-2.7.0-rnd2+de

* tag 'l10n-2.7.0-rnd2+de' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 68 new messages
  l10n: de.po: improve some translations

8 years agouser-manual: add addition gitweb information
Stephen P. Smith [Wed, 30 Dec 2015 23:25:20 +0000 (16:25 -0700)] 
user-manual: add addition gitweb information

Rework the section on gitweb to add information about the cgi script
and the instaweb command.

Signed-off-by: Stephen P. Smith <ischis2@cox.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agouser-manual: add section documenting shallow clones
Stephen P. Smith [Wed, 30 Dec 2015 00:03:50 +0000 (17:03 -0700)] 
user-manual: add section documenting shallow clones

Signed-off-by: Stephen P. Smith <ischis2@cox.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoglossary: define the term shallow clone
Stephen P. Smith [Tue, 29 Dec 2015 18:54:35 +0000 (11:54 -0700)] 
glossary: define the term shallow clone

There are several places in the documentation that
the term shallow clone is used. Defining the term
enables its use elsewhere with a known definition.

Signed-off-by: Stephen P. Smith <ischis2@cox.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agol10n: de.po: translate 68 new messages
Ralf Thielow [Tue, 22 Dec 2015 17:08:06 +0000 (18:08 +0100)] 
l10n: de.po: translate 68 new messages

Translate 68 new messages came from git.pot update in
f4f2c8f (l10n: git.pot: v2.7.0 round 1 (66 new, 29 removed)) and
2c0ca05 (l10n: git.pot: v2.7.0 round 2 (2 new, 2 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
8 years agol10n: de.po: improve some translations
Ralf Thielow [Thu, 29 Oct 2015 21:18:32 +0000 (22:18 +0100)] 
l10n: de.po: improve some translations

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Phillip Sz <phillip.szelat@gmail.com>
8 years agoGit 2.7-rc3 v2.7.0-rc3
Junio C Hamano [Mon, 28 Dec 2015 22:00:52 +0000 (14:00 -0800)] 
Git 2.7-rc3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'sh/p4-multi-depot'
Junio C Hamano [Mon, 28 Dec 2015 21:58:57 +0000 (13:58 -0800)] 
Merge branch 'sh/p4-multi-depot'

"git p4" when interacting with multiple depots at the same time
used to incorrectly drop changes.

* sh/p4-multi-depot:
  git-p4: reduce number of server queries for fetches
  git-p4: support multiple depot paths in p4 submit
  git-p4: failing test case for skipping changes with multiple depots

8 years agoMerge branch 'jk/pending-keep-tag-name'
Junio C Hamano [Mon, 28 Dec 2015 21:58:03 +0000 (13:58 -0800)] 
Merge branch 'jk/pending-keep-tag-name'

History traversal with "git log --source" that starts with an
annotated tag failed to report the tag as "source", due to an
old regression in the command line parser back in v2.2 days.

* jk/pending-keep-tag-name:
  revision.c: propagate tag names from pending array

8 years agoMerge branch 'jk/symbolic-ref-maint'
Junio C Hamano [Mon, 28 Dec 2015 21:57:24 +0000 (13:57 -0800)] 
Merge branch 'jk/symbolic-ref-maint'

"git symbolic-ref" forgot to report a failure with its exit status.

* jk/symbolic-ref-maint:
  t1401: test reflog creation for git-symbolic-ref
  symbolic-ref: propagate error code from create_symref()

8 years agoMerge tag 'l10n-2.7.0-rnd2' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 28 Dec 2015 21:53:47 +0000 (13:53 -0800)] 
Merge tag 'l10n-2.7.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.7.0-rnd2

* tag 'l10n-2.7.0-rnd2' of git://github.com/git-l10n/git-po:
  l10n: ru.po: update Russian translation
  l10n: Updated Bulgarian translation of git (2477t,0f,0u)
  l10n: ca.po: update translation
  l10n: zh_CN: for git v2.7.0 l10n round 2
  l10n: sv.po: Update Swedish translation (2477t0f0u)
  l10n: sv: Fix bad translation
  l10n: fr.po v2.7.0 round 2 (2477t)
  l10n: git.pot: v2.7.0 round 2 (2 new, 2 removed)
  l10n: zh_CN: for git v2.7.0 l10n round 1
  l10n: ca.po: update translation
  l10n: fr v2.7.0 round 1 (2477t)
  l10n: Updated Bulgarian translation of git (2477t,0f,0u)
  l10n: sv.po: Update Swedish translation (2477t0f0u)
  l10n: vi.po: Updated translation (2477t)
  l10n: git.pot: v2.7.0 round 1 (66 new, 29 removed)
  l10n: fr.po: Fix typo
  l10n: fr.po: Fix typo

8 years agouser-manual: remove temporary branch entry from todo list
Stephen P. Smith [Mon, 28 Dec 2015 20:16:44 +0000 (13:16 -0700)] 
user-manual: remove temporary branch entry from todo list

In the section on "How to check out a different version of a
project" the "new" branch is used as a temporary branch.  A detached
HEAD was not used since it was a new feature introduced just a
couple weeks prior.

The section could be changed to use and explain a detached HEAD,
except that would increase the learning curve early in the manual.
Detached HEADs are discussed a couple sections later under
"Examining an old version without creating a new branch".

Let's declare that it is a bad idea to rewrite the example that
uses a temporary branch to do the sightseeing on a detached HEAD.

Signed-off-by: Stephen P. Smith <ischis2@cox.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodir.c: clean the entire struct in clear_exclude_list()
Nguyễn Thái Ngọc Duy [Sun, 27 Dec 2015 01:54:34 +0000 (08:54 +0700)] 
dir.c: clean the entire struct in clear_exclude_list()

Make sure "el" can be reuseable again. The problem was el->alloc is
not cleared and may cause segfaults next time because add_exclude()
thinks el->excludes (being NULL) has enough space. Just clear the
entire struct to be safe.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agol10n: ru.po: update Russian translation
Dimitriy Ryazantcev [Fri, 25 Dec 2015 12:02:48 +0000 (14:02 +0200)] 
l10n: ru.po: update Russian translation

Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
8 years agoMerge branch 'master' of git://github.com/alshopov/git-po
Jiang Xin [Mon, 28 Dec 2015 15:13:15 +0000 (23:13 +0800)] 
Merge branch 'master' of git://github.com/alshopov/git-po

* 'master' of git://github.com/alshopov/git-po:
  l10n: Updated Bulgarian translation of git (2477t,0f,0u)

8 years agol10n: Updated Bulgarian translation of git (2477t,0f,0u)
Alexander Shopov [Mon, 28 Dec 2015 09:33:41 +0000 (11:33 +0200)] 
l10n: Updated Bulgarian translation of git (2477t,0f,0u)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
8 years agol10n: ca.po: update translation
Alex Henrie [Mon, 28 Dec 2015 04:42:59 +0000 (21:42 -0700)] 
l10n: ca.po: update translation

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
8 years agol10n: zh_CN: for git v2.7.0 l10n round 2
Jiang Xin [Tue, 22 Dec 2015 15:06:59 +0000 (23:06 +0800)] 
l10n: zh_CN: for git v2.7.0 l10n round 2

Update 2 translations (2477t0f0u) for git v2.7.0-rc1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>