]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agomerge: apply autostash if fast-forward fails
Philippe Blain [Fri, 23 Jul 2021 12:14:29 +0000 (12:14 +0000)] 
merge: apply autostash if fast-forward fails

Since 'git merge' learned '--autostash' in a03b55530a (merge: teach
--autostash option, 2020-04-07), 'cmd_merge', in the fast-forward case,
calls 'create_autostash' before calling 'checkout_fast_forward' if
'--autostash' is given.

However, if 'checkout_fast_forward' fails, the autostash is not applied
to the working tree, nor saved in the stash list, since the code simply
calls 'goto done'.

Be more helpful to the user by applying the autostash in that case.

An easy way to test a failing fast-forward is when we are merging a
branch that has a tracked file that conflicts with an untracked file in
the working tree.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation: define 'MERGE_AUTOSTASH'
Philippe Blain [Fri, 23 Jul 2021 12:14:28 +0000 (12:14 +0000)] 
Documentation: define 'MERGE_AUTOSTASH'

The documentation for 'git merge --abort' and 'git merge --quit' both
mention the special ref 'MERGE_AUTOSTASH', but this ref is not formally
defined anywhere. Mention it in the description of the '--autostash'
option for 'git merge'.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomerge: add missing word "strategy" to a message
Philippe Blain [Fri, 23 Jul 2021 12:14:27 +0000 (12:14 +0000)] 
merge: add missing word "strategy" to a message

The variable 'best_strategy' holds the name of the merge strategy that
resulted in fewer conflicts, if several strategies were tried. When
that's the case but the best strategy was not the first one tried, we
inform the user which strategy was the "best" one before recreating the
merge and leaving the conflicted files in the tree.

This informational message is missing the word "strategy", so it shows
something like:

    Using the recursive to prepare resolving by hand.

Fix that.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe sixth batch
Junio C Hamano [Wed, 21 Jul 2021 20:32:38 +0000 (13:32 -0700)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'bc/rev-list-without-commit-line'
Junio C Hamano [Thu, 22 Jul 2021 20:05:56 +0000 (13:05 -0700)] 
Merge branch 'bc/rev-list-without-commit-line'

"git rev-list" learns to omit the "commit <object-name>" header
lines from the output with the `--no-commit-header` option.

* bc/rev-list-without-commit-line:
  rev-list: add option for --pretty=format without header

3 years agoMerge branch 'ab/imap-send-read-everything-simplify'
Junio C Hamano [Thu, 22 Jul 2021 20:05:56 +0000 (13:05 -0700)] 
Merge branch 'ab/imap-send-read-everything-simplify'

Code simplification.

* ab/imap-send-read-everything-simplify:
  imap-send.c: use less verbose strbuf_fread() idiom

3 years agoMerge branch 'ab/gitignore-discovery-doc'
Junio C Hamano [Thu, 22 Jul 2021 20:05:55 +0000 (13:05 -0700)] 
Merge branch 'ab/gitignore-discovery-doc'

Doc update.

* ab/gitignore-discovery-doc:
  docs: .gitignore parsing is to the top of the repo

3 years agoMerge branch 'js/ci-windows-update'
Junio C Hamano [Thu, 22 Jul 2021 20:05:55 +0000 (13:05 -0700)] 
Merge branch 'js/ci-windows-update'

GitHub Actions / CI update.

* js/ci-windows-update:
  ci: accelerate the checkout
  ci (vs-build): build with NO_GETTEXT
  artifacts-tar: respect NO_GETTEXT
  ci (windows): transfer also the Git-tracked files to the test jobs
  ci: upgrade to using actions/{up,down}load-artifacts v2
  ci (vs-build): use `cmd` to copy the DLLs, not `powershell`
  ci: use the new GitHub Action to download git-sdk-64-minimal

3 years agoMerge branch 'ab/send-email-optim'
Junio C Hamano [Thu, 22 Jul 2021 20:05:54 +0000 (13:05 -0700)] 
Merge branch 'ab/send-email-optim'

"git send-email" optimization.

* ab/send-email-optim:
  perl: nano-optimize by replacing Cwd::cwd() with Cwd::getcwd()
  send-email: move trivial config handling to Perl
  perl: lazily load some common Git.pm setup code
  send-email: lazily load modules for a big speedup
  send-email: get rid of indirect object syntax
  send-email: use function syntax instead of barewords
  send-email: lazily shell out to "git var"
  send-email: lazily load config for a big speedup
  send-email: copy "config_regxp" into git-send-email.perl
  send-email: refactor sendemail.smtpencryption config parsing
  send-email: remove non-working support for "sendemail.smtpssl"
  send-email tests: test for boolean variables without a value
  send-email tests: support GIT_TEST_PERL_FATAL_WARNINGS=true

3 years agoMerge branch 'jk/typofix'
Junio C Hamano [Thu, 22 Jul 2021 20:05:53 +0000 (13:05 -0700)] 
Merge branch 'jk/typofix'

Typofix.

* jk/typofix:
  doc/rev-list-options: fix duplicate word typo

3 years agoThe fifth batch
Junio C Hamano [Fri, 16 Jul 2021 23:56:24 +0000 (16:56 -0700)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ds/gender-neutral-doc'
Junio C Hamano [Sat, 17 Jul 2021 00:42:53 +0000 (17:42 -0700)] 
Merge branch 'ds/gender-neutral-doc'

Update the documentation not to assume users are of certain gender
and adds to guidelines to do so.

* ds/gender-neutral-doc:
  *: fix typos
  comments: avoid using the gender of our users
  doc: avoid using the gender of other people

3 years agoMerge branch 'jt/partial-clone-submodule-1'
Junio C Hamano [Sat, 17 Jul 2021 00:42:53 +0000 (17:42 -0700)] 
Merge branch 'jt/partial-clone-submodule-1'

Prepare the internals for lazily fetching objects in submodules
from their promisor remotes.

* jt/partial-clone-submodule-1:
  promisor-remote: teach lazy-fetch in any repo
  run-command: refactor subprocess env preparation
  submodule: refrain from filtering GIT_CONFIG_COUNT
  promisor-remote: support per-repository config
  repository: move global r_f_p_c to repo struct

3 years agoMerge branch 'ab/struct-init'
Junio C Hamano [Sat, 17 Jul 2021 00:42:52 +0000 (17:42 -0700)] 
Merge branch 'ab/struct-init'

Code cleanup around struct_type_init() functions.

* ab/struct-init:
  string-list.h users: change to use *_{nodup,dup}()
  string-list.[ch]: add a string_list_init_{nodup,dup}()
  dir.[ch]: replace dir_init() with DIR_INIT
  *.c *_init(): define in terms of corresponding *_INIT macro
  *.h: move some *_INIT to designated initializers

3 years agoMerge branch 'dd/test-stdout-count-lines'
Junio C Hamano [Sat, 17 Jul 2021 00:42:52 +0000 (17:42 -0700)] 
Merge branch 'dd/test-stdout-count-lines'

Tiny test clean-up.

* dd/test-stdout-count-lines:
  t6402: preserve git exit status code
  t6400: preserve git ls-files exit status code
  test-lib-functions: introduce test_stdout_line_count

3 years agoMerge branch 'hn/refs-test-cleanup'
Junio C Hamano [Sat, 17 Jul 2021 00:42:52 +0000 (17:42 -0700)] 
Merge branch 'hn/refs-test-cleanup'

Test clean-up.

* hn/refs-test-cleanup:
  t7509: avoid direct file access for writing CHERRY_PICK_HEAD
  t1415: avoid direct filesystem access for writing refs

3 years agoMerge branch 'rs/khash-alloc-cleanup'
Junio C Hamano [Sat, 17 Jul 2021 00:42:51 +0000 (17:42 -0700)] 
Merge branch 'rs/khash-alloc-cleanup'

Code clean-up.

* rs/khash-alloc-cleanup:
  khash: clarify that allocations never fail

3 years agoMerge branch 'ar/help-micro-cleanup'
Junio C Hamano [Sat, 17 Jul 2021 00:42:51 +0000 (17:42 -0700)] 
Merge branch 'ar/help-micro-cleanup'

Tiny code clean-up.

* ar/help-micro-cleanup:
  help: convert git_cmd to page in one place

3 years agoMerge branch 'ar/submodule-helper-include-cleanup'
Junio C Hamano [Sat, 17 Jul 2021 00:42:51 +0000 (17:42 -0700)] 
Merge branch 'ar/submodule-helper-include-cleanup'

Code clean-up.

* ar/submodule-helper-include-cleanup:
  submodule--helper: remove redundant include

3 years agoMerge branch 'ab/bundle-updates'
Junio C Hamano [Sat, 17 Jul 2021 00:42:49 +0000 (17:42 -0700)] 
Merge branch 'ab/bundle-updates'

Code clean-up and leak plugging in "git bundle".

* ab/bundle-updates:
  bundle: remove "ref_list" in favor of string-list.c API
  bundle.c: use a temporary variable for OIDs and names
  bundle cmd: stop leaking memory from parse_options_cmd_bundle()

3 years agoMerge branch 'hn/refs-iterator-peel-returns-boolean'
Junio C Hamano [Sat, 17 Jul 2021 00:42:49 +0000 (17:42 -0700)] 
Merge branch 'hn/refs-iterator-peel-returns-boolean'

Tiny API tweak.

* hn/refs-iterator-peel-returns-boolean:
  refs: make explicit that ref_iterator_peel returns boolean

3 years agoMerge branch 'ab/mktag-tests'
Junio C Hamano [Sat, 17 Jul 2021 00:42:48 +0000 (17:42 -0700)] 
Merge branch 'ab/mktag-tests'

Fill test gaps.

* ab/mktag-tests:
  mktag tests: test fast-export
  mktag tests: test for-each-ref
  mktag tests: test update-ref and reachable fsck
  mktag tests: test hash-object --literally and unreachable fsck
  mktag tests: invert --no-strict test
  mktag tests: parse out options in helper

3 years agoMerge branch 'ab/show-branch-tests'
Junio C Hamano [Sat, 17 Jul 2021 00:42:48 +0000 (17:42 -0700)] 
Merge branch 'ab/show-branch-tests'

Fill test gaps.

* ab/show-branch-tests:
  show-branch tests: add missing tests
  show-branch: don't <COLOR></RESET> for space characters
  show-branch tests: modernize test code
  show-branch tests: rename the one "show-branch" test file

3 years agoMerge branch 'ab/fetch-negotiate-segv-fix'
Junio C Hamano [Sat, 17 Jul 2021 00:42:48 +0000 (17:42 -0700)] 
Merge branch 'ab/fetch-negotiate-segv-fix'

Code recently added to support common ancestry negotiation during
"git push" did not sanity check its arguments carefully enough.

* ab/fetch-negotiate-segv-fix:
  fetch: fix segfault in --negotiate-only without --negotiation-tip=*
  fetch: document the --negotiate-only option
  send-pack.c: move "no refs in common" abort earlier

3 years agoMerge branch 'ab/make-delete-on-error'
Junio C Hamano [Sat, 17 Jul 2021 00:42:47 +0000 (17:42 -0700)] 
Merge branch 'ab/make-delete-on-error'

Use ".DELETE_ON_ERROR" pseudo target to simplify our Makefile.

* ab/make-delete-on-error:
  Makefile: add and use the ".DELETE_ON_ERROR" flag

3 years agoMerge branch 'ew/mmap-failures'
Junio C Hamano [Sat, 17 Jul 2021 00:42:47 +0000 (17:42 -0700)] 
Merge branch 'ew/mmap-failures'

Error message update.

* ew/mmap-failures:
  xmmap: inform Linux users of tuning knobs on ENOMEM

3 years agoMerge branch 'js/config-mak-windows-pcre-fix'
Junio C Hamano [Sat, 17 Jul 2021 00:42:47 +0000 (17:42 -0700)] 
Merge branch 'js/config-mak-windows-pcre-fix'

Whitespace fix.

* js/config-mak-windows-pcre-fix:
  config.mak.uname: PCRE1 cleanup

3 years agoMerge branch 'js/gfw-system-config-loc-fix'
Junio C Hamano [Sat, 17 Jul 2021 00:42:46 +0000 (17:42 -0700)] 
Merge branch 'js/gfw-system-config-loc-fix'

Update the location of system-side configuration file on Windows.

* js/gfw-system-config-loc-fix:
  config: normalize the path of the system gitconfig
  cmake(windows): set correct path to the system Git config
  mingw: move Git for Windows' system config where users expect it

3 years agoMerge branch 'ks/submodule-cleanup'
Junio C Hamano [Sat, 17 Jul 2021 00:42:46 +0000 (17:42 -0700)] 
Merge branch 'ks/submodule-cleanup'

Code cleanup.

* ks/submodule-cleanup:
  submodule: remove unnecessary `prefix` based option logic

3 years agoMerge branch 'tb/midx-use-checksum'
Junio C Hamano [Sat, 17 Jul 2021 00:42:46 +0000 (17:42 -0700)] 
Merge branch 'tb/midx-use-checksum'

When rebuilding the multi-pack index file reusing an existing one,
we used to blindly trust the existing file and ended up carrying
corrupted data into the updated file, which has been corrected.

* tb/midx-use-checksum:
  midx: report checksum mismatches during 'verify'
  midx: don't reuse corrupt MIDXs when writing
  commit-graph: rewrite to use checksum_valid()
  csum-file: introduce checksum_valid()

3 years agoMerge branch 'en/merge-dir-rename-corner-case-fix'
Junio C Hamano [Sat, 17 Jul 2021 00:42:45 +0000 (17:42 -0700)] 
Merge branch 'en/merge-dir-rename-corner-case-fix'

The merge code had funny interactions between content based rename
detection and directory rename detection.

* en/merge-dir-rename-corner-case-fix:
  merge-recursive: handle rename-to-self case
  merge-ort: ensure we consult df_conflict and path_conflicts
  t6423: test directory renames causing rename-to-self

3 years agoMerge branch 'en/ort-perf-batch-13'
Junio C Hamano [Sat, 17 Jul 2021 00:42:45 +0000 (17:42 -0700)] 
Merge branch 'en/ort-perf-batch-13'

Performance tweaks of "git merge -sort" around lazy fetching of objects.

* en/ort-perf-batch-13:
  merge-ort: add prefetching for content merges
  diffcore-rename: use a different prefetch for basename comparisons
  diffcore-rename: allow different missing_object_cb functions
  t6421: add tests checking for excessive object downloads during merge
  promisor-remote: output trace2 statistics for number of objects fetched

3 years agoMerge branch 'en/ort-perf-batch-12'
Junio C Hamano [Sat, 17 Jul 2021 00:42:45 +0000 (17:42 -0700)] 
Merge branch 'en/ort-perf-batch-12'

More fix-ups and optimization to "merge -sort".

* en/ort-perf-batch-12:
  merge-ort: miscellaneous touch-ups
  Fix various issues found in comments
  diffcore-rename: avoid unnecessary strdup'ing in break_idx
  merge-ort: replace string_list_df_name_compare with faster alternative

3 years agoThe fourth batch
Junio C Hamano [Tue, 13 Jul 2021 23:52:11 +0000 (16:52 -0700)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'rs/grep-parser-fix'
Junio C Hamano [Tue, 13 Jul 2021 23:52:53 +0000 (16:52 -0700)] 
Merge branch 'rs/grep-parser-fix'

"git grep --and -e foo" ought to have been diagnosed as an error
but instead segfaulted, which has been corrected.

* rs/grep-parser-fix:
  grep: report missing left operand of --and

3 years agoMerge branch 'bk/doc-commit-typofix'
Junio C Hamano [Tue, 13 Jul 2021 23:52:52 +0000 (16:52 -0700)] 
Merge branch 'bk/doc-commit-typofix'

Doc typo/grammo-fix.

* bk/doc-commit-typofix:
  Documentation: fix typo in the --patch option of the commit command

3 years agoMerge branch 'dc/p4-binary-submit-fix'
Junio C Hamano [Tue, 13 Jul 2021 23:52:52 +0000 (16:52 -0700)] 
Merge branch 'dc/p4-binary-submit-fix'

Prevent "git p4" from failing to submit changes to binary file.

* dc/p4-binary-submit-fix:
  git-p4: fix failed submit by skip non-text data files

3 years agoMerge branch 'ab/pre-auto-gc-hook-test'
Junio C Hamano [Tue, 13 Jul 2021 23:52:52 +0000 (16:52 -0700)] 
Merge branch 'ab/pre-auto-gc-hook-test'

Test fix.

* ab/pre-auto-gc-hook-test:
  gc tests: add a test for the "pre-auto-gc" hook

3 years agoMerge branch 'jk/union-merge-binary'
Junio C Hamano [Tue, 13 Jul 2021 23:52:51 +0000 (16:52 -0700)] 
Merge branch 'jk/union-merge-binary'

The "union" conflict resolution variant misbehaved when used with
binary merge driver.

* jk/union-merge-binary:
  ll_union_merge(): rename path_unused parameter
  ll_union_merge(): pass name labels to ll_xdl_merge()
  ll_binary_merge(): handle XDL_MERGE_FAVOR_UNION

3 years agoMerge branch 'mr/cmake'
Junio C Hamano [Tue, 13 Jul 2021 23:52:51 +0000 (16:52 -0700)] 
Merge branch 'mr/cmake'

CMake update.

* mr/cmake:
  cmake: add warning for ignored MSGFMT_EXE
  cmake: create compile_commands.json by default
  cmake: add knob to disable vcpkg

3 years agoMerge branch 'ab/describe-tests-fix'
Junio C Hamano [Tue, 13 Jul 2021 23:52:51 +0000 (16:52 -0700)] 
Merge branch 'ab/describe-tests-fix'

Various updates to tests around "git describe"

* ab/describe-tests-fix:
  describe tests: support -C in "check_describe"
  describe tests: fix nested "test_expect_success" call
  describe tests: don't rely on err.actual from "check_describe"
  describe tests: refactor away from glob matching
  describe tests: improve test for --work-tree & --dirty

3 years agoMerge branch 'ab/pickaxe-pcre2'
Junio C Hamano [Tue, 13 Jul 2021 23:52:50 +0000 (16:52 -0700)] 
Merge branch 'ab/pickaxe-pcre2'

Rewrite the backend for "diff -G/-S" to use pcre2 engine when
available.

* ab/pickaxe-pcre2: (22 commits)
  xdiff-interface: replace discard_hunk_line() with a flag
  xdiff users: use designated initializers for out_line
  pickaxe -G: don't special-case create/delete
  pickaxe -G: terminate early on matching lines
  xdiff-interface: allow early return from xdiff_emit_line_fn
  xdiff-interface: prepare for allowing early return
  pickaxe -S: slightly optimize contains()
  pickaxe: rename variables in has_changes() for brevity
  pickaxe -S: support content with NULs under --pickaxe-regex
  pickaxe: assert that we must have a needle under -G or -S
  pickaxe: refactor function selection in diffcore-pickaxe()
  perf: add performance test for pickaxe
  pickaxe/style: consolidate declarations and assignments
  diff.h: move pickaxe fields together again
  pickaxe: die when --find-object and --pickaxe-all are combined
  pickaxe: die when -G and --pickaxe-regex are combined
  pickaxe tests: add missing test for --no-pickaxe-regex being an error
  pickaxe tests: test for -G, -S and --find-object incompatibility
  pickaxe tests: add test for "log -S" not being a regex
  pickaxe tests: add test for diffgrep_consume() internals
  ...

3 years agoMerge branch 'hn/prep-tests-for-reftable'
Junio C Hamano [Tue, 13 Jul 2021 23:52:50 +0000 (16:52 -0700)] 
Merge branch 'hn/prep-tests-for-reftable'

Preliminary clean-up of tests before the main reftable changes
hits the codebase.

* hn/prep-tests-for-reftable: (22 commits)
  t1415: set REFFILES for test specific to storage format
  t4202: mark bogus head hash test with REFFILES
  t7003: check reflog existence only for REFFILES
  t7900: stop checking for loose refs
  t1404: mark tests that muck with .git directly as REFFILES.
  t2017: mark --orphan/logAllRefUpdates=false test as REFFILES
  t1414: mark corruption test with REFFILES
  t1407: require REFFILES for for_each_reflog test
  test-lib: provide test prereq REFFILES
  t5304: use "reflog expire --all" to clear the reflog
  t5304: restyle: trim empty lines, drop ':' before >
  t7003: use rev-parse rather than FS inspection
  t5000: inspect HEAD using git-rev-parse
  t5000: reformat indentation to the latest fashion
  t1301: fix typo in error message
  t1413: use tar to save and restore entire .git directory
  t1401-symbolic-ref: avoid direct filesystem access
  t1401: use tar to snapshot and restore repo state
  t5601: read HEAD using rev-parse
  t9300: check ref existence using test-helper rather than a file system check
  ...

3 years agoMerge branch 'fc/push-simple-updates-cleanup'
Junio C Hamano [Tue, 13 Jul 2021 23:52:50 +0000 (16:52 -0700)] 
Merge branch 'fc/push-simple-updates-cleanup'

Some more code and doc clarification around "git push".

* fc/push-simple-updates-cleanup:
  push: don't get a full remote object
  push: only check same_remote when needed
  push: remove trivial function
  push: remove redundant check
  push: factor out the typical case
  push: get rid of all the setup_push_* functions
  push: trivial simplifications
  push: make setup_push_* return the dst
  push: only get the branch when needed
  push: factor out null branch check
  push: split switch cases
  push: return immediately in trivial switch case
  push: create new get_upstream_ref() helper

3 years agoMerge branch 'fc/push-simple-updates'
Junio C Hamano [Tue, 13 Jul 2021 23:52:49 +0000 (16:52 -0700)] 
Merge branch 'fc/push-simple-updates'

Some code and doc clarification around "git push".

* fc/push-simple-updates:
  doc: push: explain default=simple correctly
  push: remove unused code in setup_push_upstream()
  push: simplify setup_push_simple()
  push: reorganize setup_push_simple()
  push: copy code to setup_push_simple()
  push: hedge code of default=simple
  push: rename !triangular to same_remote

3 years agoMerge branch 'zh/cat-file-batch-fix'
Junio C Hamano [Tue, 13 Jul 2021 23:52:49 +0000 (16:52 -0700)] 
Merge branch 'zh/cat-file-batch-fix'

"git cat-file --batch-all-objects"" misbehaved when "--batch" is in
use and did not ask for certain object traits.

* zh/cat-file-batch-fix:
  cat-file: merge two block into one
  cat-file: handle trivial --batch format with --batch-all-objects

3 years agodoc/rev-list-options: fix duplicate word typo
Jeff King [Tue, 13 Jul 2021 22:31:26 +0000 (18:31 -0400)] 
doc/rev-list-options: fix duplicate word typo

Reported-by: Jason Hatton <jhatton@globalfinishing.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorev-list: add option for --pretty=format without header
brian m. carlson [Sun, 11 Jul 2021 21:55:10 +0000 (21:55 +0000)] 
rev-list: add option for --pretty=format without header

In general, we encourage users to use plumbing commands, like git
rev-list, over porcelain commands, like git log, when scripting.
However, git rev-list has one glaring problem that prevents it from
being used in certain cases: when --pretty is used with a custom format,
it always prints out a line containing "commit" and the object ID.  This
makes it unsuitable for many scripting needs, and forces users to use
git log instead.

While we can't change this behavior for backwards compatibility, we can
add an option to suppress this behavior, so let's do so, and call it
"--no-commit-header".  Additionally, add the corresponding positive
option to switch it back on.

Note that this option doesn't affect the built-in formats, only custom
formats.  This is exactly the same behavior as users already have from
git log and is what most users will be used to.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe third batch
Junio C Hamano [Thu, 8 Jul 2021 20:14:36 +0000 (13:14 -0700)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/stop-exporting-bogus-columns'
Junio C Hamano [Thu, 8 Jul 2021 20:15:06 +0000 (13:15 -0700)] 
Merge branch 'js/stop-exporting-bogus-columns'

When we cannot figure out how wide the terminal is, we use a
fallback value of 80 ourselves (which cannot be avoided), but when
we run the pager, we export it in COLUMNS, which forces the pager
to use the hardcoded value, even when the pager is perfectly
capable to figure it out itself.  Stop exporting COLUMNS when we
fall back on the hardcoded default value for our own use.

* js/stop-exporting-bogus-columns:
  pager: avoid setting COLUMNS when we're guessing its value

3 years agoMerge branch 'dd/document-log-decorate-default'
Junio C Hamano [Thu, 8 Jul 2021 20:15:05 +0000 (13:15 -0700)] 
Merge branch 'dd/document-log-decorate-default'

Doc clean-up.

* dd/document-log-decorate-default:
  doc/log: correct default for --decorate

3 years agoMerge branch 'ar/test-code-cleanup'
Junio C Hamano [Thu, 8 Jul 2021 20:15:05 +0000 (13:15 -0700)] 
Merge branch 'ar/test-code-cleanup'

Test code clean-up.

* ar/test-code-cleanup:
  t: fix whitespace around &&

3 years agoMerge branch 'ba/object-info'
Junio C Hamano [Thu, 8 Jul 2021 20:15:05 +0000 (13:15 -0700)] 
Merge branch 'ba/object-info'

Code clean-up.

* ba/object-info:
  protocol-caps.h: add newline at end of file

3 years agoMerge branch 'ab/progress-cleanup'
Junio C Hamano [Thu, 8 Jul 2021 20:15:04 +0000 (13:15 -0700)] 
Merge branch 'ab/progress-cleanup'

Code clean-up.

* ab/progress-cleanup:
  read-cache.c: don't guard calls to progress.c API

3 years agoMerge branch 'ab/xdiff-bug-cleanup'
Junio C Hamano [Thu, 8 Jul 2021 20:15:04 +0000 (13:15 -0700)] 
Merge branch 'ab/xdiff-bug-cleanup'

Code clean-up.

* ab/xdiff-bug-cleanup:
  xdiff: use BUG(...), not xdl_bug(...)

3 years agoMerge branch 'ms/mergetools-kdiff3-on-windows'
Junio C Hamano [Thu, 8 Jul 2021 20:15:04 +0000 (13:15 -0700)] 
Merge branch 'ms/mergetools-kdiff3-on-windows'

On Windows, mergetool has been taught to find kdiff3.exe just like
it finds winmerge.exe.

* ms/mergetools-kdiff3-on-windows:
  mergetools/kdiff3: make kdiff3 work on Windows too

3 years agoMerge branch 'ab/cmd-foo-should-return'
Junio C Hamano [Thu, 8 Jul 2021 20:15:04 +0000 (13:15 -0700)] 
Merge branch 'ab/cmd-foo-should-return'

Code clean-up.

* ab/cmd-foo-should-return:
  builtins + test helpers: use return instead of exit() in cmd_*

3 years agoMerge branch 'ar/doc-libera-chat-in-my-first-contrib'
Junio C Hamano [Thu, 8 Jul 2021 20:15:03 +0000 (13:15 -0700)] 
Merge branch 'ar/doc-libera-chat-in-my-first-contrib'

Update MyFirst document.

* ar/doc-libera-chat-in-my-first-contrib:
  MyFirstContribution: link #git-devel to Libera Chat

3 years agoMerge branch 'ar/mailinfo-memcmp-to-skip-prefix'
Junio C Hamano [Thu, 8 Jul 2021 20:15:03 +0000 (13:15 -0700)] 
Merge branch 'ar/mailinfo-memcmp-to-skip-prefix'

Code clean-up.

* ar/mailinfo-memcmp-to-skip-prefix:
  mailinfo: use starts_with() when checking scissors

3 years agoMerge branch 'jk/doc-max-pack-size'
Junio C Hamano [Thu, 8 Jul 2021 20:15:03 +0000 (13:15 -0700)] 
Merge branch 'jk/doc-max-pack-size'

Doc update.

* jk/doc-max-pack-size:
  doc: warn people against --max-pack-size

3 years agoMerge branch 'ab/fix-columns-to-80-during-tests'
Junio C Hamano [Thu, 8 Jul 2021 20:15:02 +0000 (13:15 -0700)] 
Merge branch 'ab/fix-columns-to-80-during-tests'

Output from some of our tests were affected by the width of the
terminal that they were run in, which has been corrected by
exporting a fixed value in the COLUMNS environment.

* ab/fix-columns-to-80-during-tests:
  test-lib.sh: set COLUMNS=80 for --verbose repeatability

3 years agoMerge branch 'ar/more-typofix'
Junio C Hamano [Thu, 8 Jul 2021 20:15:02 +0000 (13:15 -0700)] 
Merge branch 'ar/more-typofix'

Typofixes.

* ar/more-typofix:
  git-worktree.txt: fix typo in example path
  t: fix typos in test messages
  blame: correct name of config option in docs

3 years agoMerge branch 'fw/complete-cmd-idx-fix'
Junio C Hamano [Thu, 8 Jul 2021 20:15:02 +0000 (13:15 -0700)] 
Merge branch 'fw/complete-cmd-idx-fix'

Recent update to completion script (in contrib/) broke those who
use the __git_complete helper to define completion to their custom
command.

* fw/complete-cmd-idx-fix:
  completion: bash: fix late declaration of __git_cmd_idx

3 years agoMerge branch 'jk/test-without-readlink-1'
Junio C Hamano [Thu, 8 Jul 2021 20:15:02 +0000 (13:15 -0700)] 
Merge branch 'jk/test-without-readlink-1'

Some test scripts assumed that readlink(1) was universally
installed and available, which is not the case.

* jk/test-without-readlink-1:
  t: use portable wrapper for readlink(1)

3 years agoMerge branch 'jx/sideband-cleanup'
Junio C Hamano [Thu, 8 Jul 2021 20:15:01 +0000 (13:15 -0700)] 
Merge branch 'jx/sideband-cleanup'

The side-band demultiplexer that is used to display progress output
from the remote end did not clear the line properly when the end of
line hits at a packet boundary, which has been corrected.  Also
comes with test clean-ups.

* jx/sideband-cleanup:
  test: refactor to use "get_abbrev_oid" to get abbrev oid
  test: refactor to use "test_commit" to create commits
  test: compare raw output, not mangle tabs and spaces
  sideband: don't lose clear-to-eol at packet boundary

3 years agoMerge branch 'jk/test-avoid-globmatch-with-skip-patterns'
Junio C Hamano [Thu, 8 Jul 2021 20:15:01 +0000 (13:15 -0700)] 
Merge branch 'jk/test-avoid-globmatch-with-skip-patterns'

We broke "GIT_SKIP_TESTS=t?000" to skip certain tests in recent
update, which got fixed.

* jk/test-avoid-globmatch-with-skip-patterns:
  test-lib: avoid accidental globbing in match_pattern_list()

3 years agoMerge branch 'jv/userdiff-csharp-update'
Junio C Hamano [Thu, 8 Jul 2021 20:15:01 +0000 (13:15 -0700)] 
Merge branch 'jv/userdiff-csharp-update'

The userdiff pattern for C# learned the token "record".

* jv/userdiff-csharp-update:
  userdiff: add support for C# record types

3 years agoMerge branch 'ab/config-hooks-path-testfix'
Junio C Hamano [Thu, 8 Jul 2021 20:15:00 +0000 (13:15 -0700)] 
Merge branch 'ab/config-hooks-path-testfix'

Test fix.

* ab/config-hooks-path-testfix:
  pre-commit hook tests: don't leave "actual" nonexisting on failure

3 years agoMerge branch 'fc/pull-cleanups'
Junio C Hamano [Thu, 8 Jul 2021 20:15:00 +0000 (13:15 -0700)] 
Merge branch 'fc/pull-cleanups'

Code cleanup.

* fc/pull-cleanups:
  pull: trivial whitespace style fix
  pull: trivial cleanup
  pull: cleanup autostash check

3 years agoMerge branch 'jk/bitmap-tree-optim'
Junio C Hamano [Thu, 8 Jul 2021 20:15:00 +0000 (13:15 -0700)] 
Merge branch 'jk/bitmap-tree-optim'

Avoid duplicated work while building reachability bitmaps.

* jk/bitmap-tree-optim:
  bitmaps: don't recurse into trees already in the bitmap

3 years agoMerge branch 'ah/graph-typofix'
Junio C Hamano [Thu, 8 Jul 2021 20:15:00 +0000 (13:15 -0700)] 
Merge branch 'ah/graph-typofix'

Typofix in an error message.

* ah/graph-typofix:
  graph: improve grammar of "invalid color" error message

3 years agoMerge branch 'jx/t6020-with-older-bash'
Junio C Hamano [Thu, 8 Jul 2021 20:14:59 +0000 (13:14 -0700)] 
Merge branch 'jx/t6020-with-older-bash'

Work around inefficient glob substitution in older versions of bash
by rewriting parts of a test.

* jx/t6020-with-older-bash:
  t6020: fix incompatible parameter expansion

3 years agoMerge branch 'ar/typofix'
Junio C Hamano [Thu, 8 Jul 2021 20:14:59 +0000 (13:14 -0700)] 
Merge branch 'ar/typofix'

Typofixes.

* ar/typofix:
  *: fix typos which duplicate a word

3 years agoMerge branch 'jk/revision-squelch-gcc-warning'
Junio C Hamano [Thu, 8 Jul 2021 20:14:59 +0000 (13:14 -0700)] 
Merge branch 'jk/revision-squelch-gcc-warning'

Warning fix.

* jk/revision-squelch-gcc-warning:
  add_pending_object_with_path(): work around "gcc -O3" complaint

3 years agoMerge branch 'ah/uninitialized-reads-fix'
Junio C Hamano [Thu, 8 Jul 2021 20:14:58 +0000 (13:14 -0700)] 
Merge branch 'ah/uninitialized-reads-fix'

Make the codebase MSAN clean.

* ah/uninitialized-reads-fix:
  builtin/checkout--worker: zero-initialise struct to avoid MSAN complaints
  split-index: use oideq instead of memcmp to compare object_id's
  bulk-checkin: make buffer reuse more obvious and safer

3 years agoMerge branch 'js/no-more-multimail'
Junio C Hamano [Thu, 8 Jul 2021 20:14:58 +0000 (13:14 -0700)] 
Merge branch 'js/no-more-multimail'

Remove multimail from contrib/

* js/no-more-multimail:
  multimail: stop shipping a copy

3 years agoMerge branch 'js/subtree-on-windows-fix'
Junio C Hamano [Thu, 8 Jul 2021 20:14:58 +0000 (13:14 -0700)] 
Merge branch 'js/subtree-on-windows-fix'

Update "git subtree" to work better on Windows.

* js/subtree-on-windows-fix:
  subtree: fix assumption about the directory separator
  subtree: fix the GIT_EXEC_PATH sanity check to work on Windows

3 years agoMerge branch 'dd/svn-test-wo-locale-a'
Junio C Hamano [Thu, 8 Jul 2021 20:14:58 +0000 (13:14 -0700)] 
Merge branch 'dd/svn-test-wo-locale-a'

"git-svn" tests assumed that "locale -a", which is used to pick an
available UTF-8 locale, is available everywhere.  A knob has been
introduced to allow testers to specify a suitable locale to use.

* dd/svn-test-wo-locale-a:
  t: use user-specified utf-8 locale for testing svn

3 years agoMerge branch 'fc/doc-default-to-upstream-config'
Junio C Hamano [Thu, 8 Jul 2021 20:14:57 +0000 (13:14 -0700)] 
Merge branch 'fc/doc-default-to-upstream-config'

Doc clean-up.

* fc/doc-default-to-upstream-config:
  doc: merge: mention default of defaulttoupstream

3 years agoMerge branch 'js/trace2-discard-event-docfix'
Junio C Hamano [Thu, 8 Jul 2021 20:14:57 +0000 (13:14 -0700)] 
Merge branch 'js/trace2-discard-event-docfix'

Docfix.

* js/trace2-discard-event-docfix:
  docs: fix api-trace2 doc for "too_many_files" event

3 years agoMerge branch 'tb/complete-diff-anchored'
Junio C Hamano [Thu, 8 Jul 2021 20:14:56 +0000 (13:14 -0700)] 
Merge branch 'tb/complete-diff-anchored'

The command line completion (in contrib/) learned that "git diff"
takes the "--anchored" option.

* tb/complete-diff-anchored:
  completion: add --anchored to diff's options

3 years agoMerge branch 'tk/partial-clone-repack-doc'
Junio C Hamano [Thu, 8 Jul 2021 20:14:56 +0000 (13:14 -0700)] 
Merge branch 'tk/partial-clone-repack-doc'

Docfix.

* tk/partial-clone-repack-doc:
  Remove warning that repack only works on non-promisor packfiles

3 years agofetch: fix segfault in --negotiate-only without --negotiation-tip=*
Ævar Arnfjörð Bjarmason [Thu, 8 Jul 2021 10:53:15 +0000 (12:53 +0200)] 
fetch: fix segfault in --negotiate-only without --negotiation-tip=*

The recent --negotiate-only option would segfault in the call to
oid_array_for_each() in negotiate_using_fetch() unless one or more
--negotiation-tip=* options were provided.

All of the other tests for the feature combine both, but nothing was
checking this assumption, let's do that and add a test for it. Fixes a
bug in 9c1e657a8fd (fetch: teach independent negotiation (no
packfile), 2021-05-04).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoimap-send.c: use less verbose strbuf_fread() idiom
Ævar Arnfjörð Bjarmason [Wed, 7 Jul 2021 09:05:24 +0000 (11:05 +0200)] 
imap-send.c: use less verbose strbuf_fread() idiom

When looking for things that hardcoded a non-zero "hint" parameter to
strbuf_fread() I discovered that since f2561fda364 (Add git-imap-send,
derived from isync 1.0.1., 2006-03-10) we've been passing a hardcoded
4096 in imap-send.c to read stdin.

Since we're not doing anything unusual here let's use a less verbose
pattern used in a lot of other places (the hint of "0" will default to
8192). We don't need to take a FILE * here either, so we can use "0"
instead of "stdin". While we're at it improve the error message if we
can't read the input to use error_errno().

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodocs: .gitignore parsing is to the top of the repo
Andrew Berry [Tue, 6 Jul 2021 20:57:12 +0000 (16:57 -0400)] 
docs: .gitignore parsing is to the top of the repo

The current documentation reads as if .gitignore files will be parsed in
every parent directory, and not until they reach a repository boundary.
This clarifies the current behaviour.

As well, this corrects 'toplevel' to 'top-level', matching usage for
'top-level domain'.

Signed-off-by: Andrew Berry <andrew@furrypaws.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosubmodule--helper: remove redundant include
Atharva Raykar [Tue, 6 Jul 2021 18:24:08 +0000 (23:54 +0530)] 
submodule--helper: remove redundant include

"dir.h" should have been included only once.

Signed-off-by: Atharva Raykar <raykar.ath@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Shourya Shukla <periperidip@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohelp: convert git_cmd to page in one place
Andrei Rybak [Sun, 4 Jul 2021 15:39:12 +0000 (17:39 +0200)] 
help: convert git_cmd to page in one place

Depending on the chosen format of help pages, git-help uses function
show_man_page, show_info_page, or show_html_page.  The first thing all
three functions do is to convert given `git_cmd` to a `page` using
function cmd_to_page.

Move the common part of these three functions to function cmd_help to
avoid code duplication.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Reviewed-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agokhash: clarify that allocations never fail
René Scharfe [Sat, 3 Jul 2021 12:57:30 +0000 (14:57 +0200)] 
khash: clarify that allocations never fail

We use our standard allocation functions and macros (xcalloc,
ALLOC_ARRAY, REALLOC_ARRAY) in our version of khash.h.  They terminate
the program on error instead, so code that's using them doesn't have to
handle allocation failures.  Make this behavior explicit by turning
kh_resize_ into a void function and removing the related unreachable
error handling code.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7509: avoid direct file access for writing CHERRY_PICK_HEAD
Han-Wen Nienhuys [Tue, 6 Jul 2021 18:47:57 +0000 (18:47 +0000)] 
t7509: avoid direct file access for writing CHERRY_PICK_HEAD

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1415: avoid direct filesystem access for writing refs
Han-Wen Nienhuys [Tue, 6 Jul 2021 18:47:56 +0000 (18:47 +0000)] 
t1415: avoid direct filesystem access for writing refs

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6402: preserve git exit status code
Đoàn Trần Công Danh [Sun, 4 Jul 2021 05:46:12 +0000 (12:46 +0700)] 
t6402: preserve git exit status code

In t6402, we're checking number of files in the index and the working
tree by piping the output of Git's command to "wc -l", thus losing the
exit status code of git.

Let's use the new helper test_stdout_line_count in order to preserve
Git's exit status code.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6400: preserve git ls-files exit status code
Đoàn Trần Công Danh [Sun, 4 Jul 2021 05:46:11 +0000 (12:46 +0700)] 
t6400: preserve git ls-files exit status code

In t6400, we're checking number of files in the index and the working
tree by piping the output of "git ls-files" to "wc -l", thus losing the
exit status code of git.

Let's use the newly introduced test_stdout_line_count in order to check
the exit status code of Git's command.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotest-lib-functions: introduce test_stdout_line_count
Đoàn Trần Công Danh [Sun, 4 Jul 2021 05:46:10 +0000 (12:46 +0700)] 
test-lib-functions: introduce test_stdout_line_count

In some tests, we're checking the number of lines in output of some
commands, including but not limited to Git's command.

We're doing the check by running those commands in the left side of
a pipe, thus losing the exit status code of those commands. Meanwhile,
we really want to check the exit status code of Git's command.

Let's write the output of those commands to a temporary file, and use
test_line_count separately in order to check exit status code of
those commands properly.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: accelerate the checkout
Johannes Schindelin [Sun, 4 Jul 2021 22:55:14 +0000 (22:55 +0000)] 
ci: accelerate the checkout

By upgrading from v1 to v2 of `actions/checkout`, we avoid fetching all
the tags and the complete history: v2 only fetches one revision by
default. This should make things a lot faster.

Note that `actions/checkout@v2` seems to be incompatible with running in
containers: https://github.com/actions/checkout/issues/151. Therefore,
we stick with v1 there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci (vs-build): build with NO_GETTEXT
Dennis Ameling [Sun, 4 Jul 2021 22:55:13 +0000 (22:55 +0000)] 
ci (vs-build): build with NO_GETTEXT

We already build Git for Windows with `NO_GETTEXT` when compiling with
GCC. Let's do the same with Visual C, too.

Note that we do not technically _need_ to pass `NO_GETTEXT` explicitly
in that `make artifacts-tar` invocation because we do this while `MSVC`
is set (which will set `uname_S := Windows`, which in turn will set
`NO_GETTEXT = YesPlease`). But it is definitely nicer to be explicit
here.

Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
Helped-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoartifacts-tar: respect NO_GETTEXT
Johannes Schindelin [Sun, 4 Jul 2021 22:55:12 +0000 (22:55 +0000)] 
artifacts-tar: respect NO_GETTEXT

We obviously do not want to bundle `.mo` files during `make
artifacts-tar NO_GETTEXT=Yep`, but that was the case.

To fix that, go a step beyond just fixing the symptom, and simply
define the lists of `.po` and `.mo` files as empty if `NO_GETTEXT` is
set.

Helped-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci (windows): transfer also the Git-tracked files to the test jobs
Johannes Schindelin [Sun, 4 Jul 2021 22:55:11 +0000 (22:55 +0000)] 
ci (windows): transfer also the Git-tracked files to the test jobs

Git's test suite is excruciatingly slow on Windows, mainly due to the
fact that it executes a lot of shell script code, and that's simply not
native to Windows.

To help with that, we established the pattern where the artifacts are
first built in one job, and then multiple test jobs run in parallel
using the artifacts built in the first job.

We take pains in transferring only the build outputs, and letting
`actions/checkout` fill in the rest of the files.

One major downside of that strategy is that the test jobs might fail to
check out the intended revision (e.g. because the branch has been
updated while the build was running, as is frequently the case with the
`seen` branch).

Let's transfer also the files tracked by Git, and skip the checkout step
in the test jobs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobundle: remove "ref_list" in favor of string-list.c API
Ævar Arnfjörð Bjarmason [Fri, 2 Jul 2021 09:57:32 +0000 (11:57 +0200)] 
bundle: remove "ref_list" in favor of string-list.c API

Move away from the "struct ref_list" in bundle.c in favor of the
almost identical string-list.c API.

That API fits this use-case perfectly, but did not exist in its
current form when this code was added in 2e0afafebd (Add git-bundle:
move objects and references by archive, 2007-02-22), with hindsight we
could have used the path-list API, which later got renamed to
string-list. See 8fd2cb4069 (Extract helper bits from
c-merge-recursive work, 2006-07-25)

We need to change "name" to "string" and "oid" to "util" to make this
conversion, but other than that the APIs are pretty much identical for
what bundle.c made use of.

Let's also replace the memset(..,0,...) pattern with a more idiomatic
"INIT" macro, and finally add a *_release() function so to free the
allocated memory.

Before this the add_to_ref_list() would leak memory, now e.g. "bundle
list-heads" reports no memory leaks at all under valgrind.

In the bundle_header_init() function we're using a clever trick to
memcpy() what we'd get from the corresponding
BUNDLE_HEADER_INIT. There is a concurrent series to make use of that
pattern more generally, see [1].

1. https://lore.kernel.org/git/cover-0.5-00000000000-20210701T104855Z-avarab@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobundle.c: use a temporary variable for OIDs and names
Ævar Arnfjörð Bjarmason [Fri, 2 Jul 2021 09:57:31 +0000 (11:57 +0200)] 
bundle.c: use a temporary variable for OIDs and names

In preparation for moving away from accessing the OID and name via the
"oid" and "name" slots in a subsequent commit, change the code that
accesses it to use named variables. This makes the subsequent change
smaller.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobundle cmd: stop leaking memory from parse_options_cmd_bundle()
Ævar Arnfjörð Bjarmason [Fri, 2 Jul 2021 09:57:30 +0000 (11:57 +0200)] 
bundle cmd: stop leaking memory from parse_options_cmd_bundle()

Fix a memory leak from the prefix_filename() function introduced with
its use in 3b754eedd5 (bundle: use prefix_filename with bundle path,
2017-03-20).

As noted in that commit the leak was intentional as a part of being
sloppy about freeing resources just before we exit, I'm changing this
because I'll be fixing other memory leaks in the bundle API (including
the library version) in subsequent commits. It's easier to reason
about those fixes if valgrind runs cleanly at the end without any
leaks whatsoever.

An earlier version of this change[1] went out of its way to not leak
memory on the die() codepaths here, but doing so will only avoid
reports of potential leaks under heap-only leak trackers such as
valgrind, not the SANITIZE=leak mode.

Avoiding those leaks as well might be useful to enable us to run
cleanly under the likes of valgrind in the future. But for now the
relative verbosity of the resulting code, and the fact that we don't
have some valgrind or SANITIZE=leak mode as part of our CI (it's only
run ad-hoc, see [2]), means we're not worrying about that for now.

1. https://lore.kernel.org/git/87v95vdxrc.fsf@evledraar.gmail.com/
2. https://lore.kernel.org/git/87czsv2idy.fsf@evledraar.gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>