Junio C Hamano [Wed, 23 Aug 2017 21:13:14 +0000 (14:13 -0700)]
Merge branch 'sb/submodule-parallel-update'
Code clean-up.
* sb/submodule-parallel-update:
submodule.sh: remove unused variable
Junio C Hamano [Wed, 23 Aug 2017 21:13:13 +0000 (14:13 -0700)]
Merge branch 'jc/diff-sane-truncate-no-more'
Code clean-up.
* jc/diff-sane-truncate-no-more:
diff: retire sane_truncate_fn
Junio C Hamano [Wed, 23 Aug 2017 21:13:13 +0000 (14:13 -0700)]
Merge branch 'hv/t5526-andand-chain-fix'
Test fix.
* hv/t5526-andand-chain-fix:
t5526: fix some broken && chains
Junio C Hamano [Wed, 23 Aug 2017 21:13:12 +0000 (14:13 -0700)]
Merge branch 'as/grep-quiet-no-match-exit-code-fix'
"git grep -L" and "git grep --quiet -L" reported different exit
codes; this has been corrected.
* as/grep-quiet-no-match-exit-code-fix:
git-grep: correct exit code with --quiet and -L
Junio C Hamano [Wed, 23 Aug 2017 21:13:11 +0000 (14:13 -0700)]
Merge branch 'kw/commit-keep-index-when-pre-commit-is-not-run'
"git commit" used to discard the index and re-read from the filesystem
just in case the pre-commit hook has updated it in the middle; this
has been optimized out when we know we do not run the pre-commit hook.
* kw/commit-keep-index-when-pre-commit-is-not-run:
commit: skip discarding the index if there is no pre-commit hook
Junio C Hamano [Wed, 23 Aug 2017 21:13:10 +0000 (14:13 -0700)]
Merge branch 'sb/sha1-file-cleanup'
Code clean-up.
* sb/sha1-file-cleanup:
sha1_file: make read_info_alternates static
Junio C Hamano [Wed, 23 Aug 2017 21:13:09 +0000 (14:13 -0700)]
Merge branch 'rs/t1002-do-not-use-sum'
Test simplification.
* rs/t1002-do-not-use-sum:
t1002: stop using sum(1)
Junio C Hamano [Wed, 23 Aug 2017 21:13:08 +0000 (14:13 -0700)]
Merge branch 'kd/stash-with-bash-4.4'
bash 4.4 or newer gave a warning on NUL byte in command
substitution done in "git stash"; this has been squelched.
* kd/stash-with-bash-4.4:
stash: prevent warning about null bytes in input
Junio C Hamano [Wed, 23 Aug 2017 21:13:08 +0000 (14:13 -0700)]
Merge branch 'ah/doc-empty-string-is-false'
Doc update.
* ah/doc-empty-string-is-false:
doc: clarify "config --bool" behaviour with empty string
Junio C Hamano [Wed, 23 Aug 2017 21:13:07 +0000 (14:13 -0700)]
Merge branch 'kw/rebase-progress'
"git rebase", especially when it is run by mistake and ends up
trying to replay many changes, spent long time in silence. The
command has been taught to show progress report when it spends
long time preparing these many changes to replay (which would give
the user a chance to abort with ^C).
* kw/rebase-progress:
rebase: turn on progress option by default for format-patch
format-patch: have progress option while generating patches
Junio C Hamano [Wed, 23 Aug 2017 21:13:07 +0000 (14:13 -0700)]
Merge branch 'ks/prepare-commit-msg-sample-fix'
An "oops" fix to a topic that is already in 'master'.
* ks/prepare-commit-msg-sample-fix:
hook: use correct logical variable
Junio C Hamano [Wed, 23 Aug 2017 21:13:07 +0000 (14:13 -0700)]
Merge branch 'nm/stash-untracked'
"git stash -u" used the contents of the committed version of the
".gitignore" file to decide which paths are ignored, even when the
file has local changes. The command has been taught to instead use
the locally modified contents.
* nm/stash-untracked:
stash: clean untracked files before reset
Junio C Hamano [Wed, 23 Aug 2017 21:13:07 +0000 (14:13 -0700)]
Merge branch 'jt/sha1-file-cleanup'
Preparatory code clean-up.
* jt/sha1-file-cleanup:
sha1_file: remove read_packed_sha1()
sha1_file: set whence in storage-specific info fn
Junio C Hamano [Tue, 22 Aug 2017 17:33:58 +0000 (10:33 -0700)]
The second batch post 2.14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 22 Aug 2017 17:29:16 +0000 (10:29 -0700)]
Merge branch 'mh/packed-ref-store'
The "ref-store" code reorganization continues.
* mh/packed-ref-store: (32 commits)
files-backend: cheapen refname_available check when locking refs
packed_ref_store: handle a packed-refs file that is a symlink
read_packed_refs(): die if `packed-refs` contains bogus data
t3210: add some tests of bogus packed-refs file contents
repack_without_refs(): don't lock or unlock the packed refs
commit_packed_refs(): remove call to `packed_refs_unlock()`
clear_packed_ref_cache(): don't protest if the lock is held
packed_refs_unlock(), packed_refs_is_locked(): new functions
packed_refs_lock(): report errors via a `struct strbuf *err`
packed_refs_lock(): function renamed from lock_packed_refs()
commit_packed_refs(): use a staging file separate from the lockfile
commit_packed_refs(): report errors rather than dying
packed_ref_store: make class into a subclass of `ref_store`
packed-backend: new module for handling packed references
packed_read_raw_ref(): new function, replacing `resolve_packed_ref()`
packed_ref_store: support iteration
packed_peel_ref(): new function, extracted from `files_peel_ref()`
repack_without_refs(): take a `packed_ref_store *` parameter
get_packed_ref(): take a `packed_ref_store *` parameter
rollback_packed_refs(): take a `packed_ref_store *` parameter
...
Junio C Hamano [Tue, 22 Aug 2017 17:29:16 +0000 (10:29 -0700)]
Merge branch 'sb/retire-t1200'
A test script that outlived its usefulness has been removed.
* sb/retire-t1200:
t1200: remove t1200-tutorial.sh
Junio C Hamano [Tue, 22 Aug 2017 17:29:16 +0000 (10:29 -0700)]
Merge branch 'rs/win32-syslog-leakfix'
Memory leak in an error codepath has been plugged.
* rs/win32-syslog-leakfix:
win32: plug memory leak on realloc() failure in syslog()
Junio C Hamano [Tue, 22 Aug 2017 17:29:15 +0000 (10:29 -0700)]
Merge branch 'rs/unpack-entry-leakfix'
Memory leak in an error codepath has been plugged.
* rs/unpack-entry-leakfix:
sha1_file: release delta_stack on error in unpack_entry()
Junio C Hamano [Tue, 22 Aug 2017 17:29:15 +0000 (10:29 -0700)]
Merge branch 'rs/strbuf-getwholeline-fix'
A helper function to read a single whole line into strbuf
mistakenly triggered OOM error at EOF under certain conditions,
which has been fixed.
* rs/strbuf-getwholeline-fix:
strbuf: clear errno before calling getdelim(3)
Junio C Hamano [Tue, 22 Aug 2017 17:29:14 +0000 (10:29 -0700)]
Merge branch 'rs/merge-microcleanup'
Code clean-up.
* rs/merge-microcleanup:
merge: use skip_prefix()
Junio C Hamano [Tue, 22 Aug 2017 17:29:13 +0000 (10:29 -0700)]
Merge branch 'rs/fsck-obj-leakfix'
Memory leak in an error codepath has been plugged.
* rs/fsck-obj-leakfix:
fsck: free buffers on error in fsck_obj()
Junio C Hamano [Tue, 22 Aug 2017 17:29:13 +0000 (10:29 -0700)]
Merge branch 'rs/t4062-obsd'
Test portability fix.
* rs/t4062-obsd:
t4062: use less than 256 repetitions in regex
Junio C Hamano [Tue, 22 Aug 2017 17:29:11 +0000 (10:29 -0700)]
Merge branch 'rs/find-pack-entry-bisection'
Code clean-up.
* rs/find-pack-entry-bisection:
sha1_file: avoid comparison if no packed hash matches the first byte
Junio C Hamano [Tue, 22 Aug 2017 17:29:10 +0000 (10:29 -0700)]
Merge branch 'rs/apply-lose-prefix-length'
Code clean-up.
* rs/apply-lose-prefix-length:
apply: remove prefix_length member from apply_state
Junio C Hamano [Tue, 22 Aug 2017 17:29:10 +0000 (10:29 -0700)]
Merge branch 'rj/add-chmod-error-message'
Message fix.
* rj/add-chmod-error-message:
builtin/add: add detail to a 'cannot chmod' error message
Junio C Hamano [Tue, 22 Aug 2017 17:29:09 +0000 (10:29 -0700)]
Merge branch 'jk/hashcmp-memcmp'
Code clean-up.
* jk/hashcmp-memcmp:
hashcmp: use memcmp instead of open-coded loop
Junio C Hamano [Tue, 22 Aug 2017 17:29:08 +0000 (10:29 -0700)]
Merge branch 'jk/drop-sha1-entry-pos'
Code clean-up.
* jk/drop-sha1-entry-pos:
sha1_file: drop experimental GIT_USE_LOOKUP search
Junio C Hamano [Tue, 22 Aug 2017 17:29:07 +0000 (10:29 -0700)]
Merge branch 'ur/svn-local-zone'
"git svn" used with "--localtime" option did not compute the tz
offset for the timestamp in question and instead always used the
current time, which has been corrected.
* ur/svn-local-zone:
git svn fetch: Create correct commit timestamp when using --localtime
Junio C Hamano [Tue, 22 Aug 2017 17:29:07 +0000 (10:29 -0700)]
Merge branch 'pw/am-signoff'
"git am -s" has been taught that some input may end with a trailer
block that is not Signed-off-by: and it should refrain from adding
an extra blank line before adding a new sign-off in such a case.
* pw/am-signoff:
am: fix signoff when other trailers are present
Junio C Hamano [Tue, 22 Aug 2017 17:29:07 +0000 (10:29 -0700)]
Merge branch 'rs/t3700-clean-leftover'
A test fix.
* rs/t3700-clean-leftover:
t3700: fix broken test under !POSIXPERM
Junio C Hamano [Tue, 22 Aug 2017 17:29:06 +0000 (10:29 -0700)]
Merge branch 'jc/perl-git-comment-typofix'
A comment fix.
* jc/perl-git-comment-typofix:
perl/Git.pm: typofix in a comment
Junio C Hamano [Tue, 22 Aug 2017 17:29:05 +0000 (10:29 -0700)]
Merge branch 'rs/in-obsd-basename-dirname-take-const'
Portability fix.
* rs/in-obsd-basename-dirname-take-const:
test-path-utils: handle const parameter of basename and dirname
Junio C Hamano [Tue, 22 Aug 2017 17:29:04 +0000 (10:29 -0700)]
Merge branch 'rs/obsd-getcwd-workaround'
Test portability fix for BSDs.
* rs/obsd-getcwd-workaround:
t0001: skip test with restrictive permissions if getpwd(3) respects them
Junio C Hamano [Tue, 22 Aug 2017 17:29:03 +0000 (10:29 -0700)]
Merge branch 'mf/no-dashed-subcommands'
Code clean-up.
* mf/no-dashed-subcommands:
scripts: use "git foo" not "git-foo"
Junio C Hamano [Tue, 22 Aug 2017 17:29:03 +0000 (10:29 -0700)]
Merge branch 'ma/parse-maybe-bool'
Code clean-up.
* ma/parse-maybe-bool:
parse_decoration_style: drop unused argument `var`
treewide: deprecate git_config_maybe_bool, use git_parse_maybe_bool
config: make git_{config,parse}_maybe_bool equivalent
config: introduce git_parse_maybe_bool_text
t5334: document that git push --signed=1 does not work
Doc/git-{push,send-pack}: correct --sign= to --signed=
Junio C Hamano [Tue, 22 Aug 2017 17:29:02 +0000 (10:29 -0700)]
Merge branch 'ab/ref-filter-no-contains'
A test fix.
* ab/ref-filter-no-contains:
tests: don't give unportable ">" to "test" built-in, use -gt
Junio C Hamano [Tue, 22 Aug 2017 17:29:01 +0000 (10:29 -0700)]
Merge branch 'bw/clone-recursive-quiet'
"git clone --recurse-submodules --quiet" did not pass the quiet
option down to submodules.
* bw/clone-recursive-quiet:
clone: teach recursive clones to respect -q
Junio C Hamano [Tue, 22 Aug 2017 17:29:01 +0000 (10:29 -0700)]
Merge branch 'bw/grep-recurse-submodules'
"git grep --recurse-submodules" has been reworked to give a more
consistent output across submodule boundary (and do its thing
without having to fork a separate process).
* bw/grep-recurse-submodules:
grep: recurse in-process using 'struct repository'
submodule: merge repo_read_gitmodules and gitmodules_config
submodule: check for unmerged .gitmodules outside of config parsing
submodule: check for unstaged .gitmodules outside of config parsing
submodule: remove fetch.recursesubmodules from submodule-config parsing
submodule: remove submodule.fetchjobs from submodule-config parsing
config: add config_from_gitmodules
cache.h: add GITMODULES_FILE macro
repository: have the_repository use the_index
repo_read_index: don't discard the index
Junio C Hamano [Tue, 22 Aug 2017 17:29:00 +0000 (10:29 -0700)]
Merge branch 'pw/sequence-rerere-autoupdate'
Commands like "git rebase" accepted the --rerere-autoupdate option
from the command line, but did not always use it. This has been
fixed.
* pw/sequence-rerere-autoupdate:
cherry-pick/revert: reject --rerere-autoupdate when continuing
cherry-pick/revert: remember --rerere-autoupdate
t3504: use test_commit
rebase -i: honor --rerere-autoupdate
rebase: honor --rerere-autoupdate
am: remember --rerere-autoupdate setting
Junio C Hamano [Tue, 22 Aug 2017 17:29:00 +0000 (10:29 -0700)]
Merge branch 'bw/push-options-recursively-to-submodules'
"git push --recurse-submodules $there HEAD:$target" was not
propagated down to the submodules, but now it is.
* bw/push-options-recursively-to-submodules:
submodule--helper: teach push-check to handle HEAD
Anthony Sottile [Fri, 18 Aug 2017 01:38:51 +0000 (18:38 -0700)]
git-grep: correct exit code with --quiet and -L
The handling of `status_only` no longer interferes with the handling of
`unmatch_name_only`. `--quiet` no longer affects the exit code when using
`-L`/`--files-without-match`.
Signed-off-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 17 Aug 2017 17:27:28 +0000 (10:27 -0700)]
diff: retire sane_truncate_fn
Long time ago,
23707811 ("diff: do not chomp hunk-header in the
middle of a character", 2008-01-02) introduced sane_truncate_line()
helper function to trim the "function header" line that is shown at
the end of the hunk header line, in order to avoid chomping it in
the middle of a single UTF-8 character. It also added a facility to
define a custom callback function to make it possible to extend it
to non UTF-8 encodings.
During the following 8 1/2 years, nobody found need for this custom
callback facility.
A custom callback function is a wrong design to use here anyway---if
your contents need support for non UTF-8 encoding, you shouldn't
have to write a custom function and recompile Git to plumb it in. A
better approach would be to extend sane_truncate_line() function and
have a new member in emit_callback to conditionally trigger it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Thu, 17 Aug 2017 15:12:50 +0000 (17:12 +0200)]
files-backend: cheapen refname_available check when locking refs
When locking references in preparation for updating them, we need to
check that none of the newly added references D/F conflict with
existing references (e.g., we don't allow `refs/foo` to be added if
`refs/foo/bar` already exists, or vice versa).
Prior to
524a9fdb51 (refs_verify_refname_available(): use function in
more places, 2017-04-16), conflicts with existing loose references
were checked by looking directly in the filesystem, and then conflicts
with existing packed references were checked by running
`verify_refname_available_dir()` against the packed-refs cache.
But that commit changed the final check to call
`refs_verify_refname_available()` against the *whole* files ref-store,
including both loose and packed references, with the following
comment:
> This means that those callsites now check for conflicts with all
> references rather than just packed refs, but the performance cost
> shouldn't be significant (and will be regained later).
That comment turned out to be too sanguine. User s@kazlauskas.me
reported that fetches involving a very large number of references in
neighboring directories were slowed down by that change.
The problem is that when fetching, each reference is updated
individually, within its own reference transaction. This is done
because some reference updates might succeed even though others fail.
But every time a reference update transaction is finished,
`clear_loose_ref_cache()` is called. So when it is time to update the
next reference, part of the loose ref cache has to be repopulated for
the `refs_verify_refname_available()` call. If the references are all
in neighboring directories, then the cost of repopulating the
reference cache increases with the number of references, resulting in
O(N²) effort.
The comment above also claims that the performance cost "will be
regained later". The idea was that once the packed-refs were finished
being split out into a separate ref-store, we could limit the
`refs_verify_refname_available()` call to the packed references again.
That is what we do now.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Heiko Voigt [Thu, 17 Aug 2017 10:36:13 +0000 (12:36 +0200)]
t5526: fix some broken && chains
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller [Wed, 16 Aug 2017 22:50:42 +0000 (15:50 -0700)]
submodule.sh: remove unused variable
This could have been part of
48308681b0 (git submodule update: have a
dedicated helper for cloning, 2016-02-29).
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kevin Willford [Mon, 14 Aug 2017 21:54:25 +0000 (15:54 -0600)]
commit: skip discarding the index if there is no pre-commit hook
If there is not a pre-commit hook, there is no reason to discard
the index and reread it.
This change checks to presence of a pre-commit hook and then only
discards the index if there was one.
Signed-off-by: Kevin Willford <kewillf@microsoft.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller [Tue, 15 Aug 2017 20:13:19 +0000 (13:13 -0700)]
sha1_file: make read_info_alternates static
read_info_alternates is not used from outside, so let's make it static.
We have to declare the function before link_alt_odb_entry instead of
moving the code around, link_alt_odb_entry calls read_info_alternates,
which in turn calls link_alt_odb_entry.
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Mon, 14 Aug 2017 20:16:34 +0000 (22:16 +0200)]
t1002: stop using sum(1)
sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3]. OpenBSD 5.6 (2014) removed sum(1).
We only use sum(1) in t1002 to check for changes in three files. On
MinGW we use md5sum(1) instead. We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1). Use our standard method for
checking for file changes instead: test_cmp.
It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.
We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state. A later patch could convert the
direct diff(1) calls to test_cmp as well.
With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.
[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/
9699919799/utilities/cksum.html
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Andreas Heiduk [Mon, 14 Aug 2017 22:12:18 +0000 (00:12 +0200)]
doc: clarify "config --bool" behaviour with empty string
`git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but
`false` for `[xxx]yyy=` or `[xxx]yyy=""`. This is tested in
t1300-repo-config.sh since
09bc098c2.
Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kevin Daudt [Mon, 14 Aug 2017 21:43:33 +0000 (23:43 +0200)]
stash: prevent warning about null bytes in input
The `no_changes` function calls the `untracked_files` function through
command substitution. `untracked_files` will return null bytes because it
runs ls-files with the '-z' option.
Bash since version 4.4 warns about these null bytes. As they are not
required for the test that is being done, make sure `untracked_files`
does not output null bytes when not required.
This is achieved by adding a parameter to the `untracked_files` function to
specify wither `-z` should be passed to ls-files or not.
This warning is triggered when running git stash save -u resulting in
two warnings:
git-stash: line 43: warning: command substitution: ignored null byte
in input
Signed-off-by: Kevin Daudt <me@ikke.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kevin Willford [Thu, 10 Aug 2017 18:32:56 +0000 (14:32 -0400)]
rebase: turn on progress option by default for format-patch
Pass the "--progress" option to format-patch when the standard error
stream is connected to the terminal and "--quiet" is not given.
Signed-off-by: Kevin Willford <kewillf@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kevin Willford [Thu, 10 Aug 2017 18:32:55 +0000 (14:32 -0400)]
format-patch: have progress option while generating patches
When generating patches for the rebase command, if the user does
not realize the branch they are rebasing onto is thousands of
commits different, there is no progress indication after initial
rewinding message.
The progress meter as presented in this patch assumes the thousands of
patches to have a fine granularity as well as assuming to require all
the same amount of work/time for each, such that a steady progress bar
is achieved.
We do not want to estimate the time for each patch based e.g.
on their size or number of touched files (or parents) as that is too
expensive for just a progress meter.
This patch allows a progress option to be passed to format-patch
so that the user can be informed the progress of generating the
patch. This option is then used by the rebase command when
calling format-patch.
Signed-off-by: Kevin Willford <kewillf@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kaartic Sivaraam [Mon, 14 Aug 2017 08:46:46 +0000 (14:16 +0530)]
hook: use correct logical variable
Sign-off added should be that of the "committer", not that of the
"commit's author"; that is how the rest of Git adds sign-off using
sequencer.c::append_signoff().
Use the correct logical variable that identifies the committer.
Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nicolas Morey-Chaisemartin [Fri, 11 Aug 2017 17:14:43 +0000 (19:14 +0200)]
stash: clean untracked files before reset
If calling git stash -u on a repo that contains a file that is not
ignored any more due to a current modification of the gitignore file,
this file is stashed but not remove from the working tree.
This is due to git-stash first doing a reset --hard which clears the
.gitignore file modification and the call git clean, leaving the file
untouched.
This causes git stash pop to fail due to the file existing.
This patch simply switches the order between cleaning and resetting
and adds a test for this usecase.
Reported-by: Sam Partington <sam@whiteoctober.co.uk>
Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Tan [Fri, 11 Aug 2017 20:36:15 +0000 (13:36 -0700)]
sha1_file: remove read_packed_sha1()
Use read_object() in its place instead. This avoids duplication of code.
This makes force_object_loose() slightly slower (because of a redundant
check of loose object storage), but only in the error case.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Tan [Fri, 11 Aug 2017 20:36:14 +0000 (13:36 -0700)]
sha1_file: set whence in storage-specific info fn
Move the setting of oi->whence to sha1_loose_object_info() and
packed_object_info().
This allows sha1_object_info_extended() to not need to know about the
delta base cache. This will be useful during a future refactoring in
which packfile-related functions, including the handling of the delta
base cache, will be moved to a separate file.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 11 Aug 2017 20:34:31 +0000 (13:34 -0700)]
The first batch of topics after the 2.14 cycle
Notably, let's declare that we aim to make "git add ''" illegal in
the cycle after this one.
The topic to do so, ex/deprecate-empty-pathspec-as-match-all, has
been cooking in 'next' too long, and will stay there during this
cycle, but not after.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 11 Aug 2017 20:27:07 +0000 (13:27 -0700)]
Merge branch 'ma/pager-per-subcommand-action'
The "tag.pager" configuration variable was useless for those who
actually create tag objects, as it interfered with the use of an
editor. A new mechanism has been introduced for commands to enable
pager depending on what operation is being carried out to fix this,
and then "git tag -l" is made to run pager by default.
* ma/pager-per-subcommand-action:
git.c: ignore pager.* when launching builtin as dashed external
tag: change default of `pager.tag` to "on"
tag: respect `pager.tag` in list-mode only
t7006: add tests for how git tag paginates
git.c: provide setup_auto_pager()
git.c: let builtins opt for handling `pager.foo` themselves
builtin.h: take over documentation from api-builtin.txt
Junio C Hamano [Fri, 11 Aug 2017 20:27:07 +0000 (13:27 -0700)]
Merge branch 'jk/rev-list-empty-input'
"git log --tag=no-such-tag" showed log starting from HEAD, which
has been fixed---it now shows nothing.
* jk/rev-list-empty-input:
revision: do not fallback to default when rev_input_given is set
rev-list: don't show usage when we see empty ref patterns
revision: add rev_input_given flag
t6018: flesh out empty input/output rev-list tests
Junio C Hamano [Fri, 11 Aug 2017 20:27:07 +0000 (13:27 -0700)]
Merge branch 'jt/t1450-fsck-corrupt-packfile'
A test update.
* jt/t1450-fsck-corrupt-packfile:
tests: ensure fsck fails on corrupt packfiles
Junio C Hamano [Fri, 11 Aug 2017 20:27:06 +0000 (13:27 -0700)]
Merge branch 'js/git-gui-msgfmt-on-windows'
Because recent Git for Windows do come with a real msgfmt, the
build procedure for git-gui has been updated to use it instead of a
hand-rolled substitute.
* js/git-gui-msgfmt-on-windows:
git-gui (MinGW): make use of MSys2's msgfmt
git gui: allow for a long recentrepo list
git gui: de-dup selected repo from recentrepo history
git gui: cope with duplicates in _get_recentrepo
git-gui: remove duplicate entries from .gitconfig's gui.recentrepo
Junio C Hamano [Fri, 11 Aug 2017 20:27:06 +0000 (13:27 -0700)]
Merge branch 'eb/contacts-reported-by'
"git contacts" (in contrib/) now lists the address on the
"Reported-by:" trailer to its output, in addition to those on
S-o-b: and other trailers, to make it easier to notify (and thank)
the original bug reporter.
* eb/contacts-reported-by:
git-contacts: also recognise "Reported-by:"
Junio C Hamano [Fri, 11 Aug 2017 20:27:06 +0000 (13:27 -0700)]
Merge branch 'dl/credential-cache-socket-in-xdg-cache'
A recently added test for the "credential-cache" helper revealed
that EOF detection done around the time the connection to the cache
daemon is torn down were flaky. This was fixed by reacting to
ECONNRESET and behaving as if we got an EOF.
* dl/credential-cache-socket-in-xdg-cache:
credential-cache: interpret an ECONNRESET as an EOF
Junio C Hamano [Fri, 11 Aug 2017 20:27:05 +0000 (13:27 -0700)]
Merge branch 'rg/rerere-train-overwrite'
The "rerere-train" script (in contrib/) learned the "--overwrite"
option to allow overwriting existing recorded resolutions.
* rg/rerere-train-overwrite:
contrib/rerere-train: optionally overwrite existing resolutions
Junio C Hamano [Fri, 11 Aug 2017 20:27:05 +0000 (13:27 -0700)]
Merge branch 'jb/t8008-cleanup'
Code clean-up.
* jb/t8008-cleanup:
t8008: rely on rev-parse'd HEAD instead of sha1 value
Junio C Hamano [Fri, 11 Aug 2017 20:27:05 +0000 (13:27 -0700)]
Merge branch 'jt/subprocess-handshake'
Code cleanup.
* jt/subprocess-handshake:
sub-process: refactor handshake to common function
Documentation: migrate sub-process docs to header
Junio C Hamano [Fri, 11 Aug 2017 20:27:05 +0000 (13:27 -0700)]
Merge branch 'dc/fmt-merge-msg-microcleanup'
Code cleanup.
* dc/fmt-merge-msg-microcleanup:
fmt-merge-msg: fix coding style
Junio C Hamano [Fri, 11 Aug 2017 20:27:04 +0000 (13:27 -0700)]
Merge branch 'ah/doc-wserrorhighlight'
Doc update.
* ah/doc-wserrorhighlight:
doc: add missing values "none" and "default" for diff.wsErrorHighlight
Junio C Hamano [Fri, 11 Aug 2017 20:27:03 +0000 (13:27 -0700)]
Merge branch 'cc/ref-is-hidden-microcleanup'
Code cleanup.
* cc/ref-is-hidden-microcleanup:
refs: use skip_prefix() in ref_is_hidden()
Junio C Hamano [Fri, 11 Aug 2017 20:27:02 +0000 (13:27 -0700)]
Merge branch 'js/run-process-parallel-api-fix'
API fix.
* js/run-process-parallel-api-fix:
run_processes_parallel: change confusing task_cb convention
Junio C Hamano [Fri, 11 Aug 2017 20:27:01 +0000 (13:27 -0700)]
Merge branch 'hb/gitweb-project-list'
When a directory is not readable, "gitweb" fails to build the
project list. Work this around by skipping such a directory.
* hb/gitweb-project-list:
gitweb: skip unreadable subdirectories
Junio C Hamano [Fri, 11 Aug 2017 20:27:01 +0000 (13:27 -0700)]
Merge branch 'ks/commit-abort-on-empty-message-fix'
"git commit" when seeing an totally empty message said "you did not
edit the message", which is clearly wrong. The message has been
corrected.
* ks/commit-abort-on-empty-message-fix:
commit: check for empty message before the check for untouched template
Junio C Hamano [Fri, 11 Aug 2017 20:27:01 +0000 (13:27 -0700)]
Merge branch 'sb/hashmap-cleanup'
Many uses of comparision callback function the hashmap API uses
cast the callback function type when registering it to
hashmap_init(), which defeats the compile time type checking when
the callback interface changes (e.g. gaining more parameters).
The callback implementations have been updated to take "void *"
pointers and cast them to the type they expect instead.
* sb/hashmap-cleanup:
t/helper/test-hashmap: use custom data instead of duplicate cmp functions
name-hash.c: drop hashmap_cmp_fn cast
submodule-config.c: drop hashmap_cmp_fn cast
remote.c: drop hashmap_cmp_fn cast
patch-ids.c: drop hashmap_cmp_fn cast
convert/sub-process: drop cast to hashmap_cmp_fn
config.c: drop hashmap_cmp_fn cast
builtin/describe: drop hashmap_cmp_fn cast
builtin/difftool.c: drop hashmap_cmp_fn cast
attr.c: drop hashmap_cmp_fn cast
Junio C Hamano [Fri, 11 Aug 2017 20:27:00 +0000 (13:27 -0700)]
Merge branch 'jk/reflog-walk'
Numerous bugs in walking of reflogs via "log -g" and friends have
been fixed.
* jk/reflog-walk:
reflog-walk: apply --since/--until to reflog dates
reflog-walk: stop using fake parents
rev-list: check reflog_info before showing usage
get_revision_1(): replace do-while with an early return
log: do not free parents when walking reflog
log: clarify comment about reflog cycles
revision: disallow reflog walking with revs->limited
t1414: document some reflog-walk oddities
Junio C Hamano [Fri, 11 Aug 2017 20:27:00 +0000 (13:27 -0700)]
Merge branch 'ls/filter-process-delayed'
The filter-process interface learned to allow a process with long
latency give a "delayed" response.
* ls/filter-process-delayed:
convert: add "status=delayed" to filter process protocol
convert: refactor capabilities negotiation
convert: move multiple file filter error handling to separate function
convert: put the flags field before the flag itself for consistent style
t0021: write "OUT <size>" only on success
t0021: make debug log file name configurable
t0021: keep filter log files on comparison
Junio C Hamano [Fri, 11 Aug 2017 20:27:00 +0000 (13:27 -0700)]
Merge branch 'st/lib-gpg-kill-stray-agent'
Some versions of GnuPG fails to kill gpg-agent it auto-spawned
and such a left-over agent can interfere with a test. Work it
around by attempting to kill one before starting a new test.
* st/lib-gpg-kill-stray-agent:
t: lib-gpg: flush gpg agent on startup
Junio C Hamano [Fri, 11 Aug 2017 20:27:00 +0000 (13:27 -0700)]
Merge branch 'rs/pack-objects-pbase-cleanup'
Code clean-up.
* rs/pack-objects-pbase-cleanup:
pack-objects: remove unnecessary NULL check
Junio C Hamano [Fri, 11 Aug 2017 20:26:59 +0000 (13:26 -0700)]
Merge branch 'jt/fsck-code-cleanup'
Code clean-up.
* jt/fsck-code-cleanup:
fsck: cleanup unused variable
object: remove "used" field from struct object
fsck: remove redundant parse_tree() invocation
Junio C Hamano [Fri, 11 Aug 2017 20:26:59 +0000 (13:26 -0700)]
Merge branch 'jc/http-sslkey-and-ssl-cert-are-paths'
The http.{sslkey,sslCert} configuration variables are to be
interpreted as a pathname that honors "~[username]/" prefix, but
weren't, which has been fixed.
* jc/http-sslkey-and-ssl-cert-are-paths:
http.c: http.sslcert and http.sslkey are both pathnames
Junio C Hamano [Fri, 11 Aug 2017 20:26:58 +0000 (13:26 -0700)]
Merge branch 'jk/c99'
Start using selected c99 constructs in small, stable and
essentialpart of the system to catch people who care about
older compilers that do not grok them.
* jk/c99:
clean.c: use designated initializer
strbuf: use designated initializers in STRBUF_INIT
Junio C Hamano [Fri, 11 Aug 2017 20:26:58 +0000 (13:26 -0700)]
Merge branch 'jk/ref-filter-colors'
"%C(color name)" in the pretty print format always produced ANSI
color escape codes, which was an early design mistake. They now
honor the configuration (e.g. "color.ui = never") and also tty-ness
of the output medium.
* jk/ref-filter-colors:
ref-filter: consult want_color() before emitting colors
pretty: respect color settings for %C placeholders
rev-list: pass diffopt->use_colors through to pretty-print
for-each-ref: load config earlier
color: check color.ui in git_default_config()
ref-filter: pass ref_format struct to atom parsers
ref-filter: factor out the parsing of sorting atoms
ref-filter: make parse_ref_filter_atom a private function
ref-filter: provide a function for parsing sort options
ref-filter: move need_color_reset_at_eol into ref_format
ref-filter: abstract ref format into its own struct
ref-filter: simplify automatic color reset
t: use test_decode_color rather than literal ANSI codes
docs/for-each-ref: update pointer to color syntax
check return value of verify_ref_format()
Junio C Hamano [Fri, 11 Aug 2017 20:26:58 +0000 (13:26 -0700)]
Merge branch 'wd/rebase-conflict-guide'
The advice message given when "git rebase" stops for conflicting
changes has been improved.
* wd/rebase-conflict-guide:
rebase: make resolve message clearer for inexperienced users
Junio C Hamano [Fri, 11 Aug 2017 20:26:58 +0000 (13:26 -0700)]
Merge branch 'rs/stat-data-unaligned-reads-fix'
Code clean-up.
* rs/stat-data-unaligned-reads-fix:
dir: support platforms that require aligned reads
Junio C Hamano [Fri, 11 Aug 2017 20:26:57 +0000 (13:26 -0700)]
Merge branch 'rs/move-array'
Code clean-up.
* rs/move-array:
ls-files: don't try to prune an empty index
apply: use COPY_ARRAY and MOVE_ARRAY in update_image()
use MOVE_ARRAY
add MOVE_ARRAY
Junio C Hamano [Fri, 11 Aug 2017 20:26:57 +0000 (13:26 -0700)]
Merge branch 'rs/bswap-ubsan-fix'
Code clean-up.
* rs/bswap-ubsan-fix:
bswap: convert get_be16, get_be32 and put_be32 to inline functions
bswap: convert to unsigned before shifting in get_be32
Junio C Hamano [Fri, 11 Aug 2017 20:26:56 +0000 (13:26 -0700)]
Merge branch 'ks/prepare-commit-msg-sample'
Remove an example that is now obsolete from a sample hook,
and improve an old example in it that added a sign-off manually
to use the interpret-trailers command.
* ks/prepare-commit-msg-sample:
hook: add a simple first example
hook: add sign-off using "interpret-trailers"
hook: name the positional variables
hook: cleanup script
Junio C Hamano [Fri, 11 Aug 2017 20:26:56 +0000 (13:26 -0700)]
Merge branch 'bw/object-id'
Conversion from uchar[20] to struct object_id continues.
* bw/object-id:
receive-pack: don't access hash of NULL object_id pointer
notes: don't access hash of NULL object_id pointer
tree-diff: don't access hash of NULL object_id pointer
Junio C Hamano [Fri, 11 Aug 2017 20:26:55 +0000 (13:26 -0700)]
Merge branch 'bc/object-id'
Conversion from uchar[20] to struct object_id continues.
* bc/object-id:
sha1_name: convert uses of 40 to GIT_SHA1_HEXSZ
sha1_name: convert GET_SHA1* flags to GET_OID*
sha1_name: convert get_sha1* to get_oid*
Convert remaining callers of get_sha1 to get_oid.
builtin/unpack-file: convert to struct object_id
bisect: convert bisect_checkout to struct object_id
builtin/update_ref: convert to struct object_id
sequencer: convert to struct object_id
remote: convert struct push_cas to struct object_id
submodule: convert submodule config lookup to use object_id
builtin/merge-tree: convert remaining caller of get_sha1 to object_id
builtin/fsck: convert remaining caller of get_sha1 to object_id
Junio C Hamano [Fri, 11 Aug 2017 20:26:55 +0000 (13:26 -0700)]
Merge branch 'sb/object-id'
Conversion from uchar[20] to struct object_id continues.
* sb/object-id:
tag: convert gpg_verify_tag to use struct object_id
commit: convert lookup_commit_graft to struct object_id
René Scharfe [Thu, 10 Aug 2017 09:42:21 +0000 (11:42 +0200)]
sha1_file: release delta_stack on error in unpack_entry()
When unpack_entry() encounters a broken packed object, it returns early.
It adjusts the reference count of the pack window, but leaks the buffer
for a big delta stack in case the small automatic one was not enough.
Jump to the cleanup code at end instead, which takes care of that.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Thu, 10 Aug 2017 09:42:10 +0000 (11:42 +0200)]
fsck: free buffers on error in fsck_obj()
Move the code for releasing tree buffers and commit buffers in
fsck_obj() to the end of the function and make sure it's executed no
matter of an error is encountered or not.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Thu, 10 Aug 2017 20:56:40 +0000 (22:56 +0200)]
strbuf: clear errno before calling getdelim(3)
getdelim(3) returns -1 at the end of the file and if it encounters an
error, but sets errno only in the latter case. Set errno to zero before
calling it to avoid misdiagnosing an out-of-memory condition due to a
left-over value from some other function call.
Reported-by: Yaroslav Halchenko <yoh@onerussian.com>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Thu, 10 Aug 2017 10:23:45 +0000 (12:23 +0200)]
win32: plug memory leak on realloc() failure in syslog()
If realloc() fails then the original buffer is still valid. Free it
before exiting the function.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Thu, 10 Aug 2017 16:47:55 +0000 (18:47 +0200)]
merge: use skip_prefix()
Get rid of a magic string length constant by using skip_prefix() instead
of starts_with().
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller [Wed, 9 Aug 2017 21:22:53 +0000 (14:22 -0700)]
t1200: remove t1200-tutorial.sh
v1.2.0~121 (New tutorial, 2006-01-22) rewrote the tutorial such that the
original intent of
2ae6c70674 (Adapt tutorial to cygwin and add test case,
2005-10-13) to test the examples from the tutorial doesn't hold any more.
There are dedicated tests for the commands used, even "git whatchanged",
such that removing these tests doesn't seem like a reduction in test
coverage.
Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 9 Aug 2017 10:14:32 +0000 (06:14 -0400)]
sha1_file: drop experimental GIT_USE_LOOKUP search
Long ago in
628522ec14 (sha1-lookup: more memory efficient
search in sorted list of SHA-1, 2007-12-29) we added
sha1_entry_pos(), a binary search that uses the uniform
distribution of sha1s to scale the selection of mid-points.
As this was a performance experiment, we tied it to the
GIT_USE_LOOKUP environment variable and never enabled it by
default.
This code was successful in reducing the number of steps in
each search. But the overhead of the scaling ends up making
it slower when the cache is warm. Here are best-of-five
timings for running rev-list on linux.git, which will have
to look up every object:
$ time git rev-list --objects --all >/dev/null
real 0m35.357s
user 0m35.016s
sys 0m0.340s
$ time GIT_USE_LOOKUP=1 git rev-list --objects --all >/dev/null
real 0m37.364s
user 0m37.045s
sys 0m0.316s
The USE_LOOKUP version might have more benefit on a cold
cache, as the time to fault in each page would dominate. But
that would be for a single lookup. In practice, most
operations tend to look up many objects, and the whole pack
.idx will end up warm.
It's possible that the code could be better optimized to
compete with a naive binary search for the warm-cache case,
and we could have the best of both worlds. But over the
years nobody has done so, and this is largely dead code that
is rarely run outside of the test suite. Let's drop it in
the name of simplicity.
This lets us remove sha1_entry_pos() entirely, as the .idx
lookup code was the only caller. Note that sha1-lookup.c
still contains sha1_pos(), which differs from
sha1_entry_pos() in two ways:
- it has a different interface; it uses a function pointer
to access sha1 entries rather than a size/offset pair
describing the table's memory layout
- it only scales the initial selection of "mi", rather
than each iteration of the search
We can't get rid of this function, as it's called from
several places. It may be that we could replace it with a
simple binary search, but that's out of scope for this patch
(and would need benchmarking).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 9 Aug 2017 10:16:45 +0000 (06:16 -0400)]
hashcmp: use memcmp instead of open-coded loop
In
1a812f3a70 (hashcmp(): inline memcmp() by hand to
optimize, 2011-04-28), it was reported that an open-coded
loop outperformed memcmp() for comparing sha1s.
Discussion[1] a few years later in 2013 showed that this
depends on your libc's version of memcmp(). In particular,
glibc 2.13 optimized their memcmp around 2011. Here are
current timings with glibc 2.24 (best-of-five, on
linux.git):
[before this patch, open-coded]
$ time git rev-list --objects --all
real 0m35.357s
user 0m35.016s
sys 0m0.340s
[after this patch, memcmp]
real 0m32.930s
user 0m32.630s
sys 0m0.300s
Now that we've had 6 years for that version of glibc to
make its way onto people's machines, it's worth revisiting
our benchmarks and switching to memcmp().
It may be that there are other non-glibc systems where
memcmp() isn't as well optimized. But since our single data
point in favor of open-coding was on a now-ancient glibc, we
should probably assume the system memcmp is good unless
proven otherwise. We may end up with a SLOW_MEMCMP Makefile
knob, but we can hold off on that until we actually find
such a system in practice.
[1] https://public-inbox.org/git/
20130318073229.GA5551@sigill.intra.peff.net/
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Wed, 9 Aug 2017 15:54:46 +0000 (17:54 +0200)]
apply: remove prefix_length member from apply_state
Use a NULL-and-NUL check to see if we have a prefix and consistently use
C string functions on it instead of storing its length in a member of
struct apply_state. This avoids strlen() calls and simplifies the code.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramsay Jones [Wed, 9 Aug 2017 00:51:23 +0000 (01:51 +0100)]
builtin/add: add detail to a 'cannot chmod' error message
In addition to adding the missing newline, add the x-ecutable bit
'mode change' character to the error message. This message now has
the same form as similar messages output by 'update-index'.
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Tue, 8 Aug 2017 22:07:30 +0000 (00:07 +0200)]
sha1_file: avoid comparison if no packed hash matches the first byte
find_pack_entry_one() uses the fan-out table of pack indexes to find out
which entries match the first byte of the searched hash and does a
binary search on this subset of the main index table.
If there are no matching entries then lo and hi will have the same
value. The binary search still starts and compares the hash of the
following entry (which has a non-matching first byte, so won't cause any
trouble), or whatever comes after the sorted list of entries.
The probability of that stray comparison matching by mistake is low, but
let's not take any chances and check when entering the binary search
loop if we're actually done already.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>