summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-09-18Merge branch 'mf/submodule-summary-with-correct-repository'Libravatar Junio C Hamano3-15/+15
"git diff/show" on a change that involves a submodule used to read the information on commits in the submodule from a wrong repository and gave a wrong information when the commit-graph is involved. * mf/submodule-summary-with-correct-repository: submodule: use submodule repository when preparing summary revision: use repository from rev_info when parsing commits
2020-09-18Merge branch 'jc/quote-path-cleanup'Libravatar Junio C Hamano7-60/+94
"git status --short" quoted a path with SP in it when tracked, but not those that are untracked, ignored or unmerged. They are all shown quoted consistently. * jc/quote-path-cleanup: quote: turn 'nodq' parameter into a set of flags quote: rename misnamed sq_lookup[] to cq_lookup[] wt-status: consistently quote paths in "status --short" output quote_path: code clarification quote_path: optionally allow quoting a path with SP in it quote_path: give flags parameter to quote_path() quote_path: rename quote_path_relative() to quote_path()
2020-09-18Merge branch 'os/collect-changed-submodules-optim'Libravatar Junio C Hamano1-1/+8
Optimization around submodule handling. * os/collect-changed-submodules-optim: submodule: suppress checking for file name and ref ambiguity for object ids
2020-09-18Merge branch 'es/wt-add-detach'Libravatar Junio C Hamano3-1/+15
"git worktree add" learns that the "-d" is a synonym to "--detach" option to create a new worktree without being on a branch. * es/wt-add-detach: git-worktree.txt: discuss branch-based vs. throwaway worktrees worktree: teach `add` to recognize -d as shorthand for --detach git-checkout.txt: document -d short option for --detach
2020-09-18Merge branch 'jk/add-i-fixes'Libravatar Junio C Hamano3-2/+10
"add -i/-p" fixes. * jk/add-i-fixes: add--interactive.perl: specify --no-color explicitly add-patch: fix inverted return code of repo_read_index()
2020-09-18Merge branch 'pw/add-p-leakfix'Libravatar Junio C Hamano1-8/+16
Leakfix. * pw/add-p-leakfix: add -p: fix memory leak
2020-09-18Merge branch 'jc/add-i-use-builtin-experimental'Libravatar Junio C Hamano1-3/+9
The "add -i/-p" machinery has been written in C but it is not used by default yet. It is made default to those who are participating in feature.experimental experiment. * jc/add-i-use-builtin-experimental: add -i: use the built-in version when feature.experimental is set
2020-09-18Merge branch 'al/t3200-back-on-a-branch'Libravatar Junio C Hamano1-0/+1
Test fix. * al/t3200-back-on-a-branch: t3200: clean side effect of git checkout --orphan
2020-09-18Merge branch 'hn/refs-ref-log-only-bit'Libravatar Junio C Hamano2-7/+7
A bit of API reshuffling to make sure stuff common to all backends are not defined only in files backend. * hn/refs-ref-log-only-bit: refs: move REF_LOG_ONLY to refs-internal.h
2020-09-18Merge branch 'ea/blame-use-oideq'Libravatar Junio C Hamano1-2/+2
Code cleanup. * ea/blame-use-oideq: blame.c: replace instance of !oidcmp for oideq
2020-09-18Merge branch 'pb/clang-json-compilation-database'Libravatar Junio C Hamano2-5/+56
Developer support. * pb/clang-json-compilation-database: Makefile: add support for generating JSON compilation database
2020-09-18Merge branch 'so/log-tree-diff-cleanup'Libravatar Junio C Hamano1-16/+5
Code cleanup. * so/log-tree-diff-cleanup: log_tree_diff: get rid of extra check for NULL log_tree_diff: get rid of code duplication for first_parent_only
2020-09-18Merge branch 'rs/parallel-read-cache-fix'Libravatar Junio C Hamano1-1/+1
A follow-up fix to a topic already in 'master'. * rs/parallel-read-cache-fix: read-cache: fix mem-pool allocation for multi-threaded index loading
2020-09-18Merge branch 'rs/refspec-leakfix'Libravatar Junio C Hamano6-51/+47
Leakfix. * rs/refspec-leakfix: refspec: add and use refspec_appendf() push: release strbufs used for refspec formatting
2020-09-18Merge branch 'rs/misc-cleanups'Libravatar Junio C Hamano3-16/+6
Misc cleanups. * rs/misc-cleanups: pack-bitmap-write: use hashwrite_be32() in write_hash_cache() midx: use hashwrite_u8() in write_midx_header() fast-import: use write_pack_header()
2020-09-10quote: turn 'nodq' parameter into a set of flagsLibravatar Junio C Hamano3-13/+20
quote_c_style() and its friend quote_two_c_style() both take an optional "please omit the double quotes around the quoted body" parameter. Turn it into a flag word, assign one bit out of it, and call it CQUOTE_NODQ bit. No behaviour change intended. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-10quote: rename misnamed sq_lookup[] to cq_lookup[]Libravatar Junio C Hamano1-7/+7
This table is used to see if each byte needs quoting when responding to a request to C-quote the string, not quoting with single-quote in the shell style. Similarly, sq_must_quote() is fed each byte from the string being C-quoted. No behaviour change intended. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-10wt-status: consistently quote paths in "status --short" outputLibravatar Junio C Hamano2-2/+29
Tracked paths with SP in them were cquoted in "git status --short" output, but untracked, ignored, and unmerged paths weren't. The test was stolen from a patch to fix output for the 'untracked' paths by brian m. carlson, with similar tests added for 'ignored' ones. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-10quote_path: code clarificationLibravatar Junio C Hamano1-7/+12
The implementation we moved from wt-status to enclose a pathname that has a SP in it inside a dq-pair is a bit convoluted. It lets quote_c_style_counted() do its escaping and then (1) if the input string got escaped, which is checked by seeing if the result begins with a double-quote, declare that we are done. If there wasn't any SP in the input, that is OK, and if there was, the result is quoted already so it is OK, too. (2) if the input string did not get escaped, and the result has SP in it, enclose the whole thing in a dq-pair ourselves. Instead we can scan the path upfront to see if the input has SP in it. If so, we tell quote_c_style_counted() not to enclose its output in a dq-pair, and we add a dq-pair ourselves. Whether the input had bytes that quote_c_style_counted() uses backslash quoting, this would give us a desired quoted string. If the input does not have SP in it, we just let quote_c_style_counted() do its thing as usual, which would enclose the result in a dq-pair only when needed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-10quote_path: optionally allow quoting a path with SP in itLibravatar Junio C Hamano3-12/+11
Some code in wt-status.c special case a path with SP in it, which usually does not have to be c-quoted, and ensure that such a path does get quoted. Move the logic to quote_path() and give it a bit in the flags word, QUOTE_PATH_QUOTE_SP. No behaviour change intended. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-10quote_path: give flags parameter to quote_path()Libravatar Junio C Hamano5-26/+26
The quote_path() function computes a path (relative to its base directory) and c-quotes the result if necessary. Teach it to take a flags parameter to allow its behaviour to be enriched later. No behaviour change intended. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-10quote_path: rename quote_path_relative() to quote_path()Libravatar Junio C Hamano5-18/+14
There is no quote_path_absolute() or anything that causes confusion, and one of the two large consumers already rename the long name locally with a preprocessor macro. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-09Fourteenth batchLibravatar Junio C Hamano1-0/+28
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-09Merge branch 'os/vcbuild'Libravatar Junio C Hamano4-4/+5
Fix build procedure for MSVC. * os/vcbuild: contrib/buildsystems: fix expat library name for generated vcxproj vcbuild: fix batch file name in README vcbuild: fix library name for expat with make MSVC=1
2020-09-09Merge branch 'jt/interpret-branch-name-fallback'Libravatar Junio C Hamano20-53/+98
"git status" has trouble showing where it came from by interpreting reflog entries that recordcertain events, e.g. "checkout @{u}", and gives a hard/fatal error. Even though it inherently is impossible to give a correct answer because the reflog entries lose some information (e.g. "@{u}" does not record what branch the user was on hence which branch 'the upstream' needs to be computed, and even if the record were available, the relationship between branches may have changed), at least hide the error to allow "status" show its output. * jt/interpret-branch-name-fallback: wt-status: tolerate dangling marks refs: move dwim_ref() to header file sha1-name: replace unsigned int with option struct
2020-09-09Merge branch 'js/ci-squelch-false-failure'Libravatar Junio C Hamano1-3/+2
CI noise reduction. * js/ci-squelch-false-failure: ci: avoid ugly "failure" in the `ci-config` job ci: fix indentation of the `ci-config` job
2020-09-09Merge branch 'pb/imap-send-updates'Libravatar Junio C Hamano1-15/+19
"git imap-send" updates. * pb/imap-send-updates: git-imap-send.txt: add note about localized Gmail folders git-imap-send.txt: do verify SSL certificate for gmail.com git-imap-send.txt: don't duplicate 'Examples' sections
2020-09-09Merge branch 'hv/ref-filter-misc'Libravatar Junio C Hamano5-65/+161
The "--format=" option to the "for-each-ref" command and friends learned a few more tricks, e.g. the ":short" suffix that applies to "objectname" now also can be used for "parent", "tree", etc. * hv/ref-filter-misc: ref-filter: add `sanitize` option for 'subject' atom pretty: refactor `format_sanitized_subject()` ref-filter: add `short` modifier to 'parent' atom ref-filter: add `short` modifier to 'tree' atom ref-filter: rename `objectname` related functions and fields ref-filter: modify error messages in `grab_objectname()` ref-filter: refactor `grab_objectname()` ref-filter: support different email formats
2020-09-09Merge branch 'ss/submodule-summary-in-c-fixes'Libravatar Junio C Hamano2-10/+9
Fixups to a topic in 'next'. * ss/submodule-summary-in-c-fixes: t7421: eliminate 'grep' check in t7421.4 for mingw compatibility submodule: fix style in function definition submodule: eliminate unused parameters from print_submodule_summary()
2020-09-09Merge branch 'so/separate-field-for-m-and-diff-merges'Libravatar Junio C Hamano3-8/+9
Internal API clean-up to handle two options "diff-index" and "log" have, which happen to share the same short form, more sensibly. * so/separate-field-for-m-and-diff-merges: revision: add separate field for "-m" of "diff-index -m"
2020-09-09Merge branch 'es/worktree-repair'Libravatar Junio C Hamano7-2/+445
"git worktree" gained a "repair" subcommand to help users recover after moving the worktrees or repository manually without telling Git. Also, "git init --separate-git-dir" no longer corrupts administrative data related to linked worktrees. * es/worktree-repair: init: make --separate-git-dir work from within linked worktree init: teach --separate-git-dir to repair linked worktrees worktree: teach "repair" to fix outgoing links to worktrees worktree: teach "repair" to fix worktree back-links to main worktree worktree: add skeleton "repair" command
2020-09-09Merge branch 'jk/worktree-check-clean-leakfix'Libravatar Junio C Hamano1-5/+3
Leakfix. * jk/worktree-check-clean-leakfix: worktree: fix leak in check_clean_worktree()
2020-09-09Merge branch 'tb/repack-clearing-midx'Libravatar Junio C Hamano5-11/+65
When a packfile is removed by "git repack", multi-pack-index gets cleared; the code was taught to do so less aggressively by first checking if the midx actually refers to a pack that no longer exists. * tb/repack-clearing-midx: midx: traverse the local MIDX first builtin/repack.c: invalidate MIDX only when necessary
2020-09-09Merge branch 'ss/submodule-summary-in-c'Libravatar Junio C Hamano7-195/+512
Yet another subcommand of "git submodule" is getting rewritten in C. * ss/submodule-summary-in-c: submodule: port submodule subcommand 'summary' from shell to C t7421: introduce a test script for verifying 'summary' output submodule: rename helper functions to avoid ambiguity submodule: remove extra line feeds between callback struct and macro
2020-09-08blame.c: replace instance of !oidcmp for oideqLibravatar Edmundo Carmona Antoranz1-2/+2
0906ac2b (blame: use changed-path Bloom filters, 2020-04-16) introduced a call to oidcmp() that should have been oideq(), which was introduced in 14438c44 (introduce hasheq() and oideq(), 2018-08-28). Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-08refs: move REF_LOG_ONLY to refs-internal.hLibravatar Han-Wen Nienhuys2-7/+7
REF_LOG_ONLY is used in the transaction preparation: if a symref is involved in a transaction, the referent of the symref should be updated, and the symref itself should only be updated in the reflog. Other ref backends will need to duplicate this logic too, so move it to a central place. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-08t3200: clean side effect of git checkout --orphanLibravatar Aaron Lipman1-0/+1
The "refuse --edit-description on unborn branch for now" test in t3200 switches to an orphan branch, causing subsequent git commands referencing HEAD to fail. Avoid this side-effect by switching back to master after the test finishes. This has gone undetected, as the next affected test expects failure - but it currently fails for the wrong reason. Verbose output of the next test referencing HEAD, "--merged is incompatible with --no-merged": fatal: malformed object name HEAD Which this commit corrects to: error: option `no-merged' is incompatible with --merged Signed-off-by: Aaron Lipman <alipman88@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-08add -i: use the built-in version when feature.experimental is setLibravatar Junio C Hamano1-3/+9
We have had parallel implementations of "add -i/-p" since 2.25 and have been using them from various codepaths since 2.26 days, but never made the built-in version the default. We have found and fixed a handful of corner case bugs in the built-in version, and it may be a good time to start switching over the user base from the scripted version to the built-in version. Let's enable the built-in version for those who opt into the feature.experimental guinea-pig program to give wider exposure. Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-08add -p: fix memory leakLibravatar Phillip Wood1-8/+16
asan reports that the C version of `add -p` is not freeing all the memory it allocates. Fix this by introducing a function to clear `struct add_p_state` and use it instead of freeing individual members. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-08contrib/buildsystems: fix expat library name for generated vcxprojLibravatar Orgad Shaneh2-1/+2
expat.lib -> libexpat.lib (libexpatd.lib for debug build). Signed-off-by: Orgad Shaneh <orgads@gmail.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-08add--interactive.perl: specify --no-color explicitlyLibravatar Jeff King2-1/+2
Our color tests of "git add -p" do something a bit different from how a normal user would behave: we pretend there's a pager in use, so that Git thinks it's OK to write color to a non-tty stdout. This comes from 8539b46534 (t3701: avoid depending on the TTY prerequisite, 2019-12-06), which allows us to avoid a lot of complicated mock-tty code. However, those environment variables also make their way down to sub-processes of add--interactive, including the "diff-files" we run to generate the patches. As a result, it thinks it should output color, too. So in t3701.50, for example, the machine-readable version of the diff we get unexpectedly has color in it. We fail to parse it as a diff and think there are zero hunks. The test does still pass, though, because even with zero hunks we'll dump the diff header (and we consider those unparseable bits to be part of the header!), and so the output still has the expected color codes in it. We don't notice that the command was totally broken and failed to apply anything. And in fact we're not really testing what we think we are about the color, either. While add--interactive does correctly show the version we got from running "diff-files --color", we'd also pass the test if we had accidentally shown the machine-readable version, too, since it (erroneously) has color codes in it. One could argue that the test isn't very realistic; it's setting up this "pretend there's a pager" situation to get around the tty restrictions of the test environment. So one option would be to move back towards using a real tty. But the behavior of add--interactive really is user-visible here. If a user, for whatever reason, did run "git --paginate add --patch" (perhaps because their pager is really a filter or something), the command would totally fail to do anything useful. Since we know that we don't want color in this output, let's just make add--interactive more defensive, and say "--no-color" explicitly. It doesn't hurt anything in the common case, but it fixes this odd case and lets our test function properly again. Note that the C builtin run_add_p() already passes --no-color, so it doesn't need a similar fix. That will eventually replace this perl code anyway, but the test change here will be valuable for ensuring that. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-08add-patch: fix inverted return code of repo_read_index()Libravatar Jeff King2-1/+8
After applying hunks to a file with "add -p", the C patch_update_file() function tries to refresh the index (just like the perl version does). We can only refresh the index if we're able to read it in, so we first check the return value of repo_read_index(). But unlike many functions, where "0" is success, that function is documented to return the number of entries in the index. Hence we should be checking for success with a non-negative return value. Neither the tests nor any users seem to have noticed this, probably due to a combination of: - this affects only the C version, which is not yet the default - following it up with any porcelain command like "git diff" or "git commit" would refresh the index automatically. But you can see the problem by running the plumbing "git diff-files" immediately after "add -p" stages all hunks. Running the new test with GIT_TEST_ADD_I_USE_BUILTIN=1 fails without the matching code change. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-06git-worktree.txt: discuss branch-based vs. throwaway worktreesLibravatar Eric Sunshine1-0/+12
By default, `git worktree add` creates a new worktree associated with a particular branch (which may have been created automatically if not specified explicitly on the command-line). It is also convenient to create throwaway worktrees not associated with any branch, which can be handy when making experimental changes or doing testing. However, the latter use-case may not be obvious to newcomers since the high-level description of worktrees talks only about checking out "more than one branch at a time". Therefore, enhance the description to to discuss both use-cases. A secondary goal of highlighting the distinction between branch-based and throwaway worktrees is to help newcomers understand that the simplest form `git worktree add <path>` automatically creates a new branch. Stating this early in the description, may help newcomers avoid creating branches without realizing they are doing so, and later wondering why `git branch --list` shows branches the user did not intentionally create. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-06worktree: teach `add` to recognize -d as shorthand for --detachLibravatar Eric Sunshine2-1/+2
Like `git switch` and `git checkout`, `git worktree add` can check out a branch or set up a detached HEAD. However, unlike those other commands, `git worktree add` does not understand -d as shorthand for --detach, which may confound users accustomed to using -d for this purpose. Address this shortcoming by teaching `add` to recognize -d for --detach, thus bringing it in line with the other commands. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-06git-checkout.txt: document -d short option for --detachLibravatar Eric Sunshine1-0/+1
`git checkout` learned -d as short option for --detach in 163e3b2975 (switch: add short option for --detach, 2019-03-29) but the documentation was never updated to reflect the change. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-06submodule: suppress checking for file name and ref ambiguity for object idsLibravatar Orgad Shaneh1-1/+8
The argv argument of collect_changed_submodules() contains only object ids (the objects references of all the refs). Notify setup_revisions() that the input is not filenames by passing assume_dashdash, so it can avoid redundant stat for each ref. Also suppress refname_ambiguity flag to avoid filesystem lookups for each object. Similar logic can be found in cat-file, pack-objects and more. This change reduces the time for git fetch in my repo from 25s to 6s. Signed-off-by: Orgad Shaneh <orgads@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-06pack-bitmap-write: use hashwrite_be32() in write_hash_cache()Libravatar René Scharfe1-2/+1
Call hashwrite_be32() instead of open-coding it. This is shorter and easier to read. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-06midx: use hashwrite_u8() in write_midx_header()Libravatar René Scharfe1-7/+4
Emit byte-sized values using hashwrite_u8() instead of buffering them locally first. The hashwrite functions already do their own buffering, so this double-buffering does not reduce the number of system calls. Getting rid of it shortens and simplifies the code a bit. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-06fast-import: use write_pack_header()Libravatar René Scharfe1-7/+1
Call write_pack_header() to hash and write a pack header instead of open-coding this function. This gets rid of duplicate code and of the magic version number 2 -- which has been used here since c90be46abd (Changed fast-import's pack header creation to use pack.h, 2006-08-16) and in pack.h (again) since 29f049a0c2 (Revert "move pack creation to version 3", 2006-10-14). Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-06refspec: add and use refspec_appendf()Libravatar René Scharfe6-49/+35
Add a function for building a refspec using printf-style formatting. It frees callers from managing their own buffer. Use it throughout the tree to shorten and simplify its callers. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>