Git development
 help / color / mirror / Atom feed
* Re: Request for Help - Too many perl arguments as of 2.43.0-rc0
From: Jeff King @ 2023-11-05  5:34 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: rsbecker, Git List
In-Reply-To: <CAPig+cTy7Mq1xhTtssoUDpwrCNB_65q4VjK902jOpJ4469_tLw@mail.gmail.com>

On Sat, Nov 04, 2023 at 08:11:01PM -0400, Eric Sunshine wrote:

> > Hmm. With compilation, we split the audience of "developers" vs "people
> > who just want to build the program", and we crank up the number and
> > severity of warning checks for the former. We could do the same here for
> > tests. I.e., turn off test linting by default and re-enable it for
> > DEVELOPER=1.
> 
> My knee-jerk reaction is that this would move us in the wrong
> direction since it is probable that most drive-by contributors won't
> have DEVELOPER=1 set, yet they are the ones who are likely to benefit
> most from test script linting (which is not to say that it doesn't
> help seasoned contributors, as well).

Yeah, that's a good point. If the linting is not causing frequent
headaches (and I don't think it is), then we are better to leave it on
by default.

-Peff

^ permalink raw reply

* OT: data destruction classics (was: Re: Error converting from 1.4.4.1 to 1.5.0?)
From: LON CHAIHONG @ 2023-11-05 13:33 UTC (permalink / raw)
  To: corecode; +Cc: git, rael

[-- Attachment #1: image0.png --]
[-- Type: image/png, Size: 306157 bytes --]

[-- Attachment #2: image1.jpeg --]
[-- Type: image/jpeg, Size: 2636251 bytes --]

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]



Sent from my iPhone

^ permalink raw reply

* git init --initial-branch (should docs mention v2 protocol)
From: Sheik @ 2023-11-05 23:17 UTC (permalink / raw)
  To: git

Hi Maintainers,


Currently it is not obvious from the docs that (git init 
--initial-branch) needs v2 protocol setup on ssh server for (git clone) 
to work properly with unborn refs, as seen in this email thread

 1. https://lore.kernel.org/git/63eb269e-72b9-4830-98fc-aeef8b8180d7@gmail.com/T/#u


Should a link to the v2 protocol documentation be added in "git init 
--initial-branch" to make this configuration more obvious for admins/users?

 1. https://git-scm.com/docs/git-init#Documentation/git-init.txt---initial-branchltbranch-namegt
 2. https://git-scm.com/docs/gitprotocol-v2


[System Info]
git version:
git version 2.42.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.5.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1 
(2023-10-07) x86_64
compiler info: gnuc: 13.2
libc info: glibc: 2.37
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]
not run from a git repository - no hooks to show


Thanks

Sheik



^ permalink raw reply

* Re: [PATCH v2 1/2] rebase: support non-interactive autosquash
From: Junio C Hamano @ 2023-11-06  0:50 UTC (permalink / raw)
  To: Andy Koppe; +Cc: git, newren
In-Reply-To: <20231104220330.14577-1-andy.koppe@gmail.com>

Andy Koppe <andy.koppe@gmail.com> writes:

> So far, the rebase --autosquash option and rebase.autoSquash=true
> config setting are quietly ignored when used without --interactive,
> except that they prevent fast-forward and that they trigger conflicts
> with --apply and relatives, which is less than helpful particularly for
> the config setting.

OK.  You do not explicitly say "So far," by the way.  Our log
message convention is to first describe what happens in the system
in the present tense to illustrate why it is suboptimal, to prepare
readers' minds to anticipate the solution, which is described next.

> Since the "merge" backend used for interactive rebase also is the
> default for non-interactive rebase, there doesn't appear to be a
> reason not to do --autosquash without --interactive, so support that.

Nice.

> Turn rebase.autoSquash into a comma-separated list of flags, with
> "interactive" or "i" enabling auto-squashing with --interactive, and
> "no-interactive" or "no-i" enabling it without. Make boolean true mean
> "interactive" for backward compatibility.

"i" and "no-i" are questionable (will talk about them later), but
otherwise, nicely explained.

> Don't prevent fast-forwards or report conflicts with --apply options
> when auto-squashing is not active.
>
> Change the git-rebase and config/rebase documentation accordingly, and
> extend t3415-rebase-autosquash.sh to test the new rebase.autosquash
> values and combinations with and without --interactive.
>
> Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
> ---

When asking reviews on a new iteration [PATCH v(N+1)], please
summarize the differences relative to [PATCH vN].  For explaining
such incremental changes for individual patches, here between the
three-dash line and the diffstat is the place to do so.  When you
have a cover letter [PATCH 0/X], it can be done in that messaage.
Either way is OK.  Doing both is also helpful as long as the
explanation done in two places do not contradict with each other.

>  Documentation/config/rebase.txt        | 11 +++-
>  Documentation/git-rebase.txt           |  2 +-
>  builtin/rebase.c                       | 63 ++++++++++++++-----
>  t/t3415-rebase-autosquash.sh           | 83 +++++++++++++++++++++-----
>  t/t3422-rebase-incompatible-options.sh |  2 +-
>  5 files changed, 129 insertions(+), 32 deletions(-)
>
> diff --git a/Documentation/config/rebase.txt b/Documentation/config/rebase.txt
> index 9c248accec..68191e5673 100644
> --- a/Documentation/config/rebase.txt
> +++ b/Documentation/config/rebase.txt
> @@ -9,7 +9,16 @@ rebase.stat::
>  	rebase. False by default.
>  
>  rebase.autoSquash::
> -	If set to true enable `--autosquash` option by default.
> +	A comma-separated list of flags for when to enable auto-squashing.
> +	Specifying `interactive` or `i` enables auto-squashing for rebasing with
> +	`--interactive`, whereas `no-interactive` or `no-i` enables it for
> +	rebasing without that option. For example, setting this to `i,no-i`
> +	enables auto-squashing for both types. Setting it to true is equivalent
> +	to setting it to `interactive`.
> +
> +	The `--autosquash` and `--no-autosquash` options of
> +	linkgit:git-rebase[1] override the setting here.
> +	Auto-squashing is disabled by default.

If you trid to format the documentation before sending this patch,
you'd have seen the second paragraph formatted as if it were a code
snippet.  Dedent the second paragraph (and later ones if you had
more than one extra paragraphs), and turn the blank line between the
paragraphs into a line with "+" (and nothing else) on it.  See the
description of `--autosquash` option in Documentation/git-rebase.txt
for an example.

> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index e7b39ad244..102ff91493 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -592,7 +592,7 @@ See also INCOMPATIBLE OPTIONS below.
>  	When the commit log message begins with "squash! ..." or "fixup! ..."
>  	or "amend! ...", and there is already a commit in the todo list that
>  	matches the same `...`, automatically modify the todo list of
> -	`rebase -i`, so that the commit marked for squashing comes right after
> +	`rebase`, so that the commit marked for squashing comes right after
>  	the commit to be modified, and change the action of the moved commit
>  	from `pick` to `squash` or `fixup` or `fixup -C` respectively. A commit
>  	matches the `...` if the commit subject matches, or if the `...` refers
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 261a9a61fc..0403c7415c 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -131,7 +131,10 @@ struct rebase_options {
>  	int reapply_cherry_picks;
>  	int fork_point;
>  	int update_refs;
> -	int config_autosquash;
> +	enum {
> +		AUTOSQUASH_INTERACTIVE = 1 << 0,
> +		AUTOSQUASH_NO_INTERACTIVE = 1 << 1,
> +	} config_autosquash;
>  	int config_rebase_merges;
>  	int config_update_refs;
>  };
> @@ -149,7 +152,6 @@ struct rebase_options {
>  		.reapply_cherry_picks = -1,             \
>  		.allow_empty_message = 1,               \
>  		.autosquash = -1,                       \
> -		.config_autosquash = -1,                \
>  		.rebase_merges = -1,                    \
>  		.config_rebase_merges = -1,             \
>  		.update_refs = -1,                      \
> @@ -711,10 +713,8 @@ static int run_specific_rebase(struct rebase_options *opts)
>  	if (opts->type == REBASE_MERGE) {
>  		/* Run sequencer-based rebase */
>  		setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1);
> -		if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
> +		if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT))
>  			setenv("GIT_SEQUENCE_EDITOR", ":", 1);
> -			opts->autosquash = 0;
> -		}
>  		if (opts->gpg_sign_opt) {
>  			/* remove the leading "-S" */
>  			char *tmp = xstrdup(opts->gpg_sign_opt + 2);
> @@ -748,6 +748,27 @@ static int run_specific_rebase(struct rebase_options *opts)
>  	return status ? -1 : 0;
>  }
>  
> +static void parse_rebase_autosquash_value(struct rebase_options *opts,
> +					  const char *var, const char *value)
> +{
> +	struct string_list tokens = STRING_LIST_INIT_NODUP;
> +	char *buf = xstrdup(value);
> +
> +	opts->config_autosquash = 0;
> +	string_list_split_in_place(&tokens, buf, ",", -1);
> +
> +	for (int i = 0; i < tokens.nr; i++) {
> +		const char *s = tokens.items[i].string;
> +
> +		if (!strcmp(s, "i") || !strcmp(s, "interactive"))
> +			opts->config_autosquash |= AUTOSQUASH_INTERACTIVE;
> +		else if (!strcmp(s, "no-i") || !strcmp(s, "no-interactive"))
> +			opts->config_autosquash |= AUTOSQUASH_NO_INTERACTIVE;
> +		else
> +			die(_("invalid value for '%s': '%s'"), var, s);
> +	}
> +}

OK, by clearing opts->config_autosquash in this function, you keep
the rebase.autosquash to be "the last one wins" as a whole.  If a
configuration file with lower precedence (e.g., /etc/gitconfig) says
"[rebase] autosquash" to set it to "interactive,no-interactive", a
separate setting in your ~/.gitconfig "[rebase] autosquash = false"
would override both bits.

A more involved design may let the users override these bits
independently by allowing something like "!no-i" (take whatever the
lower precedence configuration file says for the interactive case,
but disable autosquash when running a non-interactive rebase) as the
value, but I think the approach taken by this patch to allow replacing
as a whole is OK.  It is simpler to explain.

Giving short-hands for often used command line options is one thing,
but I do not think a short-hand is warranted here, especially when
the other one needs to be a less-than-half legible "no-i" that does
not allow "no-int" and friends, for configuration variable values.
I'd strongly suggest dropping them.

Thanks.

^ permalink raw reply

* What's cooking in git.git (Nov 2023, #02; Mon, 6)
From: Junio C Hamano @ 2023-11-06  2:47 UTC (permalink / raw)
  To: git

Here are the topics that have been cooking in my tree.  Commits
prefixed with '+' are in 'next' (being in 'next' is a sign that a
topic is stable enough to be used and are candidate to be in a
future release).  Commits prefixed with '-' are only in 'seen', and
aren't considered "accepted" at all and may be annotated with an URL
to a message that raises issues but they are no means exhaustive.  A
topic without enough support may be discarded after a long period of
no activity (of course they can be resubmit when new interests
arise).

Copies of the source code to Git live in many repositories, and the
following is a list of the ones I push into or their mirrors.  Some
repositories have only a subset of branches.

With maint, master, next, seen, todo:

	git://git.kernel.org/pub/scm/git/git.git/
	git://repo.or.cz/alt-git.git/
	https://kernel.googlesource.com/pub/scm/git/git/
	https://github.com/git/git/
	https://gitlab.com/git-vcs/git/

With all the integration branches and topics broken out:

	https://github.com/gitster/git/

Even though the preformatted documentation in HTML and man format
are not sources, they are published in these repositories for
convenience (replace "htmldocs" with "manpages" for the manual
pages):

	git://git.kernel.org/pub/scm/git/git-htmldocs.git/
	https://github.com/gitster/git-htmldocs.git/

Release tarballs are available at:

	https://www.kernel.org/pub/software/scm/git/

--------------------------------------------------
[New Topics]

* jw/git-add-attr-pathspec (2023-11-04) 1 commit
 - attr: enable attr pathspec magic for git-add and git-stash

 "git add" and "git stash" learned to support the ":(attr:...)"
 magic pathspec.

 Will merge to 'next'?
 source: <20231103163449.1578841-1-jojwang@google.com>


* la/strvec-header-fix (2023-11-03) 1 commit
  (merged to 'next' on 2023-11-03 at db23d8a911)
 + strvec: drop unnecessary include of hex.h

 Code clean-up.

 Will merge to 'master'.
 source: <pull.1608.git.1698958277454.gitgitgadget@gmail.com>


* jk/chunk-bounds (2023-11-04) 1 commit
  (merged to 'next' on 2023-11-06 at ae9fbc1700)
 + t: avoid perl's pack/unpack "Q" specifier

 Test portability fix.

 Will merge to 'master'.
 source: <20231103162019.GB1470570@coredump.intra.peff.net>


* js/ci-use-macos-13 (2023-11-03) 1 commit
  (merged to 'next' on 2023-11-06 at f7406347cd)
 + ci: upgrade to using macos-13

 Replace macos-12 used at GitHub CI with macos-13.

 Will merge to 'master'.
 source: <pull.1607.git.1698996455218.gitgitgadget@gmail.com>

--------------------------------------------------
[Stalled]

* pw/rebase-sigint (2023-09-07) 1 commit
 - rebase -i: ignore signals when forking subprocesses

 If the commit log editor or other external programs (spawned via
 "exec" insn in the todo list) receive internactive signal during
 "git rebase -i", it caused not just the spawned program but the
 "Git" process that spawned them, which is often not what the end
 user intended.  "git" learned to ignore SIGINT and SIGQUIT while
 waiting for these subprocesses.

 Expecting a reroll.
 cf. <12c956ea-330d-4441-937f-7885ab519e26@gmail.com>
 source: <pull.1581.git.1694080982621.gitgitgadget@gmail.com>


* tk/cherry-pick-sequence-requires-clean-worktree (2023-06-01) 1 commit
 - cherry-pick: refuse cherry-pick sequence if index is dirty

 "git cherry-pick A" that replays a single commit stopped before
 clobbering local modification, but "git cherry-pick A..B" did not,
 which has been corrected.

 Expecting a reroll.
 cf. <999f12b2-38d6-f446-e763-4985116ad37d@gmail.com>
 source: <pull.1535.v2.git.1685264889088.gitgitgadget@gmail.com>


* jc/diff-cached-fsmonitor-fix (2023-09-15) 3 commits
 - diff-lib: fix check_removed() when fsmonitor is active
 - Merge branch 'jc/fake-lstat' into jc/diff-cached-fsmonitor-fix
 - Merge branch 'js/diff-cached-fsmonitor-fix' into jc/diff-cached-fsmonitor-fix
 (this branch uses jc/fake-lstat.)

 The optimization based on fsmonitor in the "diff --cached"
 codepath is resurrected with the "fake-lstat" introduced earlier.

 It is unknown if the optimization is worth resurrecting, but in case...
 source: <xmqqr0n0h0tw.fsf@gitster.g>

--------------------------------------------------
[Cooking]

* jc/strbuf-comment-line-char (2023-11-01) 4 commits
 - strbuf: move env-using functions to environment.c
 - strbuf: make add_lines() public
 - strbuf_add_commented_lines(): drop the comment_line_char parameter
 - strbuf_commented_addf(): drop the comment_line_char parameter

 Code simplification.
 source: <cover.1698791220.git.jonathantanmy@google.com>


* ps/show-ref (2023-11-01) 12 commits
  (merged to 'next' on 2023-11-02 at 987bb117f5)
 + t: use git-show-ref(1) to check for ref existence
 + builtin/show-ref: add new mode to check for reference existence
 + builtin/show-ref: explicitly spell out different modes in synopsis
 + builtin/show-ref: ensure mutual exclusiveness of subcommands
 + builtin/show-ref: refactor options for patterns subcommand
 + builtin/show-ref: stop using global vars for `show_one()`
 + builtin/show-ref: stop using global variable to count matches
 + builtin/show-ref: refactor `--exclude-existing` options
 + builtin/show-ref: fix dead code when passing patterns
 + builtin/show-ref: fix leaking string buffer
 + builtin/show-ref: split up different subcommands
 + builtin/show-ref: convert pattern to a local variable
 (this branch is used by ps/ref-tests-update.)

 Teach "git show-ref" a mode to check the existence of a ref.

 Will merge to 'master'.
 source: <cover.1698739941.git.ps@pks.im>


* rc/trace-upload-pack (2023-10-30) 1 commit
  (merged to 'next' on 2023-11-01 at 90892b5cf0)
 + upload-pack: add tracing for fetches

 Trace2 update.

 Will merge to 'master'.
 source: <pull.1598.v2.git.1697577168128.gitgitgadget@gmail.com>


* bc/merge-file-object-input (2023-11-02) 2 commits
  (merged to 'next' on 2023-11-02 at ccbba9416c)
 + merge-file: add an option to process object IDs
 + git-merge-file doc: drop "-file" from argument placeholders

 "git merge-file" learns a mode to read three contents to be merged
 from blob objects.

 Will merge to 'master'.
 source: <20231101192419.794162-1-sandals@crustytoothpaste.net>


* jc/test-i18ngrep (2023-11-02) 2 commits
  (merged to 'next' on 2023-11-03 at 78406f8d94)
 + tests: teach callers of test_i18ngrep to use test_grep
 + test framework: further deprecate test_i18ngrep

 Another step to deprecate test_i18ngrep.

 Will merge to 'master'.
 source: <20231031052330.3762989-1-gitster@pobox.com>


* an/clang-format-typofix (2023-11-01) 1 commit
  (merged to 'next' on 2023-11-02 at 7f639690ab)
 + clang-format: fix typo in comment

 Typofix.

 Will merge to 'master'.
 source: <pull.1602.v2.git.git.1698759629166.gitgitgadget@gmail.com>


* jk/tree-name-and-depth-limit (2023-11-02) 1 commit
  (merged to 'next' on 2023-11-06 at 041423344c)
 + max_tree_depth: lower it for MSVC to avoid stack overflows

 Further limit tree depth max to avoid Windows build running out of
 the stack space.

 Will merge to 'master'.
 source: <pull.1604.v2.git.1698843810814.gitgitgadget@gmail.com>


* ar/submitting-patches-doc-update (2023-10-24) 1 commit
  (merged to 'next' on 2023-10-30 at e140009eb6)
 + SubmittingPatches: call gitk's command "Copy commit reference"

 Doc update.

 Will merge to 'master'.
 source: <20231024195123.911431-1-rybak.a.v@gmail.com>


* es/bugreport-no-extra-arg (2023-10-29) 2 commits
  (merged to 'next' on 2023-11-01 at 4ca0a9c77c)
 + bugreport: reject positional arguments
 + t0091-bugreport: stop using i18ngrep

 "git bugreport" learned to complain when it received a command line
 argument that it will not use.

 Will merge to 'master'.
 source: <20231026155459.2234929-1-nasamuffin@google.com>


* js/my-first-contribution-update (2023-10-28) 1 commit
  (merged to 'next' on 2023-11-01 at 94590ee724)
 + Include gettext.h in MyFirstContribution tutorial

 Documentation update.

 Will merge to 'master'.
 source: <20231017041503.3249-1-jacob@initialcommit.io>


* ms/send-email-validate-fix (2023-10-26) 1 commit
  (merged to 'next' on 2023-11-01 at f9dd32186b)
 + send-email: move validation code below process_address_list

 "git send-email" did not have certain pieces of data computed yet
 when it tried to validate the outging messages and its recipient
 addresses, which has been sorted out.

 Will merge to 'master'.
 source: <ddd4bfdd-ed14-44f4-89d3-192332bbc1c4@amd.com>


* ps/ci-gitlab (2023-11-02) 8 commits
 - ci: add support for GitLab CI
 - ci: install test dependencies for linux-musl
 - ci: squelch warnings when testing with unusable Git repo
 - ci: unify setup of some environment variables
 - ci: split out logic to set up failed test artifacts
 - ci: group installation of Docker dependencies
 - ci: make grouping setup more generic
 - ci: reorder definitions for grouping functions

 Add support for GitLab CI.

 Comments?
 source: <cover.1698843660.git.ps@pks.im>


* ps/ref-tests-update (2023-11-03) 10 commits
 - t: mark several tests that assume the files backend with REFFILES
 - t7900: assert the absence of refs via git-for-each-ref(1)
 - t7300: assert exact states of repo
 - t4207: delete replace references via git-update-ref(1)
 - t1450: convert tests to remove worktrees via git-worktree(1)
 - t: convert tests to not access reflog via the filesystem
 - t: convert tests to not access symrefs via the filesystem
 - t: convert tests to not write references via the filesystem
 - t: allow skipping expected object ID in `ref-store update-ref`
 - Merge branch 'ps/show-ref' into ps/ref-tests-update
 (this branch uses ps/show-ref.)

 Update ref-related tests.

 Will merge to 'next'?
 source: <cover.1698914571.git.ps@pks.im>


* rs/fix-arghelp (2023-10-29) 1 commit
  (merged to 'next' on 2023-11-01 at cd923d3362)
 + am, rebase: fix arghelp syntax of --empty

 Doc and help update.

 Will merge to 'master'.
 source: <10e09b2d-15d7-4af1-b24c-217f9e2f457a@web.de>


* rs/parse-options-cmdmode (2023-10-29) 2 commits
  (merged to 'next' on 2023-11-01 at b83328f1e7)
 + am: simplify --show-current-patch handling
 + parse-options: make CMDMODE errors more precise

 parse-options improvements for OPT_CMDMODE options.

 Will merge to 'master'.
 source: <4520156b-9418-493c-a50c-e61b42e805b3@web.de>


* rs/reflog-expire-single-worktree-fix (2023-10-29) 1 commit
  (merged to 'next' on 2023-11-01 at 6b4dab2cd2)
 + reflog: fix expire --single-worktree

 "git reflog expire --single-worktree" has been broken for the past
 20 months or so, which has been corrected.

 Will merge to 'master'.
 source: <63eade0e-bf2c-4906-8b4c-689797cff737@web.de>


* jx/fetch-atomic-error-message-fix (2023-10-19) 2 commits
 - fetch: no redundant error message for atomic fetch
 - t5574: test porcelain output of atomic fetch

 "git fetch --atomic" issued an unnecessary empty error message,
 which has been corrected.

 Needs review.
 source: <ced46baeb1c18b416b4b4cc947f498bea2910b1b.1697725898.git.zhiyou.jx@alibaba-inc.com>


* js/bugreport-in-the-same-minute (2023-10-16) 1 commit
 - bugreport: include +i in outfile suffix as needed

 Instead of auto-generating a filename that is already in use for
 output and fail the command, `git bugreport` learned to fuzz the
 filename to avoid collisions with existing files.

 Expecting a reroll.
 cf. <ZTtZ5CbIGETy1ucV.jacob@initialcommit.io>
 source: <20231016214045.146862-2-jacob@initialcommit.io>


* kh/t7900-cleanup (2023-10-17) 9 commits
 - t7900: fix register dependency
 - t7900: factor out packfile dependency
 - t7900: fix `print-args` dependency
 - t7900: fix `pfx` dependency
 - t7900: factor out common schedule setup
 - t7900: factor out inheritance test dependency
 - t7900: create commit so that branch is born
 - t7900: setup and tear down clones
 - t7900: remove register dependency

 Test clean-up.

 Perhaps discard?
 cf. <655ca147-c214-41be-919d-023c1b27b311@app.fastmail.com>
 source: <cover.1697319294.git.code@khaugsbakk.name>


* tb/merge-tree-write-pack (2023-10-23) 5 commits
 - builtin/merge-tree.c: implement support for `--write-pack`
 - bulk-checkin: introduce `index_tree_bulk_checkin_incore()`
 - bulk-checkin: introduce `index_blob_bulk_checkin_incore()`
 - bulk-checkin: generify `stream_blob_to_pack()` for arbitrary types
 - bulk-checkin: extract abstract `bulk_checkin_source`

 "git merge-tree" learned "--write-pack" to record its result
 without creating loose objects.

 Will merge to 'next'?
 source: <cover.1698101088.git.me@ttaylorr.com>


* tb/format-pack-doc-update (2023-11-01) 2 commits
  (merged to 'next' on 2023-11-02 at 538991fe9b)
 + Documentation/gitformat-pack.txt: fix incorrect MIDX documentation
 + Documentation/gitformat-pack.txt: fix typo

 Doc update.

 Will merge to 'master'.
 source: <cover.1698780244.git.me@ttaylorr.com>


* ps/do-not-trust-commit-graph-blindly-for-existence (2023-11-01) 2 commits
  (merged to 'next' on 2023-11-01 at 06037376ee)
 + commit: detect commits that exist in commit-graph but not in the ODB
 + commit-graph: introduce envvar to disable commit existence checks
 (this branch is used by kn/rev-list-missing-fix.)

 The codepath to traverse the commit-graph learned to notice that a
 commit is missing (e.g., corrupt repository lost an object), even
 though it knows something about the commit (like its parents) from
 what is in commit-graph.

 Will merge to 'master'.
 source: <cover.1698736363.git.ps@pks.im>


* tb/pair-chunk-expect-size (2023-10-14) 8 commits
 - midx: read `OOFF` chunk with `pair_chunk_expect()`
 - midx: read `OIDL` chunk with `pair_chunk_expect()`
 - midx: read `OIDF` chunk with `pair_chunk_expect()`
 - commit-graph: read `BIDX` chunk with `pair_chunk_expect()`
 - commit-graph: read `GDAT` chunk with `pair_chunk_expect()`
 - commit-graph: read `CDAT` chunk with `pair_chunk_expect()`
 - commit-graph: read `OIDF` chunk with `pair_chunk_expect()`
 - chunk-format: introduce `pair_chunk_expect()` helper

 Code clean-up for jk/chunk-bounds topic.

 Comments?
 source: <45cac29403e63483951f7766c6da3c022c68d9f0.1697225110.git.me@ttaylorr.com>
 source: <cover.1697225110.git.me@ttaylorr.com>


* jc/grep-f-relative-to-cwd (2023-10-12) 1 commit
  (merged to 'next' on 2023-10-31 at 0d32547b18)
 + grep: -f <path> is relative to $cwd

 "cd sub && git grep -f patterns" tried to read "patterns" file at
 the top level of the working tree; it has been corrected to read
 "sub/patterns" instead.

 Will merge to 'master'.
 cf. <ZUAnEVk65VQQE263@nand.local>
 source: <xmqqedhzg37z.fsf@gitster.g>


* tb/path-filter-fix (2023-10-18) 17 commits
 - bloom: introduce `deinit_bloom_filters()`
 - commit-graph: reuse existing Bloom filters where possible
 - object.h: fix mis-aligned flag bits table
 - commit-graph: drop unnecessary `graph_read_bloom_data_context`
 - commit-graph.c: unconditionally load Bloom filters
 - bloom: prepare to discard incompatible Bloom filters
 - bloom: annotate filters with hash version
 - commit-graph: new filter ver. that fixes murmur3
 - repo-settings: introduce commitgraph.changedPathsVersion
 - t4216: test changed path filters with high bit paths
 - t/helper/test-read-graph: implement `bloom-filters` mode
 - bloom.h: make `load_bloom_filter_from_graph()` public
 - t/helper/test-read-graph.c: extract `dump_graph_info()`
 - gitformat-commit-graph: describe version 2 of BDAT
 - commit-graph: ensure Bloom filters are read with consistent settings
 - revision.c: consult Bloom filters for root commits
 - t/t4216-log-bloom.sh: harden `test_bloom_filters_not_used()`

 The Bloom filter used for path limited history traversal was broken
 on systems whose "char" is unsigned; update the implementation and
 bump the format version to 2.

 Needs (hopefully final and quick) review.
 source: <cover.1697653929.git.me@ttaylorr.com>


* kn/rev-list-missing-fix (2023-11-01) 4 commits
  (merged to 'next' on 2023-11-02 at 2469dfc402)
 + rev-list: add commit object support in `--missing` option
 + rev-list: move `show_commit()` to the bottom
 + revision: rename bit to `do_not_die_on_missing_objects`
 + Merge branch 'ps/do-not-trust-commit-graph-blindly-for-existence' into kn/rev-list-missing-fix
 (this branch uses ps/do-not-trust-commit-graph-blindly-for-existence.)

 "git rev-list --missing" did not work for missing commit objects,
 which has been corrected.

 Will merge to 'master'.
 source: <20231026101109.43110-1-karthik.188@gmail.com>


* cc/git-replay (2023-11-03) 14 commits
 - replay: stop assuming replayed branches do not diverge
 - replay: add --contained to rebase contained branches
 - replay: add --advance or 'cherry-pick' mode
 - replay: use standard revision ranges
 - replay: make it a minimal server side command
 - replay: remove HEAD related sanity check
 - replay: remove progress and info output
 - replay: add an important FIXME comment about gpg signing
 - replay: change rev walking options
 - replay: introduce pick_regular_commit()
 - replay: die() instead of failing assert()
 - replay: start using parse_options API
 - replay: introduce new builtin
 - t6429: remove switching aspects of fast-rebase

 Introduce "git replay", a tool meant on the server side without
 working tree to recreate a history.

 Will merge to 'next'?
 source: <20231102135151.843758-1-christian.couder@gmail.com>


* ak/color-decorate-symbols (2023-10-23) 7 commits
 - log: add color.decorate.pseudoref config variable
 - refs: exempt pseudorefs from pattern prefixing
 - refs: add pseudorefs array and iteration functions
 - log: add color.decorate.ref config variable
 - log: add color.decorate.symbol config variable
 - log: use designated inits for decoration_colors
 - config: restructure color.decorate documentation

 A new config for coloring.

 Needs review.
 source: <20231023221143.72489-1-andy.koppe@gmail.com>


* js/update-urls-in-doc-and-comment (2023-09-26) 4 commits
 - doc: refer to internet archive
 - doc: update links for andre-simon.de
 - doc: update links to current pages
 - doc: switch links to https

 Stale URLs have been updated to their current counterparts (or
 archive.org) and HTTP links are replaced with working HTTPS links.

 Needs review.
 source: <pull.1589.v2.git.1695553041.gitgitgadget@gmail.com>


* la/trailer-cleanups (2023-10-20) 3 commits
 - trailer: use offsets for trailer_start/trailer_end
 - trailer: find the end of the log message
 - commit: ignore_non_trailer computes number of bytes to ignore

 Code clean-up.

 Will merge to 'next'?
 source: <pull.1563.v5.git.1697828495.gitgitgadget@gmail.com>


* eb/hash-transition (2023-10-02) 30 commits
 - t1016-compatObjectFormat: add tests to verify the conversion between objects
 - t1006: test oid compatibility with cat-file
 - t1006: rename sha1 to oid
 - test-lib: compute the compatibility hash so tests may use it
 - builtin/ls-tree: let the oid determine the output algorithm
 - object-file: handle compat objects in check_object_signature
 - tree-walk: init_tree_desc take an oid to get the hash algorithm
 - builtin/cat-file: let the oid determine the output algorithm
 - rev-parse: add an --output-object-format parameter
 - repository: implement extensions.compatObjectFormat
 - object-file: update object_info_extended to reencode objects
 - object-file-convert: convert commits that embed signed tags
 - object-file-convert: convert commit objects when writing
 - object-file-convert: don't leak when converting tag objects
 - object-file-convert: convert tag objects when writing
 - object-file-convert: add a function to convert trees between algorithms
 - object: factor out parse_mode out of fast-import and tree-walk into in object.h
 - cache: add a function to read an OID of a specific algorithm
 - tag: sign both hashes
 - commit: export add_header_signature to support handling signatures on tags
 - commit: convert mergetag before computing the signature of a commit
 - commit: write commits for both hashes
 - object-file: add a compat_oid_in parameter to write_object_file_flags
 - object-file: update the loose object map when writing loose objects
 - loose: compatibilty short name support
 - loose: add a mapping between SHA-1 and SHA-256 for loose objects
 - repository: add a compatibility hash algorithm
 - object-names: support input of oids in any supported hash
 - oid-array: teach oid-array to handle multiple kinds of oids
 - object-file-convert: stubs for converting from one object format to another

 Teach a repository to work with both SHA-1 and SHA-256 hash algorithms.

 Needs review.
 source: <878r8l929e.fsf@gmail.froward.int.ebiederm.org>


* jx/remote-archive-over-smart-http (2023-10-04) 4 commits
 - archive: support remote archive from stateless transport
 - transport-helper: call do_take_over() in connect_helper
 - transport-helper: call do_take_over() in process_connect
 - transport-helper: no connection restriction in connect_helper

 "git archive --remote=<remote>" learned to talk over the smart
 http (aka stateless) transport.

 Needs review.
 source: <cover.1696432593.git.zhiyou.jx@alibaba-inc.com>


* jx/sideband-chomp-newline-fix (2023-10-04) 3 commits
 - pkt-line: do not chomp newlines for sideband messages
 - pkt-line: memorize sideband fragment in reader
 - test-pkt-line: add option parser for unpack-sideband

 Sideband demultiplexer fixes.

 Needs review.
 source: <cover.1696425168.git.zhiyou.jx@alibaba-inc.com>


* js/config-parse (2023-09-21) 5 commits
 - config-parse: split library out of config.[c|h]
 - config.c: accept config_parse_options in git_config_from_stdin
 - config: report config parse errors using cb
 - config: split do_event() into start and flush operations
 - config: split out config_parse_options

 The parsing routines for the configuration files have been split
 into a separate file.

 Needs review.
 source: <cover.1695330852.git.steadmon@google.com>


* jc/fake-lstat (2023-09-15) 1 commit
 - cache: add fake_lstat()
 (this branch is used by jc/diff-cached-fsmonitor-fix.)

 A new helper to let us pretend that we called lstat() when we know
 our cache_entry is up-to-date via fsmonitor.

 Needs review.
 source: <xmqqcyykig1l.fsf@gitster.g>


* js/doc-unit-tests (2023-11-02) 3 commits
 - ci: run unit tests in CI
 - unit tests: add TAP unit test framework
 - unit tests: add a project plan document
 (this branch is used by js/doc-unit-tests-with-cmake.)

 Process to add some form of low-level unit tests has started.

 Will merge to 'next'?
 source: <cover.1698881249.git.steadmon@google.com>


* js/doc-unit-tests-with-cmake (2023-11-02) 7 commits
 - cmake: handle also unit tests
 - cmake: use test names instead of full paths
 - cmake: fix typo in variable name
 - artifacts-tar: when including `.dll` files, don't forget the unit-tests
 - unit-tests: do show relative file paths
 - unit-tests: do not mistake `.pdb` files for being executable
 - cmake: also build unit tests
 (this branch uses js/doc-unit-tests.)

 Update the base topic to work with CMake builds.

 Will merge to 'next'?
 source: <pull.1579.v3.git.1695640836.gitgitgadget@gmail.com>


* jc/rerere-cleanup (2023-08-25) 4 commits
 - rerere: modernize use of empty strbuf
 - rerere: try_merge() should use LL_MERGE_ERROR when it means an error
 - rerere: fix comment on handle_file() helper
 - rerere: simplify check_one_conflict() helper function

 Code clean-up.

 Not ready to be reviewed yet.
 source: <20230824205456.1231371-1-gitster@pobox.com>


* rj/status-bisect-while-rebase (2023-10-16) 1 commit
 - status: fix branch shown when not only bisecting

 "git status" is taught to show both the branch being bisected and
 being rebased when both are in effect at the same time.

 Needs review.
 source: <2e24ca9b-9c5f-f4df-b9f8-6574a714dfb2@gmail.com>

^ permalink raw reply

* Re: why does git set X in LESS env var?
From: Dragan Simic @ 2023-11-06  3:47 UTC (permalink / raw)
  To: Thomas Guyot; +Cc: Junio C Hamano, Jeff King, Christoph Anton Mitterer, git
In-Reply-To: <79cf1bf35ba6c9348735685b01e0f2f9@manjaro.org>

On 2023-11-02 15:19, Dragan Simic wrote:
> On 2023-11-02 14:19, Thomas Guyot wrote:
>> On 2023-11-02 02:48, Dragan Simic wrote:
>>> We've basically reached some kind of an agreement about the need for 
>>> a
>>> good solution, which turned out to be rather complex as a result of
>>> being quite universal and extensible, which was required for it to,
>>> hopefully, be accepted into less(1).  Also, the author of less(1) 
>>> seems
>>> to be quite busy with some other things, and he prefers to implement 
>>> new
>>> features himself.
>>> 
>>> We've also agreed on another new feature for less(1), hopefully, 
>>> which
>>> isn't exactly related, but should be quite useful.  It's about the
>>> secure mode for less(1).
>> 
>> Feel free to cc me on your next correspondence. If there are mailing
>> lists archives for the thread I'll fetch them as needed. We have at
>> least one working term/switch combination, which IMO is a better start
>> than nothing :)
> 
> Please test the "--redraw-on-quit" option, AFAICT that's all we need
> (plus the already mentioned other improvements to less(1), to avoid
> the version-dependent workarounds), and the distributions will
> eventually catch up with the newer versions of less(1).  If the whole
> thing has worked for decades as-is, it can continue working that way
> for a year or two until the packages get updated.
> 
> There's actually no two-way mailing list for less(1), the entire
> project is pretty much a one-man show, so to speak.  There's a GitHub
> page that allows issues to be submitted, but I didn't use that, so I
> exchanged a few private email messages instead with the author.  I've
> already summed up the important parts of those messages.

Good news! :)  The author of less(1) has implemented a couple of new 
features that should resolve our issues with the pagination.  The 
improvements for the secure mode of less(1) have also been implemented.  
I'll test all that in detail, and I'll move forward with implementing 
the required changes in Git.

It seems that a new version of less(1) may also be released rather soon, 
so we might be on a good way to have these longstanding issues resolved 
in the upcoming releases of Git and less(1).  It will take time for the 
Linux distributions to catch up with their package versions, but also 
the rolling-release distributions will get the new versions with no 
delays.

^ permalink raw reply

* An analogue for commit.gpgsign but for verifying signatures on each pull
From: luckyguy @ 2023-11-06  5:34 UTC (permalink / raw)
  To: git@vger.kernel.org

Hello. I apologize if this question has been asked before.

Is there anyway I can configure git to *automatically* verify the signature of the HEAD of any branch it pulls and fail if that signature is bad or missing? I'm hoping for something as convenient as `commit.gpgSign` that can be configured globally.

I can, of course, do this "manually" but others may forget or may not be knowledgeable to do this on their own. I would like git to locally enforce this, rather than some upstream server, so that new commits don't accidentally get built on top of bad commits. 

If no such functionality exists in git today, then I humbly ask that this feature be considered. Perhaps `pull.gpgVerify`?

Thank you for your time.

^ permalink raw reply

* [PATCH v2] credential/wincred: store oauth_refresh_token
From: M Hickford via GitGitGadget @ 2023-11-06  6:16 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Taylor Blau, Matthew John Cheetham, M Hickford,
	M Hickford
In-Reply-To: <pull.1534.git.1684567247339.gitgitgadget@gmail.com>

From: M Hickford <mirth.hickford@gmail.com>

a5c7656 (credential: new attribute oauth_refresh_token) introduced
a new confidential credential attribute for helpers to store.

We encode the new attribute in the CredentialBlob, separated by
newline:

    hunter2
    oauth_refresh_token=xyzzy

This is extensible and backwards compatible. The credential protocol
already assumes that attribute values do not contain newlines.

This fixes test "helper (wincred) gets oauth_refresh_token" when
t0303-credential-external.sh is run with
GIT_TEST_CREDENTIAL_HELPER=wincred. This test was added in a5c76569e7
(credential: new attribute oauth_refresh_token, 2023-04-21).

Alternatives considered: store oauth_refresh_token in a wincred
attribute. This would be insecure because wincred assumes attribute
values to be non-confidential.

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
---
    credential/wincred: store oauth_refresh_token
    
    Patch v2 fixes a bug when password is empty.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1534%2Fhickford%2Fwincred-refresh-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1534/hickford/wincred-refresh-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1534

Range-diff vs v1:

 1:  46ce22aa3a3 ! 1:  12f092f45b1 credential/wincred: store oauth_refresh_token
     @@ Commit message
          This is extensible and backwards compatible. The credential protocol
          already assumes that attribute values do not contain newlines.
      
     +    This fixes test "helper (wincred) gets oauth_refresh_token" when
     +    t0303-credential-external.sh is run with
     +    GIT_TEST_CREDENTIAL_HELPER=wincred. This test was added in a5c76569e7
     +    (credential: new attribute oauth_refresh_token, 2023-04-21).
     +
          Alternatives considered: store oauth_refresh_token in a wincred
          attribute. This would be insecure because wincred assumes attribute
          values to be non-confidential.
     @@ contrib/credential/wincred/git-credential-wincred.c: static void get_credential(
       	if (!CredEnumerateW(L"git:*", 0, &num_creds, &creds))
       		return;
      @@ contrib/credential/wincred/git-credential-wincred.c: static void get_credential(void)
     - 		if (match_cred(creds[i])) {
     + 		if (match_cred(creds[i], 0)) {
       			write_item("username", creds[i]->UserName,
       				creds[i]->UserName ? wcslen(creds[i]->UserName) : 0);
      -			write_item("password",
      -				(LPCWSTR)creds[i]->CredentialBlob,
      -				creds[i]->CredentialBlobSize / sizeof(WCHAR));
     -+			secret = xmalloc(creds[i]->CredentialBlobSize);
     -+			wcsncpy_s(secret, creds[i]->CredentialBlobSize, (LPCWSTR)creds[i]->CredentialBlob, creds[i]->CredentialBlobSize / sizeof(WCHAR));
     -+			line = wcstok_s(secret, L"\r\n", &remaining_lines);
     -+			write_item("password", line, wcslen(line));
     -+			while(line != NULL) {
     -+				part = wcstok_s(line, L"=", &remaining_parts);
     -+				if (!wcscmp(part, L"oauth_refresh_token")) {
     -+					write_item("oauth_refresh_token", remaining_parts, wcslen(remaining_parts));
     ++			if (creds[i]->CredentialBlobSize > 0) {
     ++				secret = xmalloc(creds[i]->CredentialBlobSize);
     ++				wcsncpy_s(secret, creds[i]->CredentialBlobSize, (LPCWSTR)creds[i]->CredentialBlob, creds[i]->CredentialBlobSize / sizeof(WCHAR));
     ++				line = wcstok_s(secret, L"\r\n", &remaining_lines);
     ++				write_item("password", line, line ? wcslen(line) : 0);
     ++				while(line != NULL) {
     ++					part = wcstok_s(line, L"=", &remaining_parts);
     ++					if (!wcscmp(part, L"oauth_refresh_token")) {
     ++						write_item("oauth_refresh_token", remaining_parts, remaining_parts ? wcslen(remaining_parts) : 0);
     ++					}
     ++					line = wcstok_s(NULL, L"\r\n", &remaining_lines);
      +				}
     -+				line = wcstok_s(NULL, L"\r\n", &remaining_lines);
     ++			} else {
     ++				write_item("password",
     ++						(LPCWSTR)creds[i]->CredentialBlob,
     ++						creds[i]->CredentialBlobSize / sizeof(WCHAR));
      +			}
       			for (int j = 0; j < creds[i]->AttributeCount; j++) {
       				attr = creds[i]->Attributes + j;
     @@ contrib/credential/wincred/git-credential-wincred.c: static void read_credential
       		/*
       		 * Ignore other lines; we don't know what they mean, but
       		 * this future-proofs us when later versions of git do
     -
     - ## t/t0303-credential-external.sh ##
     -@@ t/t0303-credential-external.sh: test -z "$GIT_TEST_CREDENTIAL_HELPER_SETUP" ||
     - helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
     - 
     - helper_test "$GIT_TEST_CREDENTIAL_HELPER"
     -+helper_test_oauth_refresh_token "$GIT_TEST_CREDENTIAL_HELPER"
     - 
     - if test -z "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"; then
     - 	say "# skipping timeout tests (GIT_TEST_CREDENTIAL_HELPER_TIMEOUT not set)"


 .../wincred/git-credential-wincred.c          | 46 ++++++++++++++++---
 1 file changed, 40 insertions(+), 6 deletions(-)

diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c
index 4cd56c42e24..5c6a7d65d4a 100644
--- a/contrib/credential/wincred/git-credential-wincred.c
+++ b/contrib/credential/wincred/git-credential-wincred.c
@@ -35,7 +35,7 @@ static void *xmalloc(size_t size)
 }
 
 static WCHAR *wusername, *password, *protocol, *host, *path, target[1024],
-	*password_expiry_utc;
+	*password_expiry_utc, *oauth_refresh_token;
 
 static void write_item(const char *what, LPCWSTR wbuf, int wlen)
 {
@@ -140,6 +140,11 @@ static void get_credential(void)
 	DWORD num_creds;
 	int i;
 	CREDENTIAL_ATTRIBUTEW *attr;
+	WCHAR *secret;
+	WCHAR *line;
+	WCHAR *remaining_lines;
+	WCHAR *part;
+	WCHAR *remaining_parts;
 
 	if (!CredEnumerateW(L"git:*", 0, &num_creds, &creds))
 		return;
@@ -149,9 +154,23 @@ static void get_credential(void)
 		if (match_cred(creds[i], 0)) {
 			write_item("username", creds[i]->UserName,
 				creds[i]->UserName ? wcslen(creds[i]->UserName) : 0);
-			write_item("password",
-				(LPCWSTR)creds[i]->CredentialBlob,
-				creds[i]->CredentialBlobSize / sizeof(WCHAR));
+			if (creds[i]->CredentialBlobSize > 0) {
+				secret = xmalloc(creds[i]->CredentialBlobSize);
+				wcsncpy_s(secret, creds[i]->CredentialBlobSize, (LPCWSTR)creds[i]->CredentialBlob, creds[i]->CredentialBlobSize / sizeof(WCHAR));
+				line = wcstok_s(secret, L"\r\n", &remaining_lines);
+				write_item("password", line, line ? wcslen(line) : 0);
+				while(line != NULL) {
+					part = wcstok_s(line, L"=", &remaining_parts);
+					if (!wcscmp(part, L"oauth_refresh_token")) {
+						write_item("oauth_refresh_token", remaining_parts, remaining_parts ? wcslen(remaining_parts) : 0);
+					}
+					line = wcstok_s(NULL, L"\r\n", &remaining_lines);
+				}
+			} else {
+				write_item("password",
+						(LPCWSTR)creds[i]->CredentialBlob,
+						creds[i]->CredentialBlobSize / sizeof(WCHAR));
+			}
 			for (int j = 0; j < creds[i]->AttributeCount; j++) {
 				attr = creds[i]->Attributes + j;
 				if (!wcscmp(attr->Keyword, L"git_password_expiry_utc")) {
@@ -160,6 +179,7 @@ static void get_credential(void)
 					break;
 				}
 			}
+			free(secret);
 			break;
 		}
 
@@ -170,16 +190,26 @@ static void store_credential(void)
 {
 	CREDENTIALW cred;
 	CREDENTIAL_ATTRIBUTEW expiry_attr;
+	WCHAR *secret;
+	int wlen;
 
 	if (!wusername || !password)
 		return;
 
+	if (oauth_refresh_token) {
+		wlen = _scwprintf(L"%s\r\noauth_refresh_token=%s", password, oauth_refresh_token);
+		secret = xmalloc(sizeof(WCHAR) * wlen);
+		_snwprintf_s(secret, sizeof(WCHAR) * wlen, wlen, L"%s\r\noauth_refresh_token=%s", password, oauth_refresh_token);
+	} else {
+		secret = _wcsdup(password);
+	}
+
 	cred.Flags = 0;
 	cred.Type = CRED_TYPE_GENERIC;
 	cred.TargetName = target;
 	cred.Comment = L"saved by git-credential-wincred";
-	cred.CredentialBlobSize = (wcslen(password)) * sizeof(WCHAR);
-	cred.CredentialBlob = (LPVOID)password;
+	cred.CredentialBlobSize = wcslen(secret) * sizeof(WCHAR);
+	cred.CredentialBlob = (LPVOID)_wcsdup(secret);
 	cred.Persist = CRED_PERSIST_LOCAL_MACHINE;
 	cred.AttributeCount = 0;
 	cred.Attributes = NULL;
@@ -194,6 +224,8 @@ static void store_credential(void)
 	cred.TargetAlias = NULL;
 	cred.UserName = wusername;
 
+	free(secret);
+
 	if (!CredWriteW(&cred, 0))
 		die("CredWrite failed");
 }
@@ -265,6 +297,8 @@ static void read_credential(void)
 			password = utf8_to_utf16_dup(v);
 		else if (!strcmp(buf, "password_expiry_utc"))
 			password_expiry_utc = utf8_to_utf16_dup(v);
+		else if (!strcmp(buf, "oauth_refresh_token"))
+			oauth_refresh_token = utf8_to_utf16_dup(v);
 		/*
 		 * Ignore other lines; we don't know what they mean, but
 		 * this future-proofs us when later versions of git do

base-commit: bc5204569f7db44d22477485afd52ea410d83743
-- 
gitgitgadget

^ permalink raw reply related

* Re: [PATCH 4/5] ci: split out logic to set up failed test artifacts
From: Patrick Steinhardt @ 2023-11-06  7:16 UTC (permalink / raw)
  To: Christian Couder; +Cc: git
In-Reply-To: <CAP8UFD25O9D1WL+CAQOcdqwuPsgdd6qOMNWuVtAw18U3RccYZQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2191 bytes --]

On Fri, Nov 03, 2023 at 11:35:01PM +0100, Christian Couder wrote:
> On Thu, Oct 26, 2023 at 10:01 AM Patrick Steinhardt <ps@pks.im> wrote:
> >
> > We have some logic in place to create a directory with the output from
> > failed tests, which will then subsequently be uploaded as CI artifact.
> > We're about to add support for GitLab CI, which will want to reuse the
> > logic.
> >
> > Split the logic into a separate function so that it is reusable.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> >  ci/lib.sh | 40 ++++++++++++++++++++++------------------
> >  1 file changed, 22 insertions(+), 18 deletions(-)
> >
> > diff --git a/ci/lib.sh b/ci/lib.sh
> > index 957fd152d9c..33005854520 100755
> > --- a/ci/lib.sh
> > +++ b/ci/lib.sh
> > @@ -137,6 +137,27 @@ handle_failed_tests () {
> >         return 1
> >  }
> >
> > +create_failed_test_artifacts () {
> > +       mkdir -p t/failed-test-artifacts
> > +
> > +       for test_exit in t/test-results/*.exit
> > +       do
> > +               test 0 != "$(cat "$test_exit")" || continue
> > +
> > +               test_name="${test_exit%.exit}"
> > +               test_name="${test_name##*/}"
> > +               printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
> > +               echo "The full logs are in the 'print test failures' step below."
> > +               echo "See also the 'failed-tests-*' artifacts attached to this run."
> > +               cat "t/test-results/$test_name.markup"
> > +
> > +               trash_dir="t/trash directory.$test_name"
> > +               cp "t/test-results/$test_name.out" t/failed-test-artifacts/
> > +               tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
> > +       done
> > +       return 1
> 
> Nit: I think it's more the responsibility of handle_failed_tests() to
> `return 1` than of create_failed_test_artifacts(). I understand that
> putting it into this new function means one more line that is common
> to several CI tools though.
> 
> Otherwise everything in this series LGTM. Thanks!

Good point indeed. Not sure whether this is worth a reroll though?

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* [PATCH 0/4] Memory leak fixes
From: Patrick Steinhardt @ 2023-11-06 10:45 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

Hi,

this patch series fixes some memory leaks. All of these leaks have been
found while working on the reftable backend.

Patrick

Patrick Steinhardt (4):
  test-bloom: stop setting up Git directory twice
  shallow: fix memory leak when registering shallow roots
  setup: refactor `upgrade_repository_format()` to have common exit
  setup: fix leaking repository format

 setup.c                         | 33 ++++++++++++++++++++++-----------
 shallow.c                       |  4 +++-
 t/helper/test-bloom.c           |  1 -
 t/t5311-pack-bitmaps-shallow.sh |  2 ++
 t/t5530-upload-pack-error.sh    |  1 +
 5 files changed, 28 insertions(+), 13 deletions(-)

-- 
2.42.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* [PATCH 1/4] test-bloom: stop setting up Git directory twice
From: Patrick Steinhardt @ 2023-11-06 10:45 UTC (permalink / raw)
  To: git
In-Reply-To: <cover.1699267422.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]

We're setting up the Git directory twice in the `test-tool bloom`
helper, once at the beginning of `cmd_bloom()` and once in the local
subcommand implementation `get_bloom_filter_for_commit()`. This can lead
to memory leaks as we'll overwrite variables of `the_repository` with
newly allocated data structures. On top of that it's simply unnecessary.

Fix this by only setting up the Git directory once.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/helper/test-bloom.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c
index aabe31d724b..1281e66876f 100644
--- a/t/helper/test-bloom.c
+++ b/t/helper/test-bloom.c
@@ -40,7 +40,6 @@ static void get_bloom_filter_for_commit(const struct object_id *commit_oid)
 {
 	struct commit *c;
 	struct bloom_filter *filter;
-	setup_git_directory();
 	c = lookup_commit(the_repository, commit_oid);
 	filter = get_or_compute_bloom_filter(the_repository, c, 1,
 					     &settings,
-- 
2.42.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related

* [PATCH 2/4] shallow: fix memory leak when registering shallow roots
From: Patrick Steinhardt @ 2023-11-06 10:45 UTC (permalink / raw)
  To: git
In-Reply-To: <cover.1699267422.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 1648 bytes --]

When registering shallow roots, we unset the list of parents of the
to-be-registered commit if it's already been parsed. This causes us to
leak memory though because we never free this list. Fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 shallow.c                       | 4 +++-
 t/t5311-pack-bitmaps-shallow.sh | 2 ++
 t/t5530-upload-pack-error.sh    | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/shallow.c b/shallow.c
index 5413719fd4e..ac728cdd778 100644
--- a/shallow.c
+++ b/shallow.c
@@ -38,8 +38,10 @@ int register_shallow(struct repository *r, const struct object_id *oid)
 
 	oidcpy(&graft->oid, oid);
 	graft->nr_parent = -1;
-	if (commit && commit->object.parsed)
+	if (commit && commit->object.parsed) {
+		free_commit_list(commit->parents);
 		commit->parents = NULL;
+	}
 	return register_commit_graft(r, graft, 0);
 }
 
diff --git a/t/t5311-pack-bitmaps-shallow.sh b/t/t5311-pack-bitmaps-shallow.sh
index 9dae60f73e3..4fe71fe8cd2 100755
--- a/t/t5311-pack-bitmaps-shallow.sh
+++ b/t/t5311-pack-bitmaps-shallow.sh
@@ -1,6 +1,8 @@
 #!/bin/sh
 
 test_description='check bitmap operation with shallow repositories'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 # We want to create a situation where the shallow, grafted
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 7c1460eaa99..de6e14a6c24 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -2,6 +2,7 @@
 
 test_description='errors in upload-pack'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 D=$(pwd)
-- 
2.42.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related

* [PATCH 3/4] setup: refactor `upgrade_repository_format()` to have common exit
From: Patrick Steinhardt @ 2023-11-06 10:46 UTC (permalink / raw)
  To: git
In-Reply-To: <cover.1699267422.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 2282 bytes --]

The `upgrade_repository_format()` function has multiple exit paths,
which means that there is no common cleanup of acquired resources.
While this isn't much of a problem right now, we're about to fix a
memory leak that would require us to free the resource in every one of
those exit paths.

Refactor the code to have a common exit path so that the subsequent
memory leak fix becomes easier to implement.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 setup.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/setup.c b/setup.c
index 2e607632dbd..b9474b163a0 100644
--- a/setup.c
+++ b/setup.c
@@ -693,29 +693,38 @@ int upgrade_repository_format(int target_version)
 	struct strbuf err = STRBUF_INIT;
 	struct strbuf repo_version = STRBUF_INIT;
 	struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
+	int ret;
 
 	strbuf_git_common_path(&sb, the_repository, "config");
 	read_repository_format(&repo_fmt, sb.buf);
 	strbuf_release(&sb);
 
-	if (repo_fmt.version >= target_version)
-		return 0;
+	if (repo_fmt.version >= target_version) {
+		ret = 0;
+		goto out;
+	}
 
 	if (verify_repository_format(&repo_fmt, &err) < 0) {
-		error("cannot upgrade repository format from %d to %d: %s",
-		      repo_fmt.version, target_version, err.buf);
-		strbuf_release(&err);
-		return -1;
+		ret = error("cannot upgrade repository format from %d to %d: %s",
+			    repo_fmt.version, target_version, err.buf);
+		goto out;
+	}
+	if (!repo_fmt.version && repo_fmt.unknown_extensions.nr) {
+		ret = error("cannot upgrade repository format: "
+			    "unknown extension %s",
+			    repo_fmt.unknown_extensions.items[0].string);
+		goto out;
 	}
-	if (!repo_fmt.version && repo_fmt.unknown_extensions.nr)
-		return error("cannot upgrade repository format: "
-			     "unknown extension %s",
-			     repo_fmt.unknown_extensions.items[0].string);
 
 	strbuf_addf(&repo_version, "%d", target_version);
 	git_config_set("core.repositoryformatversion", repo_version.buf);
+
+	ret = 1;
+
+out:
 	strbuf_release(&repo_version);
-	return 1;
+	strbuf_release(&err);
+	return ret;
 }
 
 static void init_repository_format(struct repository_format *format)
-- 
2.42.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related

* [PATCH 4/4] setup: fix leaking repository format
From: Patrick Steinhardt @ 2023-11-06 10:46 UTC (permalink / raw)
  To: git
In-Reply-To: <cover.1699267422.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

While populating the `repository_format` structure may cause us to
allocate memory, we do not call `clear_repository_format()` in some
places and thus potentially leak memory. Fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 setup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/setup.c b/setup.c
index b9474b163a0..fc592dc6dd5 100644
--- a/setup.c
+++ b/setup.c
@@ -722,6 +722,7 @@ int upgrade_repository_format(int target_version)
 	ret = 1;
 
 out:
+	clear_repository_format(&repo_fmt);
 	strbuf_release(&repo_version);
 	strbuf_release(&err);
 	return ret;
@@ -2199,6 +2200,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
 			       git_dir, len && git_dir[len-1] != '/' ? "/" : "");
 	}
 
+	clear_repository_format(&repo_fmt);
 	free(original_git_dir);
 	return 0;
 }
-- 
2.42.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related

* Re: [PATCH v3 1/2] rebase: support non-interactive autosquash
From: Phillip Wood @ 2023-11-06 11:06 UTC (permalink / raw)
  To: Andy Koppe, git; +Cc: gitster, newren
In-Reply-To: <20231105000808.10171-1-andy.koppe@gmail.com>

Hi Andy

On 05/11/2023 00:08, Andy Koppe wrote:
> So far, the rebase --autosquash option and rebase.autoSquash=true
> config setting are quietly ignored when used without --interactive,

Thanks for working on this, I agree that "--autosquash" being ignored 
without "--interactive" is something that we should address. I think 
there are several possible solutions

1 - make "--autosquash" imply "--interactive". This has the advantage
     that the user gets to check the commits are going to be reordered as
     they expect when they edit the todo list. It is hard to see how to
     accommodate the config setting though - I don't think we want
     "rebase.autosquash=true" to imply "--interactive".

2 - make "--autosquash" without "--interactive" an error. This would
     prevent the user being surprised that their commits are not squashed
     by a non-interactive rebase. Users who have set
     "rebase.autosquash=true" would have to pass "--no-autosquash" to
     perform any form of non-interactive rebase. This is similar to the
     current behavior where the user has to pass "--no-autosquash" if
     they want to use the apply backend with "rebase.autosquash=true".

3 - make "--autosquash" rearrange and squash commits without
     "--interactive". This is convenient but there is a risk in that the
     user does not get a chance to check the todo list before the commits
     are reordered and squashed. I think that risk is fairly small with
     an explicit "--autosquash" on the commandline. This is the approach
     taken by this patch. I do have some concerns about extending the
     config setting to non-interactive rebases though. If the user has
     commits that look like

	fixup! foo (HEAD)
	foo bar
	foo

     and runs "git -c rebase.autosquash=non-interactive rebase HEAD~2"
     then we'll silently squash the fixup into the wrong commit due to a
     prefix subject match.

> except that they prevent fast-forward and that they trigger conflicts
> with --apply and relatives, which is less than helpful particularly for
> the config setting.

The behavior to make the config setting incompatible with the apply 
backend was implemented to avoid users being surprised that their 
commits are not squashed by that backend even when they have set 
"rebase.autosquash=true"[1]. I think one could consider "--autosquash" 
being silently ignored without "--interactive" to be an oversight in 
796abac7e1 (rebase: add coverage of other incompatible options, 
2023-01-25) that introduced that change.

[1] 
https://lore.kernel.org/git/pull.1466.v5.git.1674619434.gitgitgadget@gmail.com/

> Since the "merge" backend used for interactive rebase also is the
> default for non-interactive rebase, there doesn't appear to be a
> reason not to do --autosquash without --interactive, so support that.

I think making "--autosquash" on the commandline work for 
non-interactive rebases is reasonable but I would be open to the 
argument that it would be better to make it an error and require 
"--interactive" to allow the user to check that the commits are going to 
be reordered as they expect.

> Turn rebase.autoSquash into a comma-separated list of flags, with
> "interactive" or "i" enabling auto-squashing with --interactive, and
> "no-interactive" or "no-i" enabling it without. Make boolean true mean
> "interactive" for backward compatibility.

Please, please, please don't introduce abbreviated config settings, it 
just makes the interface more complicated. The user only has to set this 
once so I think the short names just add confusion. I also think 
"non-interactive" would be a better name for the config setting 
corresponding to non-interactive rebases. Does this mean the user can 
request that commits are only rearranged when the do not pass 
"--interactive"?

As I said above I do have some concerns that the 
"rebase.autosquash=non-interactive" setting will catch people out. 
Having said that ignoring "rebase.autosquash=true" without 
"--interactive" as we do now is inconsistent with the behavior of 
"rebase.autosquash=true" with "--apply". One possibility would be to 
introduce "rebase.autosquash=interactive" which would not cause an error 
with "--apply" and always require an explicit "--autosquash" on the 
commandline to squash fixups without "--interactive"

> Don't prevent fast-forwards or report conflicts with --apply options
> when auto-squashing is not active.

I think this change deserves to be in a separate commit (which probably 
means separating out the config changes into that commit) as it is not 
directly related to fixing "--autosquash" without "--interactive" on the 
commandline. It would revert 796abac7e1 (rebase: add coverage of other 
incompatible options, 2023-01-25) and part of eddfcd8ece (rebase: 
provide better error message for apply options vs. merge config, 
2023-01-25) and so the commit message would need to explain why that is 
desirable (and why it is desirable to revert only the changes related to 
"rebase.autosquash" and not those related to "rebase.updateRefs")

> Change the git-rebase and config/rebase documentation accordingly, and
> extend t3415-rebase-autosquash.sh to test the new rebase.autosquash
> values and combinations with and without --interactive.

Thanks for adding tests for the new behavior.

In summary I like "--autosquash" working without "--interactive" but I'm 
unsure about the config changes.

Best Wishes

Phillip

> Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
> ---
>   Documentation/config/rebase.txt        | 11 +++-
>   Documentation/git-rebase.txt           |  2 +-
>   builtin/rebase.c                       | 66 +++++++++++++++-----
>   t/t3415-rebase-autosquash.sh           | 83 +++++++++++++++++++++-----
>   t/t3422-rebase-incompatible-options.sh |  2 +-
>   5 files changed, 132 insertions(+), 32 deletions(-)
> 
> diff --git a/Documentation/config/rebase.txt b/Documentation/config/rebase.txt
> index 9c248accec..68191e5673 100644
> --- a/Documentation/config/rebase.txt
> +++ b/Documentation/config/rebase.txt
> @@ -9,7 +9,16 @@ rebase.stat::
>   	rebase. False by default.
>   
>   rebase.autoSquash::
> -	If set to true enable `--autosquash` option by default.
> +	A comma-separated list of flags for when to enable auto-squashing.
> +	Specifying `interactive` or `i` enables auto-squashing for rebasing with
> +	`--interactive`, whereas `no-interactive` or `no-i` enables it for
> +	rebasing without that option. For example, setting this to `i,no-i`
> +	enables auto-squashing for both types. Setting it to true is equivalent
> +	to setting it to `interactive`.
> +
> +	The `--autosquash` and `--no-autosquash` options of
> +	linkgit:git-rebase[1] override the setting here.
> +	Auto-squashing is disabled by default.
>   
>   rebase.autoStash::
>   	When set to true, automatically create a temporary stash entry
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index e7b39ad244..102ff91493 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -592,7 +592,7 @@ See also INCOMPATIBLE OPTIONS below.
>   	When the commit log message begins with "squash! ..." or "fixup! ..."
>   	or "amend! ...", and there is already a commit in the todo list that
>   	matches the same `...`, automatically modify the todo list of
> -	`rebase -i`, so that the commit marked for squashing comes right after
> +	`rebase`, so that the commit marked for squashing comes right after
>   	the commit to be modified, and change the action of the moved commit
>   	from `pick` to `squash` or `fixup` or `fixup -C` respectively. A commit
>   	matches the `...` if the commit subject matches, or if the `...` refers
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 261a9a61fc..26c3e5dcb4 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -131,7 +131,10 @@ struct rebase_options {
>   	int reapply_cherry_picks;
>   	int fork_point;
>   	int update_refs;
> -	int config_autosquash;
> +	enum {
> +		AUTOSQUASH_INTERACTIVE = 1 << 0,
> +		AUTOSQUASH_NO_INTERACTIVE = 1 << 1,
> +	} config_autosquash;
>   	int config_rebase_merges;
>   	int config_update_refs;
>   };
> @@ -149,7 +152,6 @@ struct rebase_options {
>   		.reapply_cherry_picks = -1,             \
>   		.allow_empty_message = 1,               \
>   		.autosquash = -1,                       \
> -		.config_autosquash = -1,                \
>   		.rebase_merges = -1,                    \
>   		.config_rebase_merges = -1,             \
>   		.update_refs = -1,                      \
> @@ -711,10 +713,8 @@ static int run_specific_rebase(struct rebase_options *opts)
>   	if (opts->type == REBASE_MERGE) {
>   		/* Run sequencer-based rebase */
>   		setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1);
> -		if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
> +		if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT))
>   			setenv("GIT_SEQUENCE_EDITOR", ":", 1);
> -			opts->autosquash = 0;
> -		}
>   		if (opts->gpg_sign_opt) {
>   			/* remove the leading "-S" */
>   			char *tmp = xstrdup(opts->gpg_sign_opt + 2);
> @@ -748,6 +748,30 @@ static int run_specific_rebase(struct rebase_options *opts)
>   	return status ? -1 : 0;
>   }
>   
> +static void parse_rebase_autosquash_value(struct rebase_options *opts,
> +					  const char *var, const char *value)
> +{
> +	struct string_list tokens = STRING_LIST_INIT_NODUP;
> +	char *buf = xstrdup(value);
> +
> +	opts->config_autosquash = 0;
> +	string_list_split_in_place(&tokens, buf, ",", -1);
> +
> +	for (int i = 0; i < tokens.nr; i++) {
> +		const char *s = tokens.items[i].string;
> +
> +		if (!strcmp(s, "i") || !strcmp(s, "interactive"))
> +			opts->config_autosquash |= AUTOSQUASH_INTERACTIVE;
> +		else if (!strcmp(s, "no-i") || !strcmp(s, "no-interactive"))
> +			opts->config_autosquash |= AUTOSQUASH_NO_INTERACTIVE;
> +		else
> +			die(_("invalid value for '%s': '%s'"), var, s);
> +	}
> +
> +	string_list_clear(&tokens, 0);
> +	free(buf);
> +}
> +
>   static void parse_rebase_merges_value(struct rebase_options *options, const char *value)
>   {
>   	if (!strcmp("no-rebase-cousins", value))
> @@ -772,8 +796,14 @@ static int rebase_config(const char *var, const char *value,
>   	}
>   
>   	if (!strcmp(var, "rebase.autosquash")) {
> -		opts->config_autosquash = git_config_bool(var, value);
> -		return 0;
> +		int b = git_parse_maybe_bool(value);
> +
> +		if (b < 0)
> +			parse_rebase_autosquash_value(opts, var, value);
> +		else if (b)
> +			opts->config_autosquash = AUTOSQUASH_INTERACTIVE;
> +		else
> +			opts->config_autosquash = 0;
>   	}
>   
>   	if (!strcmp(var, "commit.gpgsign")) {
> @@ -1402,13 +1432,23 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>   		    state_dir_base, cmd_live_rebase, buf.buf);
>   	}
>   
> +	if (options.autosquash == 1) {
> +		imply_merge(&options, "--autosquash");
> +	} else if (options.autosquash == -1) {
> +		int conf = options.config_autosquash;
> +		options.autosquash =
> +			(options.flags & REBASE_INTERACTIVE_EXPLICIT)
> +			? !!(conf & AUTOSQUASH_INTERACTIVE)
> +			: !!(conf & AUTOSQUASH_NO_INTERACTIVE);
> +	}
> +
>   	if ((options.flags & REBASE_INTERACTIVE_EXPLICIT) ||
>   	    (options.action != ACTION_NONE) ||
>   	    (options.exec.nr > 0) ||
> -	    (options.autosquash == -1 && options.config_autosquash == 1) ||
> -	    options.autosquash == 1) {
> +	    options.autosquash) {
>   		allow_preemptive_ff = 0;
>   	}
> +
>   	if (options.committer_date_is_author_date || options.ignore_date)
>   		options.flags |= REBASE_FORCE;
>   
> @@ -1508,7 +1548,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>   			if (is_merge(&options))
>   				die(_("apply options and merge options "
>   					  "cannot be used together"));
> -			else if (options.autosquash == -1 && options.config_autosquash == 1)
> +			else if (options.autosquash && options.config_autosquash)
>   				die(_("apply options are incompatible with rebase.autoSquash.  Consider adding --no-autosquash"));
>   			else if (options.rebase_merges == -1 && options.config_rebase_merges == 1)
>   				die(_("apply options are incompatible with rebase.rebaseMerges.  Consider adding --no-rebase-merges"));
> @@ -1529,11 +1569,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>   	options.rebase_merges = (options.rebase_merges >= 0) ? options.rebase_merges :
>   				((options.config_rebase_merges >= 0) ? options.config_rebase_merges : 0);
>   
> -	if (options.autosquash == 1)
> -		imply_merge(&options, "--autosquash");
> -	options.autosquash = (options.autosquash >= 0) ? options.autosquash :
> -			     ((options.config_autosquash >= 0) ? options.config_autosquash : 0);
> -
>   	if (options.type == REBASE_UNSPECIFIED) {
>   		if (!strcmp(options.default_backend, "merge"))
>   			options.type = REBASE_MERGE;
> @@ -1858,3 +1893,4 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>   	free(keep_base_onto_name);
>   	return !!ret;
>   }
> +
> diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
> index a364530d76..1386eb6394 100755
> --- a/t/t3415-rebase-autosquash.sh
> +++ b/t/t3415-rebase-autosquash.sh
> @@ -43,7 +43,7 @@ test_auto_fixup () {
>   
>   	git tag $1 &&
>   	test_tick &&
> -	git rebase $2 -i HEAD^^^ &&
> +	git rebase $2 HEAD^^^ &&
>   	git log --oneline >actual &&
>   	if test -n "$no_squash"
>   	then
> @@ -61,15 +61,43 @@ test_auto_fixup () {
>   }
>   
>   test_expect_success 'auto fixup (option)' '
> -	test_auto_fixup final-fixup-option --autosquash
> +	test_auto_fixup fixup-option --autosquash &&
> +	test_auto_fixup fixup-option-i "-i --autosquash"
>   '
>   
> -test_expect_success 'auto fixup (config)' '
> -	git config rebase.autosquash true &&
> -	test_auto_fixup final-fixup-config-true &&
> -	test_auto_fixup ! fixup-config-true-no --no-autosquash &&
> +test_expect_success 'auto fixup (config false)' '
>   	git config rebase.autosquash false &&
> -	test_auto_fixup ! final-fixup-config-false
> +	test_auto_fixup ! fixup-config-false &&
> +	test_auto_fixup ! fixup-config-false-i -i
> +'
> +
> +test_expect_success 'auto fixup (config true)' '
> +	git config rebase.autosquash true &&
> +	test_auto_fixup ! fixup-config-true &&
> +	test_auto_fixup fixup-config-true-i -i &&
> +	test_auto_fixup ! fixup-config-true-i-no "-i --no-autosquash"
> +'
> +
> +test_expect_success 'auto fixup (config interactive)' '
> +	git config rebase.autosquash interactive &&
> +	test_auto_fixup ! fixup-config-interactive &&
> +	test_auto_fixup fixup-config-interactive-i -i &&
> +	test_auto_fixup ! fixup-config-interactive-i-no "-i --no-autosquash"
> +'
> +
> +test_expect_success 'auto fixup (config no-interactive)' '
> +	git config rebase.autosquash no-interactive &&
> +	test_auto_fixup fixup-config-no-interactive &&
> +	test_auto_fixup ! fixup-config-no-interactive-i -i &&
> +	test_auto_fixup ! fixup-config-no-interactive-no "--no-autosquash"
> +'
> +
> +test_expect_success 'auto fixup (config always)' '
> +	git config rebase.autosquash i,no-i &&
> +	test_auto_fixup fixup-config-always &&
> +	test_auto_fixup fixup-config-always-i -i &&
> +	test_auto_fixup ! fixup-config-always-no --no-autosquash &&
> +	test_auto_fixup ! fixup-config-always-i-no "-i --no-autosquash"
>   '
>   
>   test_auto_squash () {
> @@ -87,7 +115,7 @@ test_auto_squash () {
>   	git commit -m "squash! first" -m "extra para for first" &&
>   	git tag $1 &&
>   	test_tick &&
> -	git rebase $2 -i HEAD^^^ &&
> +	git rebase $2 HEAD^^^ &&
>   	git log --oneline >actual &&
>   	if test -n "$no_squash"
>   	then
> @@ -105,15 +133,42 @@ test_auto_squash () {
>   }
>   
>   test_expect_success 'auto squash (option)' '
> -	test_auto_squash final-squash --autosquash
> +	test_auto_squash squash-option --autosquash &&
> +	test_auto_squash squash-option-i "-i --autosquash"
>   '
>   
> -test_expect_success 'auto squash (config)' '
> -	git config rebase.autosquash true &&
> -	test_auto_squash final-squash-config-true &&
> -	test_auto_squash ! squash-config-true-no --no-autosquash &&
> +test_expect_success 'auto squash (config false)' '
>   	git config rebase.autosquash false &&
> -	test_auto_squash ! final-squash-config-false
> +	test_auto_squash ! squash-config-false &&
> +	test_auto_squash ! squash-config-false-i -i
> +'
> +
> +test_expect_success 'auto squash (config true)' '
> +	git config rebase.autosquash true &&
> +	test_auto_squash ! squash-config-true &&
> +	test_auto_squash squash-config-true-i -i &&
> +	test_auto_squash ! squash-config-true-i-no "-i --no-autosquash"
> +'
> +
> +test_expect_success 'auto squash (config interactive)' '
> +	git config rebase.autosquash i &&
> +	test_auto_squash ! squash-config-interactive &&
> +	test_auto_squash squash-config-interactive-i -i &&
> +	test_auto_squash ! squash-config-interactive-i-no "-i --no-autosquash"
> +'
> +
> +test_expect_success 'auto squash (config no-interactive)' '
> +	git config rebase.autosquash no-i &&
> +	test_auto_squash squash-config-no-interactive &&
> +	test_auto_squash ! squash-config-no-interactive-i -i &&
> +	test_auto_squash ! squash-config-no-interactive-no "--no-autosquash"
> +'
> +test_expect_success 'auto squash (config always)' '
> +	git config rebase.autosquash interactive,no-interactive &&
> +	test_auto_squash squash-config-always &&
> +	test_auto_squash squash-config-always-i -i &&
> +	test_auto_squash ! squash-config-always-no --no-autosquash &&
> +	test_auto_squash ! squash-config-always-i-no "-i --no-autosquash"
>   '
>   
>   test_expect_success 'misspelled auto squash' '
> diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh
> index 2eba00bdf5..e5119e7371 100755
> --- a/t/t3422-rebase-incompatible-options.sh
> +++ b/t/t3422-rebase-incompatible-options.sh
> @@ -102,7 +102,7 @@ test_rebase_am_only () {
>   
>   	test_expect_success "$opt incompatible with rebase.autosquash" "
>   		git checkout B^0 &&
> -		test_must_fail git -c rebase.autosquash=true rebase $opt A 2>err &&
> +		test_must_fail git -c rebase.autosquash=no-i rebase $opt A 2>err &&
>   		grep -e --no-autosquash err
>   	"
>   

^ permalink raw reply

* Re: [PATCH v3 2/2] docs: rewrite rebase --(no-)autosquash description
From: Phillip Wood @ 2023-11-06 11:07 UTC (permalink / raw)
  To: Andy Koppe, git; +Cc: gitster, newren
In-Reply-To: <20231105000808.10171-2-andy.koppe@gmail.com>

Hi Andy

On 05/11/2023 00:08, Andy Koppe wrote:
> Rewrite the description of the rebase --(no-)autosquash options to try
> to make it a bit clearer. Don't use "the '...'" to refer to part of a
> commit message,

Thanks for doing that, it is a definite improvement, I'm a bit concerned 
about the loss of detail in other areas though - see below.

> mention how --interactive can be used to review the
> todo list, and add a bit more detail on commit --squash/amend.
> 
> Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
> ---
>   Documentation/git-rebase.txt | 32 ++++++++++++++++++--------------
>   1 file changed, 18 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index 102ff91493..594158fcbc 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -589,21 +589,25 @@ See also INCOMPATIBLE OPTIONS below.
>   
>   --autosquash::
>   --no-autosquash::
> -	When the commit log message begins with "squash! ..." or "fixup! ..."
> -	or "amend! ...", and there is already a commit in the todo list that
> -	matches the same `...`, automatically modify the todo list of
> -	`rebase`, so that the commit marked for squashing comes right after
> -	the commit to be modified, and change the action of the moved commit
> -	from `pick` to `squash` or `fixup` or `fixup -C` respectively. A commit
> -	matches the `...` if the commit subject matches, or if the `...` refers
> -	to the commit's hash. As a fall-back, partial matches of the commit
> -	subject work, too. The recommended way to create fixup/amend/squash
> -	commits is by using the `--fixup`, `--fixup=amend:` or `--fixup=reword:`
> -	and `--squash` options respectively of linkgit:git-commit[1].
> +	Automatically squash commits with specially formatted messages into
> +	previous commits.  If a commit message starts with "squash! ",
> +	"fixup! " or "amend! ", the remainder of the subject line is taken
> +	as a commit specifier,

I like this change as I think saying "remainder of the subject line" is 
clearer than using `...`

> which matches a previous commit if it matches
> +	the start of the subject line or the hash of that commit.

This simplification glosses over some details, in particular it is no 
longer clear we prefer an exact subject match to a prefix match so that

	pick 123 foo
	pick 456 foo bar
	pick 789 fixup! foo

will be re-arranged to
	
	pick 123 foo
	fixup 789 fixup! foo
	pick 456 foo bar

and not

	pick 123 foo
	pick 456 foo bar
	fixup 789 fixup! foo

>   +
> -If the `--autosquash` option is enabled by default using the
> -configuration variable `rebase.autoSquash`, this option can be
> -used to override and disable this setting.
> +In the rebase todo list, commits marked for squashing are moved right after
> +the commits they modify, and their action is changed from `pick` to `squash`,
> +`fixup` or `fixup -C`, depending on the squash marker.

Here we have lost the documentation that told users which marker 
corresponds to which action which is unfortunate.

Best Wishes

Phillip

>  The `--interactive`
> +option can be used to review and edit the todo list before proceeding.
> ++
> +The recommended way to create commits with squash markers is by using the
> +`--squash`, `--fixup`, `--fixup=amend:` or `--fixup=reword:` options of
> +linkgit:git-commit[1], which take the target commit as an argument and
> +automatically fill in the subject line of the new commit from that.
> ++
> +The configuration variable `rebase.autoSquash` can be used to enable
> +`--autosquash` by default.  See the CONFIGURATION section below for details.
> +The `--no-autosquash` option overrides that setting.
>   +
>   See also INCOMPATIBLE OPTIONS below.
>   

^ permalink raw reply

* Re: [PATCH] revision: Don't queue uninteresting commits
From: Øystein Walle @ 2023-11-06 11:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, derrickstolee
In-Reply-To: <xmqqpm1lnme4.fsf@gitster.g>

Hi, Junio, and sorry for the late response.

On Wed, 11 Oct 2023 at 18:40, Junio C Hamano <gitster@pobox.com> wrote:

> What is not described here is what benefit we are expecting to gain
> by making this change.  Is anything leaking?  Are we showing wrong
> output?  Is the effect something we can demonstrate, and more
> importantly we can protect from future breakages, with a test or
> two?

As far as I know there is no significant benefit to this change. The
only one I can think of is a case such as this:

    git rev-list some-rev ^a ^very ^large ^amount ^of ^negative ^revs ^here

but even then I would assume the work done by the algorithm in total is
so large that the work saved by this change is insignificant.

I was just a bit happy after grokking a piece of this code and let the
excitement get the best of me :-) I suggest we just drop it.

Øsse

^ permalink raw reply

* Git Rename Detection Bug
From: Jeremy Pridmore @ 2023-11-06 12:00 UTC (permalink / raw)
  To: git@vger.kernel.org; +Cc: Paul Baumgartner

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
I have two GIT repositories (A and B). Both migrated from the same TFS server using git-tfs tool. I migrated code into A and made lots of changes, including moving 50,000+ files from folder "/Landscape" to "/Landscape/src".  B contains the same code but with various other changes made since my original migration from TFS to A.  All the files in B are still in the "/Landscape" folder.  I recently needed to merge my changes from A to B, so I added A as a remote to B and then performed a number of cherry-picks from A to B, but got stuck when trying to cherry-pick the commit containing the results of moving all files into "/Landscape/src".

What did you expect to happen? (Expected behavior)
I expected the git rename detection to match all files in A "/Landscape" to files in B "/Landscape/src".

What happened instead? (Actual behavior)
Although many files were matched successfully, git mismatched over two dozen similarly named files, e.g.

Incorrect path match: Landscape/Services/uiServices/Complaints/Interfaces/IAccountsIntegration.vb -> Landscape/src/Complaints/Rdt.Complaints.UI/Interfaces/IAccountsIntegration.vb
Incorrect path match: Landscape/Services/uiServices/Complaints/Interfaces/IDocumentIntegration.vb -> Landscape/src/Complaints/Rdt.Complaints.UI/Interfaces/IDocumentIntegration.vb
Incorrect path match: Landscape/Deployment/PowershellScripts/pre-req/Rdt.BatchProcessingService.Setup/pre-req.ps1 -> Landscape/src/Deployment/PowershellScripts/pre-req/Landscape.Net/pre-req.ps1
Incorrect path match: Landscape/Deployment/PowershellScripts/pre-req/Workflow/pre-req.ps1 -> Landscape/src/Deployment/PowershellScripts/pre-req/Rdt.BatchProcessingService.Setup/pre-req.ps1
Incorrect name match: Landscape/Documentation/Rdt.Documentation.UI/Properties/licenses.licx -> Landscape/src/Deployment/PowershellScripts/pre-req/Workflow/pre-req.ps1
Incorrect path match: Landscape/Documentation/uiDocumentation/licenses.licx -> Landscape/src/Documentation/Rdt.Documentation.UI/Properties/licenses.licx
Incorrect path match: Landscape/Import/uiImport/My Project/licenses.licx -> Landscape/src/Documentation/uiDocumentation/licenses.licx
Incorrect path match: Landscape/Main/uiMain.Workflow/My Project/licenses.licx -> Landscape/src/Import/uiImport/My Project/licenses.licx
Incorrect path match: Landscape/Main/uiMain/My Project/licenses.licx -> Landscape/src/Main/uiMain.Workflow/My Project/licenses.licx
Incorrect path match: Landscape/LandscapeApiService.Setup/Setup/UIContent/RDT_Logo.ico -> Landscape/src/Main/uiMain.Workflow/Resources/RDT_Logo.ico
Incorrect path match: Landscape/Policy/Rdt.Policy.UI.Templates/Properties/licenses.licx -> Landscape/src/Main/uiMain/My Project/licenses.licx
Incorrect path match: Landscape/Main/uiMain.Workflow/Resources/RDT_Logo.ico -> Landscape/src/Main/uiMain/Resources/RDT_Logo.ico
Incorrect path match: Landscape/Policy/Rdt.Policy.UI/Properties/licenses.licx -> Landscape/src/Policy/Rdt.Policy.UI.Templates/Properties/licenses.licx
Incorrect path match: Landscape/Rates/uiRates/My Project/licenses.licx -> Landscape/src/Policy/Rdt.Policy.UI/Properties/licenses.licx
Incorrect path match: Landscape/Rdt.Claim.UI/Properties/licenses.licx -> Landscape/src/Rates/uiRates/My Project/licenses.licx
Incorrect path match: Landscape/Rdt.Landscape.UI.Templates.Workflow/Properties/licenses.licx -> Landscape/src/Rdt.Claim.UI/Properties/licenses.licx
Incorrect path match: Landscape/Rdt.Landscape.UI.Templates/Properties/licenses.licx -> Landscape/src/Rdt.Landscape.UI.Templates.Workflow/Properties/licenses.licx
Incorrect path match: Landscape/Rdt.Landscape.UI.Workflow/Properties/licenses.licx -> Landscape/src/Rdt.Landscape.UI.Templates/Properties/licenses.licx
Incorrect path match: Landscape/Rdt.Landscape.UI/Properties/licenses.licx -> Landscape/src/Rdt.Landscape.UI.Workflow/Properties/licenses.licx
Incorrect path match: Landscape/StandardLetters/uiStandardLetters/My Project/licenses.licx -> Landscape/src/Rdt.Landscape.UI/Properties/licenses.licx
Incorrect path match: Landscape/Complaints/Rdt.Complaints.UI/Interfaces/IDocumentIntegration.vb -> Landscape/src/Services/uiServices/Complaints/Interfaces/IDocumentIntegration.vb
Incorrect path match: Landscape/SystemEvents/uiSystemEvents/My Project/licenses.licx -> Landscape/src/StandardLetters/uiStandardLetters/My Project/licenses.licx
Incorrect path match: Landscape/Services/busServices/RDT_Logo.ico -> Landscape/src/Startup/uiStartup.Workflow/Resources/RDT_Logo.ico
Incorrect path match: Landscape/Startup/uiStartup.Workflow/Resources/RDT_Logo.ico -> Landscape/src/Startup/uiStartup/Resources/RDT_Logo.ico
Incorrect path match: Landscape/Startup/uiStartup/Resources/RDT_Logo.ico -> Landscape/src/Startup/uiStartup32/RDT_Logo.ico
Incorrect path match: Landscape/Startup/uiStartup/Resources/newrdlogogradiant48shad.ico -> Landscape/src/Startup/uiStartup32/newrdlogogradiant48shad.ico
Incorrect path match: Landscape/Templates/uiTemplates.Workflow/My Project/licenses.licx -> Landscape/src/SystemEvents/uiSystemEvents/My Project/licenses.licx
Incorrect path match: Landscape/Utils/Rdt.Utils.UI/Properties/licenses.licx -> Landscape/src/Templates/uiTemplates.Workflow/My Project/licenses.licx
Incorrect path match: Landscape/Utils/uiUtils/My Project/licenses.licx -> Landscape/src/Utils/Rdt.Utils.UI/Properties/licenses.licx
Incorrect name match: Landscape/WebServices/ServiceFabric/Policy/Rdt.Policy.Repository.Service.Fabric.Host/PackageRoot/Data/Swagger/Examples/POST_UKSTasks_Response.json -> Landscape/src/Utils/uiUtils/My Project/licenses.licx


What's different between what you expected and what actually happened?

As you can see, although the filenames (and content) are the same, there are a few files that have been incorrectly matched to files with teh same name, but in a different sub folder.  In some cases, it seems that the catalyst has been git thinking that a file from B has been deleted from A, when in fact it has not actually been deleted at all.
For example, the file Landscape/Deployment/PowershellScripts/pre-req/Landscape.Net/pre-req.ps1 has not been deleted in A or B, therefore git should not have attempted to rename Landscape/Deployment/PowershellScripts/pre-req/Rdt.BatchProcessingService.Setup/pre-req.ps1 to Landscape/Deployment/PowershellScripts/pre-req/Landscape.Net/pre-req.ps1, especially as it then attempts to rename Landscape/Deployment/PowershellScripts/pre-req/Workflow/pre-req.ps1 to Landscape/src/Deployment/PowershellScripts/pre-req/Rdt.BatchProcessingService.Setup/pre-req.ps1 and so on.

Git status contains, for example:
        deleted by them: Landscape/Deployment/PowershellScripts/pre-req/Landscape.Net/pre-req.ps1
        renamed:    Landscape/Deployment/PowershellScripts/pre-req/Rdt.BatchProcessingService.Setup/pre-req.ps1 -> Landscape/src/Deployment/PowershellScripts/pre-req/Landscape.Net/pre-req.ps1

The correct renames should have been:
git mv "Landscape/Complaints/Rdt.Complaints.UI/Interfaces/IAccountsIntegration.vb" "Landscape/src/Complaints/Rdt.Complaints.UI/Interfaces/IAccountsIntegration.vb"
git mv "Landscape/Complaints/Rdt.Complaints.UI/Interfaces/IDocumentIntegration.vb" "Landscape/src/Complaints/Rdt.Complaints.UI/Interfaces/IDocumentIntegration.vb"
git mv "Landscape/Deployment/PowershellScripts/pre-req/Rdt.BatchProcessingService.Setup/pre-req.ps1" "Landscape/src/Deployment/PowershellScripts/pre-req/Rdt.BatchProcessingService.Setup/pre-req.ps1"
git mv "Landscape/Deployment/PowershellScripts/pre-req/Workflow/pre-req.ps1" "Landscape/src/Deployment/PowershellScripts/pre-req/Workflow/pre-req.ps1"
git mv "Landscape/Documentation/Rdt.Documentation.UI/Properties/licenses.licx" "Landscape/src/Documentation/Rdt.Documentation.UI/Properties/licenses.licx"
git mv "Landscape/Documentation/uiDocumentation/licenses.licx" "Landscape/src/Documentation/uiDocumentation/licenses.licx"
git mv "Landscape/Import/uiImport/My Project/licenses.licx" "Landscape/src/Import/uiImport/My Project/licenses.licx"
git mv "Landscape/Main/uiMain.Workflow/My Project/licenses.licx" "Landscape/src/Main/uiMain.Workflow/My Project/licenses.licx"
git mv "Landscape/Main/uiMain.Workflow/Resources/RDT_Logo.ico" "Landscape/src/Main/uiMain.Workflow/Resources/RDT_Logo.ico"
git mv "Landscape/Main/uiMain/My Project/licenses.licx" "Landscape/src/Main/uiMain/My Project/licenses.licx"
git mv "Landscape/Main/uiMain/Resources/RDT_Logo.ico" "Landscape/src/Main/uiMain/Resources/RDT_Logo.ico"
git mv "Landscape/Policy/Rdt.Policy.UI.Templates/Properties/licenses.licx" "Landscape/src/Policy/Rdt.Policy.UI.Templates/Properties/licenses.licx"
git mv "Landscape/Policy/Rdt.Policy.UI/Properties/licenses.licx" "Landscape/src/Policy/Rdt.Policy.UI/Properties/licenses.licx"
git mv "Landscape/Rdt.Claim.UI/Properties/licenses.licx" "Landscape/src/Rdt.Claim.UI/Properties/licenses.licx"
git mv "Landscape/Rdt.Landscape.UI.Templates.Workflow/Properties/licenses.licx" "Landscape/src/Rdt.Landscape.UI.Templates.Workflow/Properties/licenses.licx"
git mv "Landscape/Rdt.Landscape.UI.Templates/Properties/licenses.licx" "Landscape/src/Rdt.Landscape.UI.Templates/Properties/licenses.licx"
git mv "Landscape/Rdt.Landscape.UI.Workflow/Properties/licenses.licx" "Landscape/src/Rdt.Landscape.UI.Workflow/Properties/licenses.licx"
git mv "Landscape/Rdt.Landscape.UI/Properties/licenses.licx" "Landscape/src/Rdt.Landscape.UI/Properties/licenses.licx"
git mv "Landscape/Services/busServices/RDT_Logo.ico" "Landscape/src/Services/busServices/RDT_Logo.ico"
git mv "Landscape/Services/uiServices/Complaints/Interfaces/IAccountsIntegration.vb" "Landscape/src/Services/uiServices/Complaints/Interfaces/IAccountsIntegration.vb"
git mv "Landscape/Services/uiServices/Complaints/Interfaces/IDocumentIntegration.vb" "Landscape/src/Services/uiServices/Complaints/Interfaces/IDocumentIntegration.vb"
git mv "Landscape/StandardLetters/uiStandardLetters/My Project/licenses.licx" "Landscape/src/StandardLetters/uiStandardLetters/My Project/licenses.licx"
git mv "Landscape/Startup/uiStartup.Workflow/Resources/RDT_Logo.ico" "Landscape/src/Startup/uiStartup.Workflow/Resources/RDT_Logo.ico"
git mv "Landscape/Startup/uiStartup/Resources/RDT_Logo.ico" "Landscape/src/Startup/uiStartup/Resources/RDT_Logo.ico"
git mv "Landscape/SystemEvents/uiSystemEvents/My Project/licenses.licx" "Landscape/src/SystemEvents/uiSystemEvents/My Project/licenses.licx"
git mv "Landscape/Templates/uiTemplates.Workflow/My Project/licenses.licx" "Landscape/src/Templates/uiTemplates.Workflow/My Project/licenses.licx"
git mv "Landscape/Utils/Rdt.Utils.UI/Properties/licenses.licx" "Landscape/src/Utils/Rdt.Utils.UI/Properties/licenses.licx"
git mv "Landscape/Utils/uiUtils/My Project/licenses.licx" "Landscape/src/Utils/uiUtils/My Project/licenses.licx"


Anything else you want to add:
I can't help but think that this is related to changes made by Palantir:
https://blog.palantir.com/optimizing-gits-merge-machinery-1-127ceb0ef2a1

I have tried to unstage these renames using "git restore --staged <file_name>" so I can then apply the correct "git mv" commands, but bizzarely, this then results in "git status" reporting a different, smaller set of mismatched names:

Incorrect name match: Landscape/Services/busServices/Service References/DataCollectorService/busServices.DataCollectorService.GetDataResponse.datasource -> Landscape/src/Deployment/PowershellScripts/pre-req/Landscape.Net/pre-req.ps1
Incorrect name match: Landscape/Services/busServices/Service References/GlobalGatewayService/busServices.GlobalGatewayService.OrderResponse.datasource -> Landscape/src/Deployment/PowershellScripts/pre-req/Rdt.BatchProcessingService.Setup/pre-req.ps1
Incorrect name match: Landscape/WebServices/ServiceFabric/Policy/Rdt.Policy.Repository.Service.Fabric.Host/PackageRoot/Data/Swagger/Examples/POST_UKSTasks_Response.json -> Landscape/src/Deployment/PowershellScripts/pre-req/Workflow/pre-req.ps1
Incorrect path match: Landscape/LandscapeApiService.Setup/Setup/UIContent/RDT_Logo.ico -> Landscape/src/Main/uiMain.Workflow/Resources/RDT_Logo.ico
Incorrect path match: Landscape/WebServices/WCFServices/Landscape WCF Service/wsWcfLandscapeServices/RDT_Logo.ico -> Landscape/src/Main/uiMain/Resources/RDT_Logo.ico
Incorrect path match: Landscape/WindowsServices/Rdt.BatchProcessingService/Rdt.BatchProcessingService.Integration/RDT_Logo.ico -> Landscape/src/Services/busServices/RDT_Logo.ico
Incorrect path match: Landscape/WindowsServices/Rdt.BatchProcessingService/Rdt.BatchProcessingService.Setup/UIContent/RDT_Logo.ico -> Landscape/src/Startup/uiStartup.Workflow/Resources/RDT_Logo.ico
Incorrect path match: Landscape/WindowsServices/Rdt.BatchProcessingService/Rdt.BatchProcessingService/RDT_Logo.ico -> Landscape/src/Startup/uiStartup/Resources/RDT_Logo.ico
Incorrect path match: Landscape/_Tests/Rdt.BatchProcessingService.Tests/RDT_Logo.ico -> Landscape/src/Startup/uiStartup32/RDT_Logo.ico
Incorrect path match: Landscape/Startup/uiStartup/Resources/newrdlogogradiant48shad.ico -> Landscape/src/Startup/uiStartup32/newrdlogogradiant48shad.ico
Incorrect path match: Landscape/uiStartup.Setup/Setup/UIContent/RDT_Logo.ico -> Landscape/src/WebServices/WCFServices/Landscape WCF Service/wsWcfLandscapeServices/RDT_Logo.ico
Incorrect path match: Landscape/wisWorkflow.Setup/Setup/UIContent/RDT_Logo.ico -> Landscape/src/WindowsServices/Rdt.BatchProcessingService/Rdt.BatchProcessingService.Integration/RDT_Logo.ico
Incorrect path match: Landscape/wsXmlLandscapeServices.Setup/Setup/Binary/RDT_Logo.ico -> Landscape/src/WindowsServices/Rdt.BatchProcessingService/Rdt.BatchProcessingService.Setup/UIContent/RDT_Logo.ico

Notice how "busServices.DataCollectorService.GetDataResponse.datasource" is now renamed to "Landscape.Net/pre-req.ps1", whereas the datasource file wasn't even listed previously?

Please help.  I've been on this for a couple of weeks now and I'm running out of ideas.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.42.0.windows.2
cpu: x86_64
built from commit: 2f819d1670fff9a1818f63b6722e9959405378e3
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 19044
compiler info: gnuc: 13.2
libc info: no libc information available
$SHELL (typically, interactive shell): <unset>


[Enabled Hooks]
<none>


Regards,

Jeremy Pridmore
Lead Solution Architect

________________________________

DISCLAIMER This email is confidential. It should only be read by those persons to whom it is addressed. RDT Ltd accept no liability for the consequences of any person acting, or refraining from acting, on any information contained within this e-mail or any attached documents prior to the receipt by those persons of subsequent written confirmation of that information. If you think this e-mail may not be intended for you, do not use, pass on or copy the transmission in any way. While all reasonable precautions are taken to minimise the risk of transmitting software viruses we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses.

^ permalink raw reply

* Explanation of `eol` attribute doesn't seem correct for Windows machines
From: Hans Meiser @ 2023-11-06 15:11 UTC (permalink / raw)
  To: git@vger.kernel.org

https://git-scm.com/docs/gitattributes#_eol

claims that:

---
Set to string value "crlf"

    This setting converts the file’s line endings in the working directory to CRLF when the file is checked out.
Set to string value "lf"

    This setting uses the same line endings in the working directory as in the index when the file is checked out.
---

I don't think this explanation is sufficient for files stored on Windows machines. A file might be stored with CRLF in the index. What happens then? And what happens when a file is added to the index with `core.autocrlf=input` on Windows machines?

^ permalink raw reply

* Regression: git send-email Message-Id: numbering doesn't start at 1 any more
From: Uwe Kleine-König @ 2023-11-06 15:32 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Douglas Anderson, entwicklung

[-- Attachment #1: Type: text/plain, Size: 2079 bytes --]

Hello,

Since commit 3ece9bf0f9e24909b090cf348d89e8920bd4f82f I experience that
the generated Message-Ids don't start at ....-1-... any more. I have:

$ git send-email w/*
...
Subject: [PATCH 0/5] watchdog: Drop platform_driver_probe() and convert to platform remove callback returning void (part II)
Date: Mon,  6 Nov 2023 16:10:04 +0100
Message-ID: <20231106151003.3844134-7-u.kleine-koenig@pengutronix.de>
...

So the cover letter is sent with Message-Id: ...-7-...

Before above mentioned commit I had:

...
Message-ID: <20231106151003.3844134-1-u.kleine-koenig@pengutronix.de>
...

Similar to my earlier regression report this also only happens in the
presence of a sendemail-validate hook. Passing --no-validate works
around this issue.

While this isn't an issue for git itself, it breaks one of my scripts
that knows how to determine the number of patches in a series from the
last Message-Id:.

The following patch works for me:

diff --git a/git-send-email.perl b/git-send-email.perl
index 9e21b0b3f43a..095a3d9dd720 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -799,6 +799,7 @@ sub is_format_patch_arg {
 
 $time = time - scalar $#files;
 
+my ($message_id_stamp, $message_id_serial);
 if ($validate) {
 	# FIFOs can only be read once, exclude them from validation.
 	my @real_files = ();
@@ -821,6 +822,7 @@ sub is_format_patch_arg {
 	}
 	delete $ENV{GIT_SENDEMAIL_FILE_COUNTER};
 	delete $ENV{GIT_SENDEMAIL_FILE_TOTAL};
+	$message_id_serial = 0;
 }
 
 @files = handle_backup_files(@files);
@@ -1181,7 +1183,6 @@ sub validate_address_list {
 
 # We'll setup a template for the message id, using the "from" address:
 
-my ($message_id_stamp, $message_id_serial);
 sub make_message_id {
 	my $uniq;
 	if (!defined $message_id_stamp) {

But I guess this could be done prettier by someone who is fluent in
Perl.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related

* Re: [PATCH v5 0/5] merge-ort: implement support for packing objects together
From: Johannes Schindelin @ 2023-11-06 15:46 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Taylor Blau, git, Elijah Newren, Eric W. Biederman, Jeff King,
	Patrick Steinhardt
In-Reply-To: <xmqqo7go7w63.fsf@gitster.g>

Hi,

On Mon, 23 Oct 2023, Junio C Hamano wrote:

> Taylor Blau <me@ttaylorr.com> writes:
>
> > But I think that this approach ended up being less heavy-weight than I
> > had originally imagined, so I think that this version is a worthwhile
> > improvement over v4.
>
> ;-).
>
> This version is a good place to stop, a bit short of going full OO.
> Nicely done.

I wonder whether a more generic approach would be more desirable, an
approach that would work for `git replay`, too, for example (where
streaming objects does not work because they need to be made available
immediately because subsequent `merge_incore_nonrecursive()` might expect
the created objects to be present)?

What I have in mind is more along Elijah's suggestion at the Contributor
Summit to use the `tmp_objdir*()` machinery. But instead of discarding the
temporary object database, the contained objects would be repacked and the
`.pack`, (maybe `.rev`) and the `.idx` file would then be moved (in that
order) before discarding the temporary object database.

This would probably need to be implemented as a new
`tmp_objdir_pack_and_migrate()` function that basically spawns
`pack-objects` and feeds it the list of generated objects, writing
directly into the non-temporary object directory, then discarding the
`tmp_objdir`.

This approach would not only more easily extend to other commands, but it
would also be less intrusive (a `tmp_objdir_*()` call to begin the
transaction before the objects are written, another one to commit the
transaction after the objects are written), and it would potentially allow
for more efficient packs to be generated.

Ciao,
Johannes

^ permalink raw reply

* Bug: magic-less pathspecs that start with ":" not processed as expected.
From: Joanna Wang @ 2023-11-06 15:54 UTC (permalink / raw)
  To: git

What did you do before the bug happened? (Steps to reproduce your issue)

What did you expect to happen? (Expected behavior)
`git stash push -- :file` where `:` is part of the filename, should search
for files named ":file"

What happened instead? (Actual behavior)
The match string used to find files is "file" without the ":".

What's different between what you expected and what actually happened?
file named ":file" is not found.

Anything else you want to add:
I believe this is due to parse_short_magic() not handling the case where
":" is part of the file name rather than a prefix for pathspec magic.

I could not find any documentation that says ":" is a reserved
character to indicate pathspec magic symbols MUST follow or that
":file" is not a valid file name.

[System Info]
git version 2.42.0
cpu: x86_64
no commit associated with this build
shell-path: /bin/sh

[Enabled Hooks]
not run from a git repository - no hooks to show

^ permalink raw reply

* Re: Explanation of `eol` attribute doesn't seem correct for Windows machines
From: Torsten Bögershausen @ 2023-11-06 16:21 UTC (permalink / raw)
  To: Hans Meiser; +Cc: git@vger.kernel.org
In-Reply-To: <AS4P195MB15272FE283D0CF606A8B074EE2AAA@AS4P195MB1527.EURP195.PROD.OUTLOOK.COM>

On Mon, Nov 06, 2023 at 03:11:54PM +0000, Hans Meiser wrote:
> https://git-scm.com/docs/gitattributes#_eol
>
> claims that:
>
> ---
> Set to string value "crlf"
>
>     This setting converts the file’s line endings in the working directory to CRLF when the file is checked out.
> Set to string value "lf"
>
>     This setting uses the same line endings in the working directory as in the index when the file is checked out.
> ---
>
> I don't think this explanation is sufficient for files stored on Windows machines.
> A file might be stored with CRLF in the index.
> What happens then?

  >This setting uses the same line endings in the working directory
  >as in the index when the file is checked out.
  If you have a file commited with CRLF into the index, it will have CRLF in the working tree.
  If the file had been commited with LF into the index, it will have LF in the working tree.
  That is what the documentation tries to say, I think.

However, the above discussion is only valid, when the "text" attribute is defined.
Otherwise the eol attribute has no effect.
So you need something like
* text=auto
and/or
*.txt text
in your .gitattributes file


> And what happens when a file is added to the index with `core.autocrlf=input` on Windows machines?
Do you have a .gitattributes file ? Or not ?
Is the file a new one, or does it exist ?

In any way,
git ls-files --eol
may help to find out, what is in the index and what is in the workingtree.

^ permalink raw reply

* Re: [PATCH 1/4] test-bloom: stop setting up Git directory twice
From: Jeff King @ 2023-11-06 17:20 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git
In-Reply-To: <fb1cc73ed3395ba3de72aba70d7679dd85ebb034.1699267422.git.ps@pks.im>

On Mon, Nov 06, 2023 at 11:45:53AM +0100, Patrick Steinhardt wrote:

> We're setting up the Git directory twice in the `test-tool bloom`
> helper, once at the beginning of `cmd_bloom()` and once in the local
> subcommand implementation `get_bloom_filter_for_commit()`. This can lead
> to memory leaks as we'll overwrite variables of `the_repository` with
> newly allocated data structures. On top of that it's simply unnecessary.
> 
> Fix this by only setting up the Git directory once.

Makes sense. This situation was created by 094a685cd7 (t: make
test-bloom initialize repository, 2020-07-29), which added the setup
call at the start of the program.

That commit closed the door to running test-bloom outside of a
repository for sub-commands that could handle it (perhaps the murmur3
one, but I didn't test). So there are two possible directions here:

  - drop the call in cmd__bloom() and make sure all of the relevant
    sub-command functions do the setup.

  - drop the one command-specific one (i.e., your patch)

In practice I don't think anybody cares about running this test-helper
outside of a repository, and having to do setup in each sub-command is
an extra maintenance burden. So I think your patch is the best
direction.

-Peff

^ permalink raw reply

* Re: [PATCH 2/4] shallow: fix memory leak when registering shallow roots
From: Jeff King @ 2023-11-06 17:21 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git
In-Reply-To: <137c150e358a8248200e0c7174a79358adb92e45.1699267422.git.ps@pks.im>

On Mon, Nov 06, 2023 at 11:45:57AM +0100, Patrick Steinhardt wrote:

> --- a/shallow.c
> +++ b/shallow.c
> @@ -38,8 +38,10 @@ int register_shallow(struct repository *r, const struct object_id *oid)
>  
>  	oidcpy(&graft->oid, oid);
>  	graft->nr_parent = -1;
> -	if (commit && commit->object.parsed)
> +	if (commit && commit->object.parsed) {
> +		free_commit_list(commit->parents);
>  		commit->parents = NULL;
> +	}
>  	return register_commit_graft(r, graft, 0);
>  }

Good catch. When I've dealt with leaks around commit_lists in the past,
one gotcha is that sometimes we've saved a pointer to the list
elsewhere. But in this case it looks pretty clear that the parent list
just goes away. So this patch is doing the right thing.

-Peff

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox