Commit graph

57204 commits

Author SHA1 Message Date
Johannes Schindelin 97fff61012 Move git_sort(), a stable sort, into into libgit.a
The `qsort()` function is not guaranteed to be stable, i.e. it does not
promise to maintain the order of items it is told to consider equal. In
contrast, the `git_sort()` function we carry in `compat/qsort.c` _is_
stable, by virtue of implementing a merge sort algorithm.

In preparation for using a stable sort in Git's rename detection, move
the stable sort into `libgit.a` so that it is compiled in
unconditionally, and rename it to `git_stable_qsort()`.

Note: this also makes the hack obsolete that was introduced in
fe21c6b285 (mingw: reencode environment variables on the fly (UTF-16
<-> UTF-8), 2018-10-30), where we included `compat/qsort.c` directly in
`compat/mingw.c` to use the stable sort.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-10-02 14:44:51 +09:00
Elijah Newren 69f272b922 dir: special case check for the possibility that pathspec is NULL
Commits 404ebceda0 ("dir: also check directories for matching
pathspecs", 2019-09-17) and 89a1f4aaf7 ("dir: if our pathspec might
match files under a dir, recurse into it", 2019-09-17) added calls to
match_pathspec() and do_match_pathspec() passing along their pathspec
parameter.  Both match_pathspec() and do_match_pathspec() assume the
pathspec argument they are given is non-NULL.  It turns out that
unpack-tree.c's verify_clean_subdirectory() calls read_directory() with
pathspec == NULL, and it is possible on case insensitive filesystems for
that NULL to make it to these new calls to match_pathspec() and
do_match_pathspec().  Add appropriate checks on the NULLness of pathspec
to avoid a segfault.

In case the negation throws anyone off (one of the calls was to
do_match_pathspec() while the other was to !match_pathspec(), yet no
negation of the NULLness of pathspec is used), there are two ways to
understand the differences:
  * The code already handled the pathspec == NULL cases before this
    series, and this series only tried to change behavior when there was
    a pathspec, thus we only want to go into the if-block if pathspec is
    non-NULL.
  * One of the calls is for whether to recurse into a subdirectory, the
    other is for after we've recursed into it for whether we want to
    remove the subdirectory itself (i.e. the subdirectory didn't match
    but something under it could have).  That difference in situation
    leads to the slight differences in logic used (well, that and the
    slightly unusual fact that we don't want empty pathspecs to remove
    untracked directories by default).

Denton found and analyzed one issue and provided the patch for the
match_pathspec() call, SZEDER figured out why the issue only reproduced
for some folks and not others and provided the testcase, and I looked
through the remainder of the series and noted the do_match_pathspec()
call that should have the same check.

Co-authored-by: Denton Liu <liu.denton@gmail.com>
Co-authored-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-10-02 12:06:58 +09:00
Junio C Hamano bc12974a89 Fourth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-30 13:30:46 +09:00
Junio C Hamano 5a5350940b Merge branch 'ds/commit-graph-on-fetch'
A configuration variable tells "git fetch" to write the commit
graph after finishing.

* ds/commit-graph-on-fetch:
  fetch: add fetch.writeCommitGraph config setting
2019-09-30 13:19:32 +09:00
Junio C Hamano 974bdb0205 Merge branch 'bw/rebase-autostash-keep-current-branch'
"git rebase --autostash <upstream> <branch>", when <branch> is
different from the current branch, incorrectly moved the tip of the
current branch, which has been corrected.

* bw/rebase-autostash-keep-current-branch:
  builtin/rebase.c: Remove pointless message
  builtin/rebase.c: make sure the active branch isn't moved when autostashing
2019-09-30 13:19:32 +09:00
Junio C Hamano 9755f70fe6 Merge branch 'ds/include-exclude'
The internal code originally invented for ".gitignore" processing
got reshuffled and renamed to make it less tied to "excluding" and
stress more that it is about "matching", as it has been reused for
things like sparse checkout specification that want to check if a
path is "included".

* ds/include-exclude:
  unpack-trees: rename 'is_excluded_from_list()'
  treewide: rename 'exclude' methods to 'pattern'
  treewide: rename 'EXCL_FLAG_' to 'PATTERN_FLAG_'
  treewide: rename 'struct exclude_list' to 'struct pattern_list'
  treewide: rename 'struct exclude' to 'struct path_pattern'
2019-09-30 13:19:32 +09:00
Junio C Hamano 93fc8760e7 Merge branch 'jh/trace2-pretty-output'
Output from trace2 subsystem is formatted more prettily now.

* jh/trace2-pretty-output:
  trace2: cleanup whitespace in perf format
  trace2: cleanup whitespace in normal format
  quote: add sq_append_quote_argv_pretty()
  trace2: trim trailing whitespace in normal format error message
  trace2: remove dead code in maybe_add_string_va()
  trace2: trim whitespace in region messages in perf target format
  trace2: cleanup column alignment in perf target format
2019-09-30 13:19:31 +09:00
Junio C Hamano 640f9cd599 Merge branch 'dl/rebase-i-keep-base'
"git rebase --keep-base <upstream>" tries to find the original base
of the topic being rebased and rebase on top of that same base,
which is useful when running the "git rebase -i" (and its limited
variant "git rebase -x").

The command also has learned to fast-forward in more cases where it
can instead of replaying to recreate identical commits.

* dl/rebase-i-keep-base:
  rebase: teach rebase --keep-base
  rebase tests: test linear branch topology
  rebase: fast-forward --fork-point in more cases
  rebase: fast-forward --onto in more cases
  rebase: refactor can_fast_forward into goto tower
  t3432: test for --no-ff's interaction with fast-forward
  t3432: distinguish "noop-same" v.s. "work-same" in "same head" tests
  t3432: test rebase fast-forward behavior
  t3431: add rebase --fork-point tests
2019-09-30 13:19:31 +09:00
Junio C Hamano 026428c35e Merge branch 'sg/clean-nested-repo-with-ignored'
A bug documentation.

* sg/clean-nested-repo-with-ignored:
  t7300-clean: demonstrate deleting nested repo with an ignored file breakage
2019-09-30 13:19:31 +09:00
Junio C Hamano 21db12c9ea Merge branch 'dl/complete-cherry-pick-revert-skip'
The command line completion support (in contrib/) learned about the
"--skip" option of "git revert" and "git cherry-pick".

* dl/complete-cherry-pick-revert-skip:
  status: mention --skip for revert and cherry-pick
  completion: add --skip for cherry-pick and revert
  completion: merge options for cherry-pick and revert
2019-09-30 13:19:30 +09:00
Junio C Hamano d693345518 Merge branch 'dl/use-sq-from-test-lib'
Code cleanup.

* dl/use-sq-from-test-lib:
  t: use common $SQ variable
2019-09-30 13:19:30 +09:00
Junio C Hamano d8ce144e11 Merge branch 'jk/misc-uninitialized-fixes'
Various fixes to codepaths gcc 9 had trouble following dataflow.

* jk/misc-uninitialized-fixes:
  pack-objects: drop packlist index_pos optimization
  test-read-cache: drop namelen variable
  diff-delta: set size out-parameter to 0 for NULL delta
  bulk-checkin: zero-initialize hashfile_checkpoint
  pack-objects: use object_id in packlist_alloc()
  git-am: handle missing "author" when parsing commit
2019-09-30 13:19:30 +09:00
Junio C Hamano 2be6ccc01a Merge branch 'sg/git-test-boolean'
Fix an earlier regression in the test suite, which mistakenly
stopped running HTTPD tests.

* sg/git-test-boolean:
  ci: restore running httpd tests
  t/lib-git-svn.sh: check GIT_TEST_SVN_HTTPD when running SVN HTTP tests
2019-09-30 13:19:29 +09:00
Junio C Hamano cf861cd7a0 Merge branch 'rs/get-tagged-oid'
Code cleanup.

* rs/get-tagged-oid:
  use get_tagged_oid()
  tag: factor out get_tagged_oid()
2019-09-30 13:19:29 +09:00
Junio C Hamano 91243b019d Merge branch 'en/filter-branch-deprecation'
Start discouraging the use of "git filter-branch".

* en/filter-branch-deprecation:
  t9902: use a non-deprecated command for testing
  Recommend git-filter-repo instead of git-filter-branch
  t6006: simplify, fix, and optimize empty message test
2019-09-30 13:19:29 +09:00
Junio C Hamano 9bc67b6658 Merge branch 'en/merge-options-ff-and-friends'
Doc update.

* en/merge-options-ff-and-friends:
  merge-options.txt: clarify meaning of various ff-related options
2019-09-30 13:19:28 +09:00
Junio C Hamano fe048e4fd9 Merge branch 'tg/push-all-in-mirror-forbidden'
Fix an earlier regression to "git push --all" which should have
been forbidden when the target remote repository is set to be a
mirror.

* tg/push-all-in-mirror-forbidden:
  push: disallow --all and refspecs when remote.<name>.mirror is set
2019-09-30 13:19:28 +09:00
Junio C Hamano cab037cd4b Merge branch 'dt/remote-helper-doc-re-lock-option'
Doc update.

* dt/remote-helper-doc-re-lock-option:
  clarify documentation for remote helpers
2019-09-30 13:19:28 +09:00
Junio C Hamano 8e111e487b Merge branch 'rs/help-unknown-ref-does-not-return'
Code cleanup.

* rs/help-unknown-ref-does-not-return:
  help: make help_unknown_ref() NORETURN
2019-09-30 13:19:27 +09:00
Junio C Hamano 3ff6af7753 Merge branch 'nd/switch-and-restore'
Resurrect a performance hack.

* nd/switch-and-restore:
  checkout: add simple check for 'git checkout -b'
2019-09-30 13:19:27 +09:00
Junio C Hamano aadac067aa Merge branch 'tb/file-url-to-unc-path'
Windows update.

* tb/file-url-to-unc-path:
  mingw: support UNC in git clone file://server/share/repo
2019-09-30 13:19:27 +09:00
Junio C Hamano b57a88a5f1 Merge branch 'js/gitdir-at-unc-root'
On Windows, the root level of UNC share is now allowed to be used
just like any other directory.

* js/gitdir-at-unc-root:
  setup_git_directory(): handle UNC root paths correctly
  Fix .git/ discovery at the root of UNC shares
  setup_git_directory(): handle UNC paths correctly
2019-09-30 13:19:26 +09:00
Junio C Hamano 6f21347f11 Merge branch 'ar/mingw-run-external-with-non-ascii-path'
Windows update.

* ar/mingw-run-external-with-non-ascii-path:
  mingw: fix launching of externals from Unicode paths
2019-09-30 13:19:26 +09:00
Junio C Hamano 430439536b Merge branch 'rs/parse-tree-indirect'
Code cleanup.

* rs/parse-tree-indirect:
  tree: simplify parse_tree_indirect()
2019-09-30 13:19:26 +09:00
Junio C Hamano 991fd97b9a Merge branch 'jk/fast-import-history-bugfix'
The memory ownership model of the "git fast-import" got
straightened out.

* jk/fast-import-history-bugfix:
  fast-import: duplicate into history rather than passing ownership
  fast-import: duplicate parsed encoding string
2019-09-30 13:19:26 +09:00
Junio C Hamano 74a39b9bcc Merge branch 'mh/notes-duplicate-entries'
A few implementation fixes in the notes API.

* mh/notes-duplicate-entries:
  notes: avoid potential use-after-free during insertion
  notes: avoid leaking duplicate entries
2019-09-30 13:19:25 +09:00
Junio C Hamano 37801f0665 Merge branch 'tb/banned-vsprintf-namefix'
Error message fix.

* tb/banned-vsprintf-namefix:
  banned.h: fix vsprintf()'s ban message
2019-09-30 13:19:25 +09:00
Junio C Hamano 21ce0b48f3 Merge branch 'mh/release-commit-memory-fix'
Leakfix.

* mh/release-commit-memory-fix:
  commit: free the right buffer in release_commit_memory
2019-09-30 13:19:25 +09:00
Junio C Hamano f0fcab6deb Merge branch 'mh/http-urlmatch-cleanup'
Leakfix.

* mh/http-urlmatch-cleanup:
  http: don't leak urlmatch_config.vars
2019-09-30 13:19:24 +09:00
Junio C Hamano bf6136cab8 Merge branch 'rs/strbuf-detach'
Straighten out the use of strbuf_detach() API function.

* rs/strbuf-detach:
  grep: use return value of strbuf_detach()
  log-tree: always use return value of strbuf_detach()
2019-09-30 13:19:24 +09:00
Junio C Hamano a2e22bb3ad Merge branch 'rs/trace2-dst-warning'
Code cleanup.

* rs/trace2-dst-warning:
  trace2: use warning() directly in tr2_dst_malformed_warning()
2019-09-30 13:19:24 +09:00
Junio C Hamano 1c6fc941c7 Merge branch 'dl/format-patch-doc-test-cleanup'
The documentation and tests for "git format-patch" have been
cleaned up.

* dl/format-patch-doc-test-cleanup:
  config/format.txt: specify default value of format.coverLetter
  Doc: add more detail for git-format-patch
  t4014: stop losing return codes of git commands
  t4014: remove confusing pipe in check_threading()
  t4014: use test_line_count() where possible
  t4014: let sed open its own files
  t4014: drop redirections to /dev/null
  t4014: use indentable here-docs
  t4014: remove spaces after redirect operators
  t4014: use sq for test case names
  t4014: move closing sq onto its own line
  t4014: s/expected/expect/
  t4014: drop unnecessary blank lines from test cases
2019-09-30 13:19:24 +09:00
Junio C Hamano 0281733483 Merge branch 'bc/hash-independent-tests-part-5'
Preparation for SHA-256 upgrade continues in the test department.

* bc/hash-independent-tests-part-5:
  t4009: make hash size independent
  t4002: make hash independent
  t4000: make hash size independent
  t3903: abstract away SHA-1-specific constants
  t3800: make hash-size independent
  t3600: make hash size independent
  t3506: make hash independent
  t3430: avoid hard-coded object IDs
  t3404: abstract away SHA-1-specific constants
  t3306: abstract away SHA-1-specific constants
  t3305: make hash size independent
  t3301: abstract away SHA-1-specific constants
  t3206: abstract away hash size constants
  t3201: abstract away SHA-1-specific constants
2019-09-30 13:19:23 +09:00
Junio C Hamano f06fb376ed Merge branch 'jc/test-cleanup'
Code cleanup.

* jc/test-cleanup:
  t3005: remove unused variable
  t: use LF variable defined in the test harness
2019-09-30 13:19:23 +09:00
Junio C Hamano 00bb74453d Merge branch 'dl/compat-cleanup'
Code cleanup.

* dl/compat-cleanup:
  compat/*.[ch]: remove extern from function declarations using spatch
  mingw: apply array.cocci rule
2019-09-30 13:19:23 +09:00
Junio C Hamano 59438be06c Merge branch 'js/visual-studio'
Adjust .gitignore to unignore a path that we started to track.

* js/visual-studio:
  .gitignore: stop ignoring `.manifest` files
2019-09-30 13:19:22 +09:00
Bert Wesarg cda0d497e3 builtin/submodule--helper: fix usage string for 'update-clone'
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-29 07:33:57 +09:00
Elijah Newren af2abd870b fast-export: fix exporting a tag and nothing else
fast-export allows specifying revision ranges, which can be used to
export a tag without exporting the commit it tags.  fast-export handled
this rather poorly: it would emit a "from :0" directive.  Since marks
start at 1 and increase, this means it refers to an unknown commit and
fast-import will choke on the input.

When we are unable to look up a mark for the object being tagged, use a
"from $HASH" directive instead to fix this problem.

Note that this is quite similar to the behavior fast-export exhibits
with commits and parents when --reference-excluded-parents is passed
along with an excluded commit range.  For tags of excluded commits we do
not require the --reference-excluded-parents flag because we always have
to tag something.  By contrast, when dealing with commits, pruning a
parent is always a viable option, so we need the flag to specify that
parent pruning is not wanted.  (It is slightly weird that
--reference-excluded-parents isn't the default with a separate
--prune-excluded-parents flag, but backward compatibility concerns
resulted in the current defaults.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 18:54:40 +09:00
Martin Ågren c4d2f6143a user-manual.txt: render ASCII art correctly under Asciidoctor
This commit is similar to 379805051d ("Documentation: render revisions
correctly under Asciidoctor", 2018-05-06) and is a no-op with AsciiDoc.

When creating a literal block from an indented block without any sort of
delimiters, Asciidoctor strips off all leading whitespace, resulting in
a misrendered ASCII drawing. Use an explicit literal block to indicate
to Asciidoctor that we want to keep the leading whitespace. Drop the
common indentation for all lines to make this a no-op with AsciiDoc.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 17:39:34 +09:00
Martin Ågren dba3734103 asciidoctor-extensions.rb: handle "book" doctype in linkgit
user-manual.txt is the only file we process using the "book" doctype.
When we use AsciiDoc, user-manual.conf ensures that the linkgit macro
expands into something like

  <ulink url="git-foo.html">git-foo(1)</ulink>

in user-manual.xml, which we then process into a clickable link, both in
user-manual.html and user-manual.pdf. With Asciidoctor,
user-manual.conf is ignored (this is expected) and our
Asciidoctor-specific implementation of linkgit kicks in:

  <citerefentry>
    <refentrytitle>git-foo</refentrytitle><manvolnum>1</manvolnum>
  </citerefentry>

This eventually renders as "git-foo(1)", which is not bad, but it
doesn't turn into a link.

Teach our Asciidoctor-specific implementation of the linkgit macro that
if the doctype is "book", we should emit <ulink .../> just like we do
with AsciiDoc. While we're doing this, future-proof by supporting a
"prefix". The implementation in user-manual.conf doesn't support this,
and we don't need this for now because user-manual.txt is the only file
we process this way (and it's immediately in Documentation/).

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 17:37:56 +09:00
Martin Ågren fd5b820d9c user-manual.txt: change header notation
When AsciiDoc processes user-manual.txt, it generates a book containing
chapters containing sections. So for example, we have chapter 6,
"Advanced branch management", which contains four relatively short
sections, 6.1-6.4. Asciidoctor generates a book containing *parts*
containing *chapters* instead. So part 6, "Advanced branch management"
contains four short chapters, 1-4. This looks a bit odd.

To make AsciiDoc (8.6.10) and Asciidoctor (1.5.5) handle these the same,
change from indicating chapters like so:

  [[foobar]]
  Foobar
  ======

to doing it like so:

  [[foobar]]
  == Foobar

Same thing for sections (line of dashes to ===), subsections (line of
tildes to ====) and subsubsections (line of carets to =====). Mark the
appendices with "[appendix]", which both AsciiDoc and Asciidoctor
understand. This means we need to drop the "Appendix X: " from their
titles, or those "Appendix X: " would be included literally in the name
of the appendix.

This commit is a no-op for AsciiDoc: The generated user-manual.xml is
identical before and after this patch. Asciidoctor now creates the same
chapter-section-subsection structure as AsciiDoc.

Changing the book title at the start of the document to similarly use
"=" instead of a line of equal signs makes no difference with any of the
engines, but let's do that change anyway for consistency.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 17:35:46 +09:00
Martin Ågren e79b34533a user-manual.txt: add missing section label
We provide a label for each chapter and section except for the "Pitfalls
with submodules" section. Since we're doing it everywhere else, let's do
it here, too.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 17:35:44 +09:00
Denton Liu b503a2d515 Makefile: emulate compile in $(HCO) target better
Currently, when testing headers using `make hdr-check`, headers are
directly compiled. Although this seems to test the headers, this is too
strict since we treat the headers as C sources. As a result, this will
cause warnings to appear that would otherwise not, such as a static
variable definition intended for later use throwing a unused variable
warning.

In addition, on platforms that can run `make hdr-check` but require
custom flags, this target was failing because none of them were being
passed to the compiler. For example, on MacOS, the NO_OPENSSL flag was
being set but it was not being passed into compiler so the check was
failing.

Fix these problems by emulating the compile process better, including
test compiling dummy *.hcc C sources generated from the *.h files and
passing $(ALL_CFLAGS) into the compiler for the $(HCO) target so that
these custom flags can be used.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 14:04:22 +09:00
Denton Liu af26e2a9d2 pack-bitmap.h: remove magic number
When we ran `make hdr-check` with the following patch

	diff --git a/Makefile b/Makefile
	index f879697ea3..d8df4e316b 100644
	--- a/Makefile
	+++ b/Makefile
	@@ -2773,7 +2773,7 @@ CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
	HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))

	$(HCO): %.hco: %.h FORCE
	-	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
	+	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $(ALL_CFLAGS) $<

	.PHONY: hdr-check $(HCO)
	hdr-check: $(HCO)

and with `DEVELOPER=1`, we got the following warning on Arch Linux:

	pack-bitmap.h:20:19: error: ‘BITMAP_IDX_SIGNATURE’ defined but not used [-Werror=unused-const-variable=]
	   20 | static const char BITMAP_IDX_SIGNATURE[] = {'B', 'I', 'T', 'M'};
	      |                   ^~~~~~~~~~~~~~~~~~~~
	cc1: all warnings being treated as errors

"Use" the BITMAP_IDX_SIGNATURE variable by making the size of
bitmap_disk_header.magic equal to the size of BITMAP_IDX_SIGNATURE,
thereby eliminating the magic number (4).

An alternative was to simply add MAYBE_UNUSED, however that does not
eliminate the magic number.

Another alternative was to change the definition to

	extern const char BITMAP_IDX_SIGNATURE[4];

However, this design was also not chosen as the static definition allows
us to keep the declaration together for readability along with removing
the magic number.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 14:04:20 +09:00
Denton Liu b06fdead04 promisor-remote.h: include missing header
When we ran `make hdr-check`, we got the following warning message:

	promisor-remote.h:21:46: warning: declaration of 'struct repository' will not be visible outside of this function [-Wvisibility]
	extern int promisor_remote_get_direct(struct repository *repo,
						     ^
	1 warning generated.

This was caused by a missing reference to `struct repository`, which is
defined in "repository.h".

Include this missing header to fix this warning.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 14:04:19 +09:00
Denton Liu 97b989ee3a apply.h: include missing header
When running `make hdr-check`, we got the following error messages:

	apply.h:146:22: error: use of undeclared identifier 'GIT_MAX_HEXSZ'
		char old_oid_prefix[GIT_MAX_HEXSZ + 1];
				    ^
	apply.h:147:22: error: use of undeclared identifier 'GIT_MAX_HEXSZ'
		char new_oid_prefix[GIT_MAX_HEXSZ + 1];
				    ^
	apply.h:151:33: error: array has incomplete element type 'struct object_id'
		struct object_id threeway_stage[3];
					       ^
	./strbuf.h:79:8: note: forward declaration of 'struct object_id'
	struct object_id;
	       ^
	3 errors generated.
	make: *** [apply.hco] Error 1

Include the missing "hash.h" header to fix these errors.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 14:04:16 +09:00
Tobias Klauser 4ddd4bddb1 git-svn: trim leading and trailing whitespaces in author name
In some cases, the svn author names might contain leading or trailing
whitespaces, leading to messages such as:

  Author: user1
   not defined in authors.txt

(the trailing newline leads to the line break). The user "user1" is
defined in authors.txt though, e.g.

  user1 = User <user1@example.com>

Fix this by trimming the author name retreived from svn before using it
in check_author.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 13:51:42 +09:00
Alexandr Miloslavskiy d928a8388a t0028: add more tests
After I discovered that UTF-16-LE-BOM test was buggy, I decided that
better tests are required. Possibly the best option here is to compare
git results against hardcoded ground truth.

The new tests also cover more interesting chars where (ANSI != UTF-8).

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Reviewed-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 13:49:58 +09:00
Alexandr Miloslavskiy 0b63fd6965 t0028: fix test for UTF-16-LE-BOM
According to its name, the test is designed for UTF-16-LE-BOM.
However, possibly due to copy&paste oversight, it was using UTF-32.

While the test succeeds (extra \000\000 are interpreted as NUL),
I myself had an unrelated problem which caused the test to fail.
When analyzing the failure I was quite puzzled by the fact that the
test is obviously buggy.  And it seems that I'm not alone:
https://public-inbox.org/git/CAH8yC8kSakS807d4jc_BtcUJOrcVT4No37AXSz=jePxhw-o9Dg@mail.gmail.com/T/#u

Fix the test to follow its original intention.

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Reviewed-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 13:49:47 +09:00
Alexandr Miloslavskiy fe0ed5d5e9 contrib/buildsystems: fix Visual Studio Debug configuration
Even though Debug configuration builds, the resulting build is incorrect
in a subtle way: it mixes up Debug and Release binaries, which in turn
causes hard-to-predict bugs.

In my case, when git calls iconv library, iconv sets 'errno' and git
then tests it, but in Debug and Release CRT those 'errno' are different
memory locations.

This patch addresses 3 connected bugs:
1) Typo in '\(Configuration)'. As a result, Debug configuration
   condition is always false and Release path is taken instead.
2) Regexp that replaced 'zlib.lib' with 'zlibd.lib' was only affecting
   the first occurrence. However, some projects have it listed twice.
   Previously this bug was hidden, because Debug path was never taken.
   I decided that avoiding double -lz in makefile is fragile and I'd
   better replace all occurrences instead.
3) In Debug, 'libcurl-d.lib' should be used instead of 'libcurl.lib'.
   Previously this bug was hidden, because Debug path was never taken.

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-28 13:43:36 +09:00