* [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
* [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 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 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 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
* 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 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
* 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
* 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
* 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: [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
* 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
* 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
* 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
* Re: Request for Help - Too many perl arguments as of 2.43.0-rc0
From: Eric Sunshine @ 2023-11-05 0:11 UTC (permalink / raw)
To: Jeff King; +Cc: rsbecker, Git List
In-Reply-To: <20231104134915.GA1492953@coredump.intra.peff.net>
On Sat, Nov 4, 2023 at 9:49 AM Jeff King <peff@peff.net> wrote:
> On Sat, Nov 04, 2023 at 02:36:48AM -0400, Eric Sunshine wrote:
> > I don't see an urgent need for it. Unlike the actual tests themselves
> > run by `make test` which may catch platform-specific problems in Git
> > itself, the purpose of the "linting" checks is not to catch
> > platform-specific problems, but rather to help test authors by
> > identifying mistakes in the tests which might make them fragile. So,
> > disabling linting on a particular platform isn't going to cause `make
> > test` to miss some important Git problem specific to that platform.
>
> 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).
> OTOH, this is the first time I think I've seen the linting cause a
> problem (whereas unexpected compile warnings are much more likely, as we
> are depending on the system compiler's behavior).
There have been a few other times when the linting scripts have needed
a tweak or two to work properly on some less-well-represented
platform, but they were minor issues[1,2,3,4].
> So consider it an idle thought for discussion, and not necessarily a
> proposal. ;)
As noted in my response to Junio[5], in the long run, we may want to
go with Ævar's idea of having `make` track changes to the test
scripts, thus only run linting on an as-needed basis.
[1]: a3c4c8841c (tests: use shorter labels in chainlint.sed for AIX
sed, 2018-08-24)
[2]: 2d9ded8acc (tests: fix comment syntax in chainlint.sed for AIX
sed, 2018-08-24)
[3]: b3b753b104 (Fit to Plan 9's ANSI/POSIX compatibility layer, 2020-09-10)
[4]: 1f51b77f4f (chainlint.pl: fix /proc/cpuinfo regexp, 2022-11-22)
[5]: https://lore.kernel.org/git/CAPig+cSC8m5a8PhMw_eJbswwNB-VgBt+n56HSTLLabV9_+y--g@mail.gmail.com/
^ permalink raw reply
* [PATCH v3 1/2] rebase: support non-interactive autosquash
From: Andy Koppe @ 2023-11-05 0:08 UTC (permalink / raw)
To: git; +Cc: gitster, newren, Andy Koppe
In-Reply-To: <20231104220330.14577-1-andy.koppe@gmail.com>
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.
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.
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.
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>
---
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
"
--
2.43.0-rc0
^ permalink raw reply related
* [PATCH v3 2/2] docs: rewrite rebase --(no-)autosquash description
From: Andy Koppe @ 2023-11-05 0:08 UTC (permalink / raw)
To: git; +Cc: gitster, newren, Andy Koppe
In-Reply-To: <20231105000808.10171-1-andy.koppe@gmail.com>
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, 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, which matches a previous commit if it matches
+ the start of the subject line or the hash of that commit.
+
-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. 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.
--
2.43.0-rc0
^ permalink raw reply related
* Re: Request for Help - Too many perl arguments as of 2.43.0-rc0
From: Eric Sunshine @ 2023-11-04 23:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: rsbecker, Git List
In-Reply-To: <xmqq8r7egd8u.fsf@gitster.g>
On Sat, Nov 4, 2023 at 3:59 AM Junio C Hamano <gitster@pobox.com> wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
> > Also, in the longer term, as you suggested, `xargs` is likely a more
> > fruitful solution.
>
> Hmph, the list of our test scripts exceed command line limit? That
> sounds a bit nasty, as we somehow need to prepare a pipe and feed
> them into it, in order to drive xargs downstream of the pipe.
>
> Ideally if there were a GNUMake function that slices a list into
> sublists of "reasonable" lengths, we could use it to directly drive
> N invocations of check-non-portable-shell script instead of xargs,
> but I didn't find one. Here is I came up with, using foreach that
> is "slice the list into many sublists of 1 element", but it made me
> feel dirty.
Indeed, that's ugly. I hadn't even put any thought into it since there
doesn't seem to be a pressing need for it.
In the long run, Ævar's idea of having `make` notice which, if any,
test scripts have changed, and only perform linting on an as-needed
basis may be the way to go[1,2,3], thus only passing a single script
as argument to each of the linters.
[1]: https://lore.kernel.org/git/220901.86bkrzjm6e.gmgdl@evledraar.gmail.com/
[2]: https://lore.kernel.org/git/221122.86cz9fbyln.gmgdl@evledraar.gmail.com/
[3]: https://github.com/avar/git/commits/avar/t-Makefile-break-T-to-file-association
^ permalink raw reply
* Re: BUG: fsmonitor.c:21: fsmonitor_dirty has more entries than the index
From: Kache Hit @ 2023-11-04 22:05 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <CAC7ZvyaQpYiVAszu_Oe5UoKgpe48dRJ8i1O8hLNOSo3UXfPVug@mail.gmail.com>
Just reporting that I ran into this again, this time with some info to
help repro, though the issue may be fixed already.
I managed to avoid it by turning off core.splitIndex, so I'd suspected
the setting conflicts with feature.manyFiles.
It could very also be/instead conflict with fsmonitor that I also use,
as mentioned in the similar/related thread:
https://public-inbox.org/git/xmqqbkhv6dw3.fsf@gitster.g/T/#m13a5ad383f040bb3a6be7641bd04aa20424a274c
Which references a splitindex & fsmonitor bug that's since been
addressed since 2.41:
https://github.com/git/git/commit/3704fed5eae8ca2fa20bcf6adb277ee83b012ce0
On Mon, Aug 22, 2022 at 9:53 PM Kache Hit <kache.hit@gmail.com> wrote:
>
> Hi,
>
> I've not been able to successfully repro this after managing to
> recover from it by rebuilding the index:
> https://stackoverflow.com/questions/73044253
>
> I'm sorry I couldn't be more helpful.
>
> On Fri, Jul 29, 2022 at 8:59 AM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > Hi Kache,
> >
> > On Tue, 19 Jul 2022, Kache Hit wrote:
> >
> > > A thought: the 179457 is reminiscent of something else I did just before this:
> > >
> > > I was doing some "code archeology" and was headlessly checking out
> > > some old SHAs in this large monorepo.
> > > During checkout, it said it was updating 174823 files in total.
> >
> > Do you think it would be possible to whittle this down a bit, and maybe
> > attempt to come up with a reproducible example? Something like what is
> > described in https://stackoverflow.com/help/mcve.
> >
> > If all else fails, and you _only_ manage to reproduce it in the original
> > repository, could you at least try to figure out a reliable way to get the
> > Git index into the indicated state (if I were you, I would start off by
> > switching to the pre-rebase revision, deleting `.git/index` and then
> > running `git reset --hard` and then see whether the bug can be
> > reproduced)?
> >
> > Ciao,
> > Johannes
> >
> > >
> > > On Tue, Jul 19, 2022 at 2:36 PM Kache Hit <kache.hit@gmail.com> wrote:
> > > >
> > > > Hi. Output of git bugreport:
> > > >
> > > > ---
> > > >
> > > > 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)
> > > >
> > > > Wanted to retain git tree structure when pulling latest and rebasing.
> > > > First indication of error was the `rebase -r` of the merge commit
> > > >
> > > > What did you expect to happen? (Expected behavior)
> > > >
> > > > successful --rebase-merges rebase of my commits on top of master
> > > >
> > > > What happened instead? (Actual behavior)
> > > >
> > > > ```sh
> > > > ❯ git rebase -r master
> > > > BUG: fsmonitor.c:21: fsmonitor_dirty has more entries than the index
> > > > (179457 > 1040)
> > > > zsh: abort git rebase -r master
> > > > ```
> > > >
> > > > What's different between what you expected and what actually happened?
> > > >
> > > > Anything else you want to add:
> > > >
> > > > I'm currently "stuck" in this state, not sure how to recover or repro:
> > > >
> > > > ```sh
> > > > ❯ git s
> > > > BUG: fsmonitor.c:21: fsmonitor_dirty has more entries than the index
> > > > (179457 > 1040)
> > > > error: git died of signal 6
> > > >
> > > > ❯ git log
> > > >
> > > > ❯ git d head~
> > > > error: git died of signal 6
> > > > BUG: fsmonitor.c:21: fsmonitor_dirty has more entries than the index
> > > > (179457 > 1040)
> > > >
> > > > ❯ git log # works
> > > >
> > > > ❯ git status
> > > > BUG: fsmonitor.c:21: fsmonitor_dirty has more entries than the index
> > > > (179457 > 1040)
> > > > zsh: abort git status
> > > >
> > > > ❯ git commit --amend
> > > > BUG: fsmonitor.c:21: fsmonitor_dirty has more entries than the index
> > > > (179457 > 1040)
> > > > zsh: abort git commit --amend
> > > >
> > > > ❯ git checkout head
> > > > fatal: Unable to create '/Users/XXXXX/YYYYY/.git/index.lock': File exists.
> > > >
> > > > Another git process seems to be running in this repository, e.g. #
> > > > All of this was run while git bugreport was running
> > > > an editor opened by 'git commit'. Please make sure all processes
> > > > are terminated then try again. If it still fails, a git process
> > > > may have crashed in this repository earlier:
> > > > remove the file manually to continue.
> > > >
> > > > ❯ rm /Users/XXXXX/YYYYY/.git/index.lock
> > > >
> > > > ❯ git checkout head
> > > > BUG: fsmonitor.c:21: fsmonitor_dirty has more entries than the index
> > > > (179457 > 1040)
> > > > zsh: abort git checkout head
> > > >
> > > > ❯ git checkout head
> > > > fatal: Unable to create '/Users/XXXXX/YYYYY/.git/index.lock': File exists.
> > > >
> > > > Another git process seems to be running in this repository, e.g.
> > > > an editor opened by 'git commit'. Please make sure all processes
> > > > are terminated then try again. If it still fails, a git process
> > > > may have crashed in this repository earlier:
> > > > remove the file manually to continue.
> > > > ```
> > > >
> > > >
> > > > 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.37.1
> > > > cpu: x86_64
> > > > no commit associated with this build
> > > > sizeof-long: 8
> > > > sizeof-size_t: 8
> > > > shell-path: /bin/sh
> > > > feature: fsmonitor--daemon
> > > > uname: Darwin 20.6.0 Darwin Kernel Version 20.6.0: Tue Feb 22 21:10:41
> > > > PST 2022; root:xnu-7195.141.26~1/RELEASE_X86_64 x86_64
> > > > compiler info: clang: 13.0.0 (clang-1300.0.29.30)
> > > > libc info: no libc information available
> > > > $SHELL (typically, interactive shell): /bin/zsh
> > > >
> > > >
> > > > [Enabled Hooks]
> > > > pre-commit
> > > > pre-push
> > >
^ permalink raw reply
* Re: [PATCH 1/2] rebase: support non-interactive autosquash
From: Andy Koppe @ 2023-11-04 22:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, newren
In-Reply-To: <xmqqil6iiacq.fsf@gitster.g>
On 04/11/2023 01:19, Junio C Hamano wrote:
> Andy Koppe <andy.koppe@gmail.com> writes:
>
>> rebase.autoSquash::
>> - If set to true enable `--autosquash` option by default.
>> + When set to 'interactive' or 'true', enable the `--autosquash` option
>> + for interactive rebase. When set to 'always', enable it for
>> + non-interactive rebase as well. Defaults to 'false'.
>
> I think a better and more extensible way to coax the new feature
> into the configuration system is to arrange it more like so:
>
> false - synonym for "".
> true - synonym for "interactive".
> anything else - comman separated list of rebase methods, e.g.,
> "interactive,noninteractive"
>
> possible rebase method names might include other
> stuff like "apply" or "merge", but I haven't
> thought it through, so take this part with a
> grain of salt.
>
> That way, the Boolean versions can be considered historical spelling
> of a more general system where you can exactly tell when autosquash
> takes place. When we add to a new variant on top of 'interactive'
> and 'non-interactive' variants the current rebase has, we do not
> know if it makes sense to allow it to also handle autosquash without
> knowing how that new variant's behavior appears to the end user, so
> 'always' that blindly enables autosquash for any unforseen future
> variants of 'rebase' is probably not what you want.
Thanks, done in v2.
Andy
^ permalink raw reply
* [PATCH v2 2/2] docs: rewrite rebase --(no-)autosquash description
From: Andy Koppe @ 2023-11-04 22:03 UTC (permalink / raw)
To: git; +Cc: gitster, newren, Andy Koppe
In-Reply-To: <20231104220330.14577-1-andy.koppe@gmail.com>
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, 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, which matches a previous commit if it matches
+ the start of the subject line or the hash of that commit.
+
-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. 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.
--
2.43.0-rc0
^ permalink raw reply related
* [PATCH v2 1/2] rebase: support non-interactive autosquash
From: Andy Koppe @ 2023-11-04 22:03 UTC (permalink / raw)
To: git; +Cc: gitster, newren, Andy Koppe
In-Reply-To: <20231103212958.18472-1-andy.koppe@gmail.com>
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.
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.
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.
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>
---
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.
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..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);
+ }
+}
+
static void parse_rebase_merges_value(struct rebase_options *options, const char *value)
{
if (!strcmp("no-rebase-cousins", value))
@@ -772,8 +793,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 +1429,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 +1545,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 +1566,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 +1890,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
"
--
2.43.0-rc0
^ permalink raw reply related
* RE: Request for Help - Too many perl arguments as of 2.43.0-rc0
From: rsbecker @ 2023-11-04 14:55 UTC (permalink / raw)
To: 'Jeff King', 'Eric Sunshine'; +Cc: 'Git List'
In-Reply-To: <20231104134915.GA1492953@coredump.intra.peff.net>
On November 4, 2023 9:49 AM, Jeff King wrote:
>On Sat, Nov 04, 2023 at 02:36:48AM -0400, Eric Sunshine wrote:
>
>> I don't see an urgent need for it. Unlike the actual tests themselves
>> run by `make test` which may catch platform-specific problems in Git
>> itself, the purpose of the "linting" checks is not to catch
>> platform-specific problems, but rather to help test authors by
>> identifying mistakes in the tests which might make them fragile. So,
>> disabling linting on a particular platform isn't going to cause `make
>> test` to miss some important Git problem specific to that platform.
>
>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.
>
>OTOH, this is the first time I think I've seen the linting cause a problem (whereas
>unexpected compile warnings are much more likely, as we are depending on the
>system compiler's behavior).
>
>So consider it an idle thought for discussion, and not necessarily a proposal. ;)
In my case, I am building git for users of the platform (a.k.a. mostly a packager), although I'm hoping to be more involved in contributions soon. This involves build + full test under multiple situations on the NonStop platform.
--Randall
^ permalink raw reply
* Re: Request for Help - Too many perl arguments as of 2.43.0-rc0
From: Jeff King @ 2023-11-04 13:49 UTC (permalink / raw)
To: Eric Sunshine; +Cc: rsbecker, Git List
In-Reply-To: <CAPig+cQpxRQnhffR8EWWRhqJPmOeOuCE3qsuMcnDyuMLLbTH8Q@mail.gmail.com>
On Sat, Nov 04, 2023 at 02:36:48AM -0400, Eric Sunshine wrote:
> I don't see an urgent need for it. Unlike the actual tests themselves
> run by `make test` which may catch platform-specific problems in Git
> itself, the purpose of the "linting" checks is not to catch
> platform-specific problems, but rather to help test authors by
> identifying mistakes in the tests which might make them fragile. So,
> disabling linting on a particular platform isn't going to cause `make
> test` to miss some important Git problem specific to that platform.
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.
OTOH, this is the first time I think I've seen the linting cause a
problem (whereas unexpected compile warnings are much more likely, as we
are depending on the system compiler's behavior).
So consider it an idle thought for discussion, and not necessarily a
proposal. ;)
-Peff
^ permalink raw reply
* Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses
From: Andy Koppe @ 2023-11-04 9:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Kousik Sanagavarapu, Liam Beguin, git
In-Reply-To: <xmqqy1fegu5i.fsf@gitster.g>
On 04/11/2023 01:54, Junio C Hamano wrote:
> Andy Koppe <andy.koppe@gmail.com> writes:
>
>> I'm not sure that this is the right way to handle a missing '@' here
>> actually, because %al already returns the whole email field in that
>> case, which makes sense as the likes of the 'mail' command would
>> interpret it as a local username.
>
> We could expand "%am" to \C-h (\010) so that "%al@%am" would end up
> displaying the same as "%al" but that would be way too cute for its
> own worth ;-)
:)
Unfortunately it also wouldn't always work, because ^H only moves the
cursor, so if the next thing is a newline, the '@' wouldn't actually get
deleted.
> It is unfortunate that "%al@%am" cannot be the same as "%ae" for
> local-only address, but giving an empty string for "%am" if "%ae" is
> local-only would be the best we could do for our users, and certainly
> much better than giving the same as "%ae", as you said above.
I suppose "%@am" could mean prepending an '@' when a domain is present,
similar to how "% am" would mean prepending a space and "%+am" would
mean prepending a newline. With that, "%al%@am" would be equivalent to
"%ae".
But that then raises the question whether it should be implemented just
for "%@[ac][mM]", or for all placeholders. In any case, I don't think it
needs to be part of the changes at hand.
Andy
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox