1
0
mirror of https://github.com/git/git.git synced 2024-10-02 12:22:01 +02:00
Commit Graph

39625 Commits

Author SHA1 Message Date
Junio C Hamano
3f20927717 Merge branch 'es/osx-header-pollutes-mask-macro' into maint
* es/osx-header-pollutes-mask-macro:
  ewah: use less generic macro name
  ewah/bitmap: silence warning about MASK macro redefinition
2015-07-15 11:41:24 -07:00
Junio C Hamano
71a8af60ae Merge branch 'es/utf8-stupid-compiler-workaround' into maint
A compilation workaround.

* es/utf8-stupid-compiler-workaround:
  utf8: NO_ICONV: silence uninitialized variable warning
2015-07-15 11:41:23 -07:00
Junio C Hamano
a15ebbc2c7 Merge branch 'fk/doc-format-patch-vn' into maint
Docfix.

* fk/doc-format-patch-vn:
  doc: format-patch: fix typo
2015-07-15 11:41:22 -07:00
Junio C Hamano
e9da4e6ff2 Merge branch 'pt/t0302-needs-sanity' into maint
* pt/t0302-needs-sanity:
  t0302: "unreadable" test needs SANITY prereq
2015-07-15 11:41:21 -07:00
Junio C Hamano
eca143b721 Merge branch 'me/fetch-into-shallow-safety' into maint
"git fetch --depth=<depth>" and "git clone --depth=<depth>" issued
a shallow transfer request even to an upload-pack that does not
support the capability.

* me/fetch-into-shallow-safety:
  fetch-pack: check for shallow if depth given
2015-07-15 11:41:20 -07:00
Junio C Hamano
697f67ac9f Merge branch 'mh/fsck-reflog-entries' into maint
"git fsck" used to ignore missing or invalid objects recorded in reflog.

* mh/fsck-reflog-entries:
  fsck: report errors if reflog entries point at invalid objects
  fsck_handle_reflog_sha1(): new function
2015-07-15 11:41:19 -07:00
Junio C Hamano
ada9ecd989 Merge branch 'af/tcsh-completion-noclobber' into maint
The tcsh completion writes a bash scriptlet but that would have
failed for users with noclobber set.

* af/tcsh-completion-noclobber:
  git-completion.tcsh: fix redirect with noclobber
2015-07-15 11:41:18 -07:00
Junio C Hamano
7c621186ba Merge branch 'pa/auto-gc-mac-osx' into maint
Recent Mac OS X updates breaks the logic to detect that the machine
is on the AC power in the sample pre-auto-gc script.

* pa/auto-gc-mac-osx:
  hooks/pre-auto-gc: adjust power checking for newer OS X
2015-07-15 11:41:17 -07:00
Junio C Hamano
93eba05b4f Merge branch 'jc/do-not-feed-tags-to-clear-commit-marks' into maint
"git format-patch --ignore-if-upstream A..B" did not like to be fed
tags as boundary commits.

* jc/do-not-feed-tags-to-clear-commit-marks:
  format-patch: do not feed tags to clear_commit_marks()
2015-07-15 11:41:16 -07:00
Sebastian Schuberth
7e837c6477 clone: simplify string handling in guess_dir_name()
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-09 14:21:29 -07:00
Jeff King
3096b2ecdb check_and_freshen_file: fix reversed success-check
When we want to write out a loose object file, we have
always first made sure we don't already have the object
somewhere. Since 33d4221 (write_sha1_file: freshen existing
objects, 2014-10-15), we also update the timestamp on the
file, so that a simultaneous prune knows somebody is
likely to reference it soon.

If our utime() call fails, we treat this the same as not
having the object in the first place; the safe thing to do
is write out another copy. However, the loose-object check
accidentally inverts the utime() check; it returns failure
_only_ when the utime() call actually succeeded. Thus it was
failing to protect us there, and in the normal case where
utime() succeeds, it caused us to pointlessly write out and
link the object.

This passed our freshening tests, because writing out the
new object is certainly _one_ way of updating its utime. So
the normal case was inefficient, but not wrong.

While we're here, let's also drop a comment in front of the
check_and_freshen functions, making a note of their return
type (since it is not our usual "0 for success, -1 for
error").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-08 15:58:28 -07:00
Clemens Buchacher
60d708b220 rebase: return non-zero error code if format-patch fails
Since e481af06 (rebase: Handle cases where format-patch fails) we
notice if format-patch fails and return immediately from
git-rebase--am. We save the return value with ret=$?, but then we
return $?, which is usually zero in this case.

Fix this by returning $ret instead.

Cc: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Clemens Buchacher <clemens.buchacher@intel.com>
Helped-by: Jorge Nunes <jorge.nunes@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-08 15:36:42 -07:00
Matthieu Moy
83fe16703e Documentation/branch: document -M and -D in terms of --force
Now that we have proper documentation for --force's interaction with -d
and -m, we can avoid duplication and consider -M and -D as convenience
aliases for -m --force and -d --force.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-06 10:36:54 -07:00
Matthieu Moy
8482d042a0 Documentation/branch: document -d --force and -m --force
The --force option was modified in 356e91f (branch: allow -f with -m and
-d, 2014-12-08), but the documentation was not updated.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-06 10:36:51 -07:00
Michael Haggerty
6c8afe495b strbuf: strbuf_read_file() should return ssize_t
It is currently declared to return int, which could overflow for
large files.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-03 18:25:02 -07:00
Junio C Hamano
124b51909d pager: do not leak "GIT_PAGER_IN_USE" to the pager
Since 2e6c012e (setup_pager: set GIT_PAGER_IN_USE, 2011-08-17), we
export GIT_PAGER_IN_USE so that a process that becomes the upstream
of the spawned pager can still tell that we have spawned the pager
and decide to do colored output even when its output no longer goes
to a terminal (i.e. isatty(1)).

But we forgot to clear it from the enviornment of the spawned pager.

This is not a problem in a sane world, but if you have a handful of
thousands Git users in your organization, somebody is bound to do
strange things, e.g. typing "!<ENTER>" instead of 'q' to get control
back from $LESS.  GIT_PAGER_IN_USE is still set in that subshell
spawned by "less", and all sorts of interesting things starts
happening, e.g. "git diff | cat" starts coloring its output.

We can clear the environment variable in the half of the fork that
runs the pager to avoid the confusion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-03 18:07:21 -07:00
Jeff King
c8a70d3509 rev-list: disable --use-bitmap-index when pruning commits
The reachability bitmaps do not have enough information to
tell us which commits might have changed path "foo", so the
current code produces wrong answers for:

  git rev-list --use-bitmap-index --count HEAD -- foo

(it silently ignores the "foo" limiter). Instead, we should
fall back to doing a normal traversal (it is OK to fall
back rather than complain, because --use-bitmap-index is a
pure optimization, and might not kick in for other reasons,
such as there being no bitmaps in the repository).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-01 12:00:50 -07:00
Lawrence Siebert
75d2e5a7b0 rev-list: add --count to usage guide
--count should be mentioned in the usage guide, this updates code and
documentation.

Signed-off-by: Lawrence Siebert <lawrencesiebert@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-01 09:29:11 -07:00
Karsten Blees
7a64592cf8 config.c: fix writing config files on Windows network shares
Renaming to an existing file doesn't work on Windows network shares if the
target file is open.

munmap() the old config file before commit_lock_file.

Signed-off-by: Karsten Blees <blees@dcon.de>
Acked-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-30 11:01:59 -07:00
Johannes Schindelin
0e0aff4b4c rebase -i: do not leave a CHERRY_PICK_HEAD file behind
When skipping commits whose changes were already applied via `git rebase
--continue`, we need to clean up said file explicitly.

The same is not true for `git rebase --skip` because that will execute
`git reset --hard` as part of the "skip" handling in git-rebase.sh, even
before git-rebase--interactive.sh is called.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-29 13:12:43 -07:00
Johannes Schindelin
d17ec3a9da t3404: demonstrate CHERRY_PICK_HEAD bug
When rev-list's --cherry option does not detect that a patch has already
been applied upstream, an interactive rebase would offer to reapply it and
consequently stop at that patch with a failure, mentioning that the diff
is empty.

Traditionally, a `git rebase --continue` simply skips the commit in such a
situation.

However, as pointed out by Gábor Szeder, this leaves a CHERRY_PICK_HEAD
behind, making the Git prompt believe that a cherry pick is still going
on. This commit adds a test case demonstrating this bug.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-29 13:11:37 -07:00
Enrique Tobis
5841520b03 http: always use any proxy auth method available
We set CURLOPT_PROXYAUTH to use the most secure authentication
method available only when the user has set configuration variables
to specify a proxy.  However, libcurl also supports specifying a
proxy through environment variables.  In that case libcurl defaults
to only using the Basic proxy authentication method, because we do
not use CURLOPT_PROXYAUTH.

Set CURLOPT_PROXYAUTH to always use the most secure authentication
method available, even when there is no git configuration telling us
to use a proxy. This allows the user to use environment variables to
configure a proxy that requires an authentication method different
from Basic.

Signed-off-by: Enrique A. Tobis <etobis@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-29 09:57:43 -07:00
Junio C Hamano
84d18c0bcf fsck: it is OK for a tag and a commit to lack the body
When fsck validates a commit or a tag, it scans each line in the
header of the object using helper functions such as "start_with()",
etc. that work on a NUL terminated buffer, but before a1e920a0
(index-pack: terminate object buffers with NUL, 2014-12-08), the
validation functions were fed the object data in a piece of memory
that is not necessarily terminated with a NUL.

We added a helper function require_end_of_header() to be called at
the beginning of these validation functions to insist that the
object data contains an empty line before its end.  The theory is
that the validating functions will notice and stop when it hits an
empty line as a normal end of header (or a required header line that
is missing) without scanning past the end of potentially not
NUL-terminated buffer.

But the theory forgot that in the older days, Git itself happily
created objects with only the header lines without a body. This
caused Git 2.2 and later to issue an unnecessary warning in some
existing repositories.

With a1e920a0, we do not need to require an empty line (or the body)
in these objects to safely parse and validate them.  Drop the
offending "must have an empty line" check from this helper function,
while keeping the other check to make sure that there is no NUL in
the header part of the object, and adjust the name of the helper to
what it does accordingly.

Noticed-by: Wolfgang Denk <wd@denx.de>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-28 14:47:28 -07:00
Junio C Hamano
351d06df51 Merge branch 'jk/stash-require-clean-index' into maint
A hotfix for the topic already in 'master'.

* jk/stash-require-clean-index:
  Revert "stash: require a clean index to apply"
2015-06-25 23:03:27 -07:00
Junio C Hamano
b1f0802e91 Merge branch 'cb/array-size' into maint
* cb/array-size:
  Fix definition of ARRAY_SIZE for non-gcc builds
2015-06-25 23:03:25 -07:00
Junio C Hamano
0df0541bf1 Git 2.4.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.4.5
2015-06-25 11:03:05 -07:00
Junio C Hamano
ebf4fc90da Merge branch 'sg/merge-summary-config' into maint
Doc updates.

* sg/merge-summary-config:
  Documentation: include 'merge.branchdesc' for merge and config as well
2015-06-25 11:02:17 -07:00
Junio C Hamano
5fd72277d4 Merge branch 'jk/make-fix-dependencies' into maint
Build clean-up.

* jk/make-fix-dependencies:
  Makefile: silence perl/PM.stamp recipe
  Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS
  Makefile: drop dependency between git-instaweb and gitweb
2015-06-25 11:02:16 -07:00
Junio C Hamano
68538cf954 Merge branch 'sb/pack-protocol-mention-smart-http' into maint
Doc updates.

* sb/pack-protocol-mention-smart-http:
  Documentation/technical/pack-protocol: mention http as possible protocol
2015-06-25 11:02:14 -07:00
Junio C Hamano
f2bd231414 Merge branch 'jk/die-on-bogus-worktree-late' into maint
The setup code used to die when core.bare and core.worktree are set
inconsistently, even for commands that do not need working tree.

* jk/die-on-bogus-worktree-late:
  setup_git_directory: delay core.bare/core.worktree errors
2015-06-25 11:02:13 -07:00
Junio C Hamano
6356003c80 Merge branch 'pt/pull-tags-error-diag' into maint
There was a dead code that used to handle "git pull --tags" and
show special-cased error message, which was made irrelevant when
the semantics of the option changed back in Git 1.9 days.

* pt/pull-tags-error-diag:
  pull: remove --tags error in no merge candidates case
2015-06-25 11:02:12 -07:00
Junio C Hamano
6998d890c7 Merge branch 'jk/color-diff-plain-is-context' into maint
"color.diff.plain" was a misnomer; give it 'color.diff.context' as
a more logical synonym.

* jk/color-diff-plain-is-context:
  diff.h: rename DIFF_PLAIN color slot to DIFF_CONTEXT
  diff: accept color.diff.context as a synonym for "plain"
2015-06-25 11:02:11 -07:00
Junio C Hamano
c5baf18a40 Merge branch 'jk/diagnose-config-mmap-failure' into maint
The configuration reader/writer uses mmap(2) interface to access
the files; when we find a directory, it barfed with "Out of memory?".

* jk/diagnose-config-mmap-failure:
  xmmap(): drop "Out of memory?"
  config.c: rewrite ENODEV into EISDIR when mmap fails
  config.c: avoid xmmap error messages
  config.c: fix mmap leak when writing config
  read-cache.c: drop PROT_WRITE from mmap of index
2015-06-25 11:02:11 -07:00
Junio C Hamano
c53312583b Merge branch 'jk/squelch-missing-link-warning-for-unreachable' into maint
Recent "git prune" traverses young unreachable objects to safekeep
old objects in the reachability chain from them, which sometimes
caused error messages that are unnecessarily alarming.

* jk/squelch-missing-link-warning-for-unreachable:
  suppress errors on missing UNINTERESTING links
  silence broken link warnings with revs->ignore_missing_links
  add quieter versions of parse_{tree,commit}
2015-06-25 11:02:10 -07:00
Junio C Hamano
f249409b6b Merge branch 'mm/rebase-i-post-rewrite-exec' into maint
"git rebase -i" fired post-rewrite hook when it shouldn't (namely,
when it was told to stop sequencing with 'exec' insn).

* mm/rebase-i-post-rewrite-exec:
  t5407: use <<- to align the expected output
  rebase -i: fix post-rewrite hook with failed exec command
  rebase -i: demonstrate incorrect behavior of post-rewrite
2015-06-25 11:02:09 -07:00
Charles Bailey
e2c6f7cd5a Fix definition of ARRAY_SIZE for non-gcc builds
The improved ARRAY_SIZE macro uses BARF_UNLESS_AN_ARRAY which expands
to a valid check for recent gcc versions and to 0 for older gcc
versions but is not defined on non-gcc builds.

Non-gcc builds need this macro to expand to 0 as well. The current outer
test (defined(__GNUC__) && (__GNUC__ >= 3)) is a strictly weaker
condition than the inner test (GIT_GNUC_PREREQ(3, 1)) so we can omit the
outer test and cause the BARF_UNLESS_AN_ARRAY macro to be defined
correctly on non-gcc builds as well as gcc builds with older versions.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-24 17:14:00 -07:00
Richard Hansen
d5c1b7c286 test-lib.sh: fix color support when tput needs ~/.terminfo
If tput needs ~/.terminfo for the current $TERM, then tput will
succeed before HOME is changed to $TRASH_DIRECTORY (causing color to
be set to 't') but fail afterward.

One possible way to fix this is to treat HOME like TERM: back up the
original value and temporarily restore it before say_color() runs
tput.

Instead, pre-compute and save the color control sequences before
changing either TERM or HOME.  Use the saved control sequences in
say_color() rather than call tput each time.  This avoids the need to
back up and restore the TERM and HOME variables, and it avoids the
overhead of a subshell and two invocations of tput per call to
say_color().

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-17 15:16:52 -07:00
Jeff King
e479c5f8f3 docs: clarify that --encoding can produce invalid sequences
In the common case that the commit encoding matches the
output encoding, we do not touch the buffer at all, which
makes things much more efficient. But it might be unclear to
a consumer that we will pass through bogus sequences.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-17 13:46:36 -07:00
Torsten Bögershausen
c4ac525c84 git-checkout.txt: document "git checkout <pathspec>" better
git checkout <pathspec> can be used to reset changes in the working tree.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-17 13:33:06 -07:00
Richard Hansen
ca92a660bf Revert "test-lib.sh: do tests for color support after changing HOME"
This reverts commit 102fc80d32094ad6598b17ab9d607516ee8edc4a.

There are two issues with that commit:

  * It is buggy.  In pseudocode, it is doing:

       color is set || TERM != dumb && color works && color=t

    when it should be doing:

       color is set || { TERM != dumb && color works && color=t }

  * It unnecessarily disables color when tput needs to read
    ~/.terminfo to get the control sequences.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-17 13:05:00 -07:00
Mike Edgar
eb86a507a1 fetch-pack: check for shallow if depth given
When a repository is first fetched as a shallow clone, either by
git-clone or by fetching into an empty repo, the server's capabilities
are not currently consulted. The client will send shallow requests even
if the server does not understand them, and the resulting error may be
unhelpful to the user. This change pre-emptively checks so we can exit
with a helpful error if necessary.

Signed-off-by: Mike Edgar <adgar@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-17 12:03:58 -07:00
Junio C Hamano
f09bd215cd Git 2.4.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.4.4
2015-06-16 14:38:01 -07:00
Junio C Hamano
37d6f933df Merge branch 'jk/clone-dissociate' into maint
Code clean-up.

* jk/clone-dissociate:
  clone: reorder --dissociate and --reference options
  clone: use OPT_STRING_LIST for --reference
2015-06-16 14:33:52 -07:00
Junio C Hamano
0d9388dc30 Merge branch 'sb/submodule-doc-intro' into maint
* sb/submodule-doc-intro:
  submodule doc: reorder introductory paragraphs
2015-06-16 14:33:52 -07:00
Junio C Hamano
6de4c80839 Merge branch 'sb/glossary-submodule' into maint
* sb/glossary-submodule:
  glossary: add "remote", "submodule", "superproject"
2015-06-16 14:33:51 -07:00
Junio C Hamano
6588f82ff6 Merge branch 'ah/usage-strings' into maint
A few usage string updates.

* ah/usage-strings:
  blame, log: format usage strings similarly to those in documentation
2015-06-16 14:33:50 -07:00
Junio C Hamano
afd647c55f Merge branch 'mc/commit-doc-grammofix' into maint
Doc grammar fix.

* mc/commit-doc-grammofix:
  Documentation/git-commit: grammofix
2015-06-16 14:33:49 -07:00
Junio C Hamano
dfb67594e9 Merge branch 'rs/janitorial' into maint
Code clean-up.

* rs/janitorial:
  dir: remove unused variable sb
  clean: remove unused variable buf
  use file_exists() to check if a file exists in the worktree
2015-06-16 14:33:47 -07:00
Junio C Hamano
2cd8ebdd3d Merge branch 'sb/test-bitmap-free-at-end' into maint
An earlier leakfix to bitmap testing code was incomplete.

* sb/test-bitmap-free-at-end:
  test_bitmap_walk: free bitmap with bitmap_free
2015-06-16 14:33:47 -07:00
Junio C Hamano
6b2c0ead06 Merge branch 'dt/clean-pathspec-filter-then-lstat' into maint
"git clean pathspec..." tried to lstat(2) and complain even for
paths outside the given pathspec.

* dt/clean-pathspec-filter-then-lstat:
  clean: only lstat files in pathspec
2015-06-16 14:33:46 -07:00