Commit graph

55021 commits

Author SHA1 Message Date
Nguyễn Thái Ngọc Duy 8bb95572b0 sha1-name.c: add repo_find_unique_abbrev_r()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-16 18:56:52 +09:00
Nguyễn Thái Ngọc Duy 7f07c033a6 sha1-name.c: remove the_repo from find_abbrev_len_packed()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-16 18:56:52 +09:00
Nguyễn Thái Ngọc Duy fae2ae45df sha1-name.c: remove the_repo from sort_ambiguous()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-16 18:56:52 +09:00
Nguyễn Thái Ngọc Duy 301b8c7f40 commit.c: add repo_get_commit_tree()
Remove the implicit dependency on the_repository in this function.
It will be used in sha1-name.c functions when they are updated to take
any 'struct repository'. get_commit_tree() remains as a compat wrapper,
to be slowly replaced later.

Any access to "maybe_tree" field directly will result in _broken_ code
after running through commit.cocci because we can't know what is the
right repository to use.

the_repository would be correct most of the time. But we're relying less
and less on the_repository and that assumption may no longer be
true. The transformation now is more of a poor man replacement for a C++
compiler catching access to private fields.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-16 18:56:51 +09:00
Nguyễn Thái Ngọc Duy a133c40b23 commit.cocci: refactor code, avoid double rewrite
"maybe" pointer in 'struct commit' is tricky because it can be lazily
initialized to take advantage of commit-graph if available. This makes
it not safe to access directly.

This leads to a rule in commit.cocci to rewrite 'x->maybe_tree' to
'get_commit_tree(x)'. But that rule alone could lead to incorrectly
rewrite assignments, e.g. from

    x->maybe_tree = yes

to

    get_commit_tree(x) = yes

Because of this we have a second rule to revert this effect. Szeder
found out that we could do better by performing the assignment rewrite
rule first, then the remaining is read-only access and handled by the
current first rule.

For this to work, we need to transform "x->maybe_tree = y" to something
that does NOT contain "x->maybe_tree" to avoid the original first
rule. This is where set_commit_tree() comes in.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-16 18:56:51 +09:00
Nguyễn Thái Ngọc Duy 7fdff47432 refs.c: remove the_repo from read_ref_at()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:33 +09:00
Nguyễn Thái Ngọc Duy 567009033f refs.c: add repo_dwim_log()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:33 +09:00
Nguyễn Thái Ngọc Duy d8984c532a refs.c: add repo_dwim_ref()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:33 +09:00
Nguyễn Thái Ngọc Duy 0b1dbf53df refs.c: remove the_repo from expand_ref()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:33 +09:00
Nguyễn Thái Ngọc Duy 8f56e9d4ba refs.c: remove the_repo from substitute_branch_name()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:32 +09:00
Nguyễn Thái Ngọc Duy 546edf37ae refs.c: add refs_shorten_unambiguous_ref()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:32 +09:00
Nguyễn Thái Ngọc Duy b3cd33d079 refs.c: add refs_ref_exists()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:32 +09:00
Nguyễn Thái Ngọc Duy 5038de1937 packfile.c: add repo_approximate_object_count()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:32 +09:00
SZEDER Gábor d2c4e6292a builtin rebase: use oideq()
Use oideq() instead of !oidcmp(), as it is more idiomatic, and might
give the compiler more opportunities to optimize.

Patch generated with 'contrib/coccinelle/free.cocci' and Coccinelle
v1.0.7 (previous Coccinelle versions don't notice this).

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:32 +09:00
SZEDER Gábor 7762f44ee0 builtin rebase: use FREE_AND_NULL
Use the macro FREE_AND_NULL to release memory allocated for
'head_name' and clear its pointer.

Patch generated with 'contrib/coccinelle/free.cocci' and Coccinelle
v1.0.7 (previous Coccinelle versions don't notice this).

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-08 17:26:32 +09:00
Junio C Hamano 041f5ea1cf The third batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-20 15:19:48 +09:00
Junio C Hamano 0c45fa32ec Merge branch 'br/commit-tree-parseopt'
The command line parser of "git commit-tree" has been rewritten to
use the parse-options API.

* br/commit-tree-parseopt:
  commit-tree: utilize parse-options api
2019-03-20 15:16:08 +09:00
Junio C Hamano f6c75e392e Merge branch 'jk/config-type-color-ends-with-lf'
"git config --type=color ..." is meant to replace "git config --get-color"
but there is a slight difference that wasn't documented, which is
now fixed.

* jk/config-type-color-ends-with-lf:
  config: document --type=color output is a complete line
2019-03-20 15:16:08 +09:00
Junio C Hamano 6b5688b760 Merge branch 'ma/clear-repository-format'
The setup code has been cleaned up to avoid leaks around the
repository_format structure.

* ma/clear-repository-format:
  setup: fix memory leaks with `struct repository_format`
  setup: free old value before setting `work_tree`
2019-03-20 15:16:07 +09:00
Junio C Hamano 83b13e284c Merge branch 'jk/virtual-objects-do-exist'
A recent update broke "is this object available to us?" check for
well-known objects like an empty tree (which should yield "yes",
even when there is no on-disk object for an empty tree), which has
been corrected.

* jk/virtual-objects-do-exist:
  rev-list: allow cached objects in existence check
2019-03-20 15:16:07 +09:00
Junio C Hamano 27cdbdd134 Merge branch 'jk/no-sigpipe-during-network-transport'
On platforms where "git fetch" is killed with SIGPIPE (e.g. OSX),
the upload-pack that runs on the other end that hangs up after
detecting an error could cause "git fetch" to die with a signal,
which led to a flakey test.  "git fetch" now ignores SIGPIPE during
the network portion of its operation (this is not a problem as we
check the return status from our write(2)s).

* jk/no-sigpipe-during-network-transport:
  fetch: ignore SIGPIPE during network operation
  fetch: avoid calling write_or_die()
2019-03-20 15:16:06 +09:00
Junio C Hamano ea327760d3 Merge branch 'jk/fsck-doc'
"git fsck --connectivity-only" omits computation necessary to sift
the objects that are not reachable from any of the refs into
unreachable and dangling.  This is now enabled when dangling
objects are requested (which is done by default, but can be
overridden with the "--no-dangling" option).

* jk/fsck-doc:
  fsck: always compute USED flags for unreachable objects
  doc/fsck: clarify --connectivity-only behavior
2019-03-20 15:16:06 +09:00
Junio C Hamano 88255bba45 Merge branch 'js/stress-test-ui-tweak'
Dev support.

* js/stress-test-ui-tweak:
  tests: introduce --stress-jobs=<N>
  tests: let --stress-limit=<N> imply --stress
2019-03-20 15:16:05 +09:00
Junio C Hamano 9fbcc3d203 Merge branch 'js/rebase-orig-head-fix'
"git rebase" that was reimplemented in C did not set ORIG_HEAD
correctly, which has been corrected.

* js/rebase-orig-head-fix:
  built-in rebase: set ORIG_HEAD just once, before the rebase
  built-in rebase: demonstrate that ORIG_HEAD is not set correctly
  built-in rebase: use the correct reflog when switching branches
  built-in rebase: no need to check out `onto` twice
2019-03-20 15:16:05 +09:00
Junio C Hamano 1b8f4dc580 Merge branch 'jk/bisect-final-output'
The final report from "git bisect" used to show the suspected
culprit using a raw "diff-tree", with which there is no output for
a merge commit.  This has been updated to use a more modern and
human readable output that still is concise enough.

* jk/bisect-final-output:
  bisect: make diff-tree output prettier
  bisect: fix internal diff-tree config loading
  bisect: use string arguments to feed internal diff-tree
2019-03-20 15:16:04 +09:00
Junio C Hamano 3cef67694c Merge branch 'ab/makefile-help-devs-more'
CFLAGS now can be tweaked when invoking Make while using
DEVELOPER=YesPlease; this did not work well before.

* ab/makefile-help-devs-more:
  Makefile: allow for combining DEVELOPER=1 and CFLAGS="..."
  Makefile: move the setting of *FLAGS closer to "include"
  Makefile: Move *_LIBS assignment into its own section
  Makefile: add/remove comments at top and tweak whitespace
  Makefile: move "strip" assignment down from flags
  Makefile: remove an out-of-date comment
2019-03-20 15:16:04 +09:00
Junio C Hamano 0e94f7aa73 Merge git://ozlabs.org/~paulus/gitk
* git://ozlabs.org/~paulus/gitk:
  gitk: Update Bulgarian translation (317t)
2019-03-18 11:18:49 +09:00
Alexander Shopov dec59817c1 gitk: Update Bulgarian translation (317t)
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
2019-03-14 20:16:17 +11:00
Junio C Hamano e902e9bcae The second batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-11 16:18:22 +09:00
Junio C Hamano be9f1c0224 Sync with maint
* maint:
  mingw: allow building with an MSYS2 runtime v3.x
2019-03-11 16:16:34 +09:00
Junio C Hamano a07baf33e3 Merge branch 'js/rebase-recreate-merge'
Docfix.

* js/rebase-recreate-merge:
  rebase docs: fix "gitlink" typo
2019-03-11 16:16:26 +09:00
Junio C Hamano d61ddb5189 Merge branch 'js/untravis-windows'
Dev support.

* js/untravis-windows:
  travis: remove the hack to build the Windows job on Azure Pipelines
2019-03-11 16:16:26 +09:00
Junio C Hamano 443442ec71 Merge branch 'rd/gc-prune-doc-fix'
Doxfix.

* rd/gc-prune-doc-fix:
  docs/git-gc: fix typo "--prune=all" to "--prune=now"
2019-03-11 16:16:26 +09:00
Junio C Hamano c0d97d299e Merge branch 'js/find-lib-h-with-ls-files-when-possible'
The Makefile uses 'find' utility to enumerate all the *.h header
files, which is expensive on platforms with slow filesystems; it
now optionally uses "ls-files" if working within a repository,
which is a trick similar to how all sources are enumerated to run
ETAGS on.

* js/find-lib-h-with-ls-files-when-possible:
  Makefile: use `git ls-files` to list header files, if possible
2019-03-11 16:16:25 +09:00
Junio C Hamano 1de413bc1d Merge branch 'rj/hdr-check-gcrypt-fix'
The set of header files used by "make hdr-check" unconditionally
included sha256/gcrypt.h, even when it is not used, causing the
make target to fail.  We now skip it when GCRYPT_SHA256 is not in
use.

* rj/hdr-check-gcrypt-fix:
  Makefile: fix 'hdr-check' when GCRYPT not installed
2019-03-11 16:16:25 +09:00
Junio C Hamano 2274fc75c3 Merge branch 'jk/guard-bswap-header'
The include file compat/bswap.h has been updated so that it is safe
to (accidentally) include it more than once.

* jk/guard-bswap-header:
  compat/bswap: add include header guards
2019-03-11 16:16:25 +09:00
Junio C Hamano 0f519aba51 Merge branch 'rd/attr.c-comment-typofix'
In-code comment typofix.

* rd/attr.c-comment-typofix:
  attr.c: ".gitattribute" -> ".gitattributes" (comments)
2019-03-11 16:16:24 +09:00
Junio C Hamano 2cab288694 Merge branch 'yb/utf-16le-bom-spellfix'
Doc update.

* yb/utf-16le-bom-spellfix:
  gitattributes.txt: fix typo
2019-03-11 16:16:24 +09:00
Johannes Schindelin aeb582a983 mingw: allow building with an MSYS2 runtime v3.x
Recently the Git for Windows project started the upgrade process to
a MSYS2 runtime version based on Cygwin v3.x.

This has the very notable consequence that `$(uname -r)` no longer
reports a version starting with "2", but a version with "3".

That breaks our build, as df5218b4c3 (config.mak.uname: support MSys2,
2016-01-13) simply did not expect the version reported by `uname -r` to
depend on the underlying Cygwin version: it expected the reported
version to match the "2" in "MSYS2".

So let's invert that test case to test for *anything else* than a
version starting with "1" (for MSys). That should safeguard us for the
future, even if Cygwin ends up releasing versionsl like 314.272.65536.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-11 11:02:16 +09:00
Johannes Schindelin 6053c04b88 mingw: drop MakeMaker reference
In 20d2a30f8f (Makefile: replace perl/Makefile.PL with simple make
rules, 2017-12-10), Git stopped using MakeMaker. Therefore, that
definition in the MINGW-specific section became useless.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-08 10:42:10 +09:00
Brandon Richardson cbdeab98e8 commit-tree: utilize parse-options api
Rather than parse options manually, which is both difficult to
read and error prone, parse options supplied to commit-tree
using the parse-options api.

It was discovered that the --no-gpg-sign option was documented
but not implemented in commit 70ddbd7767 (commit-tree: add missing
--gpg-sign flag, 2019-01-19), and the existing implementation
would attempt to translate the option as a tree oid. It was also
suggested earlier in commit 55ca3f99ae (commit-tree: add and document
--no-gpg-sign, 2013-12-13) that commit-tree should be migrated to
utilize the parse-options api, which could help prevent mistakes
like this in the future. Hence this change.

Also update the documentation to better describe that mixing
`-m` and `-F` options will correctly compose commit log messages in the
order in which the options are given.

In the process, mark various strings for translation.

Signed-off-by: Brandon Richardson <brandon1024.br@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-08 10:31:24 +09:00
Jeff King cd8e7593b9 config: document --type=color output is a complete line
Even though the newer "--type=color" option to "git config" is meant
to be upward compatible with the traditional "--get-color" option,
unlike the latter, its output is not an incomplete line that lack
the LF at the end.  That makes it consistent with output of other
types like "git config --type=bool".

Document it, as it sometimes surprises unsuspecting users.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-07 12:48:35 +09:00
Junio C Hamano 6e0cc67761 Start 2.22 cycle
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-07 11:59:54 +09:00
Junio C Hamano c42c664a2f Merge branch 'jt/http-auth-proto-v2-fix'
Unify RPC code for smart http in protocol v0/v1 and v2, which fixes
a bug in the latter (lack of authentication retry) and generally
improves the code base.

* jt/http-auth-proto-v2-fix:
  remote-curl: use post_rpc() for protocol v2 also
  remote-curl: refactor reading into rpc_state's buf
  remote-curl: reduce scope of rpc_state.result
  remote-curl: reduce scope of rpc_state.stdin_preamble
  remote-curl: reduce scope of rpc_state.argv
2019-03-07 10:00:00 +09:00
Junio C Hamano 12e5bdd9c4 Merge branch 'jk/diff-no-index-initialize'
"git diff --no-index" may still want to access Git goodies like
--ext-diff and --textconv, but so far these have been ignored,
which has been corrected.

* jk/diff-no-index-initialize:
  diff: reuse diff setup for --no-index case
2019-03-07 09:59:59 +09:00
Junio C Hamano 68731c7ec7 Merge branch 'nd/no-more-check-racy'
Unused code removal.

* nd/no-more-check-racy:
  Delete check-racy.c
2019-03-07 09:59:59 +09:00
Junio C Hamano 1c6036b69a Merge branch 'rd/doc-hook-used-in-sample'
Doc update.

* rd/doc-hook-used-in-sample:
  mention use of "hooks.allownonascii" in "man githooks"
2019-03-07 09:59:59 +09:00
Junio C Hamano 4ab0f13857 Merge branch 'nd/diff-parseopt-2'
Second batch to teach the diff machinery to use the parse-options
API.

* nd/diff-parseopt-2: (21 commits)
  diff-parseopt: convert --ignore-some-changes
  diff-parseopt: convert --[no-]minimal
  diff-parseopt: convert --relative
  diff-parseopt: convert --no-renames|--[no--rename-empty
  diff-parseopt: convert --find-copies-harder
  diff-parseopt: convert -C|--find-copies
  diff-parseopt: convert -D|--irreversible-delete
  diff-parseopt: convert -M|--find-renames
  diff-parseopt: convert -B|--break-rewrites
  diff-parseopt: convert --output-*
  diff-parseopt: convert --[no-]compact-summary
  diff-parseopt: convert --stat*
  diff-parseopt: convert -s|--no-patch
  diff-parseopt: convert --name-status
  diff-parseopt: convert --name-only
  diff-parseopt: convert --patch-with-stat
  diff-parseopt: convert --summary
  diff-parseopt: convert --check
  diff-parseopt: convert --dirstat and friends
  diff-parseopt: convert --numstat and --shortstat
  ...
2019-03-07 09:59:58 +09:00
Junio C Hamano 082c15ade1 Merge branch 'en/merge-options-doc'
Doc update.

* en/merge-options-doc:
  merge-options.txt: correct wording of --no-commit option
2019-03-07 09:59:58 +09:00
Junio C Hamano b0e7fb2e5c Merge branch 'nd/completion-more-parameters'
The command line completion (in contrib/) has been taught to
complete more subcommand parameters.

* nd/completion-more-parameters:
  completion: add more parameter value completion
2019-03-07 09:59:58 +09:00