summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-01-08sha1-file: prefer "loose object file" to "sha1 file" in messagesLibravatar Jeff King1-3/+3
When we're reporting an error for a loose object, let's use that term. It's more consistent with other parts of Git, and it is future-proof against changes to the hash function. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08sha1-file: drop has_sha1_file()Libravatar Jeff King3-54/+6
There are no callers left of has_sha1_file() or its with_flags() variant. Let's drop them, and convert has_object_file() from a wrapper into the "real" function. Ironically, the sha1 variant was just copying into an object_id internally, so the resulting code is actually shorter! We can also drop the coccinelle rules for catching has_sha1_file() callers. Since the function no longer exists, the compiler will do that for us. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08convert has_sha1_file() callers to has_object_file()Libravatar Jeff King12-16/+47
The only remaining callers of has_sha1_file() actually have an object_id already. They can use the "object" variant, rather than dereferencing the hash themselves. The code changes here were completely generated by the included coccinelle patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08sha1-file: convert pass-through functions to object_idLibravatar Jeff King1-13/+7
These two static functions, read_object() and quick_has_loose(), both have to hashcpy() their bare-sha1 arguments into object_id structs to pass them along. Since all of their callers actually have object_id structs in the first place, we can eliminate the copying by adjusting their input parameters. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08sha1-file: modernize loose header/stream functionsLibravatar Jeff King3-49/+51
As with the open/map/close functions for loose objects that were recently converted, the functions for parsing the loose object stream use the name "sha1" and a bare "unsigned char *". Let's fix that so that unpack_sha1_header() becomes unpack_loose_header(), etc. These conversions are less clear-cut than the file access functions. You could argue that the they are parsing Git's canonical object format (i.e., "type size\0contents", over which we compute the hash), which is not strictly tied to loose storage. But in practice these functions are used only for loose objects, and using the term "loose_header" (instead of "object_header") distinguishes it from the object header found in packfiles (which contains the same information in a different format). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08sha1-file: modernize loose object file functionsLibravatar Jeff King5-48/+51
The loose object access code in sha1-file.c is some of the oldest in Git, and could use some modernizing. It mostly uses "unsigned char *" for object ids, which these days should be "struct object_id". It also uses the term "sha1_file" in many functions, which is confusing. The term "loose_objects" is much better. It clearly distinguishes them from packed objects (which didn't even exist back when the name "sha1_file" came into being). And it also distinguishes it from the checksummed-file concept in csum-file.c (which until recently was actually called "struct sha1file"!). This patch converts the functions {open,close,map,stat}_sha1_file() into open_loose_object(), etc, and switches their sha1 arguments for object_id structs. Similarly, path functions like fill_sha1_path() become fill_loose_path() and use object_ids. The function sha1_loose_object_info() already says "loose", so we can just drop the "sha1" (and teach it to use object_id). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08http: use struct object_id instead of bare sha1Libravatar Jeff King4-14/+14
The dumb-http walker code still passes around and stores object ids as "unsigned char *sha1". Let's modernize it. There's probably still more work to be done to handle dumb-http fetches with a new, larger hash. But that can wait; this is enough that we can now convert some of the low-level object routines that we call into from here (and in fact, some of the "oid.hash" references added here will be further improved in the next patch). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08update comment references to sha1_object_info()Libravatar Jeff King3-6/+6
Commit abef9020e3 (sha1_file: convert sha1_object_info* to object_id, 2018-03-12) renamed the function to oid_object_info(), but missed some comments which mention it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08sha1-file: fix outdated sha1 comment referencesLibravatar Jeff King1-3/+3
Commit 17e65451e3 (sha1_file: convert check_sha1_signature to struct object_id, 2018-03-12) switched to using the name "oid", but forgot to update the variable name in the comment. Likewise, b4f5aca40e (sha1_file: convert read_sha1_file to struct object_id, 2018-03-12) dropped the name read_sha1_file(), but missed a comment which mentions it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08object-store: retire odb_load_loose_cache()Libravatar René Scharfe2-14/+2
Inline odb_load_loose_cache() into its only remaining caller, odb_loose_cache(). The latter offers a nicer interface for loading the cache, as it doesn't require callers to deal with fanout directory numbers directly. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08object-store: use one oid_array per subdirectory for loose cacheLibravatar René Scharfe2-4/+7
The loose objects cache is filled one subdirectory at a time as needed. It is stored in an oid_array, which has to be resorted after each add operation. So when querying a wide range of objects, the partially filled array needs to be resorted up to 255 times, which takes over 100 times longer than sorting once. Use one oid_array for each subdirectory. This ensures that entries have to only be sorted a single time. It also avoids eight binary search steps for each cache lookup as a small bonus. The cache is used for collision checks for the log placeholders %h, %t and %p, and we can see the change speeding them up in a repository with ca. 100 objects per subdirectory: $ git count-objects 26733 objects, 68808 kilobytes Test HEAD^ HEAD -------------------------------------------------------------------- 4205.1: log with %H 0.51(0.47+0.04) 0.51(0.49+0.02) +0.0% 4205.2: log with %h 0.84(0.82+0.02) 0.60(0.57+0.03) -28.6% 4205.3: log with %T 0.53(0.49+0.04) 0.52(0.48+0.03) -1.9% 4205.4: log with %t 0.84(0.80+0.04) 0.60(0.59+0.01) -28.6% 4205.5: log with %P 0.52(0.48+0.03) 0.51(0.50+0.01) -1.9% 4205.6: log with %p 0.85(0.78+0.06) 0.61(0.56+0.05) -28.2% 4205.7: log with %h-%h-%h 0.96(0.92+0.03) 0.69(0.64+0.04) -28.1% Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08object-store: factor out odb_clear_loose_cache()Libravatar René Scharfe4-6/+13
Add and use a function for emptying the loose object cache, so callers don't have to know any of its implementation details. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-08object-store: factor out odb_loose_cache()Libravatar René Scharfe3-8/+21
Add and use a function for loading the entries of a loose object subdirectory for a given object ID. It frees callers from deriving the fanout key; they can use the returned oid_array reference for lookups or forward range scans. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-04First batch after 2.20.1Libravatar Junio C Hamano1-0/+44
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-04Merge branch 'mk/http-backend-kill-children-before-exit'Libravatar Junio C Hamano1-0/+2
The http-backend CGI process did not correctly clean up the child processes it spawns to run upload-pack etc. when it dies itself, which has been corrected. * mk/http-backend-kill-children-before-exit: http-backend: enable cleaning up forked upload/receive-pack on exit
2019-01-04Merge branch 'sd/stash-wo-user-name'Libravatar Junio C Hamano2-0/+45
A properly configured username/email is required under user.useConfigOnly in order to create commits; now "git stash" (even though it creates commit objects to represent stash entries) command is exempt from the requirement. * sd/stash-wo-user-name: stash: tolerate missing user identity
2019-01-04Merge branch 'sg/clone-initial-fetch-configuration'Libravatar Junio C Hamano3-14/+72
Refspecs configured with "git -c var=val clone" did not propagate to the resulting repository, which has been corrected. * sg/clone-initial-fetch-configuration: Documentation/clone: document ignored configuration variables clone: respect additional configured fetch refspecs during initial fetch clone: use a more appropriate variable name for the default refspec
2019-01-04Merge branch 'nd/checkout-dwim-fix'Libravatar Junio C Hamano4-6/+50
"git checkout frotz" (without any double-dash) avoids ambiguity by making sure 'frotz' cannot be interpreted as a revision and as a path at the same time. This safety has been updated to check also a unique remote-tracking branch 'frotz' in a remote, when dwimming to create a local branch 'frotz' out of a remote-tracking branch 'frotz' from a remote. * nd/checkout-dwim-fix: checkout: disambiguate dwim tracking branches and local files
2019-01-04Merge branch 'ab/push-dwim-dst'Libravatar Junio C Hamano6-13/+156
"git push $there $src:$dst" rejects when $dst is not a fully qualified refname and not clear what the end user meant. The codepath has been taught to give a clearer error message, and also guess where the push should go by taking the type of the pushed object into account (e.g. a tag object would want to go under refs/tags/). * ab/push-dwim-dst: push doc: document the DWYM behavior pushing to unqualified <dst> push: test that <src> doesn't DWYM if <dst> is unqualified push: add an advice on unqualified <dst> push push: move unqualified refname error into a function push: improve the error shown on unqualified <dst> push i18n: remote.c: mark error(...) messages for translation remote.c: add braces in anticipation of a follow-up change
2019-01-04Merge branch 'en/fast-export-import'Libravatar Junio C Hamano5-214/+268
Small fixes and features for fast-export and fast-import, mostly on the fast-export side. * en/fast-export-import: fast-export: add a --show-original-ids option to show original names fast-import: remove unmaintained duplicate documentation fast-export: add --reference-excluded-parents option fast-export: ensure we export requested refs fast-export: when using paths, avoid corrupt stream with non-existent mark fast-export: move commit rewriting logic into a function for reuse fast-export: avoid dying when filtering by paths and old tags exist fast-export: use value from correct enum git-fast-export.txt: clarify misleading documentation about rev-list args git-fast-import.txt: fix documentation for --quiet option fast-export: convert sha1 to oid
2019-01-04Merge branch 'nd/the-index'Libravatar Junio C Hamano66-491/+652
More codepaths become aware of working with in-core repository instance other than the default "the_repository". * nd/the-index: (22 commits) rebase-interactive.c: remove the_repository references rerere.c: remove the_repository references pack-*.c: remove the_repository references pack-check.c: remove the_repository references notes-cache.c: remove the_repository references line-log.c: remove the_repository reference diff-lib.c: remove the_repository references delta-islands.c: remove the_repository references cache-tree.c: remove the_repository references bundle.c: remove the_repository references branch.c: remove the_repository reference bisect.c: remove the_repository reference blame.c: remove implicit dependency the_repository sequencer.c: remove implicit dependency on the_repository sequencer.c: remove implicit dependency on the_index transport.c: remove implicit dependency on the_index notes-merge.c: remove implicit dependency the_repository notes-merge.c: remove implicit dependency on the_index list-objects.c: reduce the_repository references list-objects-filter.c: remove implicit dependency on the_index ...
2019-01-04Merge branch 'jk/loose-object-cache'Libravatar Junio C Hamano18-274/+211
Code clean-up with optimization for the codepath that checks (non-)existence of loose objects. * jk/loose-object-cache: odb_load_loose_cache: fix strbuf leak fetch-pack: drop custom loose object cache sha1-file: use loose object cache for quick existence check object-store: provide helpers for loose_objects_cache sha1-file: use an object_directory for the main object dir handle alternates paths the same as the main object dir sha1_file_name(): overwrite buffer instead of appending rename "alternate_object_database" to "object_directory" submodule--helper: prefer strip_suffix() to ends_with() fsck: do not reuse child_process structs
2019-01-04Merge branch 'fc/http-version'Libravatar Junio C Hamano2-0/+48
The "http.version" configuration variable can be used with recent enough cURL library to force the version of HTTP used to talk when fetching and pushing. * fc/http-version: http: add support selecting http version
2019-01-04Merge branch 'en/merge-path-collision'Libravatar Junio C Hamano6-292/+1149
Updates for corner cases in merge-recursive. * en/merge-path-collision: t6036: avoid non-portable "cp -a" merge-recursive: combine error handling t6036, t6043: increase code coverage for file collision handling merge-recursive: improve rename/rename(1to2)/add[/add] handling merge-recursive: use handle_file_collision for add/add conflicts merge-recursive: improve handling for rename/rename(2to1) conflicts merge-recursive: fix rename/add conflict handling merge-recursive: new function for better colliding conflict resolutions merge-recursive: increase marker length with depth of recursion t6036, t6042: testcases for rename collision of already conflicting files t6042: add tests for consistency in file collision conflict handling
2019-01-04Merge branch 'nd/i18n'Libravatar Junio C Hamano23-266/+303
More _("i18n") markings. * nd/i18n: fsck: mark strings for translation fsck: reduce word legos to help i18n parse-options.c: mark more strings for translation parse-options.c: turn some die() to BUG() parse-options: replace opterror() with optname() repack: mark more strings for translation remote.c: mark messages for translation remote.c: turn some error() or die() to BUG() reflog: mark strings for translation read-cache.c: add missing colon separators read-cache.c: mark more strings for translation read-cache.c: turn die("internal error") to BUG() attr.c: mark more string for translation archive.c: mark more strings for translation alias.c: mark split_cmdline_strerror() strings for translation git.c: mark more strings for translation
2018-12-15Sync with Git 2.20.1Libravatar Junio C Hamano13-7/+51
* maint: Git 2.20.1 .gitattributes: ensure t/oid-info/* has eol=lf t9902: 'send-email' test case requires PERL t4256: mark support files as LF-only parse-options: fix SunCC compiler warning help -a: handle aliases with long names gracefully help.h: fix coding style run-command: report exec failure
2018-12-15Prepare for 2.21 cycle to start soonishLibravatar Junio C Hamano3-2/+24
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-15Git 2.20.1Libravatar Junio C Hamano3-2/+22
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-15Merge branch 'jc/run-command-report-exec-failure-fix' into maintLibravatar Junio C Hamano2-3/+8
A recent update accidentally squelched an error message when the run_command API failed to run a missing command, which has been corrected. * jc/run-command-report-exec-failure-fix: run-command: report exec failure
2018-12-15Merge branch 'js/help-commands-verbose-by-default-fix' into maintLibravatar Junio C Hamano2-2/+10
"git help -a" did not work well when an overly long alias is defined, which has been corrected. * js/help-commands-verbose-by-default-fix: help -a: handle aliases with long names gracefully help.h: fix coding style
2018-12-15Merge branch 'nd/show-gitcomp-compilation-fix' into maintLibravatar Junio C Hamano5-1/+10
Portability fix for a recent update to parse-options API. * nd/show-gitcomp-compilation-fix: parse-options: fix SunCC compiler warning
2018-12-15Merge branch 'js/t9902-send-email-completion-fix' into maintLibravatar Junio C Hamano1-1/+1
* js/t9902-send-email-completion-fix: t9902: 'send-email' test case requires PERL
2018-12-15Merge branch 'js/mailinfo-format-flowed-fix' into maintLibravatar Junio C Hamano1-0/+1
Test portability fix. * js/mailinfo-format-flowed-fix: t4256: mark support files as LF-only
2018-12-15Merge branch 'ds/hash-independent-tests-fix' into maintLibravatar Junio C Hamano1-0/+1
Test portability fix. * ds/hash-independent-tests-fix: .gitattributes: ensure t/oid-info/* has eol=lf
2018-12-14.gitattributes: ensure t/oid-info/* has eol=lfLibravatar Derrick Stolee1-0/+1
The new test_oid machinery in the test library requires reading some information from t/oid-info/hash-info and t/oid-info/oid. The logic to read from these files in shell uses built-in "read" command, which leaves CR at the end of these text files when they are checked out with CRLF line endings, at least when run with bash shipped with Git for Windows. This results in an unexpected value in the variable these lines are read into, leading the tests to fail. Mark them to be checked out always with the LF line endings. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-14t9902: 'send-email' test case requires PERLLibravatar Johannes Schindelin1-1/+1
The oneline notwithstanding, 13374987dd (completion: use _gitcompbuiltin for format-patch, 2018-11-03) changed also the way send-email options are completed, by asking the git send-email command itself what options it offers. Necessarily, this must fail when built with NO_PERL because send-email itself is a Perl script. Which means that we need the PERL prerequisite for the send-email test case in t9902. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-13t4256: mark support files as LF-onlyLibravatar Johannes Schindelin1-0/+1
The test t4256-am-format-flowed.sh requires carefully applying a patch after ignoring padding whitespace. This breaks if the file is munged to include CRLF line endings instead of LF. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-12parse-options: fix SunCC compiler warningLibravatar Nguyễn Thái Ngọc Duy5-1/+10
The compiler reports this because show_gitcomp() never actually returns a value: "parse-options.c", line 520: warning: Function has no return statement : show_gitcomp We could shut the compiler up. But instead let's not bury exit() too deep. Do the same as internal -h handling, return a special error code and handle the exit() in parse_options() (and other parse_options_step() callers) instead. Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-12help -a: handle aliases with long names gracefullyLibravatar Johannes Schindelin1-1/+9
We take pains to determine the longest command beforehand, so that we can align the category column after printing the command names. However, then we re-use that value when printing the aliases. If any alias name is longer than the longest command name, we consequently try to add a negative number of spaces (but `mput_char()` does not expect any negative values and simply decrements until the value is 0, i.e. it tries to add close to 2**31 spaces). Let's fix this by adjusting the `longest` variable before printing the aliases. This fixes https://github.com/git-for-windows/git/issues/1975. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-12help.h: fix coding styleLibravatar Johannes Schindelin1-1/+1
We want a space after the `while` keyword. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-12run-command: report exec failureLibravatar Junio C Hamano2-3/+8
In 321fd823 ("run-command: mark path lookup errors with ENOENT", 2018-10-24), we rewrote the logic to execute a command by looking in the directories on $PATH; as a side effect, a request to run a command that is not found on $PATH is noticed even before a child process is forked to execute it. We however stopped to report an exec failure in such a case by mistake. Add a logic to report the error unless silent-exec-failure is requested, to match the original code. Reported-by: John Passaro <john.a.passaro@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-09Git 2.20Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-09Merge tag 'l10n-2.20.0-rnd3' of https://github.com/git-l10n/git-poLibravatar Junio C Hamano9-28687/+44486
l10n-2.20.0-rnd3 * tag 'l10n-2.20.0-rnd3' of https://github.com/git-l10n/git-po: (22 commits) l10n: de.po: fix two messages l10n: zh_CN: for git v2.20.0 l10n round 1 to 3 l10n: update German translation l10n: bg.po: Updated Bulgarian translation (4187t) l10n: sv.po: Update Swedish translation (4187t0f0u) l10n: fr.po v2.20.0 round 3 l10n: vi(4187t): Updated Vietnamese translation for v2.20.0 rd3 l10n: es.po v2.20.0 round 3 l10n: git.pot: v2.20.0 round 3 (5 new, 3 removed) l10n: vi(4185t): Updated Vietnamese translation for v2.20.0 l10n: es.po v2.20.0 round 1 l10n: bg.po: Updated Bulgarian translation (4185t) l10n: git.pot: v2.20.0 round 2 (2 new, 2 removed) l10n: bg.po: Updated Bulgarian translation (4185t) l10n: sv.po: Update Swedish translation (4185t0f0u) l10n: fr.po v2.20 rnd 1 l10n: Update Catalan translation l10n: git.pot: v2.20.0 round 1 (254 new, 27 removed) l10n: Update Catalan translation l10n: vi.po: fix typo in pack-objects ...
2018-12-07l10n: de.po: fix two messagesLibravatar Ralf Thielow1-2/+2
Reported-by: Phillip Szelat <phillip.szelat@gmail.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2018-12-06l10n: zh_CN: for git v2.20.0 l10n round 1 to 3Libravatar Jiang Xin1-3139/+4169
Translate 257 new messages (4187t0f0u) for git 2.20.0. Reviewed-by: Zhou Fangyi <fangyi.zhou@yuriko.moe> Reviewed-by: 依云 <lilydjwg@gmail.com> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2018-12-06l10n: update German translationLibravatar Ralf Thielow1-3106/+4332
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2018-12-04Merge branch 'es/format-patch-range-diff-fix-fix'Libravatar Junio C Hamano3-9/+33
* es/format-patch-range-diff-fix-fix: range-diff: always pass at least minimal diff options
2018-12-04Merge branch 'en/rebase-consistency'Libravatar Junio C Hamano1-13/+17
* en/rebase-consistency: rebase docs: fix incorrect format of the section Behavioral Differences
2018-12-04rebase docs: fix incorrect format of the section Behavioral DifferencesLibravatar Johannes Sixt1-13/+17
The text body of section Behavioral Differences is typeset as code, but should be regular text. Remove the indentation to achieve that. While here, prettify the language: - use "the x backend" instead of "x-based rebase"; - use present tense instead of future tense; and use subsections instead of a list. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-12-04RelNotes 2.20: drop spurious double quoteLibravatar Martin Ågren1-1/+1
We have three double-quote characters, which is one too many or too few. Dropping the last one seems to match the original intention best. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>