* [PATCH 5/7] clean: factorize incompatibility message
From: René Scharfe @ 2023-12-06 11:51 UTC (permalink / raw)
To: git
In-Reply-To: <20231206115215.94467-1-l.s.r@web.de>
Use the standard parameterized message for reporting incompatible
options to inform users that they can't use -x and -X together. This
reduces the number of strings to translate and makes the UI slightly
more consistent.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
builtin/clean.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/clean.c b/builtin/clean.c
index 49c224e626..d90766cad3 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -971,7 +971,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
if (ignored && ignored_only)
- die(_("-x and -X cannot be used together"));
+ die(_("options '%s' and '%s' cannot be used together"), "-x", "-X");
if (!ignored)
setup_standard_excludes(&dir);
if (ignored_only)
--
2.43.0
^ permalink raw reply related
* [PATCH 2/7] repack: use die_for_incompatible_opt3() for -A/-k/--cruft
From: René Scharfe @ 2023-12-06 11:51 UTC (permalink / raw)
To: git
In-Reply-To: <20231206115215.94467-1-l.s.r@web.de>
The repack option --keep-unreachable is incompatible with -A, --cruft is
incompatible with -A and -k, and -k is short for --keep-unreachable. So
they are all incompatible with each other.
Use the function for checking three mutually incompatible options,
die_for_incompatible_opt3(), to perform this check in one place and
without repetition. This is shorter and clearer.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
builtin/repack.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/builtin/repack.c b/builtin/repack.c
index edaee4dbec..c54777bbe5 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1203,19 +1203,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
if (delete_redundant && repository_format_precious_objects)
die(_("cannot delete packs in a precious-objects repo"));
- if (keep_unreachable &&
- (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE)))
- die(_("options '%s' and '%s' cannot be used together"), "--keep-unreachable", "-A");
+ die_for_incompatible_opt3(unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE), "-A",
+ keep_unreachable, "-k/--keep-unreachable",
+ pack_everything & PACK_CRUFT, "--cruft");
- if (pack_everything & PACK_CRUFT) {
+ if (pack_everything & PACK_CRUFT)
pack_everything |= ALL_INTO_ONE;
- if (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE))
- die(_("options '%s' and '%s' cannot be used together"), "--cruft", "-A");
- if (keep_unreachable)
- die(_("options '%s' and '%s' cannot be used together"), "--cruft", "-k");
- }
-
if (write_bitmaps < 0) {
if (!write_midx &&
(!(pack_everything & ALL_INTO_ONE) || !is_bare_repository()))
--
2.43.0
^ permalink raw reply related
* [PATCH 0/7] standardize incompatibility messages
From: René Scharfe @ 2023-12-06 11:51 UTC (permalink / raw)
To: git
More of what a699367bb8 (i18n: factorize more 'incompatible options'
messages, 2022-01-31) did: Simplify checks for multiple mutually
exclusive options, reduce the number of strings to translate, improve UI
consistency a bit.
push: use die_for_incompatible_opt4() for --delete/--tags/--all/--mirror
repack: use die_for_incompatible_opt3() for -A/-k/--cruft
revision: use die_for_incompatible_opt3() for --graph/--reverse/--walk-reflogs
revision, rev-parse: factorize incompatibility messages about --exclude-hidden
clean: factorize incompatibility message
worktree: standardize incompatibility messages
worktree: simplify incompatibility message for --orphan and commit-ish
builtin/clean.c | 2 +-
builtin/push.c | 12 ++++--------
builtin/repack.c | 14 ++++----------
builtin/rev-parse.c | 9 ++++++---
builtin/worktree.c | 21 +++++++++++----------
revision.c | 27 +++++++++++++++------------
t/t2400-worktree-add.sh | 2 +-
t/t6018-rev-list-glob.sh | 6 ++----
t/t6021-rev-list-exclude-hidden.sh | 4 ++--
9 files changed, 46 insertions(+), 51 deletions(-)
--
2.43.0
^ permalink raw reply
* [PATCH 1/7] push: use die_for_incompatible_opt4() for --delete/--tags/--all/--mirror
From: René Scharfe @ 2023-12-06 11:51 UTC (permalink / raw)
To: git
In-Reply-To: <20231206115215.94467-1-l.s.r@web.de>
The push option --delete is incompatible with --all, --mirror, and
--tags; --tags is incompatible with --all and --mirror; --all is
incompatible with --mirror. This means they are all incompatible with
each other. And --branches is an alias for --all.
Use the function for checking four mutually incompatible options,
die_for_incompatible_opt4(), to perform this check in one place and
without repetition. This is shorter and clearer.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
builtin/push.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/builtin/push.c b/builtin/push.c
index 2e708383c2..f77f424324 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -639,8 +639,10 @@ int cmd_push(int argc, const char **argv, const char *prefix)
: &push_options_config);
set_push_cert_flags(&flags, push_cert);
- if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
- die(_("options '%s' and '%s' cannot be used together"), "--delete", "--all/--branches/--mirror/--tags");
+ die_for_incompatible_opt4(deleterefs, "--delete",
+ tags, "--tags",
+ flags & TRANSPORT_PUSH_ALL, "--all/--branches",
+ flags & TRANSPORT_PUSH_MIRROR, "--mirror");
if (deleterefs && argc < 2)
die(_("--delete doesn't make sense without any refs"));
@@ -677,19 +679,13 @@ int cmd_push(int argc, const char **argv, const char *prefix)
flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);
if (flags & TRANSPORT_PUSH_ALL) {
- if (tags)
- die(_("options '%s' and '%s' cannot be used together"), "--all", "--tags");
if (argc >= 2)
die(_("--all can't be combined with refspecs"));
}
if (flags & TRANSPORT_PUSH_MIRROR) {
- if (tags)
- die(_("options '%s' and '%s' cannot be used together"), "--mirror", "--tags");
if (argc >= 2)
die(_("--mirror can't be combined with refspecs"));
}
- if ((flags & TRANSPORT_PUSH_ALL) && (flags & TRANSPORT_PUSH_MIRROR))
- die(_("options '%s' and '%s' cannot be used together"), "--all", "--mirror");
if (!is_empty_cas(&cas) && (flags & TRANSPORT_PUSH_FORCE_IF_INCLUDES))
cas.use_force_if_includes = 1;
--
2.43.0
^ permalink raw reply related
* [PATCH 4/7] revision, rev-parse: factorize incompatibility messages about --exclude-hidden
From: René Scharfe @ 2023-12-06 11:51 UTC (permalink / raw)
To: git
In-Reply-To: <20231206115215.94467-1-l.s.r@web.de>
Use the standard parameterized message for reporting incompatible
options to report options that are not accepted in combination with
--exclude-hidden. This reduces the number of strings to translate and
makes the UI a bit more consistent.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
builtin/rev-parse.c | 9 ++++++---
revision.c | 18 ++++++++++++------
t/t6018-rev-list-glob.sh | 6 ++----
t/t6021-rev-list-exclude-hidden.sh | 4 ++--
4 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index fde8861ca4..917f122440 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -893,13 +893,15 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
}
if (opt_with_value(arg, "--branches", &arg)) {
if (ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --branches"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--branches");
handle_ref_opt(arg, "refs/heads/");
continue;
}
if (opt_with_value(arg, "--tags", &arg)) {
if (ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --tags"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--tags");
handle_ref_opt(arg, "refs/tags/");
continue;
}
@@ -909,7 +911,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
}
if (opt_with_value(arg, "--remotes", &arg)) {
if (ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --remotes"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--remotes");
handle_ref_opt(arg, "refs/remotes/");
continue;
}
diff --git a/revision.c b/revision.c
index 1b7e1af6c6..25335a74ad 100644
--- a/revision.c
+++ b/revision.c
@@ -2709,7 +2709,8 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
clear_ref_exclusions(&revs->ref_excludes);
} else if (!strcmp(arg, "--branches")) {
if (revs->ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --branches"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--branches");
handle_refs(refs, revs, *flags, refs_for_each_branch_ref);
clear_ref_exclusions(&revs->ref_excludes);
} else if (!strcmp(arg, "--bisect")) {
@@ -2720,12 +2721,14 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
revs->bisect = 1;
} else if (!strcmp(arg, "--tags")) {
if (revs->ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --tags"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--tags");
handle_refs(refs, revs, *flags, refs_for_each_tag_ref);
clear_ref_exclusions(&revs->ref_excludes);
} else if (!strcmp(arg, "--remotes")) {
if (revs->ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --remotes"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--remotes");
handle_refs(refs, revs, *flags, refs_for_each_remote_ref);
clear_ref_exclusions(&revs->ref_excludes);
} else if ((argcount = parse_long_opt("glob", argv, &optarg))) {
@@ -2743,21 +2746,24 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
} else if (skip_prefix(arg, "--branches=", &optarg)) {
struct all_refs_cb cb;
if (revs->ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --branches"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--branches");
init_all_refs_cb(&cb, revs, *flags);
for_each_glob_ref_in(handle_one_ref, optarg, "refs/heads/", &cb);
clear_ref_exclusions(&revs->ref_excludes);
} else if (skip_prefix(arg, "--tags=", &optarg)) {
struct all_refs_cb cb;
if (revs->ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --tags"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--tags");
init_all_refs_cb(&cb, revs, *flags);
for_each_glob_ref_in(handle_one_ref, optarg, "refs/tags/", &cb);
clear_ref_exclusions(&revs->ref_excludes);
} else if (skip_prefix(arg, "--remotes=", &optarg)) {
struct all_refs_cb cb;
if (revs->ref_excludes.hidden_refs_configured)
- return error(_("--exclude-hidden cannot be used together with --remotes"));
+ return error(_("options '%s' and '%s' cannot be used together"),
+ "--exclude-hidden", "--remotes");
init_all_refs_cb(&cb, revs, *flags);
for_each_glob_ref_in(handle_one_ref, optarg, "refs/remotes/", &cb);
clear_ref_exclusions(&revs->ref_excludes);
diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh
index 67d523d405..3b181f771c 100755
--- a/t/t6018-rev-list-glob.sh
+++ b/t/t6018-rev-list-glob.sh
@@ -214,15 +214,13 @@ do
for pseudoopt in branches tags remotes
do
test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt" '
- echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected &&
test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt 2>err &&
- test_cmp expected err
+ test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
'
test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt=pattern" '
- echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected &&
test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
- test_cmp expected err
+ test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
'
done
done
diff --git a/t/t6021-rev-list-exclude-hidden.sh b/t/t6021-rev-list-exclude-hidden.sh
index cdf7aa9427..51df02105d 100755
--- a/t/t6021-rev-list-exclude-hidden.sh
+++ b/t/t6021-rev-list-exclude-hidden.sh
@@ -151,12 +151,12 @@ do
do
test_expect_success "$section: fails with --$pseudoopt" '
test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt 2>err &&
- test_grep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
+ test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
'
test_expect_success "$section: fails with --$pseudoopt=pattern" '
test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
- test_grep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
+ test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
'
done
done
--
2.43.0
^ permalink raw reply related
* [PATCH 3/7] revision: use die_for_incompatible_opt3() for --graph/--reverse/--walk-reflogs
From: René Scharfe @ 2023-12-06 11:51 UTC (permalink / raw)
To: git
In-Reply-To: <20231206115215.94467-1-l.s.r@web.de>
The revision options --reverse is incompatibel with --walk-reflogs and
--graph is incompatible with both --reverse and --walk-reflogs. So they
are all incompatible with each other.
Use the function for checking three mutually incompatible options,
die_for_incompatible_opt3(), to perform this check in one place and
without repetition. This is shorter and clearer.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
revision.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/revision.c b/revision.c
index b2861474b1..1b7e1af6c6 100644
--- a/revision.c
+++ b/revision.c
@@ -3036,8 +3036,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
revs->grep_filter.ignore_locale = 1;
compile_grep_patterns(&revs->grep_filter);
- if (revs->reverse && revs->reflog_info)
- die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--walk-reflogs");
if (revs->reflog_info && revs->limited)
die("cannot combine --walk-reflogs with history-limiting options");
if (revs->rewrite_parents && revs->children.name)
@@ -3048,11 +3046,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
/*
* Limitations on the graph functionality
*/
- if (revs->reverse && revs->graph)
- die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--graph");
+ die_for_incompatible_opt3(!!revs->graph, "--graph",
+ !!revs->reverse, "--reverse",
+ !!revs->reflog_info, "--walk-reflogs");
- if (revs->reflog_info && revs->graph)
- die(_("options '%s' and '%s' cannot be used together"), "--walk-reflogs", "--graph");
if (revs->no_walk && revs->graph)
die(_("options '%s' and '%s' cannot be used together"), "--no-walk", "--graph");
if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
--
2.43.0
^ permalink raw reply related
* git checkout --recurse-submodules deletes local modifications
From: Simon Etter @ 2023-12-06 7:16 UTC (permalink / raw)
To: git
Hi there!
It seems git checkout --recurse-submodules doesn't live up to its
documentation. According to the docs:
> If local modifications in a submodule would be overwritten the checkout will fail unless -f is used.
Here's an MWE where git checkout --recurse-submodules does overwrite
local modifications:
```
# Prepare repo
rm -rf /tmp/test
mkdir /tmp/test
cd /tmp/test
git init
git submodule add git@github.com:octocat/Hello-World.git
git commit -m "Add submodule"
git checkout -b other
cd Hello-World
git checkout 762941318ee16e59dabbacb1b4049eec22f0d303
cd ..
git add Hello-World
git commit -m "Change submodule commit"
# Add local modification
echo boo! > Hello-World/README
# Switch branches. This completes without error, and deletes the
change introduced in the previous line.
git checkout main --recurse-submodules
```
I believe part of the problem is that
762941318ee16e59dabbacb1b4049eec22f0d303 and
7fd1a60b01f91b314f59955a4e4d4e80d8edf11d (the Hello-World master
commit) are the same; the last line does report an error if I make
`other` point at 553c2077f0edc3d5dc5d17262f6aa498e69d6f8e instead of
the above commit. However, I don't think this changes the fact that
the above MWE makes git checkout --recurse-submodules look pretty
dangerous.
I'd love to hear if
1) the above is intended behavior,
2) I'm doing something wrong, or
3) this is a bug.
Best regards, and thanks for all your hard work,
Simon
^ permalink raw reply
* git switch has fatal dependency on default fetch config
From: Jeremiah Steele (Jerry) @ 2023-12-06 3:41 UTC (permalink / raw)
To: git
Changing the default fetch refspec for a remote breaks git switch:
% git branch -r
origin/HEAD -> origin/master
origin/feature
origin/master
% git remote set-branches origin master
% git switch -c feature --track origin/feature
fatal: cannot set up tracking information; starting point 'origin/feature' is not a branch
% git remote set-branches --add origin feature
% git switch -c feature --track origin/feature
branch 'feature' set up to track 'origin/feature'.
Switched to a new branch 'feature'
It seems like I should be able to fetch a remote branch and track it without having to monkey around with my default fetch config. Is there a reason git switch has a hard dependency on the default remote fetch refspec configuration?
^ permalink raw reply
* Re: [PATCH v2] This PR enables a successful git build on z/OS.
From: René Scharfe @ 2023-12-05 20:58 UTC (permalink / raw)
To: Eric Sunshine, Haritha via GitGitGadget; +Cc: git, brian m. carlson, Haritha D
In-Reply-To: <CAPig+cQ8eEU0TOoBf2KavTyf0OLhNtmOzs8+WqZy9JMXa=ydPQ@mail.gmail.com>
Am 04.12.23 um 22:46 schrieb Eric Sunshine:
> On Mon, Dec 4, 2023 at 9:19 AM Haritha via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>> diff --git a/fetch-negotiator.h b/fetch-negotiator.h
>> @@ -47,7 +47,7 @@ struct fetch_negotiator {
>> - void (*release)(struct fetch_negotiator *);
>> + void (*release_negotiator)(struct fetch_negotiator *);> diff --git a/fetch-pack.c b/fetch-pack.c
>> @@ -1232,7 +1232,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
>> if (negotiator)
>> - negotiator->release(negotiator);
>> + negotiator->release_negotiator(negotiator);
>> return ref;
>> }
>> diff --git a/git-compat-util.h b/git-compat-util.h
>> @@ -223,7 +223,15 @@ struct strbuf;
>> +#ifdef __MVS__
>> + #define release stdlib_release
>> + #define fetch stdlib_fetch
>> +#endif
>> #include <stdlib.h>
>> +#ifdef __MVS__
>> + #undef fetch
>> + #undef release
>> +#endif
>
> So, the problem is that z/OS is polluting the C namespace or the
> preprocessor namespace with names "release" and "fetch"? When we've
> run across this problem on other platforms, we modify
> git-compat-util.h or some other files in compat/ to suppress the
> pollution introduced by the platform headers rather than "fixing" the
> Git source code. For instance, if "release" and "fetch" are macros on
> z/OS, then you may be able to simply #undef them after pulling in
> whichever z/OS header defines them. If they are actual system
> functions (rather than macros), you may be able to employ the
> #undef/#define dance to rename them to something else, such as
> "zos_release" and "zos_fetch" _before_ including the system header
> which declares those functions.
I assume that [1] and [2] link to the documentation of these functions.
Both pages include the following paragraph:
"To avoid infringing on the user's name space, this nonstandard
function has two names. One name is prefixed with two underscore
characters, and one name is not. The name without the prefix
underscore characters is exposed only when using the runtime library
extensions."
[3] defines "runtime library extensions" and mentions the macro __EXT
and LANGLVL(EXTENDED). Do you need those extensions? If you don't then
perhaps turning them off avoids the name collisions without needing to
change the code?
René
[1] https://www.ibm.com/docs/en/zos/3.1.0?topic=functions-fetch-get-load-module
[2] https://www.ibm.com/docs/en/zos/3.1.0?topic=functions-release-delete-load-module
[3] https://www.ibm.com/docs/en/zos/3.1.0?topic=reference-zos-cc-compiler-feature#compiler_feature__ext_lib_func
^ permalink raw reply
* Re: git:// warn as connection not secure
From: Jonny Grant @ 2023-12-05 20:42 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <20231201212423.M738201@dcvr>
On 01/12/2023 21:24, Eric Wong wrote:
> Jonny Grant <jg@jguk.org> wrote:
>> Hello
>> May I ask if anyone has suggested adding a default warning that git:// is not a secure connection?
>>
>> ie "warning: git:// is not a secure connection. https and ssh are secure."
>
> To be accurate, that would need an exclusion list of hosts behind
> already-encrypted and trusted networks. So stuff like .onion hostnames
> for Tor, and a user-configurable list of hosts in a private LAN/VPN.
That sounds good Eric.
Or even just an info message?
"info: git:// itself is an unencrypted connection. https and ssh are secure."
Kind regards
Jonny
^ permalink raw reply
* Re: [PATCH 05/24] midx: implement `DISP` chunk
From: Taylor Blau @ 2023-12-05 19:26 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King, Patrick Steinhardt
In-Reply-To: <xmqqjzpv4ecg.fsf@gitster.g>
On Sun, Dec 03, 2023 at 10:15:11PM +0900, Junio C Hamano wrote:
> Taylor Blau <me@ttaylorr.com> writes:
>
> > diff --git a/Documentation/git-multi-pack-index.txt b/Documentation/git-multi-pack-index.txt
> > index 3696506eb3..d130e65b28 100644
> > --- a/Documentation/git-multi-pack-index.txt
> > +++ b/Documentation/git-multi-pack-index.txt
> > @@ -49,6 +49,10 @@ write::
> > --stdin-packs::
> > Write a multi-pack index containing only the set of
> > line-delimited pack index basenames provided over stdin.
> > + Lines beginning with a '+' character (followed by the
> > + pack index basename as before) have their pack marked as
> > + "disjoint". See the "`DISP` chunk and disjoint packs"
> > + section in linkgit:gitformat-pack[5] for more.
>
> Makes one wonder who computes the set of packfiles, decides to
> prefix '+' to which ones, and how it does so, none of which appear
> in this step (which is understandable). As the flow of information
> is from the producer of individual "disjoint" packs (not in this
> step) to this new logic in "--stdin-packs" to the new "DISP" chunk
> writer (the primary focus of this step) to the final consumer of
> "DISP" chunk (not in this step), we are digging from the middle
> (hopefully to both directions in other steps). It is probably the
> easiest way to explain the idea to start from the primary data
> structures and "DISP" seems to be a good place to start.
Thanks. I found that laying out this series was rather tricky, since all
of the individual pieces really depend on the end state in order to make
any sense.
Hopefully you're satisfied with the way things are split up and
organized currently, but if you have suggestions on other ways I could
slice or dice this, please let me know.
> > + Two packs are "disjoint" with respect to one another when they have
> > + disjoint sets of objects.
> > + In other words, any object found in a pack
> > + contained in the set of disjoint packfiles is guaranteed to be
> > + uniquely located among those packs.
>
> I often advise people to rethink what they wrote _before_ "In other
> words", because the use of that phrase is a sign that the author
> considers the statement is hard to grok and needs rephrasing, in
> which case, the rephrased version may be a better way to explain the
> concept being presented without the harder-to-grok version.
>
> But I do not think this one is a good example to apply the advice.
> It is because "In other words," is somewhat misused in the sentence.
> Two "disjoint" packs do not store any common object (which is how
> you defined the adjective "disjoint" in the first sentence). "As a
> consequence"/"Hence", an object found in one pack among many
> "disjoint" packs will not appear in others.
Thanks, I'll replace this with "As a consequence", and try to follow
that general advice more often in the future ;-).
> OK, so it seems they really need to be strictly disjoint in order to
> participate in the reuse of the existing packdata.
I think that's generally true, though there are some exceptions.
I think the real condition here is that the *reused sections* must be
disjoint with respect to one another, not necessarily the packs
themselves. So having the packs be disjoint is a sufficient condition,
since we know that no matter which section(s) we reuse, they are
guaranteed to be disjoint.
I think that there is opportunity to be more clever here, e.g., by
allowing for different disjoint "groups" of packs, or mandating that you
can only reuse certain sections from different combinations of packs in
order to satisfy this property.
That's part of the reason why I left more space than is needed for the
"disjoint" state in the DISP chunk (it is 32 bits, of which we're only
using one of them). I'm not sure that we would want more relaxed
constraints here, since they'd be harder to satisfy. But my hope is that
we would be able to learn from running this in production to figure out
whether or not such a thing would be useful.
> > + - All objects stored as offset- or reference-deltas also include their
> > + base object in the resulting pack.
>
> Are thin packs obsolete?
No, I think I should clarify this to make it more obvious that this only
applies to non-thin packs.
> > + find $objdir/pack -type f -name "*.idx" | xargs -n 1 basename | sort >packs &&
>
> That is an overly-long line.
Thanks for spotting.
> > +test_expect_success 'non-disjoint packs are detected' '
> > + test_when_finished "rm -fr repo" &&
> > + git init repo &&
> > + (
> > + cd repo &&
> > +
> > + test_commit base &&
> > + git repack -d &&
> > + test_commit other &&
> > + git repack -a &&
> > +
> > + ls -la .git/objects/pack/ &&
>
> Is this line a leftover debugging aid?
Indeed, thanks.
> > + find $objdir/pack -type f -name "*.idx" |
> > + sed -e "s/.*\/\(.*\)$/+\1/g" >in &&
>
> Lose "g"; it adds unnecessary cognitive burden to the readers if the
> patterh is expected to match multiple times, and you know that is
> not possible (your pattern is right anchored at the end). This may
> apply equally to other uses of "sed" in this patch.
Thanks, I dropped the 'g' in both instances.
Thanks,
Taylor
^ permalink raw reply
* Re: [PATCH v2] This PR enables a successful git build on z/OS.
From: Eric Sunshine @ 2023-12-04 21:46 UTC (permalink / raw)
To: Haritha via GitGitGadget; +Cc: git, brian m. carlson, Haritha D
In-Reply-To: <pull.1537.v2.git.git.1701699574054.gitgitgadget@gmail.com>
On Mon, Dec 4, 2023 at 9:19 AM Haritha via GitGitGadget
<gitgitgadget@gmail.com> wrote:
> Rename functions like "release" and "fetch"
> due to conflict in z/OS standard C libraries.
> Also disables autoconversion facility on z/OS
> and relies on iconv.
> New files created in binary format are also
> tagged as binary.
>
> Signed-off-by: Haritha D <harithamma.d@ibm.com>
> ---
> Enabling z/OS workflow for git
>
> z/OS is an IBM mainframe operating system, also known as OS/390. Our
> team has been actively involved in porting Git to z/OS and we have made
> significant modifications to facilitate this process. The patch below is
> the initial configuration for z/OS. I also have few follow up changes
> and I will send that after these changes are approved. Please let me
> know if there are any concerns.
It's fairly unlikely that this patch will be accepted as-is. Please
see brian's[1] and Junio's[2] valuable review comments in response to
your v1. They contain important suggestions which will give you a
better chance of landing these changes.
Generally speaking, the patch's commit message lacks sufficient detail
to allow a reviewer (or future reader) to understand why the changes
are being made. Moreover, this single patch seems to be addressing at
least three separate issues, hence should be split into three or more
patches, each standalone and tackling a single issue, and each easily
digested by a reviewer. The commit message of each patch should fully
explain and justify the changes made by the patch, keeping in mind
that most reviewers probably aren't familiar with z/OS, thus will need
extra hand-holding. More below...
[1]: https://lore.kernel.org/git/ZVKrWSv7JguKTSYw@tapette.crustytoothpaste.net/
[2]: https://lore.kernel.org/git/xmqqcywd2m9i.fsf@gitster.g/
> diff --git a/builtin/archive.c b/builtin/archive.c
> @@ -14,6 +14,15 @@
> static void create_output_file(const char *output_file)
> {
> int output_fd = xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);
> +#ifdef __MVS__
> + /*
> + * Since the data is in binary format,
> + * we need to set the z/OS file tag
> + * to binary to disable autoconversion
> + */
> + if (__setfdbinary(output_fd))
> + die_errno(_("could not tag archive file '%s'"), output_file);
> +#endif
As mentioned in an earlier review, the project generally doesn't want
#ifdef's littering the code and prefer that this sort of
platform-specific specialization be wrapped up in its own "compat"
file/function. For instance, perhaps you could create a
platform-specific specialization of xopen() and then `#define xopen`
to reference your specialized version. Your custom xopen() might first
call the xopen() which Git defines and then perform whatever extra
special work is needed for your platform. That way, you would not have
to muck around either in the code which calls xopen() or in the
Git-supplied xopen(). See, for example, how git-compat-util.h
overriedes certain functions, such as stat(), fstat(), etc. using an
#undefine/#define dance.
> diff --git a/combine-diff.c b/combine-diff.c
> @@ -1082,6 +1082,14 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
> + #ifdef __MVS__
> + /*
> + * Disable implicit autconversion on z/os,
> + * rely on conversion from iconv
> + */
> + __disableautocvt(fd);
> + #endif
> elem->mode = canon_mode(st.st_mode);
Similar comment. Try to find an abstraction which allows you to
perform this specialization in a way which does not require #ifdef's
within the main source code if possible.
> diff --git a/fetch-negotiator.h b/fetch-negotiator.h
> @@ -47,7 +47,7 @@ struct fetch_negotiator {
> - void (*release)(struct fetch_negotiator *);
> + void (*release_negotiator)(struct fetch_negotiator *);> diff --git a/fetch-pack.c b/fetch-pack.c
> @@ -1232,7 +1232,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
> if (negotiator)
> - negotiator->release(negotiator);
> + negotiator->release_negotiator(negotiator);
> return ref;
> }
> diff --git a/git-compat-util.h b/git-compat-util.h
> @@ -223,7 +223,15 @@ struct strbuf;
> +#ifdef __MVS__
> + #define release stdlib_release
> + #define fetch stdlib_fetch
> +#endif
> #include <stdlib.h>
> +#ifdef __MVS__
> + #undef fetch
> + #undef release
> +#endif
So, the problem is that z/OS is polluting the C namespace or the
preprocessor namespace with names "release" and "fetch"? When we've
run across this problem on other platforms, we modify
git-compat-util.h or some other files in compat/ to suppress the
pollution introduced by the platform headers rather than "fixing" the
Git source code. For instance, if "release" and "fetch" are macros on
z/OS, then you may be able to simply #undef them after pulling in
whichever z/OS header defines them. If they are actual system
functions (rather than macros), you may be able to employ the
#undef/#define dance to rename them to something else, such as
"zos_release" and "zos_fetch" _before_ including the system header
which declares those functions.
> diff --git a/read-cache.c b/read-cache.c
> @@ -205,6 +205,14 @@ static int ce_compare_data(struct index_state *istate,
> int fd = git_open_cloexec(ce->name, O_RDONLY);
> if (fd >= 0) {
> + #ifdef __MVS__
> + /*
> + * Since the data is in binary format,
> + * we need to set the z/OS file tag to
> + * binary to disable autoconversion
> + */
> + __disableautocvt(fd);
> + #endif
Same comment as above about encapsulating this in a platform-specific
specialization function in compat/ rather than polluting the code with
#ifdef.
^ permalink raw reply
* Re: [PATCH 2/2] checkout: forbid "-B <branch>" from touching a branch used elsewhere
From: Eric Sunshine @ 2023-12-04 21:06 UTC (permalink / raw)
To: Willem Verstraeten; +Cc: phillip.wood, Junio C Hamano, git, Jeff King
In-Reply-To: <CAGX9RpH0RJfBADQwJ=c7PCHU955vOqd0Wdc7Yi7XUuAQQW_FNQ@mail.gmail.com>
On Mon, Dec 4, 2023 at 7:21 AM Willem Verstraeten
<willem.verstraeten@gmail.com> wrote:
> It's not clear for me from the email thread what the status is of this
> bug report, and whether there is still something expected from me.
>
> Is the current consensus that this is a real issue that needs fixing?
> If so, does the current patch-set fix the issue, and how does the fix
> get into (one of) the next release(s)?
>
> Do I still need to do something?
According to Junio's latest "What's cooking"[1], the status of this
patch series is:
* jc/checkout-B-branch-in-use (2023-11-23) 2 commits
- checkout: forbid "-B <branch>" from touching a branch used elsewhere
- checkout: refactor die_if_checked_out() caller
"git checkout -B <branch> [<start-point>]" allowed a branch that is
in use in another worktree to be updated and checked out, which
might be a bit unexpected. The rule has been tightened, which is a
breaking change. "--ignore-other-worktrees" option is required to
unbreak you, if you are used to the current behaviour that "-B"
overrides the safety.
Needs review and documentation updates.
I'm not sure if the "Needs review" comment is still applicable since
the patch did get some review comments, however, the mentioned
documentation update is probably still needed for this series to
graduate. I can't speak for what Junio had in mind, but perhaps
sufficient would be to add a side-note to the description of the -B
option saying that it historically (accidentally) would succeed even
if the named branch was checked out in another worktree, but now
requires --ignore-other-worktrees.
To move the series forward, someone will probably need to make the
necessary documentation update. That someone could be you, if you're
interested, either by rerolling Junio's series and modifying patch
[2/2] to also make the necessary documentation update, or by posting a
patch, [3/2] atop his series which updates the documentation.
[1]: https://lore.kernel.org/git/xmqq8r6j1dgt.fsf@gitster.g/
^ permalink raw reply
* git status --porcelain=v2 -z returns paths relative to root
From: Ondra Medek @ 2023-12-04 19:04 UTC (permalink / raw)
To: git
Hello,
git status Porcelain Format Version 1 ignores config
"status.relativePaths" and returns paths relative to the working tree
root always.
On the other hand, git status Porcelain Format Version 2 respects
config "status.relativePaths". But, if the "-z" option is provided,
i.e. "git status --porcelain=v2 -z" it also ignores
"status.relativePaths" and returns paths relative to the working tree
root. Is this a bug or undocumented behaviour? See
https://git-scm.com/docs/git-status#_porcelain_format_version_2
Note: I would welcome some option to force git status to return
relative paths to the current working directory always.
Best regards
Ondra Medek
^ permalink raw reply
* Re: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording
From: Kousik Sanagavarapu @ 2023-12-04 18:43 UTC (permalink / raw)
To: Shreyansh Paliwal; +Cc: git, Junio C Hamano
In-Reply-To: <20231203171956.771-1-shreyanshpaliwalcmsmn@gmail.com>
On Sun, Dec 03, 2023 at 10:47:59PM +0530, Shreyansh Paliwal wrote:
> From: shreyp135 <shreyanshpaliwalcmsmn@gmail.com>
>
> In the recent commit
> 2e87fca189 (test framework: further deprecate test_i18ngrep, 2023-10-31),
> the test_i18ngrep() function was deprecated.
s/In the/In a
is gramatically correct, but probably not worth a reroll.
> So if a test employing this function fails,
> the error messages may be confusing due to wording issues.
Isn't the confusion due to test_i18ngrep being displayed in place of
test_grep and not the other way around? Because the formation of the
sentence makes it look like the latter.
> It's important to address these wording changes to ensure smooth transitions
> for developers adapting to the deprecation of test_i18ngrep,
> and to maintain the effectiveness of the testing process.
>
> Signed-off-by: Shreyansh Paliwal <Shreyanshpaliwalcmsmn@gmail.com>
> ---
> t/test-lib-functions.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> index 9c3cf12b26..8737c95e0c 100644
> --- a/t/test-lib-functions.sh
> +++ b/t/test-lib-functions.sh
> @@ -1277,7 +1277,7 @@ test_grep () {
> if test $# -lt 2 ||
> { test "x!" = "x$1" && test $# -lt 3 ; }
> then
> - BUG "too few parameters to test_i18ngrep"
> + BUG "too few parameters to test_grep"
> fi
>
> if test "x!" = "x$1"
> --
> 2.43.0.1
Rest looks good.
Have a great time at the vacation Junio (and sorry for pinging in the
first place... although this email will indirectly ping too :P).
Thanks
^ permalink raw reply
* [Outreachy][PATCH v3] t2400: avoid using pipes
From: Achu Luma @ 2023-12-04 15:37 UTC (permalink / raw)
To: christian.couder; +Cc: ach.lumap, git
In-Reply-To: <CAP8UFD0KDdwoJw6AzLUpqos=bLumcmDax59_MfQ9TUFqmmpcoA@mail.gmail.com>
The exit code of the preceding command in a pipe is disregarded,
so it's advisable to refrain from relying on it. Instead, by
saving the output of a Git command to a file, we gain the
ability to examine the exit codes of both commands separately.
Signed-off-by: Achu Luma <ach.lumap@gmail.com>
---
Since v2 I don't send a cover letter anymore, and I changed
my "Signed-of-by: ..." line so that it
contains my full real name and I added "Outreachy" to the subject.
t/t2400-worktree-add.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh
index df4aff7825..7ead05bb98 100755
--- a/t/t2400-worktree-add.sh
+++ b/t/t2400-worktree-add.sh
@@ -468,7 +468,8 @@ test_expect_success 'put a worktree under rebase' '
cd under-rebase &&
set_fake_editor &&
FAKE_LINES="edit 1" git rebase -i HEAD^ &&
- git worktree list | grep "under-rebase.*detached HEAD"
+ git worktree list >actual &&
+ grep "under-rebase.*detached HEAD" actual
)
'
@@ -509,7 +510,8 @@ test_expect_success 'checkout a branch under bisect' '
git bisect start &&
git bisect bad &&
git bisect good HEAD~2 &&
- git worktree list | grep "under-bisect.*detached HEAD" &&
+ git worktree list >actual &&
+ grep "under-bisect.*detached HEAD" actual &&
test_must_fail git worktree add new-bisect under-bisect &&
! test -d new-bisect
)
--
2.41.0.windows.1
^ permalink raw reply related
* [PATCH v2] This PR enables a successful git build on z/OS.
From: Haritha via GitGitGadget @ 2023-12-04 14:19 UTC (permalink / raw)
To: git; +Cc: brian m. carlson, Haritha, Haritha D
In-Reply-To: <pull.1537.git.git.1699871056.gitgitgadget@gmail.com>
From: Haritha D <harithamma.d@ibm.com>
Rename functions like "release" and "fetch"
due to conflict in z/OS standard C libraries.
Also disables autoconversion facility on z/OS
and relies on iconv.
New files created in binary format are also
tagged as binary.
Signed-off-by: Haritha D <harithamma.d@ibm.com>
---
Enabling z/OS workflow for git
z/OS is an IBM mainframe operating system, also known as OS/390. Our
team has been actively involved in porting Git to z/OS and we have made
significant modifications to facilitate this process. The patch below is
the initial configuration for z/OS. I also have few follow up changes
and I will send that after these changes are approved. Please let me
know if there are any concerns.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1537%2FHarithaIBM%2Fenablezos-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1537/HarithaIBM/enablezos-v2
Pull-Request: https://github.com/git/git/pull/1537
Range-diff vs v1:
1: 712eb3712f1 < -: ----------- Enabling z/OS workflow for git
2: 098b9ca8ece ! 1: b9882d90c5d Enable builds for z/OS.
@@ Metadata
Author: Haritha D <harithamma.d@ibm.com>
## Commit message ##
- Enable builds for z/OS.
+ This PR enables a successful git build on z/OS.
- This commit enables git to build on z/OS.
- It takes advantage of enahanced ASCII
- services on z/OS to auto-convert input
- files to ASCII
- It also adds support for
- [platform]-working-tree-encoding.
- Platform is substituted with uname_info.sysname,
- so it will only apply to the given platform.
- Also adds support for scripts that are not in
- standard locations so that /bin/env bash
- can be specified.
+ Rename functions like "release" and "fetch"
+ due to conflict in z/OS standard C libraries.
+ Also disables autoconversion facility on z/OS
+ and relies on iconv.
+ New files created in binary format are also
+ tagged as binary.
- Signed-off-by: Harithamma D <harithamma.d@ibm.com>
-
- ## Makefile ##
-@@ Makefile: include shared.mak
- #
- # Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
- #
-+# Define SHELL_PATH_FOR_SCRIPTS to a POSIX shell if your /bin/sh is broken.
-+#
- # Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
- # to PATH if your tools in /usr/bin are broken.
- #
-@@ Makefile: include shared.mak
- #
- # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
- #
-+# Define PERL_PATH_FOR_SCRIPTS to a Perl binary if your /usr/bin/perl is broken.
-+#
- # Define NO_PERL if you do not want Perl scripts or libraries at all.
- #
- # Define NO_PERL_CPAN_FALLBACKS if you do not want to install bundled
-@@ Makefile: BINDIR_PROGRAMS_NO_X += git-cvsserver
- ifndef SHELL_PATH
- SHELL_PATH = /bin/sh
- endif
-+ifndef SHELL_PATH_FOR_SCRIPTS
-+ SHELL_PATH_FOR_SCRIPTS = /bin/sh
-+endif
- ifndef PERL_PATH
- PERL_PATH = /usr/bin/perl
- endif
-+ifndef PERL_PATH_FOR_SCRIPTS
-+ PERL_PATH_FOR_SCRIPTS = /usr/bin/perl
-+endif
- ifndef PYTHON_PATH
- PYTHON_PATH = /usr/bin/python
- endif
-@@ Makefile: THIRD_PARTY_SOURCES += sha1dc/%
-
- # xdiff and reftable libs may in turn depend on what is in libgit.a
- GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(LIB_FILE)
--EXTLIBS =
-+EXTLIBS = $(ZOPEN_EXTRA_LIBS)
-
- GIT_USER_AGENT = git/$(GIT_VERSION)
-
-@@ Makefile: perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
- gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
- gitwebstaticdir_SQ = $(subst ','\'',$(gitwebstaticdir))
-
--SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
-+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH_FOR_SCRIPTS))
- TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
- PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
-+PERL_PATH_FOR_SCRIPTS_SQ = $(subst ','\'',$(PERL_PATH_FOR_SCRIPTS))
- PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
- TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
- DIFF_SQ = $(subst ','\'',$(DIFF))
-@@ Makefile: hook-list.h: generate-hooklist.sh Documentation/githooks.txt
-
- SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
- $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
-- $(gitwebdir_SQ):$(PERL_PATH_SQ):$(PAGER_ENV):\
-+ $(gitwebdir_SQ):$(PERL_PATH_FOR_SCRIPTS_SQ):$(PAGER_ENV):\
- $(perllibdir_SQ)
- GIT-SCRIPT-DEFINES: FORCE
- @FLAGS='$(SCRIPT_DEFINES)'; \
-@@ Makefile: sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
-- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-+ -e 's|@@PERL@@|$(PERL_PATH_FOR_SCRIPTS_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
- endef
-@@ Makefile: PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
- $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
-- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
-+ -e ' s|#!.*perl|#!$(PERL_PATH_FOR_SCRIPTS_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
-
- ## builtin.h ##
-@@ builtin.h: int cmd_verify_pack(int argc, const char **argv, const char *prefix);
- int cmd_show_ref(int argc, const char **argv, const char *prefix);
- int cmd_pack_refs(int argc, const char **argv, const char *prefix);
- int cmd_replace(int argc, const char **argv, const char *prefix);
-+#ifdef __MVS__
-+ extern int setbinaryfd(int);
-+#endif
-
- #endif
+ Signed-off-by: Haritha D <harithamma.d@ibm.com>
## builtin/archive.c ##
@@
@@ builtin/archive.c
{
int output_fd = xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);
+#ifdef __MVS__
-+ #if (__CHARSET_LIB == 1)
-+ if (setbinaryfd(output_fd))
++ /*
++ * Since the data is in binary format,
++ * we need to set the z/OS file tag
++ * to binary to disable autoconversion
++ */
++ if (__setfdbinary(output_fd))
+ die_errno(_("could not tag archive file '%s'"), output_file);
-+ #endif
+#endif
if (output_fd != 1) {
if (dup2(output_fd, 1) < 0)
die_errno(_("could not redirect output"));
## builtin/hash-object.c ##
-@@ builtin/hash-object.c: static void hash_fd(int fd, const char *type, const char *path, unsigned flags,
- maybe_flush_or_die(stdout, "hash to stdout");
- }
-
-+#ifdef __MVS__
-+# if (__CHARSET_LIB == 1)
-+# include <stdio.h>
-+# include <stdlib.h>
-+
-+ int setbinaryfd(int fd)
-+ {
-+ attrib_t attr;
-+ int rc;
-+
-+ memset(&attr, 0, sizeof(attr));
-+ attr.att_filetagchg = 1;
-+ attr.att_filetag.ft_ccsid = FT_BINARY;
-+ attr.att_filetag.ft_txtflag = 0;
-+
-+ rc = __fchattr(fd, &attr, sizeof(attr));
-+ return rc;
-+ }
-+# endif
-+#endif
-+
-+
- static void hash_object(const char *path, const char *type, const char *vpath,
- unsigned flags, int literally)
+@@ builtin/hash-object.c: static void hash_object(const char *path, const char *type, const char *vpath,
{
int fd;
fd = xopen(path, O_RDONLY);
+#ifdef __MVS__
-+# if (__CHARSET_LIB == 1)
-+ if (setbinaryfd(fd))
++ /*
++ * Since the data being read is in binary format,
++ * we need to disable autoconversion for z/OS
++ */
++ if (__setfdbinary(fd))
+ die_errno("Cannot set to binary '%s'", path);
-+# endif
+#endif
hash_fd(fd, type, vpath, flags, literally);
}
@@ combine-diff.c: static void show_patch_diff(struct combine_diff_path *elem, int
ssize_t done;
int is_file, i;
-+#ifdef __MVS__
-+ __disableautocvt(fd);
-+#endif
++ #ifdef __MVS__
++ /*
++ * Disable implicit autconversion on z/os,
++ * rely on conversion from iconv
++ */
++ __disableautocvt(fd);
++ #endif
+
elem->mode = canon_mode(st.st_mode);
/* if symlinks don't work, assume symlink if all parents
* are symlinks
- ## config.c ##
-@@ config.c: static int git_default_core_config(const char *var, const char *value,
- return 0;
- }
-
-+ #ifdef __MVS__
-+ if (!strcmp(var, "core.ignorefiletags")) {
-+ ignore_file_tags = git_config_bool(var, value);
-+ return 0;
-+ }
-+ #endif
-+
- if (!strcmp(var, "core.safecrlf")) {
- int eol_rndtrp_die;
- if (value && !strcasecmp(value, "warn")) {
-
- ## configure.ac ##
-@@ configure.ac: else
- CC_LD_DYNPATH=-Wl,+b,
- else
- CC_LD_DYNPATH=
-+ if test "$(uname -s)" = "OS/390"; then
-+ CC_LD_DYNPATH=-L
-+ fi
- AC_MSG_WARN([linker does not support runtime path to dynamic libraries])
- fi
- fi
-
- ## convert.c ##
-@@ convert.c: static int check_roundtrip(const char *enc_name)
- static const char *default_encoding = "UTF-8";
-
- static int encode_to_git(const char *path, const char *src, size_t src_len,
-- struct strbuf *buf, const char *enc, int conv_flags)
-+ struct strbuf *buf, const char *enc, enum convert_crlf_action attr_action, int conv_flags)
- {
- char *dst;
- size_t dst_len;
- int die_on_error = conv_flags & CONV_WRITE_OBJECT;
-
-+ if (attr_action == CRLF_BINARY) {
-+ return 0;
-+ }
- /*
- * No encoding is specified or there is nothing to encode.
- * Tell the caller that the content was not modified.
-@@ convert.c: static int encode_to_git(const char *path, const char *src, size_t src_len,
- return 0;
-
- trace_encoding("source", path, enc, src, src_len);
-+#ifdef __MVS__
-+ // Don't convert ISO8859-1 on z/OS
-+ if (strcasecmp("ISO8859-1", enc) == 0)
-+ return 0;
-+#endif
- dst = reencode_string_len(src, src_len, default_encoding, enc,
- &dst_len);
- if (!dst) {
-@@ convert.c: static int encode_to_git(const char *path, const char *src, size_t src_len,
- }
-
- static int encode_to_worktree(const char *path, const char *src, size_t src_len,
-- struct strbuf *buf, const char *enc)
-+ struct strbuf *buf, enum convert_crlf_action attr_action, const char *enc)
- {
- char *dst;
- size_t dst_len;
-
-+ if (attr_action == CRLF_BINARY) {
-+ return 0;
-+ }
- /*
- * No encoding is specified or there is nothing to encode.
- * Tell the caller that the content was not modified.
-@@ convert.c: static int git_path_check_ident(struct attr_check_item *check)
-
- static struct attr_check *check;
-
-+static const char* get_platform() {
-+ struct utsname uname_info;
-+
-+ if (uname(&uname_info))
-+ die(_("uname() failed with error '%s' (%d)\n"),
-+ strerror(errno),
-+ errno);
-+
-+ if (!strcmp(uname_info.sysname, "OS/390"))
-+ return "zos";
-+ return uname_info.sysname;
-+}
-+
-+
- void convert_attrs(struct index_state *istate,
- struct conv_attrs *ca, const char *path)
- {
- struct attr_check_item *ccheck = NULL;
-+ struct strbuf platform_working_tree_encoding = STRBUF_INIT;
-+
-+ strbuf_addf(&platform_working_tree_encoding, "%s-working-tree-encoding", get_platform());
-+
-
- if (!check) {
- check = attr_check_initl("crlf", "ident", "filter",
-- "eol", "text", "working-tree-encoding",
-+ "eol", "text", "working-tree-encoding", platform_working_tree_encoding.buf,
- NULL);
- user_convert_tail = &user_convert;
- git_config(read_convert_config, NULL);
- }
-+ strbuf_release(&platform_working_tree_encoding);
-
- git_check_attr(istate, path, check);
- ccheck = check->items;
-@@ convert.c: void convert_attrs(struct index_state *istate,
- ca->crlf_action = CRLF_TEXT_CRLF;
- }
- ca->working_tree_encoding = git_path_check_encoding(ccheck + 5);
-+ if (git_path_check_encoding(ccheck + 6))
-+ ca->working_tree_encoding = git_path_check_encoding(ccheck + 6);
-
- /* Save attr and make a decision for action */
- ca->attr_action = ca->crlf_action;
-@@ convert.c: int convert_to_git(struct index_state *istate,
- len = dst->len;
- }
-
-- ret |= encode_to_git(path, src, len, dst, ca.working_tree_encoding, conv_flags);
-+ ret |= encode_to_git(path, src, len, dst, ca.working_tree_encoding, ca.attr_action, conv_flags);
- if (ret && dst) {
- src = dst->buf;
- len = dst->len;
-@@ convert.c: void convert_to_git_filter_fd(struct index_state *istate,
- if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL, NULL))
- die(_("%s: clean filter '%s' failed"), path, ca.drv->name);
-
-- encode_to_git(path, dst->buf, dst->len, dst, ca.working_tree_encoding, conv_flags);
-+ encode_to_git(path, dst->buf, dst->len, dst, ca.working_tree_encoding, ca.attr_action, conv_flags);
- crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags);
- ident_to_git(dst->buf, dst->len, dst, ca.ident);
- }
-@@ convert.c: static int convert_to_working_tree_ca_internal(const struct conv_attrs *ca,
- }
- }
-
-- ret |= encode_to_worktree(path, src, len, dst, ca->working_tree_encoding);
-+ ret |= encode_to_worktree(path, src, len, dst, ca->attr_action, ca->working_tree_encoding);
- if (ret) {
- src = dst->buf;
- len = dst->len;
-
## copy.c ##
@@ copy.c: int copy_fd(int ifd, int ofd)
if (write_in_full(ofd, buffer, len) < 0)
return COPY_WRITE_ERROR;
}
-+#ifdef __MVS__
-+ __copyfdccsid(ifd, ofd);
-+#endif
++ #ifdef __MVS__
++ /*
++ * This is to ensure that file tags are copied
++ * from source to destination
++ */
++ __copyfdccsid(ifd, ofd);
++ #endif
return 0;
}
- ## diff.c ##
-@@ diff.c: int diff_populate_filespec(struct repository *r,
- int check_binary = options ? options->check_binary : 0;
- int err = 0;
- int conv_flags = global_conv_flags_eol;
-+#ifdef __MVS__
-+ int autocvtToASCII;
-+#endif
- /*
- * demote FAIL to WARN to allow inspecting the situation
- * instead of refusing.
-@@ diff.c: int diff_populate_filespec(struct repository *r,
- s->is_binary = 1;
- return 0;
- }
-+#ifdef __MVS__
-+ validate_codeset(r->index, s->path, &autocvtToASCII);
-+#endif
- fd = open(s->path, O_RDONLY);
- if (fd < 0)
- goto err_empty;
-+
-+#ifdef __MVS__
-+ if (!autocvtToASCII)
-+ __disableautocvt(fd);
-+#endif
- s->data = xmmap(NULL, s->size, PROT_READ, MAP_PRIVATE, fd, 0);
- close(fd);
- s->should_munmap = 1;
-
- ## entry.c ##
-@@ entry.c: int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st)
- return 0;
+ ## fetch-negotiator.h ##
+@@ fetch-negotiator.h: struct repository;
+ * Then, when "have" lines are required, call next(). Call ack() to report what
+ * the server tells us.
+ *
+- * Once negotiation is done, call release(). The negotiator then cannot be used
++ * Once negotiation is done, call release_negotiator(). The negotiator then cannot be used
+ * (unless reinitialized with fetch_negotiator_init()).
+ */
+ struct fetch_negotiator {
+@@ fetch-negotiator.h: struct fetch_negotiator {
+ */
+ int (*ack)(struct fetch_negotiator *, struct commit *);
+
+- void (*release)(struct fetch_negotiator *);
++ void (*release_negotiator)(struct fetch_negotiator *);
+
+ /* internal use */
+ void *data;
+
+ ## fetch-pack.c ##
+@@ fetch-pack.c: static struct ref *do_fetch_pack(struct fetch_pack_args *args,
+
+ all_done:
+ if (negotiator)
+- negotiator->release(negotiator);
++ negotiator->release_negotiator(negotiator);
+ return ref;
}
-+#ifdef __MVS__
-+void tag_file_as_working_tree_encoding(struct index_state *istate, char* path, int fd) {
-+ struct conv_attrs ca;
-+ convert_attrs(istate, &ca, path);
-+ if (ca.attr_action != CRLF_BINARY) {
-+ if (ca.working_tree_encoding)
-+ __chgfdcodeset(fd, ca.working_tree_encoding);
-+ else
-+ __setfdtext(fd);
-+ }
-+ else {
-+ __setfdbinary(fd);
-+ }
-+
-+ __disableautocvt(fd);
-+}
-+#endif
-+
- static int streaming_write_entry(const struct cache_entry *ce, char *path,
- struct stream_filter *filter,
- const struct checkout *state, int to_tempfile,
-@@ entry.c: static int streaming_write_entry(const struct cache_entry *ce, char *path,
- if (fd < 0)
- return -1;
+@@ fetch-pack.c: static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
+ die("fsck failed");
-+#ifdef __MVS__
-+ tag_file_as_working_tree_encoding(state->istate, path, fd);
-+#endif
-+
- result |= stream_blob_to_fd(fd, &ce->oid, filter, 1);
- *fstat_done = fstat_checkout_output(fd, state, statbuf);
- result |= close(fd);
-@@ entry.c: static int write_entry(struct cache_entry *ce, char *path, struct conv_attrs *ca
- return error_errno("unable to create file %s", path);
- }
+ if (negotiator)
+- negotiator->release(negotiator);
++ negotiator->release_negotiator(negotiator);
-+#ifdef __MVS__
-+ tag_file_as_working_tree_encoding(state->istate, path, fd);
-+#endif
-+
- wrote = write_in_full(fd, new_blob, size);
- if (!to_tempfile)
- fstat_done = fstat_checkout_output(fd, state, &st);
-
- ## environment.c ##
-@@ environment.c: const char *git_hooks_path;
- int zlib_compression_level = Z_BEST_SPEED;
- int pack_compression_level = Z_DEFAULT_COMPRESSION;
- int fsync_object_files = -1;
-+#ifdef __MVS__
-+int ignore_file_tags = 0;
-+#endif
- int use_fsync = -1;
- enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT;
- enum fsync_component fsync_components = FSYNC_COMPONENTS_DEFAULT;
+ oidset_clear(&common);
+ return ref;
## git-compat-util.h ##
@@ git-compat-util.h: struct strbuf;
@@ git-compat-util.h: struct strbuf;
#include <fcntl.h>
#include <stddef.h>
+#ifdef __MVS__
-+#define release stdlib_release
-+#define fetch stdlib_fetch
++ #define release stdlib_release
++ #define fetch stdlib_fetch
+#endif
#include <stdlib.h>
+#ifdef __MVS__
-+#undef fetch
-+#undef release
++ #undef fetch
++ #undef release
+#endif
#include <stdarg.h>
#include <string.h>
@@ negotiator/noop.c: static int ack(struct fetch_negotiator *n UNUSED, struct comm
}
-static void release(struct fetch_negotiator *n UNUSED)
-+static void release_negotiator(struct fetch_negotiator *n UNUSED)
++static void release_negotiator (struct fetch_negotiator *n UNUSED)
{
/* nothing to release */
}
@@ negotiator/skipping.c: void skipping_negotiator_init(struct fetch_negotiator *ne
data->rev_list.compare = compare;
- ## object-file.c ##
-@@
- #include "setup.h"
- #include "submodule.h"
- #include "fsck.h"
--
-+#ifdef __MVS__
-+#include <_Ccsid.h>
-+#endif
- /* The maximum size for an object header. */
- #define MAX_HEADER_LEN 32
-
-@@ object-file.c: int index_fd(struct index_state *istate, struct object_id *oid,
- return ret;
- }
-
-+#ifdef __MVS__
-+void validate_codeset(struct index_state *istate, const char *path, int* autoconvertToASCII) {
-+ struct conv_attrs ca;
-+ struct stat st;
-+ unsigned short attr_ccsid;
-+ unsigned short file_ccsid;
-+
-+ if (ignore_file_tags)
-+ return;
-+
-+ *autoconvertToASCII = 0;
-+ convert_attrs(istate, &ca, path);
-+ if (ca.attr_action == CRLF_BINARY) {
-+ attr_ccsid = FT_BINARY;
-+ }
-+ else if (ca.working_tree_encoding) {
-+ attr_ccsid = __toCcsid(ca.working_tree_encoding);
-+ }
-+ else
-+ attr_ccsid = 819;
-+
-+ if (stat(path, &st) < 0)
-+ return;
-+
-+ file_ccsid = st.st_tag.ft_ccsid;
-+
-+ if (file_ccsid == FT_UNTAGGED) {
-+ die("File %s is untagged, set the correct file tag (using the chtag command).", path);
-+ }
-+
-+ if (attr_ccsid != file_ccsid) {
-+ if (file_ccsid == 1047 && attr_ccsid == 819) {
-+ *autoconvertToASCII = 1;
-+ return;
-+ }
-+ // Allow tag mixing of 819 and 1208
-+ if ((file_ccsid == 819 || file_ccsid == 1208) && (attr_ccsid == 1208 || attr_ccsid == 819)) {
-+ return;
-+ }
-+ // Don't check for binary files, just add them
-+ if (attr_ccsid == FT_BINARY)
-+ return;
-+
-+ char attr_csname[_XOPEN_PATH_MAX] = {0};
-+ char file_csname[_XOPEN_PATH_MAX] = {0};
-+ if (attr_ccsid != FT_BINARY) {
-+ __toCSName(attr_ccsid, attr_csname);
-+ } else {
-+ snprintf(attr_csname, _XOPEN_PATH_MAX, "%s", "binary");
-+ }
-+ if (file_ccsid != FT_BINARY) {
-+ __toCSName(file_ccsid, file_csname);
-+ } else {
-+ snprintf(file_csname, _XOPEN_PATH_MAX, "%s", "binary");
-+ }
-+ die("%s added file: file tag (%s) does not match working-tree-encoding (%s)", path, file_csname, attr_csname);
-+ }
-+}
-+#endif
-+
-+
-+
- int index_path(struct index_state *istate, struct object_id *oid,
- const char *path, struct stat *st, unsigned flags)
- {
-@@ object-file.c: int index_path(struct index_state *istate, struct object_id *oid,
- struct strbuf sb = STRBUF_INIT;
- int rc = 0;
-
-+#ifdef __MVS__
-+ struct conv_attrs ca;
-+ int autocvtToASCII;
-+#endif
-+
- switch (st->st_mode & S_IFMT) {
- case S_IFREG:
-+#ifdef __MVS__
-+ validate_codeset(istate, path, &autocvtToASCII);
-+#endif
- fd = open(path, O_RDONLY);
- if (fd < 0)
- return error_errno("open(\"%s\")", path);
-+
-+#ifdef __MVS__
-+ if (!autocvtToASCII)
-+ __disableautocvt(fd);
-+#endif
-+
- if (index_fd(istate, oid, fd, st, OBJ_BLOB, path, flags) < 0)
- return error(_("%s: failed to insert into database"),
- path);
-
## read-cache.c ##
@@ read-cache.c: static int ce_compare_data(struct index_state *istate,
int fd = git_open_cloexec(ce->name, O_RDONLY);
if (fd >= 0) {
-+#ifdef __MVS__
-+ __disableautocvt(fd);
-+#endif
++ #ifdef __MVS__
++ /*
++ * Since the data is in binary format,
++ * we need to set the z/OS file tag to
++ * binary to disable autoconversion
++ */
++ __disableautocvt(fd);
++ #endif
struct object_id oid;
if (!index_fd(istate, &oid, fd, st, OBJ_BLOB, ce->name, 0))
match = !oideq(&oid, &ce->oid);
-
- ## utf8.c ##
-@@ utf8.c: char *reencode_string_len(const char *in, size_t insz,
- #endif
- }
-
-+#ifdef __MVS__
-+ //HACK: For backwards compat, ISO8859-1 really means utf-8 in the z/OS world
-+ if (strcasecmp("ISO8859-1", in_encoding) == 0) {
-+ in_encoding = "UTF-8";
-+ out_encoding = "UTF-8";
-+ }
-+ if (strcasecmp("ISO8859-1", out_encoding) == 0) {
-+ in_encoding = "UTF-8";
-+ out_encoding = "UTF-8";
-+ }
-+#endif
- conv = iconv_open(out_encoding, in_encoding);
- if (conv == (iconv_t) -1) {
- in_encoding = fallback_encoding(in_encoding);
3: e31be0d764f < -: ----------- spaces and errors fix Handled git pipeline errors
4: 7bace397b4a < -: ----------- fixes for build errors Handled git pipeline errorse
5: 3b6d1f80668 < -: ----------- fixes for build errors
6: 3c9b02e18d2 < -: ----------- spaces and errors fix Handled git pipeline errors
7: 8165196f869 < -: ----------- spaces and errors fix Handled git pipeline errors
8: 9fb74d92e3f < -: ----------- platform_name fix Handled git pipeline errors
9: 8fa15ac45f7 < -: ----------- strncpy fix Handled git pipeline errors
10: 63479fe3696 < -: ----------- strncpy fix Handled git pipeline errors
11: 25271363e57 < -: ----------- strncpy fix Handled git pipeline errors
12: 06658ebad10 < -: ----------- Handled git pipeline errors - Memory leak
13: 804624950ae < -: ----------- Handled git pipeline errors - z/OS enable
builtin/archive.c | 9 +++++++++
builtin/hash-object.c | 8 ++++++++
combine-diff.c | 8 ++++++++
copy.c | 7 +++++++
fetch-negotiator.h | 4 ++--
fetch-pack.c | 4 ++--
git-compat-util.h | 8 ++++++++
negotiator/default.c | 4 ++--
negotiator/noop.c | 4 ++--
negotiator/skipping.c | 4 ++--
read-cache.c | 8 ++++++++
11 files changed, 58 insertions(+), 10 deletions(-)
diff --git a/builtin/archive.c b/builtin/archive.c
index 90761fdfee0..3b1b258e383 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -14,6 +14,15 @@
static void create_output_file(const char *output_file)
{
int output_fd = xopen(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);
+#ifdef __MVS__
+ /*
+ * Since the data is in binary format,
+ * we need to set the z/OS file tag
+ * to binary to disable autoconversion
+ */
+ if (__setfdbinary(output_fd))
+ die_errno(_("could not tag archive file '%s'"), output_file);
+#endif
if (output_fd != 1) {
if (dup2(output_fd, 1) < 0)
die_errno(_("could not redirect output"));
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index 5ffec99dcea..f43450db02d 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -62,6 +62,14 @@ static void hash_object(const char *path, const char *type, const char *vpath,
{
int fd;
fd = xopen(path, O_RDONLY);
+#ifdef __MVS__
+ /*
+ * Since the data being read is in binary format,
+ * we need to disable autoconversion for z/OS
+ */
+ if (__setfdbinary(fd))
+ die_errno("Cannot set to binary '%s'", path);
+#endif
hash_fd(fd, type, vpath, flags, literally);
}
diff --git a/combine-diff.c b/combine-diff.c
index f90f4424829..3230b660371 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1082,6 +1082,14 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
ssize_t done;
int is_file, i;
+ #ifdef __MVS__
+ /*
+ * Disable implicit autconversion on z/os,
+ * rely on conversion from iconv
+ */
+ __disableautocvt(fd);
+ #endif
+
elem->mode = canon_mode(st.st_mode);
/* if symlinks don't work, assume symlink if all parents
* are symlinks
diff --git a/copy.c b/copy.c
index 23d84c6c1db..f5b9828b1c9 100644
--- a/copy.c
+++ b/copy.c
@@ -14,6 +14,13 @@ int copy_fd(int ifd, int ofd)
if (write_in_full(ofd, buffer, len) < 0)
return COPY_WRITE_ERROR;
}
+ #ifdef __MVS__
+ /*
+ * This is to ensure that file tags are copied
+ * from source to destination
+ */
+ __copyfdccsid(ifd, ofd);
+ #endif
return 0;
}
diff --git a/fetch-negotiator.h b/fetch-negotiator.h
index e348905a1f0..71d44102fdc 100644
--- a/fetch-negotiator.h
+++ b/fetch-negotiator.h
@@ -14,7 +14,7 @@ struct repository;
* Then, when "have" lines are required, call next(). Call ack() to report what
* the server tells us.
*
- * Once negotiation is done, call release(). The negotiator then cannot be used
+ * Once negotiation is done, call release_negotiator(). The negotiator then cannot be used
* (unless reinitialized with fetch_negotiator_init()).
*/
struct fetch_negotiator {
@@ -47,7 +47,7 @@ struct fetch_negotiator {
*/
int (*ack)(struct fetch_negotiator *, struct commit *);
- void (*release)(struct fetch_negotiator *);
+ void (*release_negotiator)(struct fetch_negotiator *);
/* internal use */
void *data;
diff --git a/fetch-pack.c b/fetch-pack.c
index 26999e3b659..c1f2e714f8e 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1232,7 +1232,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
all_done:
if (negotiator)
- negotiator->release(negotiator);
+ negotiator->release_negotiator(negotiator);
return ref;
}
@@ -1853,7 +1853,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
die("fsck failed");
if (negotiator)
- negotiator->release(negotiator);
+ negotiator->release_negotiator(negotiator);
oidset_clear(&common);
return ref;
diff --git a/git-compat-util.h b/git-compat-util.h
index 3e7a59b5ff1..be4516fa64e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -223,7 +223,15 @@ struct strbuf;
#include <sys/stat.h>
#include <fcntl.h>
#include <stddef.h>
+#ifdef __MVS__
+ #define release stdlib_release
+ #define fetch stdlib_fetch
+#endif
#include <stdlib.h>
+#ifdef __MVS__
+ #undef fetch
+ #undef release
+#endif
#include <stdarg.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
diff --git a/negotiator/default.c b/negotiator/default.c
index 9a5b6963272..b1f9f153372 100644
--- a/negotiator/default.c
+++ b/negotiator/default.c
@@ -174,7 +174,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c)
return known_to_be_common;
}
-static void release(struct fetch_negotiator *n)
+static void release_negotiator(struct fetch_negotiator *n)
{
clear_prio_queue(&((struct negotiation_state *)n->data)->rev_list);
FREE_AND_NULL(n->data);
@@ -187,7 +187,7 @@ void default_negotiator_init(struct fetch_negotiator *negotiator)
negotiator->add_tip = add_tip;
negotiator->next = next;
negotiator->ack = ack;
- negotiator->release = release;
+ negotiator->release_negotiator = release_negotiator;
negotiator->data = CALLOC_ARRAY(ns, 1);
ns->rev_list.compare = compare_commits_by_commit_date;
diff --git a/negotiator/noop.c b/negotiator/noop.c
index de39028ab7f..b2d555e0fec 100644
--- a/negotiator/noop.c
+++ b/negotiator/noop.c
@@ -30,7 +30,7 @@ static int ack(struct fetch_negotiator *n UNUSED, struct commit *c UNUSED)
return 0;
}
-static void release(struct fetch_negotiator *n UNUSED)
+static void release_negotiator (struct fetch_negotiator *n UNUSED)
{
/* nothing to release */
}
@@ -41,6 +41,6 @@ void noop_negotiator_init(struct fetch_negotiator *negotiator)
negotiator->add_tip = add_tip;
negotiator->next = next;
negotiator->ack = ack;
- negotiator->release = release;
+ negotiator->release_negotiator = release_negotiator;
negotiator->data = NULL;
}
diff --git a/negotiator/skipping.c b/negotiator/skipping.c
index 5b91520430c..783b3f27e63 100644
--- a/negotiator/skipping.c
+++ b/negotiator/skipping.c
@@ -243,7 +243,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c)
return known_to_be_common;
}
-static void release(struct fetch_negotiator *n)
+static void release_negotiator(struct fetch_negotiator *n)
{
clear_prio_queue(&((struct data *)n->data)->rev_list);
FREE_AND_NULL(n->data);
@@ -256,7 +256,7 @@ void skipping_negotiator_init(struct fetch_negotiator *negotiator)
negotiator->add_tip = add_tip;
negotiator->next = next;
negotiator->ack = ack;
- negotiator->release = release;
+ negotiator->release_negotiator = release_negotiator;
negotiator->data = CALLOC_ARRAY(data, 1);
data->rev_list.compare = compare;
diff --git a/read-cache.c b/read-cache.c
index 080bd39713b..b7189c58144 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -205,6 +205,14 @@ static int ce_compare_data(struct index_state *istate,
int fd = git_open_cloexec(ce->name, O_RDONLY);
if (fd >= 0) {
+ #ifdef __MVS__
+ /*
+ * Since the data is in binary format,
+ * we need to set the z/OS file tag to
+ * binary to disable autoconversion
+ */
+ __disableautocvt(fd);
+ #endif
struct object_id oid;
if (!index_fd(istate, &oid, fd, st, OBJ_BLOB, ce->name, 0))
match = !oideq(&oid, &ce->oid);
base-commit: 564d0252ca632e0264ed670534a51d18a689ef5d
--
gitgitgadget
^ permalink raw reply related
* Re: [PATCH 3/4] refs: complete list of special refs
From: Phillip Wood @ 2023-12-04 14:18 UTC (permalink / raw)
To: Patrick Steinhardt, phillip.wood; +Cc: git, hanwenn
In-Reply-To: <ZWmAn20UYWBo9i8C@tanuki>
Hi Patrick
On 01/12/2023 06:43, Patrick Steinhardt wrote:
> On Thu, Nov 30, 2023 at 03:42:06PM +0000, Phillip Wood wrote:
>> Hi Patrick
>>
>> Thanks for working on this. I've left a couple of thought below.
>>
>> On 29/11/2023 08:14, Patrick Steinhardt wrote:
>>> +static int is_special_ref(const char *refname)
>>> +{
>>> + /*
>>> + * Special references get written and read directly via the filesystem
>>> + * by the subsystems that create them. Thus, they must not go through
>>> + * the reference backend but must instead be read directly. It is
>>> + * arguable whether this behaviour is sensible, or whether it's simply
>>> + * a leaky abstraction enabled by us only having a single reference
>>> + * backend implementation. But at least for a subset of references it
>>> + * indeed does make sense to treat them specially:
>>> + *
>>> + * - FETCH_HEAD may contain multiple object IDs, and each one of them
>>> + * carries additional metadata like where it came from.
>>> + *
>>> + * - MERGE_HEAD may contain multiple object IDs when merging multiple
>>> + * heads.
>>> + *
>>> + * - "rebase-apply/" and "rebase-merge/" contain all of the state for
>>> + * rebases, where keeping it closely together feels sensible.
>>
>> I'd really like to get away from treating these files as refs. I think their
>> use as refs is purely historic and predates the reflog and possibly
>> ORIG_HEAD. These days I'm not sure there is a good reason to be running
>>
>> git rev-parse rebase-merge/orig-head
>>
>> One reason for not wanting to treat them as refs is that we do not handle
>> multi-level refs that do not begin with "refs/" consistently.
>>
>> git update-ref foo/bar HEAD
>>
>> succeeds and creates .git/foo/bar but
>>
>> git update-ref -d foo/bar
>>
>> fails with
>>
>> error: refusing to update ref with bad name 'foo/bar'
>>
>> To me it would make sense to refuse to create 'foo/bar' but allow an
>> existing ref named 'foo/bar' to be deleted but the current behavior is the
>> opposite of that.
>>
>> I'd be quite happy to see us refuse to treat anything that fails
>>
>> if (starts_with(refname, "refs/") || refname_is_safe(refname))
>>
>> as a ref but I don't know how much pain that would cause.
>
> Well, we already do use these internally as references, but I don't
> disagree with you.
I should have been clearer that I was talking about the refs starting
"rebase-*" rather than FETCH_HEAD and MERGE_HEAD. As a user find it
convenient to be able to run "git fetch ... && git log -p FETCH_HEAD"
even if the implementation is a bit ugly. As far as I can see we do not
use "rebase-(apply|merge)/(orig-head|amend|autostash)" as a ref in our
code or tests.
> I think the current state is extremely confusing,
> which is why my first approach was to simply document what falls into
> the category of these "special" references.
That's certainly a good place to start
> In my mind, this patch series here is a first step towards addressing
> the problem more generally. For now it is more or less only documenting
> _what_ is a special ref and why they are special, while also ensuring
> that these refs are compatible with the reftable backend. But once this
> lands, I'd certainly want to see us continue to iterate on this.
>
> Most importantly, I'd love to see us address two issues:
>
> - Start to refuse writing these special refs via the refdb so that
> the rules I've now layed out are also enforced. This would also
> address your point about things being inconsistent.
>
> - Gradually reduce the list of special refs so that they are reduced
> to a bare minimum and so that most refs are simply that, a normal
> ref.
That sounds like a good plan
>>> + const char * const special_refs[] = {
>>> + "AUTO_MERGE",
>>
>> Is there any reason to treat this specially in the long term? It points to a
>> tree rather than a commit but unlike MERGE_HEAD and FETCH_HEAD it is
>> effectively a "normal" ref.
>
> No, I'd love to see this and others converted to become a normal ref
> eventually. The goal of this patch series was mostly to document what we
> already have, and address those cases which are inconsistent with the
> new rules. But I'd be happy to convert more of these special refs to
> become normal refs after it lands.
That's great
>>> + "BISECT_EXPECTED_REV",
>>> + "FETCH_HEAD",
>>> + "MERGE_AUTOSTASH",
>>
>> Should we be treating this as a ref? I thought it was written as an
>> implementation detail of the autostash implementation rather than to provide
>> a ref for users and scripts.
>
> Yes, we have to in the context of the reftable backend. There's a bunch
> of tests that exercise our ability to parse this as a ref, and they
> would otherwise fail with the reftable backend.
Ah, looking at the the man page for "git merge" it seems we do actually
document the existence of MERGE_AUTOSTASH so it is not just an
implementation detail after all.
Best Wishes
Phillip
^ permalink raw reply
* [PATCH] gitk: add setting to hide unknown refs
From: Joachim B Haga via GitGitGadget @ 2023-12-04 13:18 UTC (permalink / raw)
To: git; +Cc: Joachim B Haga, Joachim B Haga
From: Joachim B Haga <jobh@simula.no>
Tools such as branchless (https://github.com/arxanas/git-branchless)
add a lot of refs under the "refs/branchless" prefix. By default,
these are filtered out from `git log` using the `log.excludeDecoration`
config directive.
However, gitk applies decoration itself from the output of `git show-ref`,
so these refs clutter up the UI.
This patch adds a setting to gitk to exclude all unknown refs - which
is considerably simpler than trying to honour the `excludeDecoration`
pattern. Note that this also hides f.x. the `git bisect` refs, which I
think is fine given that this behaviour is opt-in (it defaults to not
hide anything).
Signed-off-by: Joachim B Haga <jobh@simula.no>
---
gitk: add setting to hide unknown refs
Tools such as branchless (https://github.com/arxanas/git-branchless) add
a lot of refs under the "refs/branchless" prefix. By default, these are
filtered out from git log using the log.excludeDecoration config
directive.
However, gitk applies decoration itself from the output of git show-ref,
so these refs clutter up the UI.
This patch adds a setting to gitk to exclude all unknown refs - which is
considerably simpler than trying to honour the excludeDecoration
pattern. Note that this also hides f.x. the git bisect refs, which I
think is fine given that this behaviour is opt-in (defaults to not hide
anything).
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1619%2Fjobh%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1619/jobh/master-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1619
gitk-git/gitk | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index df3ba2ea99b..e91856b33a0 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1798,7 +1798,7 @@ proc readrefs {} {
global tagids idtags headids idheads tagobjid
global otherrefids idotherrefs mainhead mainheadid
global selecthead selectheadid
- global hideremotes
+ global hideremotes hideunknown
global tclencoding
foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
@@ -1835,8 +1835,10 @@ proc readrefs {} {
set tagids($name) $id
lappend idtags($id) $name
} else {
- set otherrefids($name) $id
- lappend idotherrefs($id) $name
+ if {[string match "stash" $name] || !$hideunknown} {
+ set otherrefids($name) $id
+ lappend idotherrefs($id) $name
+ }
}
}
catch {close $refd}
@@ -11577,7 +11579,7 @@ proc create_prefs_page {w} {
proc prefspage_general {notebook} {
global NS maxwidth maxgraphpct showneartags showlocalchanges
global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
- global hideremotes want_ttk have_ttk maxrefs web_browser
+ global hideremotes hideunknown want_ttk have_ttk maxrefs web_browser
set page [create_prefs_page $notebook.general]
@@ -11601,6 +11603,9 @@ proc prefspage_general {notebook} {
${NS}::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \
-variable hideremotes
grid x $page.hideremotes -sticky w
+ ${NS}::checkbutton $page.hideunknown -text [mc "Hide unknown refs"] \
+ -variable hideunknown
+ grid x $page.hideunknown -sticky w
${NS}::label $page.ddisp -text [mc "Diff display options"]
grid $page.ddisp - -sticky w -pady 10
@@ -11725,7 +11730,7 @@ proc doprefs {} {
global oldprefs prefstop showneartags showlocalchanges
global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
- global hideremotes want_ttk have_ttk
+ global hideremotes hideunknown want_ttk have_ttk
set top .gitkprefs
set prefstop $top
@@ -11734,7 +11739,7 @@ proc doprefs {} {
return
}
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
- limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+ limitdiffs tabstop perfile_attrs hideremotes hideunknown want_ttk} {
set oldprefs($v) [set $v]
}
ttk_toplevel $top
@@ -11860,7 +11865,7 @@ proc prefscan {} {
global oldprefs prefstop
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
- limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+ limitdiffs tabstop perfile_attrs hideremotes hideunknown want_ttk} {
global $v
set $v $oldprefs($v)
}
@@ -11874,7 +11879,7 @@ proc prefsok {} {
global oldprefs prefstop showneartags showlocalchanges
global fontpref mainfont textfont uifont
global limitdiffs treediffs perfile_attrs
- global hideremotes
+ global hideremotes hideunknown
catch {destroy $prefstop}
unset prefstop
@@ -11920,7 +11925,7 @@ proc prefsok {} {
$limitdiffs != $oldprefs(limitdiffs)} {
reselectline
}
- if {$hideremotes != $oldprefs(hideremotes)} {
+ if {$hideremotes != $oldprefs(hideremotes) || $hideunknown != $oldprefs(hideunknown)} {
rereadrefs
}
}
@@ -12394,6 +12399,7 @@ set cmitmode "patch"
set wrapcomment "none"
set showneartags 1
set hideremotes 0
+set hideunknown 0
set maxrefs 20
set visiblerefs {"master"}
set maxlinelen 200
@@ -12498,7 +12504,7 @@ config_check_tmp_exists 50
set config_variables {
mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth
cmitmode wrapcomment autoselect autosellen showneartags maxrefs visiblerefs
- hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk
+ hideremotes hideunknown showlocalchanges datetimeformat limitdiffs uicolor want_ttk
bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors
markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor
extdifftool perfile_attrs headbgcolor headfgcolor headoutlinecolor
base-commit: 564d0252ca632e0264ed670534a51d18a689ef5d
--
gitgitgadget
^ permalink raw reply related
* Re: [PATCH 2/2] checkout: forbid "-B <branch>" from touching a branch used elsewhere
From: Willem Verstraeten @ 2023-12-04 12:20 UTC (permalink / raw)
To: phillip.wood; +Cc: Junio C Hamano, git, Jeff King
In-Reply-To: <b3532261-3cf4-4666-9cbd-4ce668cd2e49@gmail.com>
Hi everyone,
It's not clear for me from the email thread what the status is of this
bug report, and whether there is still something expected from me.
Is the current consensus that this is a real issue that needs fixing?
If so, does the current patch-set fix the issue, and how does the fix
get into (one of) the next release(s)?
Do I still need to do something?
Kind regards,
Willem
On Thu, 30 Nov 2023 at 16:22, Phillip Wood <phillip.wood123@gmail.com> wrote:
>
> Hi Junio
>
> On 27/11/2023 01:51, Junio C Hamano wrote:
> > Phillip Wood <phillip.wood123@gmail.com> writes:
> >
> >> At the moment this is academic as neither of the test scripts changed
> >> by this patch are leak free and so I don't think we need to worry
> >> about it but it raises an interesting question about how we should
> >> handle memory leaks when dying. Leaving the leak when dying means that
> >> a test script that tests an expected failure will never be leak free
> >> but using UNLEAK() would mean we miss a leak being introduced in the
> >> successful case should the call to "free()" ever be removed.
> >
> > Is there a leak here? The piece of memory is pointed at by an on-stack
> > variable full_ref when leak sanitizer starts scanning the heap and
> > the stack just before the process exits due to die, so I do not see
> > a reason to worry about this particular variable over all the other
> > on stack variables we accumulated before the control reached this
> > point of the code.
>
> Oh, good point. I was thinking "we exit without calling free() so it is
> leaked" but as you say the leak checker (thankfully) does not consider
> it a leak as there is still a reference to the allocation on the stack.
>
> Sorry for the noise
>
> Phillip
>
> > Are you worried about optimizing compilers that behave more cleverly
> > than their own good to somehow lose the on-stack reference to
> > full_ref while calling die_if_switching_to_a_branch_in_use()? We
> > might need to squelch them with UNLEAK() but that does not mean we
> > have to remove the free() we see above, and I suspect a more
> > productive use of our time to solve that issue is ensure that our
> > leak-sanitizing build will not triger such an unwanted optimization
> > anyway.
> >
> > Thanks.
^ permalink raw reply
* Re: [PATCH v6] subtree: fix split processing with multiple subtrees present
From: Christian Couder @ 2023-12-04 11:08 UTC (permalink / raw)
To: Zach FettersMoore via GitGitGadget; +Cc: git, Zach FettersMoore
In-Reply-To: <pull.1587.v6.git.1701442494319.gitgitgadget@gmail.com>
On Fri, Dec 1, 2023 at 3:54 PM Zach FettersMoore via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Zach FettersMoore <zach.fetters@apollographql.com>
>
> When there are multiple subtrees present in a repository and they are
> all using 'git subtree split', the 'split' command can take a
> significant (and constantly growing) amount of time to run even when
> using the '--rejoin' flag. This is due to the fact that when processing
> commits to determine the last known split to start from when looking
> for changes, if there has been a split/merge done from another subtree
> there will be 2 split commits, one mainline and one subtree, for the
> second subtree that are part of the processing. The non-mainline
> subtree split commit will cause the processing to always need to search
> the entire history of the given subtree as part of its processing even
> though those commits are totally irrelevant to the current subtree
> split being run.
>
> To see this in practice you can use the open source GitHub repo
> 'apollo-ios-dev' and do the following in order:
>
> -Make a changes to a file in 'apollo-ios' and 'apollo-ios-codegen'
> directories
> -Create a commit containing these changes
> -Do a split on apollo-ios-codegen
> - Do a fetch on the subtree repo
> - git fetch git@github.com:apollographql/apollo-ios-codegen.git
> - git subtree split --prefix=apollo-ios-codegen --squash --rejoin
Now I get the following without your patch at this step:
$ git subtree split --prefix=apollo-ios-codegen --squash --rejoin
[...]/libexec/git-core/git-subtree: 318: Maximum function recursion
depth (1000) reached
Line 318 in git-subtree.sh contains the following:
missed=$(cache_miss "$@") || exit $?
With your patch it seems to work:
$ git subtree split --prefix=apollo-ios-codegen --squash --rejoin
Merge made by the 'ort' strategy.
e274aed3ba6d0659fb4cc014587cf31c1e8df7f4
> - Depending on the current state of the 'apollo-ios-dev' repo
> you may see the issue at this point if the last split was on
> apollo-ios
I guess I see it, but it seems a bit different for me than what you describe.
Otherwise your patch looks good to me now.
Thanks,
Christian.
^ permalink raw reply
* Re: [PATCH 00/24] pack-objects: multi-pack verbatim reuse
From: Patrick Steinhardt @ 2023-12-04 8:49 UTC (permalink / raw)
To: Taylor Blau; +Cc: git, Jeff King, Junio C Hamano
In-Reply-To: <ZWo7zjs+q8SZ5o1o@nand.local>
[-- Attachment #1: Type: text/plain, Size: 2098 bytes --]
On Fri, Dec 01, 2023 at 03:02:22PM -0500, Taylor Blau wrote:
> On Fri, Dec 01, 2023 at 09:31:14AM +0100, Patrick Steinhardt wrote:
[snip]
> I suppose if we're relatively confident that the last series will be
> merged eventually, then that seems like less of a concern. But I'm not
> sure that we're at that point yet.
That's an additional valid concern indeed.
[snip]
> > > - The fourth series (which actually implements multi-pack reuse) still
> > > remains the most complicated, and would likely be the most difficult
> > > to review. So I think you'd still have one difficult series to
> > > review, plus four other series which are slightly less difficult to
> > > review ;-).
> >
> > That's fine in my opinion, there's no surprise here that a complicated
> > topic is demanding for both the author and the reviewer.
>
> My preference is to avoid splitting the series if we can help it. But if
> you feel strongly, or others feel similarly, I'm happy to take another
> crack at breaking it up. Thanks for all of your review so far!
I don't feel strongly about this at all, I've only tried to spell out my
own thoughts in this context as I thought they were kind of relevant
here. I've thought quite a lot about this topic recently due to my work
on the reftable backend, where I'm trying to get as many pieces as
possible landed individually before landing the actual backend itself.
It's working well for most of the part, but in other contexts it's a bit
weird that we try to cater towards something that doesn't exist yet. But
naturally, the reftable work is of different nature than the topic you
work on here and thus my own takeaways may likely not apply heer.
To summarize, I think there is merit in splitting up patches into chunks
that make it in individually and thus gradually work toward a topic, but
I also totally understand why you (or Junio as the maintainer) might
think that this is not a good idea. The ultimate decision for how to
handle topics should be with the patch series' author and maintainer.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording
From: Shreyansh Paliwal @ 2023-12-03 17:17 UTC (permalink / raw)
To: git; +Cc: five231003, gitster, shreyp135, Shreyansh Paliwal
In-Reply-To: <CAPYXD64yCuMta_iGE+ZwgxrJn0U5shcwcB9jaiNkFhvff=R7MQ@mail.gmail.com>
From: shreyp135 <shreyanshpaliwalcmsmn@gmail.com>
In the recent commit
2e87fca189 (test framework: further deprecate test_i18ngrep, 2023-10-31),
the test_i18ngrep() function was deprecated.
So if a test employing this function fails,
the error messages may be confusing due to wording issues.
It's important to address these wording changes to ensure smooth transitions
for developers adapting to the deprecation of test_i18ngrep,
and to maintain the effectiveness of the testing process.
Signed-off-by: Shreyansh Paliwal <Shreyanshpaliwalcmsmn@gmail.com>
---
t/test-lib-functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 9c3cf12b26..8737c95e0c 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1277,7 +1277,7 @@ test_grep () {
if test $# -lt 2 ||
{ test "x!" = "x$1" && test $# -lt 3 ; }
then
- BUG "too few parameters to test_i18ngrep"
+ BUG "too few parameters to test_grep"
fi
if test "x!" = "x$1"
--
2.43.0.1
^ permalink raw reply related
* (no subject)
From: Shreyansh Paliwal @ 2023-12-03 16:51 UTC (permalink / raw)
To: git; +Cc: five231003, gitster, shreyp135, Shreyansh Paliwal
From: shreyp135 <shreyanshpaliwalcmsmn@gmail.com>
Subject: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording
In the recent commit
2e87fca189 (test framework: further deprecate test_i18ngrep, 2023-10-31),
the test_i18ngrep() function was deprecated.
So if a test employing this function fails,
the error messages may be confusing due to wording issues.
It's important to address these wording changes to ensure smooth transitions
for developers adapting to the deprecation of test_i18ngrep,
and to maintain the effectiveness of the testing process.
Signed-off-by: Shreyansh Paliwal <Shreyanshpaliwalcmsmn@gmail.com>
---
t/test-lib-functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 9c3cf12b26..8737c95e0c 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1277,7 +1277,7 @@ test_grep () {
if test $# -lt 2 ||
{ test "x!" = "x$1" && test $# -lt 3 ; }
then
- BUG "too few parameters to test_i18ngrep"
+ BUG "too few parameters to test_grep"
fi
if test "x!" = "x$1"
--
2.43.0.1
^ permalink raw reply related
* [RFC PATCH 4/4] unpack-trees: introduce parallel_unlink
From: Han Young @ 2023-12-03 13:39 UTC (permalink / raw)
To: git; +Cc: Han Young
In-Reply-To: <20231203133911.41594-1-hanyoung@protonmail.com>
From: Han Young <hanyang.tony@bytedance.com>
We have parallel_checkout option since 04155bdad, but the unlink is still executed single threaded. On very large repo, checkout across directory rename or restructure commit can lead to large amount of unlinked entries. In some instance, the unlink operation can be slower than the parallel checkout. This commit add parallel unlink support, parallel unlink uses multithreaded removal of entries.
---
Unlink operation by itself is way faster than checkout, the default threshold should be way higher
than parallel_checkout. I hardcoded the threshold to be 100 times higher, probably need to introduce
a new config option with sensible default.
To discover how many entries to remove require us to iterate index->cache, this is fast even for large
number of entries compare to filesystem operation.
I think we can reuse checkout.workers as the main switch for parallel_unlink, since it's also part of
checkout process.
unpack-trees.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index c2b20b80d5..53589cde8a 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -452,17 +452,8 @@ static int check_updates(struct unpack_trees_options *o,
if (should_update_submodules())
load_gitmodules_file(index, NULL);
- for (i = 0; i < index->cache_nr; i++) {
- const struct cache_entry *ce = index->cache[i];
-
- if (ce->ce_flags & CE_WT_REMOVE) {
- display_progress(progress, ++cnt);
- unlink_entry(ce, o->super_prefix);
- }
- }
-
- remove_marked_cache_entries(index, 0);
- remove_scheduled_dirs();
+ get_parallel_checkout_configs(&pc_workers, &pc_threshold);
+ cnt = run_parallel_unlink(index, progress, o->super_prefix, pc_workers, pc_threshold * 100, cnt);
if (should_update_submodules())
load_gitmodules_file(index, &state);
@@ -474,8 +465,6 @@ static int check_updates(struct unpack_trees_options *o,
*/
prefetch_cache_entries(index, must_checkout);
- get_parallel_checkout_configs(&pc_workers, &pc_threshold);
-
enable_delayed_checkout(&state);
if (pc_workers > 1)
init_parallel_checkout();
--
2.43.0
^ permalink raw reply related
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