git.git
5 years agoconnect: add function to detect supported v1 hash functions
brian m. carlson [Mon, 25 May 2020 19:58:56 +0000 (19:58 +0000)]
connect: add function to detect supported v1 hash functions

Add a function, server_supports_hash, to see if the remote server
supports a particular hash algorithm when speaking protocol v1.

Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agotransport: add a hash algorithm member
brian m. carlson [Mon, 25 May 2020 19:58:55 +0000 (19:58 +0000)]
transport: add a hash algorithm member

When connecting to a remote system, we need to know what hash algorithm
it will be using to talk to us.  Add a hash_algo member to struct
transport and add a function to read this data from the transport
object.

Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agopkt-line: add a member for hash algorithm
brian m. carlson [Mon, 25 May 2020 19:58:54 +0000 (19:58 +0000)]
pkt-line: add a member for hash algorithm

Add a member for the hash algorithm currently in use to the packet
reader so it can parse references correctly.

Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoconnect: add function to fetch value of a v2 server capability
brian m. carlson [Mon, 25 May 2020 19:58:53 +0000 (19:58 +0000)]
connect: add function to fetch value of a v2 server capability

So far in protocol v2, all of our server capabilities that have values
have not had values that we've been interested in parsing.  For example,
we receive but ignore the agent value.

However, in a future commit, we're going to want to parse out the value
of a server capability.  To make this easy, add a function,
server_feature_v2, that can fetch the value provided as part of the
server capability.

Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoconnect: add function to parse multiple v1 capability values
brian m. carlson [Mon, 25 May 2020 19:58:52 +0000 (19:58 +0000)]
connect: add function to parse multiple v1 capability values

In a capability response, we can have multiple symref entries.  In the
future, we will also allow for multiple hash algorithms to be specified.
To avoid duplication, expand the parse_feature_value function to take an
optional offset where the parsing should begin next time.  Add a wrapper
function that allows us to query the next server feature value, and use
it in the existing symref parsing code.

Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoremote: advertise the object-format capability on the server side
brian m. carlson [Mon, 25 May 2020 19:58:51 +0000 (19:58 +0000)]
remote: advertise the object-format capability on the server side

Advertise the current hash algorithm in use by using the object-format
capability as part of the ref advertisement.

Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agowrapper: add function to compare strings with different NUL termination
brian m. carlson [Mon, 25 May 2020 19:58:50 +0000 (19:58 +0000)]
wrapper: add function to compare strings with different NUL termination

When parsing capabilities for the pack protocol, there are times we'll
want to compare the value of a capability to a NUL-terminated string.
Since the data we're reading will be space-terminated, not
NUL-terminated, we need a function that compares the two strings, but
also checks that they're the same length.  Otherwise, if we used strncmp
to compare these strings, we might accidentally accept a parameter that
was a prefix of the expected value.

Add a function, xstrncmpz, that takes a NUL-terminated string and a
non-NUL-terminated string, plus a length, and compares them, ensuring
that they are the same length.

Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoconnect: have ref processing code take struct packet_reader
brian m. carlson [Mon, 25 May 2020 19:58:49 +0000 (19:58 +0000)]
connect: have ref processing code take struct packet_reader

In a future patch, we'll want to access multiple members from struct
packet_reader when parsing references.  Therefore, have the ref parsing
code take pointers to struct reader instead of having to pass multiple
arguments to each function.

Rename the len variable to "linelen" to make it clearer what the
variable does in light of the variable change.

Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoDocumentation: correct hash environment variable
Toon Claes [Tue, 26 May 2020 18:37:20 +0000 (20:37 +0200)]
Documentation: correct hash environment variable

To set the default hash algorithm you can set the `GIT_DEFAULT_HASH`
environment variable. In the documentation this variable is named
`GIT_DEFAULT_HASH_ALGORITHM`, which is incorrect.

Signed-off-by: Toon Claes <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agol10n: tr: v2.27.0 round 2
Emir Sarı [Wed, 27 May 2020 09:48:41 +0000 (12:48 +0300)]
l10n: tr: v2.27.0 round 2

Signed-off-by: Emir Sarı <redacted>
5 years agol10n: fr.po v2.27.0 rnd 2
Jean-Noël Avila [Wed, 27 May 2020 09:18:48 +0000 (11:18 +0200)]
l10n: fr.po v2.27.0 rnd 2

Signed-off-by: Jean-Noël Avila <redacted>
5 years agol10n: bg.po: Updated Bulgarian translation (4875t)
Alexander Shopov [Wed, 27 May 2020 07:44:12 +0000 (09:44 +0200)]
l10n: bg.po: Updated Bulgarian translation (4875t)

Signed-off-by: Alexander Shopov <redacted>
5 years agol10n: Update Catalan translation
Jordi Mas [Wed, 27 May 2020 06:59:48 +0000 (08:59 +0200)]
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <redacted>
5 years agol10n: sv.po: Update Swedish translation (4875t0f0u)
Peter Krefting [Wed, 27 May 2020 06:41:28 +0000 (07:41 +0100)]
l10n: sv.po: Update Swedish translation (4875t0f0u)

Signed-off-by: Peter Krefting <redacted>
5 years agol10n: vi(4875t): Updated Vietnamses translation for 2.27.0rd2
Tran Ngoc Quan [Wed, 27 May 2020 01:07:58 +0000 (08:07 +0700)]
l10n: vi(4875t): Updated Vietnamses translation for 2.27.0rd2

Signed-off-by: Tran Ngoc Quan <redacted>
5 years agol10n: zh_CN: for git v2.27.0 l10n round 1~2
Jiang Xin [Sun, 11 Mar 2018 00:53:35 +0000 (08:53 +0800)]
l10n: zh_CN: for git v2.27.0 l10n round 1~2

Translate 73 new messages (4875t0f0u) for git 2.27.0.

Reviewed-by: 依云 <redacted>
Reviewed-by: Fangyi Zhou <redacted>
Signed-off-by: Jiang Xin <redacted>
5 years agol10n: git.pot: v2.27.0 round 2 (+1)
Jiang Xin [Tue, 26 May 2020 23:24:01 +0000 (07:24 +0800)]
l10n: git.pot: v2.27.0 round 2 (+1)

Generate po/git.pot from v2.27.0-rc2 for git v2.27.0 l10n round 2.

Signed-off-by: Jiang Xin <redacted>
5 years agoMerge branch 'master' of github.com:git-l10n/git-po
Jiang Xin [Tue, 26 May 2020 23:22:26 +0000 (07:22 +0800)]
Merge branch 'master' of github.com:git-l10n/git-po

* 'master' of github.com:git-l10n/git-po:
  l10n: Update Catalan translation
  l10n: vi(4874t): Updated Vietnamses translation for 2.27.0
  l10n: es: 2.27.0 round 1
  l10n: bg.po: Updated Bulgarian translation (4868t)
  l10n: fr v2.27.0 rnd 1
  l10n: sv.po: Update Swedish translation (4839t0f0u)
  l10n: tr: v2.27.0 round 1
  l10n: it.po: update the Italian translation for Git 2.27.0 round 1
  l10n: git.pot: v2.27.0 round 1 (72 new, 37 removed)
  l10n: Update Catalan translation

5 years agoGit 2.27-rc2
Junio C Hamano [Tue, 26 May 2020 16:38:13 +0000 (09:38 -0700)]
Git 2.27-rc2

Signed-off-by: Junio C Hamano <redacted>
5 years agoMerge branch 'ss/faq-ignore'
Junio C Hamano [Tue, 26 May 2020 16:32:08 +0000 (09:32 -0700)]
Merge branch 'ss/faq-ignore'

Doc markup fix.

* ss/faq-ignore:
  gitfaq: avoid validation error with older asciidoc

5 years agorev-list-options.txt: start a list for `show-pulls`
Martin Ågren [Mon, 25 May 2020 17:06:07 +0000 (19:06 +0200)]
rev-list-options.txt: start a list for `show-pulls`

The explanation of the `--show-pulls` option added in commit 8d049e182e
("revision: --show-pulls adds helpful merges", 2020-04-10) consists of
several paragraphs and we use "+" throughout to tie them together in one
long chain of list continuations. Only thing is, we're not in any kind
of list, so these pluses end up being rendered literally.

The preceding few paragraphs describe `--ancestry-path` and there we
*do* have a list, since we've started one with `--ancestry-path::`. In
fact, we have several such lists for all the various history-simplifying
options we're discussing earlier in this file.

Thus, we're missing a list both from a consistency point of view and
from a practical rendering standpoint.

Let's start a list for `--show-pulls` where we start actually discussing
the option, and keep the paragraphs preceding it out of that list. That
is, drop all those pluses before the new list we're adding here.

Helped-by: Derrick Stolee <redacted>
Signed-off-by: Martin Ågren <redacted>
Reviewed-by: Derrick Stolee <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agogitfaq: avoid validation error with older asciidoc
Todd Zullinger [Tue, 19 May 2020 04:53:01 +0000 (00:53 -0400)]
gitfaq: avoid validation error with older asciidoc

When building with asciidoc-8.4.5 (as found on CentOS/Red Hat 6), the
period in the "[[files-in-.gitignore-are-tracked]]" anchor is not
properly parsed as a section:

  WARNING: gitfaq.txt: line 245: missing [[files-in-.gitignore-are-tracked]] section

The resulting XML file fails to validate with xmlto:

    xmlto: /git/Documentation/gitfaq.xml does not validate (status 3)
    xmlto: Fix document syntax or use --skip-validation option
     /git/Documentation/gitfaq.xml:3: element refentry: validity error :
     Element refentry content does not follow the DTD, expecting
     (beginpage? , indexterm* , refentryinfo? , refmeta? , (remark | link
     | olink | ulink)* , refnamediv+ , refsynopsisdiv? , (refsect1+ |
     refsection+)), got (refmeta refnamediv refsynopsisdiv refsect1
     refsect1 refsect1 refsect1 variablelist refsect1 refsect1 )
    Document /git/Documentation/gitfaq.xml does not validate

Let's avoid breaking users of platforms which ship an old version of
asciidoc, since the cost to do so is quite low.

Reported-by: Son Luong Ngoc <redacted>
Signed-off-by: Todd Zullinger <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoHopefully final batch before 2.27-rc2
Junio C Hamano [Mon, 25 May 2020 01:13:53 +0000 (18:13 -0700)]
Hopefully final batch before 2.27-rc2

Signed-off-by: Junio C Hamano <redacted>
5 years agoMerge branch 'dd/t5703-grep-a-fix'
Junio C Hamano [Mon, 25 May 2020 02:39:40 +0000 (19:39 -0700)]
Merge branch 'dd/t5703-grep-a-fix'

Update an unconditional use of "grep -a" with a perl script in a test.

* dd/t5703-grep-a-fix:
  t5703: replace "grep -a" usage by perl

5 years agoMerge branch 'ds/multi-pack-verify'
Junio C Hamano [Mon, 25 May 2020 02:39:39 +0000 (19:39 -0700)]
Merge branch 'ds/multi-pack-verify'

Fix for a copy-and-paste error introduced during 2.20 era.

* ds/multi-pack-verify:
  fsck: use ERROR_MULTI_PACK_INDEX

5 years agoMerge branch 'ma/doc-fixes'
Junio C Hamano [Mon, 25 May 2020 02:39:38 +0000 (19:39 -0700)]
Merge branch 'ma/doc-fixes'

Various doc fixes.

* ma/doc-fixes:
  git-sparse-checkout.txt: add missing '
  git-credential.txt: use list continuation
  git-commit-graph.txt: fix list rendering
  git-commit-graph.txt: fix grammo
  date-formats.txt: fix list continuation

5 years agoMerge branch 'cb/bisect-replay-with-dos-fix'
Junio C Hamano [Mon, 25 May 2020 02:39:38 +0000 (19:39 -0700)]
Merge branch 'cb/bisect-replay-with-dos-fix'

Re-fix longstanding "edited bisect log may confuse bisect replay
with trailing carriage-return" issue.

* cb/bisect-replay-with-dos-fix:
  bisect: avoid tailing CR characters from revision in replay

5 years agoMerge branch 'gs/commit-graph-path-filter'
Junio C Hamano [Mon, 25 May 2020 02:39:38 +0000 (19:39 -0700)]
Merge branch 'gs/commit-graph-path-filter'

Test fix.

* gs/commit-graph-path-filter:
  t4216: avoid unnecessary subshell in test_bloom_filters_not_used

5 years agoMerge branch 'dl/merge-autostash'
Junio C Hamano [Mon, 25 May 2020 02:39:37 +0000 (19:39 -0700)]
Merge branch 'dl/merge-autostash'

Test fix.

* dl/merge-autostash:
  t5520: avoid alternation in grep's BRE (not POSIX)

5 years agoMerge branch 'bc/faq'
Junio C Hamano [Mon, 25 May 2020 02:39:36 +0000 (19:39 -0700)]
Merge branch 'bc/faq'

"git help guides" now includes the newly added FAQ document.

* bc/faq:
  command-list.txt: add gitfaq to the list of guides

5 years agoMerge branch 'jt/avoid-prefetch-when-able-in-diff'
Junio C Hamano [Mon, 25 May 2020 02:39:35 +0000 (19:39 -0700)]
Merge branch 'jt/avoid-prefetch-when-able-in-diff'

Test-coverage enhancement.

* jt/avoid-prefetch-when-able-in-diff:
  t4067: make rename detection test output raw diff

5 years agoMerge branch 'gp/hppa-stack-test-fix'
Junio C Hamano [Mon, 25 May 2020 02:39:35 +0000 (19:39 -0700)]
Merge branch 'gp/hppa-stack-test-fix'

Platform dependent tweak to a test for HP-PA.

* gp/hppa-stack-test-fix:
  tests: skip small-stack tests on hppa architecture

5 years agosparse: allow '{ 0 }' to be used without warnings
Luc Van Oostenryck [Fri, 22 May 2020 00:25:02 +0000 (02:25 +0200)]
sparse: allow '{ 0 }' to be used without warnings

In standard C, '{ 0 }' can be used as an universal zero-initializer.
However, Sparse complains if this is used on a type where the first
member (possibly nested) is a pointer since Sparse purposely wants
to warn when '0' is used to initialize a pointer type.

Legitimaly, it's desirable to be able to use '{ 0 }' as an idiom
without these warnings [1,2]. To allow this, an option have now
been added to Sparse:
    537e3e2dae univ-init: conditionally accept { 0 } without warnings

So, add this option to the SPARSE_FLAGS variable.

Note: The option have just been added to Sparse. So, to benefit
      now from this patch it's needed to use the latest Sparse
      source from kernel.org. The option will simply be ignored
      by older versions of Sparse.

[1] https://lore.kernel.org/r/e6796c60-a870-e761-3b07-b680f934c537@ramsayjones.plus.com
[2] https://lore.kernel.org/r/xmqqd07xem9l.fsf@gitster.c.googlers.com

Signed-off-by: Luc Van Oostenryck <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agostateless-connect: send response end packet
Denton Liu [Tue, 19 May 2020 10:54:00 +0000 (06:54 -0400)]
stateless-connect: send response end packet

Currently, remote-curl acts as a proxy and blindly forwards packets
between an HTTP server and fetch-pack. In the case of a stateless RPC
connection where the connection is terminated before the transaction is
complete, remote-curl will blindly forward the packets before waiting on
more input from fetch-pack. Meanwhile, fetch-pack will read the
transaction and continue reading, expecting more input to continue the
transaction. This results in a deadlock between the two processes.

This can be seen in the following command which does not terminate:

$ git -c protocol.version=2 clone https://github.com/git/git.git --shallow-since=20151012
Cloning into 'git'...

whereas the v1 version does terminate as expected:

$ git -c protocol.version=1 clone https://github.com/git/git.git --shallow-since=20151012
Cloning into 'git'...
fatal: the remote end hung up unexpectedly

Instead of blindly forwarding packets, make remote-curl insert a
response end packet after proxying the responses from the remote server
when using stateless_connect(). On the RPC client side, ensure that each
response ends as described.

A separate control packet is chosen because we need to be able to
differentiate between what the remote server sends and remote-curl's
control packets. By ensuring in the remote-curl code that a server
cannot send response end packets, we prevent a malicious server from
being able to perform a denial of service attack in which they spoof a
response end packet and cause the described deadlock to happen.

Reported-by: Force Charlie <redacted>
Helped-by: Jeff King <redacted>
Signed-off-by: Denton Liu <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agopkt-line: define PACKET_READ_RESPONSE_END
Denton Liu [Tue, 19 May 2020 10:53:59 +0000 (06:53 -0400)]
pkt-line: define PACKET_READ_RESPONSE_END

In a future commit, we will use PACKET_READ_RESPONSE_END to separate
messages proxied by remote-curl. To prepare for this, add the
PACKET_READ_RESPONSE_END enum value.

In switch statements that need a case added, die() or BUG() when a
PACKET_READ_RESPONSE_END is unexpected. Otherwise, mirror how
PACKET_READ_DELIM is implemented (especially in cases where packets are
being forwarded).

Signed-off-by: Denton Liu <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoremote-curl: error on incomplete packet
Denton Liu [Tue, 19 May 2020 10:53:58 +0000 (06:53 -0400)]
remote-curl: error on incomplete packet

Currently, remote-curl acts as a proxy and blindly forwards packets
between an HTTP server and fetch-pack. In the case of a stateless RPC
connection where the connection is terminated with a partially written
packet, remote-curl will blindly send the partially written packet
before waiting on more input from fetch-pack. Meanwhile, fetch-pack will
read the partial packet and continue reading, expecting more input. This
results in a deadlock between the two processes.

For a stateless connection, inspect packets before sending them and
error out if a packet line packet is incomplete.

Helped-by: Jeff King <redacted>
Signed-off-by: Denton Liu <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agodiff: add config option relative
Laurent Arnoud [Fri, 22 May 2020 10:46:18 +0000 (12:46 +0200)]
diff: add config option relative

The `diff.relative` boolean option set to `true` shows only changes in
the current directory/value specified by the `path` argument of the
`relative` option and shows pathnames relative to the aforementioned
directory.

Teach `--no-relative` to override earlier `--relative`

Add for git-format-patch(1) options documentation `--relative` and
`--no-relative`

Signed-off-by: Laurent Arnoud <redacted>
Acked-by: Đoàn Trần Công Danh <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot5608: avoid say() and use "skip_all" instead for consistency
Carlo Marcelo Arenas Belón [Fri, 22 May 2020 18:42:14 +0000 (11:42 -0700)]
t5608: avoid say() and use "skip_all" instead for consistency

Printing a message directly to stdout could affect TAP processing
and is not really needed, as there is a standard way to skip all
tests that could be used instead, while printing an equivalent
message.

While at it; update the message to better reflect that since
a85efb5985 (t5608-clone-2gb.sh: turn GIT_TEST_CLONE_2GB into a bool,
2019-11-22), the enabling variable should be a recognized boolean
(ex: true, false, 1, 0) and get rid of the prerequisite that used
to guard all the tests, since "skip_all" is just much faster and
idempotent.

Helped-by: Johannes Schindelin <redacted>
Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agocheckout: improve error messages for -b with extra argument
René Scharfe [Sun, 24 May 2020 07:23:00 +0000 (09:23 +0200)]
checkout: improve error messages for -b with extra argument

When we try to create a branch "foo" based on "origin/master" and give
git commit -b an extra unsupported argument "bar", it confusingly
reports:

   $ git checkout -b foo origin/master bar
   fatal: 'bar' is not a commit and a branch 'foo' cannot be created from it

   $ git checkout --track -b foo origin/master bar
   fatal: 'bar' is not a commit and a branch 'foo' cannot be created from it

That's wrong, because it very well understands that "origin/master" is
supposed to be the start point for the new branch and not "bar".  Check
if we got a commit and show more fitting messages in that case instead:

   $ git checkout -b foo origin/master bar
   fatal: Cannot update paths and switch to branch 'foo' at the same time.

   $ git checkout --track -b foo origin/master bar
   fatal: '--track' cannot be used with updating paths

Original-patch-by: Jeff King <redacted>
Signed-off-by: René Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agocheckout: add tests for -b and --track
René Scharfe [Sun, 24 May 2020 07:22:51 +0000 (09:22 +0200)]
checkout: add tests for -b and --track

Test git checkout -b with and without --track and demonstrate unexpected
error messages when it's given an extra (i.e. unsupported) path
argument.  In both cases it reports:

   $ git checkout -b foo origin/master bar
   fatal: 'bar' is not a commit and a branch 'foo' cannot be created from it

The problem is that the start point we gave for the new branch is
"origin/master" and "bar" is just some extra argument -- it could even
be a valid commit, which would make the message even more confusing.  We
have more fitting error messages in git commit, but get confused; use
the text of the rights ones in the tests.

Reported-by: Dana Dahlstrom <redacted>
Original-test-by: Jeff King <redacted>
Signed-off-by: René Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agobisect--helper: avoid segfault with bad syntax in `start --term-*`
Carlo Marcelo Arenas Belón [Wed, 20 May 2020 23:26:27 +0000 (16:26 -0700)]
bisect--helper: avoid segfault with bad syntax in `start --term-*`

06f5608c14 (bisect--helper: `bisect_start` shell function partially in C,
2019-01-02) adds a lax parser for `git bisect start` which could result
in a segfault under a bad syntax call for start with custom terms.

Detect if there are enough arguments left in the command line to use for
--term-{old,good,new,bad} and abort with the same syntax error the original
implementation will show if not.

While at it, remove an unnecessary (and incomplete) check for unknown
arguments and make sure to add a test to avoid regressions.

Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
Acked-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agol10n: Update Catalan translation
Jordi Mas [Fri, 22 May 2020 05:59:22 +0000 (07:59 +0200)]
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <redacted>
5 years agocompletion: don't override given stash subcommand with -p
Ville Skyttä [Thu, 21 May 2020 18:35:59 +0000 (21:35 +0300)]
completion: don't override given stash subcommand with -p

df70b190 (completion: make stash -p and alias for stash push -p,
2018-04-20) wanted to make sure "git stash -p <TAB>" offers the same
completion as "git stash push -p <TAB>", but it did so by forcing the
$subcommand to be "push" whenever then "-p" option is found on the
command line.

This harms any subcommand that can take the "-p" option---even when the
subcommand is explicitly given, e.g. "git stash show -p", the code added
by the change would overwrite the $subcommand the user gave us.

Fix it by making sure that the defaulting to "push" happens only when
there is no $subcommand given yet.

Signed-off-by: Ville Skyttä <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoMerge https://github.com/prati0100/git-gui
Junio C Hamano [Thu, 21 May 2020 18:15:04 +0000 (11:15 -0700)]
Merge https://github.com/prati0100/git-gui

* https://github.com/prati0100/git-gui:
  git-gui: Handle Ctrl + BS/Del in the commit msg
  Subject: git-gui: fix syntax error because of missing semicolon

5 years agofsck: detect more in-tree d/f conflicts
René Scharfe [Thu, 21 May 2020 09:52:54 +0000 (11:52 +0200)]
fsck: detect more in-tree d/f conflicts

If the conflict candidate file name from the top of the stack is not a
prefix of the current candiate directory then we can discard it as no
matching directory can come up later.  But we are not done checking the
candidate directory -- the stack might still hold a matching file name,
so stay in the loop and check the next candidate file name.

Signed-off-by: René Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot1450: demonstrate undetected in-tree d/f conflict
René Scharfe [Thu, 21 May 2020 09:52:43 +0000 (11:52 +0200)]
t1450: demonstrate undetected in-tree d/f conflict

Signed-off-by: René Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot1450: increase test coverage of in-tree d/f detection
René Scharfe [Thu, 21 May 2020 09:52:28 +0000 (11:52 +0200)]
t1450: increase test coverage of in-tree d/f detection

Exercise the case of putting a conflict candidate file name back on the
stack because a matching directory might yet come up later.

Do that by factoring out the test code into a function to allow for more
concise notation in the form of parameters indicating names of trees
(with trailing slash) and blobs (without trailing slash) in no
particular order (they are sorted by git mktree).  Then add the new test
case as a second function call.

Fix a typo in the test title while at it ("dublicate").

Reported-by: Derrick Stolee <redacted>
Signed-off-by: René Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agofsck: fix a typo in a comment
René Scharfe [Thu, 21 May 2020 09:52:04 +0000 (11:52 +0200)]
fsck: fix a typo in a comment

Reported-by: Junio C Hamano <redacted>
Signed-off-by: René Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agodoc: fix wrong 4-byte length of pkt-line message
Jiuyang Xie [Thu, 21 May 2020 11:32:38 +0000 (19:32 +0800)]
doc: fix wrong 4-byte length of pkt-line message

The first four bytes of the line, the pkt-len, indicates the total
length of the pkt-line in hexadecimal. Fix wrong pkt-len headers of
some pkt-line messages in `http-protocol.txt` and `pack-protocol.txt`.

Reviewed-by: Denton Liu <redacted>
Signed-off-by: Jiuyang Xie <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot2060: add a test for switch with --orphan and --discard-changes
brian m. carlson [Thu, 21 May 2020 02:07:12 +0000 (02:07 +0000)]
t2060: add a test for switch with --orphan and --discard-changes

We have several code paths in the checkout code which are traversed only
in this case, due to switch having different defaults from checkout.
Let's add a test that the combination of options works and produces the
expected behavior.

Signed-off-by: brian m. carlson <redacted>
Reviewed-by: Derrick Stolee <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agobuiltin/checkout: simplify metadata initialization
brian m. carlson [Thu, 21 May 2020 02:07:11 +0000 (02:07 +0000)]
builtin/checkout: simplify metadata initialization

When we call init_checkout_metadata in reset_tree, we want to pass the
object ID of the commit in question so that it can be passed to filters,
or if there is no commit, the tree.  We anticipated this latter case,
which can occur elsewhere in the checkout code, but it cannot occur
here.  The only case in which we do not have a commit object is when
invoking git switch with --orphan.  Moreover, we can only hit this code
path without a commit object additionally with either --force or
--discard-changes.

In such a case, there is no point initializing the checkout metadata
with a commit or tree because (a) there is no commit, only the empty
tree, and (b) we will never use the data, since no files will be smudged
when checking out a branch with no files.  Pass the all-zeros object ID
in this case, since we just need some value which is a valid pointer.

Signed-off-by: brian m. carlson <redacted>
Reviewed-by: Derrick Stolee <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoconfig: let feature.experimental imply protocol.version=2
Jonathan Nieder [Thu, 21 May 2020 02:15:33 +0000 (19:15 -0700)]
config: let feature.experimental imply protocol.version=2

Git 2.26 used protocol v2 as its default protocol, but soon after
release, users noticed that the protocol v2 negotiation code was prone
to fail when fetching from some remotes that are far ahead of others
(such as linux-next.git versus Linus's linux.git).  That has been
fixed by 0b07eecf6ed (Merge branch 'jt/v2-fetch-nego-fix',
2020-05-01), but to be cautious, we are using protocol v0 as the
default in 2.27 to buy some time for any other unanticipated issues to
surface.

To that end, let's ensure that users requesting the bleeding edge
using the feature.experimental flag *do* get protocol v2.  This way,
we can gain experience with a wider audience for the new protocol
version and be more confident when it is time to enable it by default
for all users in some future Git version.

Implementation note: this isn't with the rest of the
feature.experimental options in repo-settings.c because those are tied
to a repository object, whereas this code path is used for operations
like "git ls-remote" that do not require a repository.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoMerge branch 'il/ctrl-bs-del'
Pratyush Yadav [Thu, 21 May 2020 12:55:32 +0000 (18:25 +0530)]
Merge branch 'il/ctrl-bs-del'

Allow deleting words backwards and forwards using Ctrl + Backspace and
Delete in the commit message buffer.

* il/ctrl-bs-del:
  git-gui: Handle Ctrl + BS/Del in the commit msg

5 years agol10n: vi(4874t): Updated Vietnamses translation for 2.27.0
Tran Ngoc Quan [Thu, 21 May 2020 01:22:14 +0000 (08:22 +0700)]
l10n: vi(4874t): Updated Vietnamses translation for 2.27.0

Signed-off-by: Tran Ngoc Quan <redacted>
5 years agorefs: improve documentation for ref iterator
Han-Wen Nienhuys [Wed, 20 May 2020 17:36:09 +0000 (17:36 +0000)]
refs: improve documentation for ref iterator

Document some of the flag options in refs_ref_iterator_begin, and explain how
ref_iterator_advance_fn should handle them.

Signed-off-by: Han-Wen Nienhuys <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot: use update-ref and show-ref to reading/writing refs
Han-Wen Nienhuys [Wed, 20 May 2020 17:36:08 +0000 (17:36 +0000)]
t: use update-ref and show-ref to reading/writing refs

Reading and writing .git/refs/* assumes that refs are stored in the 'files'
ref backend.

Signed-off-by: Han-Wen Nienhuys <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agorefs.h: clarify reflog iteration order
Han-Wen Nienhuys [Wed, 20 May 2020 17:36:07 +0000 (17:36 +0000)]
refs.h: clarify reflog iteration order

Signed-off-by: Han-Wen Nienhuys <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agobisect: avoid tailing CR characters from revision in replay
Carlo Marcelo Arenas Belón [Wed, 20 May 2020 17:08:43 +0000 (10:08 -0700)]
bisect: avoid tailing CR characters from revision in replay

6c722cbe5a (bisect: allow CRLF line endings in "git bisect replay"
input, 2020-05-07) includes CR as a field separator, but relies on
it not being included in the last field, which breaks at least when
running under OpenBSD 6.7's sh.

Instead of just assume the CR will get swallowed, read the rest of
the line into an otherwise unused variable and ignore it everywhere
except on the call for git bisect start, where it matters.

Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agocommand-list.txt: add gitfaq to the list of guides
Philippe Blain [Wed, 20 May 2020 14:44:48 +0000 (14:44 +0000)]
command-list.txt: add gitfaq to the list of guides

When 'gitfaq.txt' was added in 2149b6748f (docs: add a FAQ, 2020-03-30),
it was added to the Makefile but not to command-list.txt.

Add it there also, so that the new FAQ is listed in the output of
`git help --guides`.

Signed-off-by: Philippe Blain <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot5520: avoid alternation in grep's BRE (not POSIX)
Carlo Marcelo Arenas Belón [Wed, 20 May 2020 03:44:44 +0000 (20:44 -0700)]
t5520: avoid alternation in grep's BRE (not POSIX)

Instead of using a BRE, that broke tests 30-32, 37-39, 42 at least with
OpenBSD 6.7; use a simpler ERE.

Fixes: d9f15d37f1 (pull: pass --autostash to merge, 2020-04-07)
Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot4216: avoid unnecessary subshell in test_bloom_filters_not_used
Carlo Marcelo Arenas Belón [Wed, 20 May 2020 03:44:42 +0000 (20:44 -0700)]
t4216: avoid unnecessary subshell in test_bloom_filters_not_used

Seems to trigger a bug in at least OpenBSD's 6.7 sh where it is
interpreted as a history lookup and therefore fails 125-126, 128,
130.

Remove the subshell and get a space between ! and grep, so tests
pass successfully.

Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoGit 2.27-rc1
Junio C Hamano [Wed, 20 May 2020 15:33:55 +0000 (08:33 -0700)]
Git 2.27-rc1

Signed-off-by: Junio C Hamano <redacted>
5 years agoMerge branch 'es/bugreport'
Junio C Hamano [Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)]
Merge branch 'es/bugreport'

Doc fix.

* es/bugreport:
  git-bugreport.txt: adjust reference to strftime(3)

5 years agoMerge branch 'ak/slab-decl-cleanup'
Junio C Hamano [Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)]
Merge branch 'ak/slab-decl-cleanup'

Code clean-up.

* ak/slab-decl-cleanup:
  commit-slab-decl.h: update include guard

5 years agoMerge branch 'jc/fix-tap-output-under-bash'
Junio C Hamano [Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)]
Merge branch 'jc/fix-tap-output-under-bash'

A recent attempt to make the test output nicer to view on CI
systems broke TAP output under bash.  The effort has been reverted
to be re-attempted in the next cycle.

* jc/fix-tap-output-under-bash:
  Revert "tests: when run in Bash, annotate test failures with file name/line number"
  Revert "ci: add a problem matcher for GitHub Actions"
  Revert "t/test_lib: avoid naked bash arrays in file_lineno"

5 years agoMerge branch 'en/sparse-checkout'
Junio C Hamano [Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)]
Merge branch 'en/sparse-checkout'

Consistency fix to a topic already in 'master'.

* en/sparse-checkout:
  unpack-trees: also allow get_progress() to work on a different index

5 years agoMerge branch 'ds/trace-log-progress-fix'
Junio C Hamano [Wed, 20 May 2020 15:33:28 +0000 (08:33 -0700)]
Merge branch 'ds/trace-log-progress-fix'

Last-minute fix for our recent change to allow use of progress API
as a traceable region.

* ds/trace-log-progress-fix:
  progress: call trace2_region_leave() only after calling _enter()

5 years agoMerge branch 'js/ci-sdk-download-fix'
Junio C Hamano [Wed, 20 May 2020 15:33:27 +0000 (08:33 -0700)]
Merge branch 'js/ci-sdk-download-fix'

Instead of downloading Windows SDK for CI jobs for windows builds
from an external site (wingit.blob.core.windows.net), use the one
created in the windows-build job, to work around quota issues at
the external site.

* js/ci-sdk-download-fix:
  ci: avoid pounding on the poor ci-artifacts container

5 years agoMerge branch 'en/merge-rename-rename-worktree-fix'
Junio C Hamano [Wed, 20 May 2020 15:33:27 +0000 (08:33 -0700)]
Merge branch 'en/merge-rename-rename-worktree-fix'

When a binary file gets modified and renamed on both sides of history
to different locations, both files would be written to the working
tree but both would have the contents from "ours".  This has been
corrected so that the path from each side gets their original content.

* en/merge-rename-rename-worktree-fix:
  merge-recursive: fix rename/rename(1to2) for working tree with a binary

5 years agoMerge branch 'cb/no-more-gmtime'
Junio C Hamano [Wed, 20 May 2020 15:33:27 +0000 (08:33 -0700)]
Merge branch 'cb/no-more-gmtime'

Code clean-up by removing a compatibility implementation of a
function we no longer use.

* cb/no-more-gmtime:
  compat: remove gmtime

5 years agoMerge branch 'dd/t1509-i18n-fix'
Junio C Hamano [Wed, 20 May 2020 15:33:26 +0000 (08:33 -0700)]
Merge branch 'dd/t1509-i18n-fix'

A few tests were not i18n clean.

* dd/t1509-i18n-fix:
  t1509: correct i18n test

5 years agoMerge branch 'next' of github.com:ChrisADR/git-po
Jiang Xin [Wed, 20 May 2020 00:07:30 +0000 (08:07 +0800)]
Merge branch 'next' of github.com:ChrisADR/git-po

* 'next' of github.com:ChrisADR/git-po:
  l10n: es: 2.27.0 round 1

5 years agofsck: use ERROR_MULTI_PACK_INDEX
Derrick Stolee [Tue, 19 May 2020 19:48:45 +0000 (19:48 +0000)]
fsck: use ERROR_MULTI_PACK_INDEX

The multi-pack-index was added to the data verified by git-fsck in
ea5ae6c3 "fsck: verify multi-pack-index". This implementation was
based on the implementation for verifying the commit-graph, and a
copy-paste error kept the ERROR_COMMIT_GRAPH flag as the bit set
when an error appears in the multi-pack-index.

Add a new flag, ERROR_MULTI_PACK_INDEX, and use that instead.

Signed-off-by: Derrick Stolee <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot4067: make rename detection test output raw diff
Jonathan Tan [Tue, 19 May 2020 18:31:51 +0000 (11:31 -0700)]
t4067: make rename detection test output raw diff

95acf11a3d ("diff: restrict when prefetching occurs", 2020-04-07) taught
diff to prefetch blobs in a more limited set of situations. These
limited situations include when the output format requires blob data,
and when inexact rename detection is needed.

There is an existing test case that tests inexact rename detection, but
it also uses an output format that requires blob data, resulting in the
inexact-rename-detection-only code not being tested. Update this test to
use the raw output format, which does not require blob data.

Thanks to Derrick Stolee for noticing this lapse in code coverage and
for doing the preliminary analysis [1].

[1] https://lore.kernel.org/git/853759d3-97c3-241f-98e1-990883cd204e@gmail.com/

Signed-off-by: Jonathan Tan <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agopkt-line: extern packet_length()
Denton Liu [Tue, 19 May 2020 10:53:57 +0000 (06:53 -0400)]
pkt-line: extern packet_length()

In a future commit, we will be manually processing packets and we will
need to access the length header. In order to simplify this, extern
packet_length() so that the logic can be reused.

Change the function parameter from `const char *linelen` to
`const char lenbuf_hex[4]`. Even though these two types behave
identically as function parameters, use the array notation to
semantically indicate exactly what this function is expecting as an
argument. Also, rename it from linelen to lenbuf_hex as the former
sounds like it should be an integral type which is misleading.

Signed-off-by: Denton Liu <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agotransport: extract common fetch_pack() call
Denton Liu [Tue, 19 May 2020 10:53:56 +0000 (06:53 -0400)]
transport: extract common fetch_pack() call

In the switch statement, the difference between the `protocol_v2` and
`protocol_v{1,0}` arms is a preparatory call to die_if_server_options() in
the latter. The fetch_pack() call is identical in both arms. However,
since this fetch_pack() call has so many parameters, it is not
immediately obvious that the call is identical in both cases.

Extract the common fetch_pack() call out of the switch statement so that
code duplication is reduced and the logic is more clear for future
readers. While we're at it, rewrite the switch statement as an if-else
tower for increased clarity.

Signed-off-by: Denton Liu <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agomerge: optimization to skip evaluate_result for single strategy
Andrew Ng [Tue, 19 May 2020 13:05:35 +0000 (14:05 +0100)]
merge: optimization to skip evaluate_result for single strategy

For a merge with a single strategy, the result of evaluate_result() is
effectively not used and therefore is not needed, so avoid altogether.

On Windows, this optimization can halve the time required to perform a
recursive merge of a single commit with the LLVM repo.

Signed-off-by: Andrew Ng <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot5703: replace "grep -a" usage by perl
Đoàn Trần Công Danh [Tue, 19 May 2020 00:50:46 +0000 (07:50 +0700)]
t5703: replace "grep -a" usage by perl

On some platforms likes HP-UX, grep(1) doesn't understand "-a".
Let's switch to perl.

Signed-off-by: Đoàn Trần Công Danh <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agogit-sparse-checkout.txt: add missing '
Martin Ågren [Sun, 17 May 2020 18:52:21 +0000 (20:52 +0200)]
git-sparse-checkout.txt: add missing '

Where we explain the 'reapply' command, we don't properly wrap it in
single quote marks like we do with the other commands: We omit the
closing mark ("'reapply") and this ends up being rendered literally as
"'reapply". Add the missing "'".

Signed-off-by: Martin Ågren <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agogit-credential.txt: use list continuation
Martin Ågren [Sun, 17 May 2020 18:52:20 +0000 (20:52 +0200)]
git-credential.txt: use list continuation

Use list continuation to avoid the second and third paragraphs
rendering with a different indentation from the first one where we
describe the "url" attribute.

Signed-off-by: Martin Ågren <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agogit-commit-graph.txt: fix list rendering
Martin Ågren [Sun, 17 May 2020 18:52:19 +0000 (20:52 +0200)]
git-commit-graph.txt: fix list rendering

The first list item follows immediately on the paragraph where we
introduce the list. This makes the "*" render literally as part of one
huge paragraph. (With AsciiDoc, everything is fine after that, but with
Asciidoctor, we get some minor follow-on errors.) Add an empty line --
with a list continuation ("+") -- to make the first list item render ok.

Signed-off-by: Martin Ågren <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agogit-commit-graph.txt: fix grammo
Martin Ågren [Sun, 17 May 2020 18:52:18 +0000 (20:52 +0200)]
git-commit-graph.txt: fix grammo

It's easy to mix up the possessive "its" and "it's" ("it is"). Correct
an instance of this.

Signed-off-by: Martin Ågren <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agodate-formats.txt: fix list continuation
Martin Ågren [Sun, 17 May 2020 18:52:16 +0000 (20:52 +0200)]
date-formats.txt: fix list continuation

The blank line before the lone "+" means it isn't detected as a list
continuation, but instead renders literally, at least with AsciiDoc.
Drop the empty line and, while at it, add a closing period to the
preceding paragraph.

Signed-off-by: Martin Ågren <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot4210: detect REG_ILLSEQ dynamically and skip affected tests
Carlo Marcelo Arenas Belón [Mon, 18 May 2020 18:44:16 +0000 (11:44 -0700)]
t4210: detect REG_ILLSEQ dynamically and skip affected tests

7187c7bbb8 (t4210: skip i18n tests that don't work on FreeBSD, 2019-11-27)
adds a REG_ILLSEQ prerequisite, and to do that copies the common branch in
test-lib and expands it to include it in a special case for FreeBSD.

Instead; test for it using a previously added extension to test-tool and
use that, together with a function that identifies when regcomp/regexec
will be called with broken patterns to avoid any test that would otherwise
rely on undefined behaviour.

The description of the first test which wasn't accurate has been corrected,
and the test rearranged for clarity, including a helper function that avoids
overly long lines.

Only the affected engines will have their tests suppressed, also including
"fixed" if the PCRE optimization that uses LIBPCRE2 since b65abcafc7
(grep: use PCRE v2 for optimized fixed-string search, 2019-07-01) is not
available.

Helped-by: Eric Sunshine <redacted>
Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agot/helper: teach test-regex to report pattern errors (like REG_ILLSEQ)
Carlo Marcelo Arenas Belón [Mon, 18 May 2020 18:44:15 +0000 (11:44 -0700)]
t/helper: teach test-regex to report pattern errors (like REG_ILLSEQ)

7187c7bbb8 (t4210: skip i18n tests that don't work on FreeBSD, 2019-11-27)
adds a REG_ILLSEQ prerequisite to avoid failures from the tests added in
4e2443b181 (log tests: test regex backends in "--encode=<enc>" tests,
2019-06-28), but hardcodes it to be only enabled in FreeBSD.

Instead of hardcoding the affected platform, teach the test-regex helper,
how to validate a pattern and report back, so it can be used to detect the
same issue in other affected systems (like DragonFlyBSD or macOS).

While at it, refactor the tool so it can report back the source of the
errors it founds, and can be invoked also in a --silent mode, when needed,
for backward compatibility.  A missing flag has been added and the code
reformatted, as well as updates to the way the parameters are handled, for
consistency.

To minimize changes, it is assumed the regcomp error is of the right type
since we control the only caller, and is also assumed to affect both basic
and extended syntax (only basic is tested, but both behave the same in all
three affected platforms since they use the same function).

Based-on-patch-by: Junio C Hamano <redacted>
Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: use upload_pack_data fields in receive_needs()
Christian Couder [Fri, 15 May 2020 10:04:54 +0000 (12:04 +0200)]
upload-pack: use upload_pack_data fields in receive_needs()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's use fields from this struct in
receive_needs(), instead of local variables with the same name
and purpose.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: pass upload_pack_data to create_pack_file()
Christian Couder [Fri, 15 May 2020 10:04:53 +0000 (12:04 +0200)]
upload-pack: pass upload_pack_data to create_pack_file()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's pass that struct to create_pack_file(),
so that this function, and the function it calls, can use all
the fields of the struct.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: remove static variable 'stateless_rpc'
Christian Couder [Fri, 15 May 2020 10:04:52 +0000 (12:04 +0200)]
upload-pack: remove static variable 'stateless_rpc'

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's remove the 'stateless_rpc' static
variable, as we can now use the field of 'struct upload_pack_data'
with the same name instead.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: pass upload_pack_data to check_non_tip()
Christian Couder [Fri, 15 May 2020 10:04:51 +0000 (12:04 +0200)]
upload-pack: pass upload_pack_data to check_non_tip()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's pass that struct to check_non_tip(), so
that this function and the functions it calls, can use all the
fields of the struct in followup commits.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: pass upload_pack_data to send_ref()
Christian Couder [Fri, 15 May 2020 10:04:50 +0000 (12:04 +0200)]
upload-pack: pass upload_pack_data to send_ref()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's pass that struct to send_ref(), so that
this function, and the functions it calls, can use all the
fields of the struct in followup commits.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: move symref to upload_pack_data
Christian Couder [Fri, 15 May 2020 10:04:49 +0000 (12:04 +0200)]
upload-pack: move symref to upload_pack_data

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, we are passing around that struct to many
functions, so let's also pass 'struct string_list symref' around
at the same time by moving it from a local variable in
upload_pack() into a field of 'struct upload_pack_data'.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: use upload_pack_data writer in receive_needs()
Christian Couder [Fri, 15 May 2020 10:04:48 +0000 (12:04 +0200)]
upload-pack: use upload_pack_data writer in receive_needs()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's use the 'struct packet_writer writer'
field from 'struct upload_pack_data' in receive_needs(),
instead of a local 'struct packet_writer writer' variable.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: pass upload_pack_data to receive_needs()
Christian Couder [Fri, 15 May 2020 10:04:47 +0000 (12:04 +0200)]
upload-pack: pass upload_pack_data to receive_needs()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's pass 'struct upload_pack_data' to
receive_needs(), so that this function and the functions it
calls can use all the fields of that struct in followup commits.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: pass upload_pack_data to get_common_commits()
Christian Couder [Fri, 15 May 2020 10:04:46 +0000 (12:04 +0200)]
upload-pack: pass upload_pack_data to get_common_commits()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's pass 'struct upload_pack_data' to
get_common_commits(), so that this function and the functions
it calls can use all the fields of that struct in followup
commits.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: use 'struct upload_pack_data' in upload_pack()
Christian Couder [Fri, 15 May 2020 10:04:45 +0000 (12:04 +0200)]
upload-pack: use 'struct upload_pack_data' in upload_pack()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's use 'struct upload_pack_data' in
upload_pack().

This will make it possible in followup commits to remove a lot
of static variables and local variables that have the same name
and purpose as fields in 'struct upload_pack_data'. This will
also make upload_pack() work in a more similar way as
upload_pack_v2().

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: move 'struct upload_pack_data' around
Christian Couder [Fri, 15 May 2020 10:04:44 +0000 (12:04 +0200)]
upload-pack: move 'struct upload_pack_data' around

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's move 'struct upload_pack_data' and the
related upload_pack_data_init() and upload_pack_data_clear()
functions towards the beginning of the file, so that this struct
and its related functions can then be used by upload_pack() in a
followup commit.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: move {want,have}_obj to upload_pack_data
Christian Couder [Fri, 15 May 2020 10:04:43 +0000 (12:04 +0200)]
upload-pack: move {want,have}_obj to upload_pack_data

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's move the want_obj and have_obj object
arrays into 'struct upload_pack_data'.

These object arrays are used by both upload_pack() and
upload_pack_v2(), for example when these functions call
create_pack_file(). We are going to use
'struct upload_pack_data' in upload_pack() in a followup
commit.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agoupload-pack: remove unused 'wants' from upload_pack_data
Christian Couder [Fri, 15 May 2020 10:04:42 +0000 (12:04 +0200)]
upload-pack: remove unused 'wants' from upload_pack_data

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's remove 'struct object_array wants' from
'struct upload_pack_data', as it appears to be unused.

Signed-off-by: Christian Couder <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agogit-bugreport.txt: adjust reference to strftime(3)
Todd Zullinger [Mon, 18 May 2020 19:37:36 +0000 (15:37 -0400)]
git-bugreport.txt: adjust reference to strftime(3)

The strftime(3) man page is outside of the Git suite.  Refererence it as
we do other external man pages and avoid creating a broken link when
generating the HTML documentation.

Signed-off-by: Todd Zullinger <redacted>
Signed-off-by: Junio C Hamano <redacted>
5 years agocommit-graph: drop COMMIT_GRAPH_WRITE_CHECK_OIDS flag
Taylor Blau [Wed, 13 May 2020 21:59:55 +0000 (15:59 -0600)]
commit-graph: drop COMMIT_GRAPH_WRITE_CHECK_OIDS flag

Since 7c5c9b9c57 (commit-graph: error out on invalid commit oids in
'write --stdin-commits', 2019-08-05), the commit-graph builtin dies on
receiving non-commit OIDs as input to '--stdin-commits'.

This behavior can be cumbersome to work around in, say, the case of
piping 'git for-each-ref' to 'git commit-graph write --stdin-commits' if
the caller does not want to cull out non-commits themselves. In this
situation, it would be ideal if 'git commit-graph write' wrote the graph
containing the inputs that did pertain to commits, and silently ignored
the remainder of the input.

Some options have been proposed to the effect of '--[no-]check-oids'
which would allow callers to have the commit-graph builtin do just that.
After some discussion, it is difficult to imagine a caller who wouldn't
want to pass '--no-check-oids', suggesting that we should get rid of the
behavior of complaining about non-commit inputs altogether.

If callers do wish to retain this behavior, they can easily work around
this change by doing the following:

     git for-each-ref --format='%(objectname) %(objecttype) %(*objecttype)' |
     awk '
       !/commit/ { print "not-a-commit:"$1 }
        /commit/ { print $1 }
     ' |
     git commit-graph write --stdin-commits

To make it so that valid OIDs that refer to non-existent objects are
indeed an error after loosening the error handling, perform an extra
lookup to make sure that object indeed exists before sending it to the
commit-graph internals.

Helped-by: Jeff King <redacted>
Signed-off-by: Taylor Blau <redacted>
Signed-off-by: Junio C Hamano <redacted>
git clone https://git.99rst.org/PROJECT