* [PATCH v8 07/14] replay: add an important FIXME comment about gpg signing
From: Christian Couder @ 2023-11-24 11:10 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Johannes Schindelin,
Elijah Newren, John Cai, Derrick Stolee, Phillip Wood, Calvin Wan,
Toon Claes, Dragan Simic, Linus Arver, Christian Couder
In-Reply-To: <20231124111044.3426007-1-christian.couder@gmail.com>
From: Elijah Newren <newren@gmail.com>
We want to be able to handle signed commits in some way in the future,
but we are not ready to do it now. So for the time being let's just add
a FIXME comment to remind us about it.
These are different ways we could handle them:
- in case of a cli user and if there was an interactive mode, we could
perhaps ask if the user wants to sign again
- we could add an option to just fail if there are signed commits
Co-authored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
builtin/replay.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/replay.c b/builtin/replay.c
index 2f664218be..384bb4ddd3 100644
--- a/builtin/replay.c
+++ b/builtin/replay.c
@@ -62,7 +62,7 @@ static struct commit *create_commit(struct tree *tree,
struct object *obj;
struct commit_list *parents = NULL;
char *author;
- char *sign_commit = NULL;
+ char *sign_commit = NULL; /* FIXME: cli users might want to sign again */
struct commit_extra_header *extra;
struct strbuf msg = STRBUF_INIT;
const char *out_enc = get_commit_output_encoding();
--
2.43.0.14.g93e034faee
^ permalink raw reply related
* [PATCH v8 06/14] replay: change rev walking options
From: Christian Couder @ 2023-11-24 11:10 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Johannes Schindelin,
Elijah Newren, John Cai, Derrick Stolee, Phillip Wood, Calvin Wan,
Toon Claes, Dragan Simic, Linus Arver, Christian Couder
In-Reply-To: <20231124111044.3426007-1-christian.couder@gmail.com>
From: Elijah Newren <newren@gmail.com>
Let's force the rev walking options we need after calling
setup_revisions() instead of before.
This might override some user supplied rev walking command line options
though. So let's detect that and warn users by:
a) setting the desired values, before setup_revisions(),
b) checking after setup_revisions() whether these values differ from
the desired values,
c) if so throwing a warning and setting the desired values again.
We want the command to work from older commits to newer ones by default.
Also we don't want history simplification, as we want to deal with all
the commits in the affected range.
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Co-authored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
builtin/replay.c | 48 +++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 41 insertions(+), 7 deletions(-)
diff --git a/builtin/replay.c b/builtin/replay.c
index d039467cd4..2f664218be 100644
--- a/builtin/replay.c
+++ b/builtin/replay.c
@@ -173,22 +173,56 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
repo_init_revisions(the_repository, &revs, prefix);
- revs.verbose_header = 1;
- revs.max_parents = 1;
- revs.cherry_mark = 1;
- revs.limited = 1;
+ strvec_pushl(&rev_walk_args, "", argv[2], "--not", argv[1], NULL);
+
+ /*
+ * Set desired values for rev walking options here. If they
+ * are changed by some user specified option in setup_revisions()
+ * below, we will detect that below and then warn.
+ *
+ * TODO: In the future we might want to either die(), or allow
+ * some options changing these values if we think they could
+ * be useful.
+ */
revs.reverse = 1;
- revs.right_only = 1;
revs.sort_order = REV_SORT_IN_GRAPH_ORDER;
revs.topo_order = 1;
-
- strvec_pushl(&rev_walk_args, "", argv[2], "--not", argv[1], NULL);
+ revs.simplify_history = 0;
if (setup_revisions(rev_walk_args.nr, rev_walk_args.v, &revs, NULL) > 1) {
ret = error(_("unhandled options"));
goto cleanup;
}
+ /*
+ * Detect and warn if we override some user specified rev
+ * walking options.
+ */
+ if (revs.reverse != 1) {
+ warning(_("some rev walking options will be overridden as "
+ "'%s' bit in 'struct rev_info' will be forced"),
+ "reverse");
+ revs.reverse = 1;
+ }
+ if (revs.sort_order != REV_SORT_IN_GRAPH_ORDER) {
+ warning(_("some rev walking options will be overridden as "
+ "'%s' bit in 'struct rev_info' will be forced"),
+ "sort_order");
+ revs.sort_order = REV_SORT_IN_GRAPH_ORDER;
+ }
+ if (revs.topo_order != 1) {
+ warning(_("some rev walking options will be overridden as "
+ "'%s' bit in 'struct rev_info' will be forced"),
+ "topo_order");
+ revs.topo_order = 1;
+ }
+ if (revs.simplify_history != 0) {
+ warning(_("some rev walking options will be overridden as "
+ "'%s' bit in 'struct rev_info' will be forced"),
+ "simplify_history");
+ revs.simplify_history = 0;
+ }
+
strvec_clear(&rev_walk_args);
if (prepare_revision_walk(&revs) < 0) {
--
2.43.0.14.g93e034faee
^ permalink raw reply related
* [PATCH v8 05/14] replay: introduce pick_regular_commit()
From: Christian Couder @ 2023-11-24 11:10 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Johannes Schindelin,
Elijah Newren, John Cai, Derrick Stolee, Phillip Wood, Calvin Wan,
Toon Claes, Dragan Simic, Linus Arver, Christian Couder
In-Reply-To: <20231124111044.3426007-1-christian.couder@gmail.com>
From: Elijah Newren <newren@gmail.com>
Let's refactor the code to handle a regular commit (a commit that is
neither a root commit nor a merge commit) into a single function instead
of keeping it inside cmd_replay().
This is good for separation of concerns, and this will help further work
in the future to replay merge commits.
Co-authored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
builtin/replay.c | 54 ++++++++++++++++++++++++++++++------------------
1 file changed, 34 insertions(+), 20 deletions(-)
diff --git a/builtin/replay.c b/builtin/replay.c
index f48c5ed255..d039467cd4 100644
--- a/builtin/replay.c
+++ b/builtin/replay.c
@@ -89,6 +89,35 @@ static struct commit *create_commit(struct tree *tree,
return (struct commit *)obj;
}
+static struct commit *pick_regular_commit(struct commit *pickme,
+ struct commit *last_commit,
+ struct merge_options *merge_opt,
+ struct merge_result *result)
+{
+ struct commit *base;
+ struct tree *pickme_tree, *base_tree;
+
+ base = pickme->parents->item;
+
+ pickme_tree = repo_get_commit_tree(the_repository, pickme);
+ base_tree = repo_get_commit_tree(the_repository, base);
+
+ merge_opt->branch2 = short_commit_name(pickme);
+ merge_opt->ancestor = xstrfmt("parent of %s", merge_opt->branch2);
+
+ merge_incore_nonrecursive(merge_opt,
+ base_tree,
+ result->tree,
+ pickme_tree,
+ result);
+
+ free((char*)merge_opt->ancestor);
+ merge_opt->ancestor = NULL;
+ if (!result->clean)
+ return NULL;
+ return create_commit(result->tree, pickme, last_commit);
+}
+
int cmd_replay(int argc, const char **argv, const char *prefix)
{
struct commit *onto;
@@ -100,7 +129,7 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
struct rev_info revs;
struct commit *commit;
struct merge_options merge_opt;
- struct tree *next_tree, *base_tree, *head_tree;
+ struct tree *head_tree;
struct merge_result result;
struct strbuf reflog_msg = STRBUF_INIT;
struct strbuf branch_name = STRBUF_INIT;
@@ -175,7 +204,7 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
result.tree = head_tree;
last_commit = onto;
while ((commit = get_revision(&revs))) {
- struct commit *base;
+ struct commit *pick;
fprintf(stderr, "Rebasing %s...\r",
oid_to_hex(&commit->object.oid));
@@ -185,26 +214,11 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
if (commit->parents->next)
die(_("replaying merge commits is not supported yet!"));
- base = commit->parents->item;
-
- next_tree = repo_get_commit_tree(the_repository, commit);
- base_tree = repo_get_commit_tree(the_repository, base);
-
- merge_opt.branch2 = short_commit_name(commit);
- merge_opt.ancestor = xstrfmt("parent of %s", merge_opt.branch2);
-
- merge_incore_nonrecursive(&merge_opt,
- base_tree,
- result.tree,
- next_tree,
- &result);
-
- free((char*)merge_opt.ancestor);
- merge_opt.ancestor = NULL;
- if (!result.clean)
+ pick = pick_regular_commit(commit, last_commit, &merge_opt, &result);
+ if (!pick)
break;
+ last_commit = pick;
last_picked_commit = commit;
- last_commit = create_commit(result.tree, commit, last_commit);
}
merge_finalize(&merge_opt, &result);
--
2.43.0.14.g93e034faee
^ permalink raw reply related
* [PATCH v8 04/14] replay: die() instead of failing assert()
From: Christian Couder @ 2023-11-24 11:10 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Johannes Schindelin,
Elijah Newren, John Cai, Derrick Stolee, Phillip Wood, Calvin Wan,
Toon Claes, Dragan Simic, Linus Arver, Christian Couder
In-Reply-To: <20231124111044.3426007-1-christian.couder@gmail.com>
From: Elijah Newren <newren@gmail.com>
It's not a good idea for regular Git commands to use an assert() to
check for things that could happen but are not supported.
Let's die() with an explanation of the issue instead.
Co-authored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
builtin/replay.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/builtin/replay.c b/builtin/replay.c
index 7998f6ed04..f48c5ed255 100644
--- a/builtin/replay.c
+++ b/builtin/replay.c
@@ -179,7 +179,12 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
fprintf(stderr, "Rebasing %s...\r",
oid_to_hex(&commit->object.oid));
- assert(commit->parents && !commit->parents->next);
+
+ if (!commit->parents)
+ die(_("replaying down to root commit is not supported yet!"));
+ if (commit->parents->next)
+ die(_("replaying merge commits is not supported yet!"));
+
base = commit->parents->item;
next_tree = repo_get_commit_tree(the_repository, commit);
--
2.43.0.14.g93e034faee
^ permalink raw reply related
* [PATCH v8 03/14] replay: start using parse_options API
From: Christian Couder @ 2023-11-24 11:10 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Johannes Schindelin,
Elijah Newren, John Cai, Derrick Stolee, Phillip Wood, Calvin Wan,
Toon Claes, Dragan Simic, Linus Arver, Christian Couder
In-Reply-To: <20231124111044.3426007-1-christian.couder@gmail.com>
From: Elijah Newren <newren@gmail.com>
Instead of manually parsing arguments, let's start using the parse_options
API. This way this new builtin will look more standard, and in some
upcoming commits will more easily be able to handle more command line
options.
Note that we plan to later use standard revision ranges instead of
hardcoded "<oldbase> <branch>" arguments. When we will use standard
revision ranges, it will be easier to check if there are no spurious
arguments if we keep ARGV[0], so let's call parse_options() with
PARSE_OPT_KEEP_ARGV0 even if we don't need ARGV[0] right now to avoid
some useless code churn.
Co-authored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
builtin/replay.c | 45 ++++++++++++++++++++++++++++++++-------------
1 file changed, 32 insertions(+), 13 deletions(-)
diff --git a/builtin/replay.c b/builtin/replay.c
index 1998134683..7998f6ed04 100644
--- a/builtin/replay.c
+++ b/builtin/replay.c
@@ -15,7 +15,7 @@
#include "lockfile.h"
#include "merge-ort.h"
#include "object-name.h"
-#include "read-cache-ll.h"
+#include "parse-options.h"
#include "refs.h"
#include "revision.h"
#include "sequencer.h"
@@ -92,6 +92,7 @@ static struct commit *create_commit(struct tree *tree,
int cmd_replay(int argc, const char **argv, const char *prefix)
{
struct commit *onto;
+ const char *onto_name = NULL;
struct commit *last_commit = NULL, *last_picked_commit = NULL;
struct object_id head;
struct lock_file lock = LOCK_INIT;
@@ -105,16 +106,32 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
struct strbuf branch_name = STRBUF_INIT;
int ret = 0;
- if (argc == 2 && !strcmp(argv[1], "-h")) {
- printf("usage: (EXPERIMENTAL!) git replay --onto <newbase> <oldbase> <branch>\n");
- exit(129);
+ const char * const replay_usage[] = {
+ N_("(EXPERIMENTAL!) git replay --onto <newbase> <oldbase> <branch>"),
+ NULL
+ };
+ struct option replay_options[] = {
+ OPT_STRING(0, "onto", &onto_name,
+ N_("revision"),
+ N_("replay onto given commit")),
+ OPT_END()
+ };
+
+ argc = parse_options(argc, argv, prefix, replay_options, replay_usage,
+ PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT);
+
+ if (!onto_name) {
+ error(_("option --onto is mandatory"));
+ usage_with_options(replay_usage, replay_options);
}
- if (argc != 5 || strcmp(argv[1], "--onto"))
- die("usage: read the code, figure out how to use it, then do so");
+ if (argc != 3) {
+ error(_("bad number of arguments"));
+ usage_with_options(replay_usage, replay_options);
+ }
- onto = peel_committish(argv[2]);
- strbuf_addf(&branch_name, "refs/heads/%s", argv[4]);
+ onto = peel_committish(onto_name);
+ strbuf_addf(&branch_name, "refs/heads/%s", argv[2]);
/* Sanity check */
if (repo_get_oid(the_repository, "HEAD", &head))
@@ -126,6 +143,7 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
BUG("Could not read index");
repo_init_revisions(the_repository, &revs, prefix);
+
revs.verbose_header = 1;
revs.max_parents = 1;
revs.cherry_mark = 1;
@@ -134,7 +152,8 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
revs.right_only = 1;
revs.sort_order = REV_SORT_IN_GRAPH_ORDER;
revs.topo_order = 1;
- strvec_pushl(&rev_walk_args, "", argv[4], "--not", argv[3], NULL);
+
+ strvec_pushl(&rev_walk_args, "", argv[2], "--not", argv[1], NULL);
if (setup_revisions(rev_walk_args.nr, rev_walk_args.v, &revs, NULL) > 1) {
ret = error(_("unhandled options"));
@@ -197,8 +216,8 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
&last_commit->object.oid,
&last_picked_commit->object.oid,
REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR)) {
- error(_("could not update %s"), argv[4]);
- die("Failed to update %s", argv[4]);
+ error(_("could not update %s"), argv[2]);
+ die("Failed to update %s", argv[2]);
}
if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
die(_("unable to update HEAD"));
@@ -210,8 +229,8 @@ int cmd_replay(int argc, const char **argv, const char *prefix)
&last_commit->object.oid,
&head,
REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR)) {
- error(_("could not update %s"), argv[4]);
- die("Failed to update %s", argv[4]);
+ error(_("could not update %s"), argv[2]);
+ die("Failed to update %s", argv[2]);
}
}
ret = (result.clean == 0);
--
2.43.0.14.g93e034faee
^ permalink raw reply related
* [PATCH v8 02/14] replay: introduce new builtin
From: Christian Couder @ 2023-11-24 11:10 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Johannes Schindelin,
Elijah Newren, John Cai, Derrick Stolee, Phillip Wood, Calvin Wan,
Toon Claes, Dragan Simic, Linus Arver, Christian Couder
In-Reply-To: <20231124111044.3426007-1-christian.couder@gmail.com>
From: Elijah Newren <newren@gmail.com>
For now, this is just a rename from `t/helper/test-fast-rebase.c` into
`builtin/replay.c` with minimal changes to make it build appropriately.
Let's add a stub documentation and a stub test script though.
Subsequent commits will flesh out the capabilities of the new command
and make it a more standard regular builtin.
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Co-authored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
.gitignore | 1 +
Documentation/git-replay.txt | 39 ++++++++++++
Makefile | 2 +-
builtin.h | 1 +
.../test-fast-rebase.c => builtin/replay.c | 29 +++------
command-list.txt | 1 +
git.c | 1 +
t/helper/test-tool.c | 1 -
t/helper/test-tool.h | 1 -
t/t3650-replay-basics.sh | 60 +++++++++++++++++++
t/t6429-merge-sequence-rename-caching.sh | 27 +++------
11 files changed, 122 insertions(+), 41 deletions(-)
create mode 100644 Documentation/git-replay.txt
rename t/helper/test-fast-rebase.c => builtin/replay.c (87%)
create mode 100755 t/t3650-replay-basics.sh
diff --git a/.gitignore b/.gitignore
index 5e56e471b3..612c0f6a0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -135,6 +135,7 @@
/git-remote-ext
/git-repack
/git-replace
+/git-replay
/git-request-pull
/git-rerere
/git-reset
diff --git a/Documentation/git-replay.txt b/Documentation/git-replay.txt
new file mode 100644
index 0000000000..2ca7ca5fd8
--- /dev/null
+++ b/Documentation/git-replay.txt
@@ -0,0 +1,39 @@
+git-replay(1)
+=============
+
+NAME
+----
+git-replay - EXPERIMENTAL: Replay commits on a new base, works with bare repos too
+
+
+SYNOPSIS
+--------
+[verse]
+(EXPERIMENTAL!) 'git replay' --onto <newbase> <oldbase> <branch>
+
+DESCRIPTION
+-----------
+
+Takes a range of commits, specified by <oldbase> and <branch>, and
+replays them onto a new location (see `--onto` option below).
+
+THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
+
+OPTIONS
+-------
+
+--onto <newbase>::
+ Starting point at which to create the new commits. May be any
+ valid commit, and not just an existing branch name.
+
+EXIT STATUS
+-----------
+
+For a successful, non-conflicted replay, the exit status is 0. When
+the replay has conflicts, the exit status is 1. If the replay is not
+able to complete (or start) due to some kind of error, the exit status
+is something other than 0 or 1.
+
+GIT
+---
+Part of the linkgit:git[1] suite
diff --git a/Makefile b/Makefile
index 03adcb5a48..3834bc1544 100644
--- a/Makefile
+++ b/Makefile
@@ -799,7 +799,6 @@ TEST_BUILTINS_OBJS += test-dump-split-index.o
TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
TEST_BUILTINS_OBJS += test-env-helper.o
TEST_BUILTINS_OBJS += test-example-decorate.o
-TEST_BUILTINS_OBJS += test-fast-rebase.o
TEST_BUILTINS_OBJS += test-find-pack.o
TEST_BUILTINS_OBJS += test-fsmonitor-client.o
TEST_BUILTINS_OBJS += test-genrandom.o
@@ -1290,6 +1289,7 @@ BUILTIN_OBJS += builtin/remote-fd.o
BUILTIN_OBJS += builtin/remote.o
BUILTIN_OBJS += builtin/repack.o
BUILTIN_OBJS += builtin/replace.o
+BUILTIN_OBJS += builtin/replay.o
BUILTIN_OBJS += builtin/rerere.o
BUILTIN_OBJS += builtin/reset.o
BUILTIN_OBJS += builtin/rev-list.o
diff --git a/builtin.h b/builtin.h
index d560baa661..28280636da 100644
--- a/builtin.h
+++ b/builtin.h
@@ -211,6 +211,7 @@ int cmd_remote(int argc, const char **argv, const char *prefix);
int cmd_remote_ext(int argc, const char **argv, const char *prefix);
int cmd_remote_fd(int argc, const char **argv, const char *prefix);
int cmd_repack(int argc, const char **argv, const char *prefix);
+int cmd_replay(int argc, const char **argv, const char *prefix);
int cmd_rerere(int argc, const char **argv, const char *prefix);
int cmd_reset(int argc, const char **argv, const char *prefix);
int cmd_restore(int argc, const char **argv, const char *prefix);
diff --git a/t/helper/test-fast-rebase.c b/builtin/replay.c
similarity index 87%
rename from t/helper/test-fast-rebase.c
rename to builtin/replay.c
index 2bfab66b1b..1998134683 100644
--- a/t/helper/test-fast-rebase.c
+++ b/builtin/replay.c
@@ -1,17 +1,11 @@
/*
- * "git fast-rebase" builtin command
- *
- * FAST: Forking Any Subprocesses (is) Taboo
- *
- * This is meant SOLELY as a demo of what is possible. sequencer.c and
- * rebase.c should be refactored to use the ideas here, rather than attempting
- * to extend this file to replace those (unless Phillip or Dscho say that
- * refactoring is too hard and we need a clean slate, but I'm guessing that
- * refactoring is the better route).
+ * "git replay" builtin command
*/
#define USE_THE_INDEX_VARIABLE
-#include "test-tool.h"
+#include "git-compat-util.h"
+
+#include "builtin.h"
#include "cache-tree.h"
#include "commit.h"
#include "environment.h"
@@ -27,7 +21,8 @@
#include "sequencer.h"
#include "setup.h"
#include "strvec.h"
-#include "tree.h"
+#include <oidset.h>
+#include <tree.h>
static const char *short_commit_name(struct commit *commit)
{
@@ -94,7 +89,7 @@ static struct commit *create_commit(struct tree *tree,
return (struct commit *)obj;
}
-int cmd__fast_rebase(int argc, const char **argv)
+int cmd_replay(int argc, const char **argv, const char *prefix)
{
struct commit *onto;
struct commit *last_commit = NULL, *last_picked_commit = NULL;
@@ -110,14 +105,8 @@ int cmd__fast_rebase(int argc, const char **argv)
struct strbuf branch_name = STRBUF_INIT;
int ret = 0;
- /*
- * test-tool stuff doesn't set up the git directory by default; need to
- * do that manually.
- */
- setup_git_directory();
-
if (argc == 2 && !strcmp(argv[1], "-h")) {
- printf("Sorry, I am not a psychiatrist; I can not give you the help you need. Oh, you meant usage...\n");
+ printf("usage: (EXPERIMENTAL!) git replay --onto <newbase> <oldbase> <branch>\n");
exit(129);
}
@@ -136,7 +125,7 @@ int cmd__fast_rebase(int argc, const char **argv)
if (repo_read_index(the_repository) < 0)
BUG("Could not read index");
- repo_init_revisions(the_repository, &revs, NULL);
+ repo_init_revisions(the_repository, &revs, prefix);
revs.verbose_header = 1;
revs.max_parents = 1;
revs.cherry_mark = 1;
diff --git a/command-list.txt b/command-list.txt
index 54b2a50f5f..c4cd0f352b 100644
--- a/command-list.txt
+++ b/command-list.txt
@@ -160,6 +160,7 @@ git-reflog ancillarymanipulators complete
git-remote ancillarymanipulators complete
git-repack ancillarymanipulators complete
git-replace ancillarymanipulators complete
+git-replay plumbingmanipulators
git-request-pull foreignscminterface complete
git-rerere ancillaryinterrogators
git-reset mainporcelain history
diff --git a/git.c b/git.c
index c67e44dd82..7068a184b0 100644
--- a/git.c
+++ b/git.c
@@ -594,6 +594,7 @@ static struct cmd_struct commands[] = {
{ "remote-fd", cmd_remote_fd, NO_PARSEOPT },
{ "repack", cmd_repack, RUN_SETUP },
{ "replace", cmd_replace, RUN_SETUP },
+ { "replay", cmd_replay, RUN_SETUP },
{ "rerere", cmd_rerere, RUN_SETUP },
{ "reset", cmd_reset, RUN_SETUP },
{ "restore", cmd_restore, RUN_SETUP | NEED_WORK_TREE },
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 876cd2dc31..37ba996539 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -30,7 +30,6 @@ static struct test_cmd cmds[] = {
{ "dump-untracked-cache", cmd__dump_untracked_cache },
{ "env-helper", cmd__env_helper },
{ "example-decorate", cmd__example_decorate },
- { "fast-rebase", cmd__fast_rebase },
{ "find-pack", cmd__find_pack },
{ "fsmonitor-client", cmd__fsmonitor_client },
{ "genrandom", cmd__genrandom },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 70dd4eba11..8a1a7c63da 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -24,7 +24,6 @@ int cmd__dump_untracked_cache(int argc, const char **argv);
int cmd__dump_reftable(int argc, const char **argv);
int cmd__env_helper(int argc, const char **argv);
int cmd__example_decorate(int argc, const char **argv);
-int cmd__fast_rebase(int argc, const char **argv);
int cmd__find_pack(int argc, const char **argv);
int cmd__fsmonitor_client(int argc, const char **argv);
int cmd__genrandom(int argc, const char **argv);
diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh
new file mode 100755
index 0000000000..36c1b5082a
--- /dev/null
+++ b/t/t3650-replay-basics.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+test_description='basic git replay tests'
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+GIT_AUTHOR_NAME=author@name
+GIT_AUTHOR_EMAIL=bogus@email@address
+export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
+
+test_expect_success 'setup' '
+ test_commit A &&
+ test_commit B &&
+
+ git switch -c topic1 &&
+ test_commit C &&
+ git switch -c topic2 &&
+ test_commit D &&
+ test_commit E &&
+ git switch topic1 &&
+ test_commit F &&
+ git switch -c topic3 &&
+ test_commit G &&
+ test_commit H &&
+ git switch -c topic4 main &&
+ test_commit I &&
+ test_commit J &&
+
+ git switch -c next main &&
+ test_commit K &&
+ git merge -m "Merge topic1" topic1 &&
+ git merge -m "Merge topic2" topic2 &&
+ git merge -m "Merge topic3" topic3 &&
+ >evil &&
+ git add evil &&
+ git commit --amend &&
+ git merge -m "Merge topic4" topic4 &&
+
+ git switch main &&
+ test_commit L &&
+ test_commit M &&
+
+ git switch -c conflict B &&
+ test_commit C.conflict C.t conflict
+'
+
+test_expect_success 'using replay to rebase two branches, one on top of other' '
+ git switch main &&
+
+ git replay --onto main topic1 topic2 >result &&
+
+ git log --format=%s $(cut -f 3 -d " " result) >actual &&
+ test_write_lines E D M L B A >expect &&
+ test_cmp expect actual
+'
+
+test_done
diff --git a/t/t6429-merge-sequence-rename-caching.sh b/t/t6429-merge-sequence-rename-caching.sh
index 75d3fd2dba..7670b72008 100755
--- a/t/t6429-merge-sequence-rename-caching.sh
+++ b/t/t6429-merge-sequence-rename-caching.sh
@@ -71,9 +71,8 @@ test_expect_success 'caching renames does not preclude finding new ones' '
git switch upstream &&
- test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git replay --onto HEAD upstream~1 topic &&
git reset --hard topic &&
- #git cherry-pick upstream~1..topic
git ls-files >tracked-files &&
test_line_count = 2 tracked-files &&
@@ -141,8 +140,7 @@ test_expect_success 'cherry-pick both a commit and its immediate revert' '
GIT_TRACE2_PERF="$(pwd)/trace.output" &&
export GIT_TRACE2_PERF &&
- test-tool fast-rebase --onto HEAD upstream~1 topic &&
- #git cherry-pick upstream~1..topic &&
+ git replay --onto HEAD upstream~1 topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
test_line_count = 1 calls
@@ -200,9 +198,8 @@ test_expect_success 'rename same file identically, then reintroduce it' '
GIT_TRACE2_PERF="$(pwd)/trace.output" &&
export GIT_TRACE2_PERF &&
- test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git replay --onto HEAD upstream~1 topic &&
git reset --hard topic &&
- #git cherry-pick upstream~1..topic &&
git ls-files >tracked &&
test_line_count = 2 tracked &&
@@ -278,9 +275,8 @@ test_expect_success 'rename same file identically, then add file to old dir' '
GIT_TRACE2_PERF="$(pwd)/trace.output" &&
export GIT_TRACE2_PERF &&
- test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git replay --onto HEAD upstream~1 topic &&
git reset --hard topic &&
- #git cherry-pick upstream~1..topic &&
git ls-files >tracked &&
test_line_count = 4 tracked &&
@@ -356,8 +352,7 @@ test_expect_success 'cached dir rename does not prevent noticing later conflict'
GIT_TRACE2_PERF="$(pwd)/trace.output" &&
export GIT_TRACE2_PERF &&
- test_must_fail test-tool fast-rebase --onto HEAD upstream~1 topic >output &&
- #git cherry-pick upstream..topic &&
+ test_must_fail git replay --onto HEAD upstream~1 topic >output &&
grep region_enter.*diffcore_rename trace.output >calls &&
test_line_count = 2 calls
@@ -456,9 +451,8 @@ test_expect_success 'dir rename unneeded, then add new file to old dir' '
GIT_TRACE2_PERF="$(pwd)/trace.output" &&
export GIT_TRACE2_PERF &&
- test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git replay --onto HEAD upstream~1 topic &&
git reset --hard topic &&
- #git cherry-pick upstream..topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
test_line_count = 2 calls &&
@@ -523,9 +517,8 @@ test_expect_success 'dir rename unneeded, then rename existing file into old dir
GIT_TRACE2_PERF="$(pwd)/trace.output" &&
export GIT_TRACE2_PERF &&
- test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git replay --onto HEAD upstream~1 topic &&
git reset --hard topic &&
- #git cherry-pick upstream..topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
test_line_count = 3 calls &&
@@ -626,9 +619,8 @@ test_expect_success 'caching renames only on upstream side, part 1' '
GIT_TRACE2_PERF="$(pwd)/trace.output" &&
export GIT_TRACE2_PERF &&
- test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git replay --onto HEAD upstream~1 topic &&
git reset --hard topic &&
- #git cherry-pick upstream..topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
test_line_count = 1 calls &&
@@ -685,9 +677,8 @@ test_expect_success 'caching renames only on upstream side, part 2' '
GIT_TRACE2_PERF="$(pwd)/trace.output" &&
export GIT_TRACE2_PERF &&
- test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git replay --onto HEAD upstream~1 topic &&
git reset --hard topic &&
- #git cherry-pick upstream..topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
test_line_count = 2 calls &&
--
2.43.0.14.g93e034faee
^ permalink raw reply related
* [PATCH v8 01/14] t6429: remove switching aspects of fast-rebase
From: Christian Couder @ 2023-11-24 11:10 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Johannes Schindelin,
Elijah Newren, John Cai, Derrick Stolee, Phillip Wood, Calvin Wan,
Toon Claes, Dragan Simic, Linus Arver, Christian Couder
In-Reply-To: <20231124111044.3426007-1-christian.couder@gmail.com>
From: Elijah Newren <newren@gmail.com>
At the time t6429 was written, merge-ort was still under development,
did not have quite as many tests, and certainly was not widely deployed.
Since t6429 was exercising some codepaths just a little differently, we
thought having them also test the "merge_switch_to_result()" bits of
merge-ort was useful even though they weren't intrinsic to the real
point of these tests.
However, the value provided by doing extra testing of the
"merge_switch_to_result()" bits has decreased a bit over time, and it's
actively making it harder to refactor `test-tool fast-rebase` into `git
replay`, which we are going to do in following commits. Dispense with
these bits.
Co-authored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
t/helper/test-fast-rebase.c | 9 +--------
t/t6429-merge-sequence-rename-caching.sh | 9 +++++++--
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c
index cac20a72b3..2bfab66b1b 100644
--- a/t/helper/test-fast-rebase.c
+++ b/t/helper/test-fast-rebase.c
@@ -194,7 +194,7 @@ int cmd__fast_rebase(int argc, const char **argv)
last_commit = create_commit(result.tree, commit, last_commit);
}
- merge_switch_to_result(&merge_opt, head_tree, &result, 1, !result.clean);
+ merge_finalize(&merge_opt, &result);
if (result.clean < 0)
exit(128);
@@ -213,9 +213,6 @@ int cmd__fast_rebase(int argc, const char **argv)
}
if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
die(_("unable to update HEAD"));
-
- prime_cache_tree(the_repository, the_repository->index,
- result.tree);
} else {
fprintf(stderr, "\nAborting: Hit a conflict.\n");
strbuf_addf(&reflog_msg, "rebase progress up to %s",
@@ -228,10 +225,6 @@ int cmd__fast_rebase(int argc, const char **argv)
die("Failed to update %s", argv[4]);
}
}
- if (write_locked_index(&the_index, &lock,
- COMMIT_LOCK | SKIP_IF_UNCHANGED))
- die(_("unable to write %s"), get_index_file());
-
ret = (result.clean == 0);
cleanup:
strbuf_release(&reflog_msg);
diff --git a/t/t6429-merge-sequence-rename-caching.sh b/t/t6429-merge-sequence-rename-caching.sh
index d02fa16614..75d3fd2dba 100755
--- a/t/t6429-merge-sequence-rename-caching.sh
+++ b/t/t6429-merge-sequence-rename-caching.sh
@@ -72,6 +72,7 @@ test_expect_success 'caching renames does not preclude finding new ones' '
git switch upstream &&
test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git reset --hard topic &&
#git cherry-pick upstream~1..topic
git ls-files >tracked-files &&
@@ -200,6 +201,7 @@ test_expect_success 'rename same file identically, then reintroduce it' '
export GIT_TRACE2_PERF &&
test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git reset --hard topic &&
#git cherry-pick upstream~1..topic &&
git ls-files >tracked &&
@@ -277,6 +279,7 @@ test_expect_success 'rename same file identically, then add file to old dir' '
export GIT_TRACE2_PERF &&
test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git reset --hard topic &&
#git cherry-pick upstream~1..topic &&
git ls-files >tracked &&
@@ -356,8 +359,6 @@ test_expect_success 'cached dir rename does not prevent noticing later conflict'
test_must_fail test-tool fast-rebase --onto HEAD upstream~1 topic >output &&
#git cherry-pick upstream..topic &&
- grep CONFLICT..rename/rename output &&
-
grep region_enter.*diffcore_rename trace.output >calls &&
test_line_count = 2 calls
)
@@ -456,6 +457,7 @@ test_expect_success 'dir rename unneeded, then add new file to old dir' '
export GIT_TRACE2_PERF &&
test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git reset --hard topic &&
#git cherry-pick upstream..topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
@@ -522,6 +524,7 @@ test_expect_success 'dir rename unneeded, then rename existing file into old dir
export GIT_TRACE2_PERF &&
test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git reset --hard topic &&
#git cherry-pick upstream..topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
@@ -624,6 +627,7 @@ test_expect_success 'caching renames only on upstream side, part 1' '
export GIT_TRACE2_PERF &&
test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git reset --hard topic &&
#git cherry-pick upstream..topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
@@ -682,6 +686,7 @@ test_expect_success 'caching renames only on upstream side, part 2' '
export GIT_TRACE2_PERF &&
test-tool fast-rebase --onto HEAD upstream~1 topic &&
+ git reset --hard topic &&
#git cherry-pick upstream..topic &&
grep region_enter.*diffcore_rename trace.output >calls &&
--
2.43.0.14.g93e034faee
^ permalink raw reply related
* [PATCH v8 00/14] Introduce new `git replay` command
From: Christian Couder @ 2023-11-24 11:10 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Patrick Steinhardt, Johannes Schindelin,
Elijah Newren, John Cai, Derrick Stolee, Phillip Wood, Calvin Wan,
Toon Claes, Dragan Simic, Linus Arver, Christian Couder
In-Reply-To: <20231115143327.2441397-1-christian.couder@gmail.com>
# Intro
`git replay` has initially been developed entirely by Elijah Newren
mostly last year (2022) at:
https://github.com/newren/git/commits/replay
I took over this year to polish and upstream it as GitLab is
interested in replacing libgit2, and for that purpose needs a command
to do server side (so without using a worktree) rebases, cherry-picks
and reverts.
I reduced the number of commits and features in this patch series,
compared to what Elijah already developed. Especially I stopped short
of replaying merge commits and replaying interactively. These and
other features might be upstreamed in the future after this patch
series has graduated.
The focus in this series is to make it a good plumbing command that
can already be used server side and that replaces the "fast-rebase"
test-tool command. So things to make it easier to use on the command
line, and more advanced features (like replaying merges) are left out.
It looks like GitHub has actually already been using version 3 of this
patch series in production with good results. See:
https://github.blog/2023-07-27-scaling-merge-ort-across-github/
https://lore.kernel.org/git/304f2a49-5e05-7655-9f87-2011606df5db@gmx.de/
# Content of this cover letter
The "Quick Overview" and "Reasons for diverging from cherry-pick &
rebase" sections just below are describing the purpose of the new
command in the big scheme of things. They are taken from Elijah's
design notes
(https://github.com/newren/git/blob/replay/replay-design-notes.txt)
and describe what we want this command to become and the reasons for
that, not what the command is after only this patch series. Also these
design notes were written at least one year ago, so parts of those 2
sections are not true anymore. I have added Phillip Wood's or Felipe
Contreras' notes (thanks to them) where that's the case, but some now
flawed parts may have missed.
After these two sections, starting with the "Important limitations"
section, you will find sections describing what is actually in this
patch series.
More interesting material is available in Elijah's design notes like
an "Intro via examples"
(https://github.com/newren/git/blob/replay/replay-design-notes.txt#L37-L132),
a discussion about "Preserving topology, replaying merges"
(https://github.com/newren/git/blob/replay/replay-design-notes.txt#L264-L341)
and a "Current status" section describing Elijah's work
(https://github.com/newren/git/blob/replay/replay-design-notes.txt#L344-L392)
before I started working on upstreaming it.
I have not included this material here though, as the documentation
added by this patch series for the `git replay` command already
includes an "EXAMPLES" section, and other sections of Elijah's design
notes might not be interesting for now. Also this cover letter is
already pretty long. But reviewers can refer to the links above if
they think it can help.
# Quick Overview (from Elijah's design notes)
`git replay`, at a basic level, can perhaps be thought of as a
"default-to-dry-run rebase" -- meaning no updates to the working tree,
or to the index, or to any references. However, it differs from
rebase in that it:
* Works for branches that aren't checked out
* Works in a bare repository
* Can replay multiple branches simultaneously (with or without common
history in the range being replayed)
* Preserves relative topology by default (merges are replayed too in
Elijah's original work, not in this series)
* Focuses on performance
* Has several altered defaults as a result of the above
I sometimes think of `git replay` as "fast-replay", a patch-based
analogue to the snapshot-based fast-export & fast-import tools.
# Reasons for diverging from cherry-pick & rebase (from Elijah's
design notes)
There are multiple reasons to diverge from the defaults in cherry-pick and
rebase.
* Server side needs
* Both cherry-pick and rebase, via the sequencer, are heavily tied
to updating the working tree, index, some refs, and a lot of
control files with every commit replayed, and invoke a mess of
hooks[1] that might be hard to avoid for backward compatibility
reasons (at least, that's been brought up a few times on the
list).
* cherry-pick and rebase both fork various subprocesses
unnecessarily, but somewhat intrinsically in part to ensure the
same hooks are called that old scripted implementations would have
called.
Note: since 356ee4659bb (sequencer: try to commit without forking
'git commit', 2017-11-24) cherry-pick and rebase do not fork
subprocesses other than hooks for the cases covered by this patch
series (i.e. they do not fork "git commit" for simple picks).
* "Dry run" behavior, where there are no updates to worktree, index,
or even refs might be important.
* Should not assume users only want to operate on HEAD (see next
section)
* Decapitate HEAD-centric assumptions
* cherry-pick forces commits to be played on top of HEAD;
inflexible.
* rebase assumes the range of commits to be replayed is
upstream..HEAD by default, though it allows one to replay
upstream..otherbranch -- but it still forcibly and needlessly
checks out 'otherbranch' before starting to replay things.
Note: since 767a9c417eb (rebase -i: stop checking out the tip of
the branch to rebase, 2020-01-24) it's not true that rebase
forcibly and needlessly checks out 'otherbranch'.
* Assuming HEAD is involved severely limits replaying multiple
(possibly divergent) branches.
Note: since 89fc0b53fdb (rebase: update refs from 'update-ref'
commands, 2022-07-19) the sequencer can update multiple
branches. The issue with divergent branch is with command line
arguments and the todo list generation rather than the
capabilities of the sequencer.
* Once you stop assuming HEAD has a certain meaning, there's not
much reason to have two separate commands anymore (except for the
funny extra not-necessarily-compatible options both have gained
over time).
* (Micro issue: Assuming HEAD is involved also makes it harder for
new users to learn what rebase means and does; it makes command
lines hard to parse. Not sure I want to harp on this too much, as
I have a suspicion I might be creating a tool for experts with
complicated use cases, but it's a minor quibble.)
* Performance
* jj is slaughtering us on rebase speed[2]. I would like us to become
competitive. (I dropped a few comments in the link at [2] about why
git is currently so bad.)
* From [3], there was a simple 4-patch series in linux.git that took
53 seconds to rebase. Switching to ort dropped it to 16 seconds.
While that sounds great, only 11 *milliseconds* were needed to do
the actual merges. That means almost *all* the time (>99%) was
overhead! Big offenders:
* --reapply-cherry-picks should be the default
* can_fast_forward() should be ripped out, and perhaps other extraneous
revision walks
Note: d42c9ffa0f (rebase: factor out branch_base calculation,
2022-10-17) might already deal with that (according to Felipe
Contreras).
* avoid updating working tree, index, refs, reflogs, and control
structures except when needed (e.g. hitting a conflict, or operation
finished)
* Other performance ideas (mostly for future work, not in this
series)
* single-file control structures instead of directory of files
(when doing interactive things which is in Elijah's original
work, but not in this series)
* avoid forking subprocesses unless explicitly requested (e.g.
--exec, --strategy, --run-hooks). For example, definitely do not
invoke `git commit` or `git merge`.
* Sanitize hooks:
* dispense with all per-commit hooks for sure (pre-commit,
post-commit, post-checkout).
* pre-rebase also seems to assume exactly 1 ref is written, and
invoking it repeatedly would be stupid. Plus, it's specific
to "rebase". So...ignore? (Stolee's --ref-update option for
rebase probably broke the pre-rebase assumptions already...)
* post-rewrite hook might make sense, but fast-import got
exempted, and I think of replay like a patch-based analogue
to the snapshot-based fast-import.
* When not running server side, resolve conflicts in a sparse-cone
sparse-index worktree to reduce number of files written to a
working tree. (See below as well.)
* [High risk of possible premature optimization] Avoid large
numbers of newly created loose objects, when replaying large
numbers of commits. Two possibilities: (1) Consider using
tmp-objdir and pack objects from the tmp-objdir at end of
exercise, (2) Lift code from git-fast-import to immediately
stuff new objects into a pack?
* Multiple branches and non-checked out branches
* The ability to operate on non-checked out branches also implies
that we should generally be able to replay when in a dirty working
tree (exception being when we expect to update HEAD and any of the
dirty files is one that needs to be updated by the replay).
* Also, if we are operating locally on a non-checked out branch and
hit a conflict, we should have a way to resolve the conflict
without messing with the user's work on their current
branch. (This is not is this patch series though.)
* Idea: new worktree with sparse cone + sparse index checkout,
containing only files in the root directory, and whatever is
necessary to get the conflicts
* Companion to above idea: control structures should be written to
$GIT_COMMON_DIR/replay-${worktree}, so users can have multiple
replay sessions, and so we know which worktrees are associated
with which replay operations.
- [1] https://lore.kernel.org/git/pull.749.v3.git.git.1586044818132.gitgitgadget@gmail.com/
- [2] https://github.com/martinvonz/jj/discussions/49
- [3] https://lore.kernel.org/git/CABPp-BE48=97k_3tnNqXPjSEfA163F8hoE+HY0Zvz1SWB2B8EA@mail.gmail.com/
# Important limitations
* The code exits with code 1 if there are any conflict. No
resumability. No nice output. No interactivity. No special exit code
depending on the reason.
* When a commit becomes empty as it is replayed, it is still replayed
as an empty commit, instead of being dropped.
* No replaying merges, nor root commits. Only regular commits.
* Signed commits are not properly handled. It's not clear what to do
to such commits when replaying on the server side.
* Notes associated with replayed commits are not updated nor
duplicated. (Thanks to Phillip Wood for noticing.)
# Commit overview
* 1/14 t6429: remove switching aspects of fast-rebase
Preparatory commit to make it easier to later replace the
fast-rebase test-tool by `git replay` without breaking existing
tests.
* 2/14 replay: introduce new builtin
This creates a minimal `git replay` command by moving the code
from the `fast-rebase` test helper from `t/helper/` into
`builtin/` and doing some renames and a few other needed changes.
Since v7, there is only a synopsys change in the doc, and the
corresponding usage message change, as suggested by Dscho.
* - 3/14 replay: start using parse_options API
- 4/14 replay: die() instead of failing assert()
- 5/14 replay: introduce pick_regular_commit()
- 6/14 replay: change rev walking options
- 7/14 replay: add an important FIXME comment about gpg signing
- 8/14 replay: remove progress and info output
- 9/14 replay: remove HEAD related sanity check
These slowly change the command to make it behave more like
regular commands and to start cleaning up its output.
* 10/14 replay: make it a minimal server side command
After the cleaning up in previous commits, it's now time to
radically change the way it works by stopping it to do ref
updates, to update the index and worktree, to consider HEAD as
special. Instead just make it output commands that should be
passed to `git update-ref --stdin`.
* 11/14 replay: use standard revision ranges
Start adding new interesting features and also documentation and
tests, as the interface of the command is cristalizing into its
final form.
* - 12/14 replay: add --advance or 'cherry-pick' mode
- 13/14 replay: add --contained to rebase contained branches
Add new options and features to the command.
* 14/14 replay: stop assuming replayed branches do not diverge
This adds another interesting feature, as well as related
documentation and tests.
# Notes about `fast-rebase`, tests and documentation
The `fast-rebase` test-tool helper was developed by Elijah to
experiment with a rebasing tool that would be developed from scratch
based on his merge-ort work, could be used to test that merge-ort
work, and would not have the speed and interface limitations of `git
rebase` or `git cherry-pick`.
This `fast-rebase` helper was used before this series in:
t6429-merge-sequence-rename-caching.sh
So when `git replay` is created from `fast-rebase` in patch 2/14, the
t6429 test script is also converted to use `git replay`. This ensures
that `git replay` doesn't break too badly during the first 10 patches
in this patch series.
Tests and documentation are introduced specifically for `git replay`
as soon as patch 2/14, but they are not much improved since around
11/14 as it doesn't make much sense to document and test behavior that
we know is going to change soon.
# Possibly controversial issues
* bare or not bare: this series works towards a plumbing command with
the end goal of it being usable and used first on bare repos,
contrary to existing commands like `git rebase` and `git
cherry-pick`. The tests check that the command works on both bare
and non-bare repo though.
* exit status: a successful, non-conflicted replay exits with code
0. When the replay has conflicts, the exit status is 1. If the
replay is not able to complete (or start) due to some kind of error,
the exit status is something other than 0 or 1. There are a few
tests checking that. It has been suggested in an internal review
that conflicts might want to get a more specific error code as an
error code of 1 might be quite easy to return by accident. It
doesn't seem to me from their docs (which might want to be improved,
I didn't look at the code) that other commands like `git merge` and
`git rebase` exit with a special error code in case of conflict.
* make worktree and index changes optional: commit 10/14 stops
updating the index and worktree, but it might be better especially
for cli users to make that optional. The issue is that this would
make the command more complex while we are developing a number of
important features so that the command can be used on bare repos. It
seems that this should rather be done in an iterative improvement
after the important features have landed.
* --advance and --contained: these two advanced options might not
belong to this first series and could perhaps be added in a followup
series in separate commits. On the other hand the code for
--contained seems involved with the code of --advance and it's nice
to see soon that git replay can indeed do cherry-picking and rebase
many refs at once, and this way fullfil these parts of its promise.
* replaying diverging branches: 14/14 the last patch in the series,
which allow replaying diverging branches, can be seen as a
fundamental fix or alternatively as adding an interesting
feature. So it's debatable if it should be in its own patch along
with its own tests as in this series, or if it should be merged into
a previous patch and which one.
* only 2 patches: this patch series can be seen from a high level
point of view as 1) introducing the new `git replay` command, and 2)
using `git replay` to replace, and get rid of, the fast-rebase
test-tool command. The fact that not much of the original
fast-rebase code and interface is left would agree with that point
of view. On the other hand, fast-rebase can also be seen as a first
iteration towards `git replay`. So it can also make sense to see how
`git replay` evolved from it.
# Changes between v7 and v8
Thanks to Dscho, Linus Arver, Dragan Simic, Elijah, Junio, Derrick
Stolee, Phillip Wood, Calvin Wan and Toon Claes for their suggestions
on the previous versions! The only few changes compared to v7 are:
* The patch series was rebased onto master at 564d0252ca (Git 2.43,
2023-11-20). This is to make it stand on a stable base.
* In patch 2/14 (replay: introduce new builtin), there is a synopsys
change in the doc, and the corresponding usage message change as
suggested by Dscho. This is just about replacing " # EXPERIMENTAL"
at the end of both the synopsys and usage message with
"(EXPERIMENTAL!) " at the beginning of them.
CI tests seem to pass according to:
https://github.com/chriscool/git/actions/runs/6979770154
(Sorry I am not waiting more than 20 minutes for the 3 last ones to
finish.)
# Range-diff between v7 and v8
(A single change was made in patch 2/14, but unfortunately as the
lines changed in that patch are also changed by other patches later,
it looks like there are more changes in subsequent patches.)
1: cddcd967b2 = 1: 18fd9b0d5d t6429: remove switching aspects of fast-rebase
2: c8476fb093 ! 2: fc6bdf4de4 replay: introduce new builtin
@@ Documentation/git-replay.txt (new)
+SYNOPSIS
+--------
+[verse]
-+'git replay' --onto <newbase> <oldbase> <branch> # EXPERIMENTAL
++(EXPERIMENTAL!) 'git replay' --onto <newbase> <oldbase> <branch>
+
+DESCRIPTION
+-----------
@@ builtin/replay.c: int cmd__fast_rebase(int argc, const char **argv)
-
if (argc == 2 && !strcmp(argv[1], "-h")) {
- printf("Sorry, I am not a psychiatrist; I can not give you the help you need. Oh, you meant usage...\n");
-+ printf("git replay --onto <newbase> <oldbase> <branch> # EXPERIMENTAL\n");
++ printf("usage: (EXPERIMENTAL!) git replay --onto <newbase> <oldbase> <branch>\n");
exit(129);
}
3: 43322abd1e ! 3: e96a66c352 replay: start using parse_options API
@@ builtin/replay.c: int cmd_replay(int argc, const char **argv, const char *prefix
int ret = 0;
- if (argc == 2 && !strcmp(argv[1], "-h")) {
-- printf("git replay --onto <newbase> <oldbase> <branch> # EXPERIMENTAL\n");
+- printf("usage: (EXPERIMENTAL!) git replay --onto <newbase> <oldbase> <branch>\n");
- exit(129);
+ const char * const replay_usage[] = {
-+ N_("git replay --onto <newbase> <oldbase> <branch> # EXPERIMENTAL"),
++ N_("(EXPERIMENTAL!) git replay --onto <newbase> <oldbase> <branch>"),
+ NULL
+ };
+ struct option replay_options[] = {
4: 6524c7f045 = 4: f819d283d9 replay: die() instead of failing assert()
5: 05d0efa3cb = 5: 68bbcf9492 replay: introduce pick_regular_commit()
6: c7a5aad3d6 = 6: 72221c647e replay: change rev walking options
7: 01f35f924b = 7: f54d8fce22 replay: add an important FIXME comment about gpg signing
8: 1498b24bad = 8: e50cc22522 replay: remove progress and info output
9: 6786fc147b = 9: 0c5ea3d18e replay: remove HEAD related sanity check
10: 9a24dbb530 = 10: 9fc636fc3d replay: make it a minimal server side command
11: ad6ca2fbef ! 11: 2096bcad79 replay: use standard revision ranges
@@ Documentation/git-replay.txt: git-replay - EXPERIMENTAL: Replay commits on a new
SYNOPSIS
--------
[verse]
--'git replay' --onto <newbase> <oldbase> <branch> # EXPERIMENTAL
-+'git replay' --onto <newbase> <revision-range>... # EXPERIMENTAL
+-(EXPERIMENTAL!) 'git replay' --onto <newbase> <oldbase> <branch>
++(EXPERIMENTAL!) 'git replay' --onto <newbase> <revision-range>...
DESCRIPTION
-----------
@@ builtin/replay.c: int cmd_replay(int argc, const char **argv, const char *prefix
int ret = 0;
const char * const replay_usage[] = {
-- N_("git replay --onto <newbase> <oldbase> <branch> # EXPERIMENTAL"),
-+ N_("git replay --onto <newbase> <revision-range>... # EXPERIMENTAL"),
+- N_("(EXPERIMENTAL!) git replay --onto <newbase> <oldbase> <branch>"),
++ N_("(EXPERIMENTAL!) git replay --onto <newbase> <revision-range>..."),
NULL
};
struct option replay_options[] = {
12: 081864ed5f ! 12: d5414806ef replay: add --advance or 'cherry-pick' mode
@@ Documentation/git-replay.txt: git-replay - EXPERIMENTAL: Replay commits on a new
SYNOPSIS
--------
[verse]
--'git replay' --onto <newbase> <revision-range>... # EXPERIMENTAL
-+'git replay' (--onto <newbase> | --advance <branch>) <revision-range>... # EXPERIMENTAL
+-(EXPERIMENTAL!) 'git replay' --onto <newbase> <revision-range>...
++(EXPERIMENTAL!) 'git replay' (--onto <newbase> | --advance <branch>) <revision-range>...
DESCRIPTION
-----------
@@ builtin/replay.c: static struct commit *pick_regular_commit(struct commit *pickm
int ret = 0;
const char * const replay_usage[] = {
-- N_("git replay --onto <newbase> <revision-range>... # EXPERIMENTAL"),
-+ N_("git replay (--onto <newbase> | --advance <branch>) <revision-range>... # EXPERIMENTAL"),
+- N_("(EXPERIMENTAL!) git replay --onto <newbase> <revision-range>..."),
++ N_("(EXPERIMENTAL!) git replay (--onto <newbase> | --advance <branch>) <revision-range>..."),
NULL
};
struct option replay_options[] = {
13: 19c4016c7c ! 13: 2a3e521c13 replay: add --contained to rebase contained branches
@@ Documentation/git-replay.txt: git-replay - EXPERIMENTAL: Replay commits on a new
SYNOPSIS
--------
[verse]
--'git replay' (--onto <newbase> | --advance <branch>) <revision-range>... # EXPERIMENTAL
-+'git replay' ([--contained] --onto <newbase> | --advance <branch>) <revision-range>... # EXPERIMENTAL
+-(EXPERIMENTAL!) 'git replay' (--onto <newbase> | --advance <branch>) <revision-range>...
++(EXPERIMENTAL!) 'git replay' ([--contained] --onto <newbase> | --advance <branch>) <revision-range>...
DESCRIPTION
-----------
@@ builtin/replay.c: int cmd_replay(int argc, const char **argv, const char *prefix
int ret = 0;
const char * const replay_usage[] = {
-- N_("git replay (--onto <newbase> | --advance <branch>) <revision-range>... # EXPERIMENTAL"),
-+ N_("git replay ([--contained] --onto <newbase> | --advance <branch>) "
-+ "<revision-range>... # EXPERIMENTAL"),
+- N_("(EXPERIMENTAL!) git replay (--onto <newbase> | --advance <branch>) <revision-range>..."),
++ N_("(EXPERIMENTAL!) git replay "
++ "([--contained] --onto <newbase> | --advance <branch>) "
++ "<revision-range>..."),
NULL
};
struct option replay_options[] = {
14: 29556bcc86 = 14: 93e034faee replay: stop assuming replayed branches do not diverge
Elijah Newren (14):
t6429: remove switching aspects of fast-rebase
replay: introduce new builtin
replay: start using parse_options API
replay: die() instead of failing assert()
replay: introduce pick_regular_commit()
replay: change rev walking options
replay: add an important FIXME comment about gpg signing
replay: remove progress and info output
replay: remove HEAD related sanity check
replay: make it a minimal server side command
replay: use standard revision ranges
replay: add --advance or 'cherry-pick' mode
replay: add --contained to rebase contained branches
replay: stop assuming replayed branches do not diverge
.gitignore | 1 +
Documentation/git-replay.txt | 127 +++++++
Makefile | 2 +-
builtin.h | 1 +
builtin/replay.c | 446 +++++++++++++++++++++++
command-list.txt | 1 +
git.c | 1 +
t/helper/test-fast-rebase.c | 241 ------------
t/helper/test-tool.c | 1 -
t/helper/test-tool.h | 1 -
t/t3650-replay-basics.sh | 198 ++++++++++
t/t6429-merge-sequence-rename-caching.sh | 45 ++-
12 files changed, 801 insertions(+), 264 deletions(-)
create mode 100644 Documentation/git-replay.txt
create mode 100644 builtin/replay.c
delete mode 100644 t/helper/test-fast-rebase.c
create mode 100755 t/t3650-replay-basics.sh
base-commit: 564d0252ca632e0264ed670534a51d18a689ef5d
--
2.43.0.14.g93e034faee
^ permalink raw reply
* [PATCH v3] commit-graph: disable GIT_COMMIT_GRAPH_PARANOIA by default
From: Patrick Steinhardt @ 2023-11-24 11:08 UTC (permalink / raw)
To: git; +Cc: Taylor Blau, Jeff King, Junio C Hamano
In-Reply-To: <7e2d300c4af9a7853201121d66f982afa421bbba.1699957350.git.ps@pks.im>
[-- Attachment #1: Type: text/plain, Size: 8404 bytes --]
In 7a5d604443 (commit: detect commits that exist in commit-graph but not
in the ODB, 2023-10-31), we have introduced a new object existence check
into `repo_parse_commit_internal()` so that we do not parse commits via
the commit-graph that don't have a corresponding object in the object
database. This new check of course comes with a performance penalty,
which the commit put at around 30% for `git rev-list --topo-order`. But
there are in fact scenarios where the performance regression is even
higher. The following benchmark against linux.git with a fully-build
commit-graph:
Benchmark 1: git.v2.42.1 rev-list --count HEAD
Time (mean ± σ): 658.0 ms ± 5.2 ms [User: 613.5 ms, System: 44.4 ms]
Range (min … max): 650.2 ms … 666.0 ms 10 runs
Benchmark 2: git.v2.43.0-rc1 rev-list --count HEAD
Time (mean ± σ): 1.333 s ± 0.019 s [User: 1.263 s, System: 0.069 s]
Range (min … max): 1.302 s … 1.361 s 10 runs
Summary
git.v2.42.1 rev-list --count HEAD ran
2.03 ± 0.03 times faster than git.v2.43.0-rc1 rev-list --count HEAD
While it's a noble goal to ensure that results are the same regardless
of whether or not we have a potentially stale commit-graph, taking twice
as much time is a tough sell. Furthermore, we can generally assume that
the commit-graph will be updated by git-gc(1) or git-maintenance(1) as
required so that the case where the commit-graph is stale should not at
all be common.
With that in mind, default-disable GIT_COMMIT_GRAPH_PARANOIA and restore
the behaviour and thus performance previous to the mentioned commit. In
order to not be inconsistent, also disable this behaviour by default in
`lookup_commit_in_graph()`, where the object existence check has been
introduced right at its inception via f559d6d45e (revision: avoid
hitting packfiles when commits are in commit-graph, 2021-08-09).
This results in another speedup in commands that end up calling this
function, even though it's less pronounced compared to the above
benchmark. The following has been executed in linux.git with ~1.2
million references:
Benchmark 1: GIT_COMMIT_GRAPH_PARANOIA=true git rev-list --all --no-walk=unsorted
Time (mean ± σ): 2.947 s ± 0.003 s [User: 2.412 s, System: 0.534 s]
Range (min … max): 2.943 s … 2.949 s 3 runs
Benchmark 2: GIT_COMMIT_GRAPH_PARANOIA=false git rev-list --all --no-walk=unsorted
Time (mean ± σ): 2.724 s ± 0.030 s [User: 2.207 s, System: 0.514 s]
Range (min … max): 2.704 s … 2.759 s 3 runs
Summary
GIT_COMMIT_GRAPH_PARANOIA=false git rev-list --all --no-walk=unsorted ran
1.08 ± 0.01 times faster than GIT_COMMIT_GRAPH_PARANOIA=true git rev-list --all --no-walk=unsorted
So whereas 7a5d604443 initially introduced the logic to start doing an
object existence check in `repo_parse_commit_internal()` by default, the
updated logic will now instead cause `lookup_commit_in_graph()` to stop
doing the check by default. This behaviour continues to be tweakable by
the user via the GIT_COMMIT_GRAPH_PARANOIA environment variable.
Note that this requires us to amend some tests to manually turn on the
paranoid checks again. This is because we cause repository corruption by
manually deleting objects which are part of the commit graph already.
These circumstances shouldn't usually happen in repositories.
Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
The only change compared to v2 is that I've split up the `export
GIT_COMMIT_GRAPH_PARANOIA=true` line into two lines as suggested by
Junio.
Documentation/git.txt | 6 +++---
commit-graph.c | 2 +-
commit.c | 2 +-
t/t5318-commit-graph.sh | 8 ++++----
t/t6022-rev-list-missing.sh | 6 ++++++
t/t7700-repack.sh | 2 +-
6 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 2535a30194..6c19fd1d76 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -917,9 +917,9 @@ for full details.
avoid issues with stale commit-graphs that contain references to
already-deleted commits, but comes with a performance penalty.
+
-The default is "true", which enables the aforementioned behavior.
-Setting this to "false" disables the existence check. This can lead to
-a performance improvement at the cost of consistency.
+The default is "false", which disables the aforementioned behavior.
+Setting this to "true" enables the existence check so that stale commits
+will never be returned from the commit-graph at the cost of performance.
`GIT_ALLOW_PROTOCOL`::
If set to a colon-separated list of protocols, behave as if
diff --git a/commit-graph.c b/commit-graph.c
index acac9bf6e1..6fad9d195d 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1005,7 +1005,7 @@ struct commit *lookup_commit_in_graph(struct repository *repo, const struct obje
uint32_t pos;
if (commit_graph_paranoia == -1)
- commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1);
+ commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0);
if (!prepare_commit_graph(repo))
return NULL;
diff --git a/commit.c b/commit.c
index 8405d7c3fc..37956b836c 100644
--- a/commit.c
+++ b/commit.c
@@ -577,7 +577,7 @@ int repo_parse_commit_internal(struct repository *r,
static int commit_graph_paranoia = -1;
if (commit_graph_paranoia == -1)
- commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1);
+ commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0);
if (commit_graph_paranoia && !has_object(r, &item->object.oid, 0)) {
unparse_commit(r, &item->object.oid);
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 7fe7c72a87..a2b4442660 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -911,10 +911,10 @@ test_expect_success 'stale commit cannot be parsed when given directly' '
# Verify that it is possible to read the commit from the
# commit graph when not being paranoid, ...
- GIT_COMMIT_GRAPH_PARANOIA=false git rev-list B &&
+ git rev-list B &&
# ... but parsing the commit when double checking that
# it actually exists in the object database should fail.
- test_must_fail git rev-list -1 B
+ test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-list -1 B
)
'
@@ -938,9 +938,9 @@ test_expect_success 'stale commit cannot be parsed when traversing graph' '
# Again, we should be able to parse the commit when not
# being paranoid about commit graph staleness...
- GIT_COMMIT_GRAPH_PARANOIA=false git rev-parse HEAD~2 &&
+ git rev-parse HEAD~2 &&
# ... but fail when we are paranoid.
- test_must_fail git rev-parse HEAD~2 2>error &&
+ test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-parse HEAD~2 2>error &&
grep "error: commit $oid exists in commit-graph but not in the object database" error
)
'
diff --git a/t/t6022-rev-list-missing.sh b/t/t6022-rev-list-missing.sh
index 40265a4f66..211672759a 100755
--- a/t/t6022-rev-list-missing.sh
+++ b/t/t6022-rev-list-missing.sh
@@ -13,6 +13,12 @@ test_expect_success 'create repository and alternate directory' '
test_commit 3
'
+# We manually corrupt the repository, which means that the commit-graph may
+# contain references to already-deleted objects. We thus need to enable
+# commit-graph paranoia to not returned these deleted commits from the graph.
+GIT_COMMIT_GRAPH_PARANOIA=true
+export GIT_COMMIT_GRAPH_PARANOIA
+
for obj in "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
do
test_expect_success "rev-list --missing=error fails with missing object $obj" '
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index d2975e6c93..94f9f4a1da 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -271,7 +271,7 @@ test_expect_success 'repacking fails when missing .pack actually means missing o
ls .git/objects/pack/*.pack >before-pack-dir &&
test_must_fail git fsck &&
- test_must_fail git repack --cruft -d 2>err &&
+ test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git repack --cruft -d 2>err &&
grep "bad object" err &&
# Before failing, the repack did not modify the
--
2.43.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related
* Re: [PATCH v2] commit-graph: disable GIT_COMMIT_GRAPH_PARANOIA by default
From: Patrick Steinhardt @ 2023-11-24 11:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Taylor Blau, Jeff King
In-Reply-To: <xmqq7cm8bsny.fsf@gitster.g>
[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]
On Thu, Nov 23, 2023 at 08:44:33PM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > Note that this requires us to amend some tests to manually turn on the
> > paranoid checks again. This is because we cause repository corruption by
> > manually deleting objects which are part of the commit graph already.
> > These circumstances shouldn't usually happen in repositories.
> > ...
> > diff --git a/t/t6022-rev-list-missing.sh b/t/t6022-rev-list-missing.sh
> > index 40265a4f66..1ca4eb5a36 100755
> > --- a/t/t6022-rev-list-missing.sh
> > +++ b/t/t6022-rev-list-missing.sh
> > @@ -13,6 +13,11 @@ test_expect_success 'create repository and alternate directory' '
> > test_commit 3
> > '
> >
> > +# We manually corrupt the repository, which means that the commit-graph may
> > +# contain references to already-deleted objects. We thus need to enable
> > +# commit-graph paranoia to not returned these deleted commits from the graph.
> > +export GIT_COMMIT_GRAPH_PARANOIA=true
>
> test-lint-shell-syntax is a bit overly strict and complains against
> this line, so until it is loosened, I'd suggest to do
>
> GIT_COMMIT_GRAPH_PARANOIA=true
> export GIT_COMMIT_GRAPH_PARANOIA
>
> instead here.
Fair. I was pondering whether to do this when writing this line, but
remembering the recent discussion about it being in POSIX [1] I didn't.
Didn't know though we had a linting rule for this, so I'll send a v3 to
split up the statement.
Patrick
[1]: <87430c6c-91c0-4be1-b89d-bf442b3f018b@gmail.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH] object-name: reject too-deep recursive ancestor queries
From: Patrick Steinhardt @ 2023-11-24 10:11 UTC (permalink / raw)
To: Junio C Hamano
Cc: Taylor Blau, git, Jeff King,
Carlos Andrés Ramírez Cataño
In-Reply-To: <xmqqy1en7af2.fsf@gitster.g>
[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]
On Fri, Nov 24, 2023 at 06:44:33PM +0900, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > I have to wonder whether we should tighten restrictions even further:
> > instead of manually keeping track of how deep in the stack we are, we
> > limit the length of revisions to at most 1MB. I would claim that this
> > limit is sufficiently large to never be a problem in practice.
>
> Tempting.
>
> > Revisions
> > are limited to 4kB on most platforms anyway due to the maximum path
> > length.
>
> I do not quite get this part, though.
>
> When we get "HEAD~~~~~~~~~^2~~~~~~" from the user, do we somehow try
> to create a file or a directory with that name and fail due to
> ENAMETOOLONG?
Sorry, this was a typo on my part. I didn't mean "revision", I meant
"reference" here. References are limited to at most 4kB on most
platforms due to filesystem limitations, whereas revisions currently
have no limits in place.
Patrick
> There are ways like "git rev-list --stdin" to cause Git read input
> lines of arbitrary length, so I do not think the command line length
> limit does not come into the picture, either.
>
> But I do agree that the only useful use of such a revision string
> that is longer than 1MB would be to attack.
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Fix git-send-email.perl w.r.t. recent Getopt::Long update
From: H.Merijn Brand @ 2023-11-24 9:39 UTC (permalink / raw)
To: git
[-- Attachment #1.1: Type: text/plain, Size: 1976 bytes --]
Patch attached
From the Getopt::Long changes:
```
Changes in version 2.55
-----------------------
* Fix long standing bug that duplicate options were not detected when
the options differ in case while ignore_case is in effect.
This will now yield a warning and become a fatal error in a future
release.
```
Current version is 2.57
```
git-2.43.0 🐧 perl -Iperl git-send-email.perl --help
Duplicate specification "cc-cover|cc-cover!" for option "cc-cover"
Duplicate specification "no-cc-cover" for option "no-cc-cover"
Duplicate specification "to-cover|to-cover!" for option "to-cover"
Duplicate specification "no-annotate" for option "no-annotate"
Duplicate specification "no-format-patch" for option "no-format-patch"
Duplicate specification "no-signed-off-cc|no-signed-off-by-cc" for option "no-signed-off-cc"
Duplicate specification "no-signed-off-cc|no-signed-off-by-cc" for option "no-signed-off-by-cc"
Duplicate specification "no-validate" for option "no-validate"
Duplicate specification "no-chain-reply-to" for option "no-chain-reply-to"
```
`"option!" => \$value`
*automatically* supports both `--option` and `--no-option` and `--nooption`
See the docs for Getopt::Long:
```
The argument specification can be
! The option does not take an argument and may be negated by
prefixing it with "no" or "no-". E.g. "foo!" will allow "--foo" (a
value of 1 will be assigned) as well as "--nofoo" and "--no-foo" (a
value of 0 will be assigned). If the option has aliases, this
applies to the aliases as well.
Using negation on a single letter option when bundling is in effect
is pointless and will result in a warning.
```
--
H.Merijn Brand https://tux.nl Perl Monger http://amsterdam.pm.org/
using perl5.00307 .. 5.37 porting perl5 on HP-UX, AIX, and Linux
https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-perl-Getopt-Long-now-issues-warnings-for-duplicate-o.patch --]
[-- Type: text/x-patch, Size: 3927 bytes --]
From 206ace60f7045e309e506a1b9de775f4e9a43b46 Mon Sep 17 00:00:00 2001
From: "H.Merijn Brand - Tux" <linux@tux.freedom.nl>
Date: Fri, 24 Nov 2023 10:27:35 +0100
Subject: [PATCH] perl Getopt::Long now issues warnings for duplicate options
$ perl -Iperl git-send-email.perl.org --help
Duplicate specification "no-validate" for option "no-validate"
Duplicate specification "to-cover|to-cover!" for option "to-cover"
Duplicate specification "no-signed-off-cc|no-signed-off-by-cc" for option "no-signed-off-cc"
Duplicate specification "no-signed-off-cc|no-signed-off-by-cc" for option "no-signed-off-by-cc"
Duplicate specification "no-format-patch" for option "no-format-patch"
Duplicate specification "cc-cover|cc-cover!" for option "cc-cover"
Duplicate specification "no-annotate" for option "no-annotate"
Duplicate specification "no-chain-reply-to" for option "no-chain-reply-to"
Duplicate specification "no-cc-cover" for option "no-cc-cover"
"option!" => \$value
*automatically* supports both --option and --no-option and --nooption
The argument specification can be
! The option does not take an argument and may be negated by
prefixing it with "no" or "no-". E.g. "foo!" will allow "--foo" (a
value of 1 will be assigned) as well as "--nofoo" and "--no-foo" (a
value of 0 will be assigned). If the option has aliases, this
applies to the aliases as well.
Using negation on a single letter option when bundling is in effect
is pointless and will result in a warning.
Signed-off-by: H.Merijn Brand - Tux <linux@tux.freedom.nl>
---
git-send-email.perl | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index d24e981d61..125f49cd08 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -491,7 +491,6 @@ sub config_regexp {
"bcc=s" => \@getopt_bcc,
"no-bcc" => \$no_bcc,
"chain-reply-to!" => \$chain_reply_to,
- "no-chain-reply-to" => sub {$chain_reply_to = 0},
"sendmail-cmd=s" => \$sendmail_cmd,
"smtp-server=s" => \$smtp_server,
"smtp-server-option=s" => \@smtp_server_options,
@@ -506,36 +505,27 @@ sub config_regexp {
"smtp-auth=s" => \$smtp_auth,
"no-smtp-auth" => sub {$smtp_auth = 'none'},
"annotate!" => \$annotate,
- "no-annotate" => sub {$annotate = 0},
"compose" => \$compose,
"quiet" => \$quiet,
"cc-cmd=s" => \$cc_cmd,
"header-cmd=s" => \$header_cmd,
"no-header-cmd" => \$no_header_cmd,
"suppress-from!" => \$suppress_from,
- "no-suppress-from" => sub {$suppress_from = 0},
"suppress-cc=s" => \@suppress_cc,
"signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
- "no-signed-off-cc|no-signed-off-by-cc" => sub {$signed_off_by_cc = 0},
- "cc-cover|cc-cover!" => \$cover_cc,
- "no-cc-cover" => sub {$cover_cc = 0},
- "to-cover|to-cover!" => \$cover_to,
- "no-to-cover" => sub {$cover_to = 0},
+ "cc-cover!" => \$cover_cc,
+ "to-cover!" => \$cover_to,
"confirm=s" => \$confirm,
"dry-run" => \$dry_run,
"envelope-sender=s" => \$envelope_sender,
"thread!" => \$thread,
- "no-thread" => sub {$thread = 0},
"validate!" => \$validate,
- "no-validate" => sub {$validate = 0},
"transfer-encoding=s" => \$target_xfer_encoding,
"format-patch!" => \$format_patch,
- "no-format-patch" => sub {$format_patch = 0},
"8bit-encoding=s" => \$auto_8bit_encoding,
"compose-encoding=s" => \$compose_encoding,
"force" => \$force,
"xmailer!" => \$use_xmailer,
- "no-xmailer" => sub {$use_xmailer = 0},
"batch-size=i" => \$batch_size,
"relogin-delay=i" => \$relogin_delay,
"git-completion-helper" => \$git_completion_helper,
--
2.42.1
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related
* Re: [PATCH] object-name: reject too-deep recursive ancestor queries
From: Junio C Hamano @ 2023-11-24 9:44 UTC (permalink / raw)
To: Patrick Steinhardt
Cc: Taylor Blau, git, Jeff King,
Carlos Andrés Ramírez Cataño
In-Reply-To: <ZV9Za7iCL6WiE-Py@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
> I have to wonder whether we should tighten restrictions even further:
> instead of manually keeping track of how deep in the stack we are, we
> limit the length of revisions to at most 1MB. I would claim that this
> limit is sufficiently large to never be a problem in practice.
Tempting.
> Revisions
> are limited to 4kB on most platforms anyway due to the maximum path
> length.
I do not quite get this part, though.
When we get "HEAD~~~~~~~~~^2~~~~~~" from the user, do we somehow try
to create a file or a directory with that name and fail due to
ENAMETOOLONG?
There are ways like "git rev-list --stdin" to cause Git read input
lines of arbitrary length, so I do not think the command line length
limit does not come into the picture, either.
But I do agree that the only useful use of such a revision string
that is longer than 1MB would be to attack.
^ permalink raw reply
* Unable to split then edit hunk in git interactive add
From: scarf @ 2023-11-24 8:16 UTC (permalink / raw)
To: git
|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)
1. Initialized a new repo with `git init`.
1-1. Created first commit with a file `main.txt` with the following content:
```rs
pub fn format_text(
input_text: &str,
format_with_host: impl FnMut(&Path, String) -> Result<Option<String>>,
) -> Result<Option<String>> {
let parse_result = jsonc_parser::parse_to_ast(
input_text,
&CollectOptions {
comments: false,
tokens: false,
},
&ParseOptions {
allow_comments: true,
allow_loose_object_property_names: true,
allow_trailing_commas: true,
},
)?;
let Some(root_value) = parse_result.value else {
return Ok(None);
};
Ok(format_root(input_text, &root_value, format_with_host))
}
```
1-2. Edited the content of the file to:
```rs
pub fn format_text(
input_text: &str,
format_with_host: impl FnMut(&Path, String) -> Result<Option<String>>,
) -> Result<Option<String>> {
let parse_result = jsonc_parser::parse_to_ast(input_text,
&COLLECT_OPTIONS, &PARSE_OPTIONS)?;
let format_result = parse_result
.value
.and_then(|root_value| format_root(input_text, &root_value,
format_with_host));
Ok(format_result)
}
```
1-3. Running `git status` will show
```rs
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: main.txt
```
2. To reliably reproduce the error:
2-1. run `git add --patch`
2-2. (s)plit once
2-3. (e)dit first hunk. the content of `addp-hunk-edit.diff` is:
```diff
@@ -2,19 +2,5 @@ pub fn format_text(
input_text: &str,
format_with_host: impl FnMut(&Path, String) -> Result<Option<String>>,
) -> Result<Option<String>> {
- let parse_result = jsonc_parser::parse_to_ast(
- input_text,
- &CollectOptions {
- comments: false,
- tokens: false,
- },
- &ParseOptions {
- allow_comments: true,
- allow_loose_object_property_names: true,
- allow_trailing_commas: true,
- },
- )?;
- let Some(root_value) = parse_result.value else {
- return Ok(None);
- };
+ let parse_result = jsonc_parser::parse_to_ast(input_text,
&COLLECT_OPTIONS, &PARSE_OPTIONS)?;
```
2-4. undelete(remove '-') L18-L20, move L21 up so it goes right before
L18. the edited content of `addp-hunk-edit.diff` is:
```diff
@@ -2,19 +2,5 @@ pub fn format_text(
input_text: &str,
format_with_host: impl FnMut(&Path, String) -> Result<Option<String>>,
) -> Result<Option<String>> {
- let parse_result = jsonc_parser::parse_to_ast(
- input_text,
- &CollectOptions {
- comments: false,
- tokens: false,
- },
- &ParseOptions {
- allow_comments: true,
- allow_loose_object_property_names: true,
- allow_trailing_commas: true,
- },
- )?;
+ let parse_result = jsonc_parser::parse_to_ast(input_text,
&COLLECT_OPTIONS, &PARSE_OPTIONS)?;
let Some(root_value) = parse_result.value else {
return Ok(None);
};
```
2-5. it fails with `hunks do not overlap` error. full error message is:
```
error: hunks do not overlap:
input_text: &str,
format_with_host: impl FnMut(&Path, String) -> Result<Option<String>>,
) -> Result<Option<String>> {
- let parse_result = jsonc_parser::parse_to_ast(
- input_text,
- &CollectOptions {
- comments: false,
- tokens: false,
- },
- &ParseOptions {
- allow_comments: true,
- allow_loose_object_property_names: true,
- allow_trailing_commas: true,
- },
- )?;
+ let parse_result = jsonc_parser::parse_to_ast(input_text,
&COLLECT_OPTIONS, &PARSE_OPTIONS)?;
let Some(root_value) = parse_result.value else {
return Ok(None);
};
does not end with:
error: patch failed: main.txt:20
error: main.txt: patch does not apply
error: 'git apply --cached' failed
```
3. to side-step the error,
3-1. run `git add --patch`
3-2. follow 2-1 to 2-4 from above
3-3. it works without error
What did you expect to happen? (Expected behavior)
I expected editing splitted hunk to work without errors.
What happened instead? (Actual behavior)
Editing hunks will only work if the hunk is not splitted.
What's different between what you expected and what actually happened?
This behavior is inconsistent and undocumented in
https://git-scm.com/docs/git-add,
which lead me to believe this is a bug.
Anything else you want to add:
I apologize for the long wall of demo snippets.
I wasn't sure whether it's allowed to send repository as tarball or link
the formatted content.
This stackoverflow post shows the exact same error:
https://stackoverflow.com/q/62896307/13503626
its comment in https://stackoverflow.com/a/62897311/13503626 mentions
sending a bug report on mailing list,
however after searching through mailing list archive at
https://lore.kernel.org/git/?q=b%3A"split"+b%3A"edit"+b%3A"hunk"
I couldn't find any bug report related to this issue.
[System Info]
git version:
git version 2.40.1
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-10-generic #10-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 13
13:49:38 UTC 2023 x86_64
compiler info: gnuc: 12.3
libc info: glibc: 2.38
$SHELL (typically, interactive shell): /usr/bin/fish
[Enabled Hooks]
None.
|
^ permalink raw reply
* Re: [PATCH v2] credential/wincred: store oauth_refresh_token
From: M Hickford @ 2023-11-24 8:00 UTC (permalink / raw)
To: Junio C Hamano
Cc: Jeff King, M Hickford, M Hickford via GitGitGadget,
Matthew John Cheetham, Taylor Blau, git, patthoyts,
Jakub Bereżański
In-Reply-To: <xmqqbkbwzss5.fsf@gitster.g>
On Tue, 14 Nov 2023 at 07:41, Junio C Hamano <gitster@pobox.com> wrote:
>
> "M Hickford via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > 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.
>
> Earlier, a5c76569 (credential: new attribute oauth_refresh_token,
> 2023-04-21) built the "git" side support for the token, and taught
> credential-cache to store the necessary information. Then 0ce02e2f
> (credential/libsecret: store new attributes, 2023-06-16) was written
> for libsecret to support the same interface.
>
> And this one adds corresponding support for wincred. Do I
> understand what is going on around this patch correctly?
Yes, that's right.
>
> I do not do Windows, but some people on this list certainly do and
> would be capable of giving the patch a necessary nudge ;-)
>
> Thanks.
>
> > .../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
^ permalink raw reply
* Re: [PATCH] git-p4: fix fast import when empty commit is first
From: Alisha Kim @ 2023-11-24 6:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Alisha Kim via GitGitGadget, git, Alisha Kim
In-Reply-To: <xmqq1qchcjtq.fsf@gitster.g>
On Thu, Nov 23, 2023 at 10:57 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Alisha Kim via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: Alisha Kim <pril@pril.cc>
> >
> > When executing p4 sync by specifying an excluded path, an empty commit
> > will be created if there is only a change in the excluded path in
> > revision.
> > If git-p4.keepEmptyCommits is turned off and an empty commit is the
> > first, fast-import will fail.
>
> The above describe under what condition a failure gets triggered,
> but there is no description on what approach the proposed solution
> takes. You could teach "fast-import" to deal with an empty commit
> properly, you could ignore empty commits and not produce input for
> the fast-import command, you could probably turn these initial empty
> commits into non-empty commits by adding dummy contents, etc. We
> want to see in our proposed log messages what solution was taken and
> how the solution was designed to satisfy what requirements. This is
> to help future developers who will have to change the code that is
> given by this patch, so that their updates can still adhere to what
> ever design criteria you had in working on this change [*].
>
> Side note: Your solution might be to ignore empty commits
> despite keepEmptyCommits option is set (as I said, you did not
> describe it at all in the above, so this is a hypothetical
> example). If the reason behind choosing that design were "I
> just do not want it to fail---I do not care if the resulting
> history coming out of fast-import is crappy (I lose the p4 CL
> descriptions for these commits, even though the user wants to
> keep them)", then future developers can safely "fix" your fix
> here by turning the initial empty commits into non-empty ones by
> adding fake contents.
I've added explanations for the changes I suggested.
>
>
> > @@ -3876,10 +3878,12 @@ class P4Sync(Command, P4UserMap):
> > self.commit(description, filesForCommit, branch, parent)
> > else:
> > files = self.extractFilesFromCommit(description)
> > - self.commit(description, files, self.branch,
> > + isCommitted = self.commit(description, files, self.branch,
> > self.initialParent)
> > # only needed once, to connect to the previous commit
> > - self.initialParent = ""
> > + if isCommitted:
> > + self.initialParent = ""
>
> "is" does not sound grammatically correct. "didCommit" (i.e., "we
> made a commit"), "haveCommitted" (i.e., "we have made a commit")
> might be more understandable.
The problem with correct grammar that you mentioned has also been
changed. Thank you for your good comments.
>
>
> > except IOError:
> > print(self.gitError.read())
> > sys.exit(1)
> >
> > base-commit: cfb8a6e9a93adbe81efca66e6110c9b4d2e57169
^ permalink raw reply
* [PATCH v2] git-p4: fix fast import when empty commit is first
From: Alisha Kim via GitGitGadget @ 2023-11-24 6:14 UTC (permalink / raw)
To: git; +Cc: Alisha Kim, Alisha Kim
In-Reply-To: <pull.1609.git.git.1700639764041.gitgitgadget@gmail.com>
From: Alisha Kim <pril@pril.cc>
When executing p4 sync by specifying an excluded path, an empty commit
will be created if there is only a change in the excluded path in
revision.
If git-p4.keepEmptyCommits is turned off and an empty commit is the
first, fast-import will fail. Change the return type of the commit
function from void to bool and return whether a commit has been
created. This failure was prevented by modifying initialParent
to be initialized only when a commit was actually created.
Signed-off-by: Alisha Kim <pril@pril.cc>
---
git-p4: fix fast import when empty commit is first
When executing p4 sync by specifying an excluded path, an empty commit
will be created if there is only a change in the excluded path in
revision. If git-p4.keepEmptyCommits is turned off and an empty commit
is the first, fast-import will fail. Change the return type of the
commit function from void to bool and return whether a commit has been
created. This failure was prevented by modifying initialParent to be
initialized only when a commit was actually created.
The error log is as follows Ignoring revision 14035 as it would produce
an empty commit. fast-import failed: warning: Not updating
refs/heads/p4/master (new tip new commit hash does not contain parent
commit hash) fast-import statistics: ...
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1609%2Fdaebo01%2Fgit-p4-pr-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1609/daebo01/git-p4-pr-v2
Pull-Request: https://github.com/git/git/pull/1609
Range-diff vs v1:
1: f7c4fa18c4c ! 1: 1de9ac6dbf8 git-p4: fix fast import when empty commit is first
@@ Commit message
will be created if there is only a change in the excluded path in
revision.
If git-p4.keepEmptyCommits is turned off and an empty commit is the
- first, fast-import will fail.
+ first, fast-import will fail. Change the return type of the commit
+ function from void to bool and return whether a commit has been
+ created. This failure was prevented by modifying initialParent
+ to be initialized only when a commit was actually created.
Signed-off-by: Alisha Kim <pril@pril.cc>
@@ git-p4.py: class P4Sync(Command, P4UserMap):
else:
files = self.extractFilesFromCommit(description)
- self.commit(description, files, self.branch,
-+ isCommitted = self.commit(description, files, self.branch,
++ haveCommitted = self.commit(description, files, self.branch,
self.initialParent)
# only needed once, to connect to the previous commit
- self.initialParent = ""
-+ if isCommitted:
++ if haveCommitted:
+ self.initialParent = ""
+
except IOError:
git-p4.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index 0eb3bb4c47d..1e3c0e815f0 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -3466,7 +3466,7 @@ class P4Sync(Command, P4UserMap):
if not files and not allow_empty:
print('Ignoring revision {0} as it would produce an empty commit.'
.format(details['change']))
- return
+ return False
self.gitStream.write("commit %s\n" % branch)
self.gitStream.write("mark :%s\n" % details["change"])
@@ -3533,6 +3533,8 @@ class P4Sync(Command, P4UserMap):
print("Tag %s does not match with change %s: file count is different."
% (labelDetails["label"], change))
+ return True
+
def getLabels(self):
"""Build a dictionary of changelists and labels, for "detect-labels"
option.
@@ -3876,10 +3878,12 @@ class P4Sync(Command, P4UserMap):
self.commit(description, filesForCommit, branch, parent)
else:
files = self.extractFilesFromCommit(description)
- self.commit(description, files, self.branch,
+ haveCommitted = self.commit(description, files, self.branch,
self.initialParent)
# only needed once, to connect to the previous commit
- self.initialParent = ""
+ if haveCommitted:
+ self.initialParent = ""
+
except IOError:
print(self.gitError.read())
sys.exit(1)
base-commit: cfb8a6e9a93adbe81efca66e6110c9b4d2e57169
--
gitgitgadget
^ permalink raw reply related
* [PATCH v3 1/4] doc: update links to current pages
From: Josh Soref via GitGitGadget @ 2023-11-24 3:35 UTC (permalink / raw)
To: git; +Cc: Eric Sunshine, Josh Soref, Elijah Newren, Josh Soref, Josh Soref
In-Reply-To: <pull.1589.v3.git.1700796916.gitgitgadget@gmail.com>
From: Josh Soref <jsoref@gmail.com>
It's somewhat traditional to respect sites' self-identification.
Signed-off-by: Josh Soref <jsoref@gmail.com>
---
Documentation/CodingGuidelines | 2 +-
Documentation/RelNotes/1.6.2.txt | 2 +-
Documentation/RelNotes/1.6.3.txt | 2 +-
Documentation/RelNotes/1.6.4.txt | 2 +-
Documentation/RelNotes/1.6.5.txt | 2 +-
Documentation/RelNotes/1.6.6.txt | 2 +-
Documentation/git-cvsimport.txt | 2 +-
Documentation/git-format-patch.txt | 4 ++--
Documentation/git.txt | 2 +-
git-gui/git-gui.sh | 2 +-
gitk-git/gitk | 2 +-
gitweb/static/js/lib/common-lib.js | 2 +-
http.c | 2 +-
imap-send.c | 2 +-
json-writer.h | 2 +-
15 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 8d3a467c013..030a254b376 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -518,7 +518,7 @@ For Perl programs:
For Python scripts:
- - We follow PEP-8 (http://www.python.org/dev/peps/pep-0008/).
+ - We follow PEP-8 (https://peps.python.org/pep-0008/).
- As a minimum, we aim to be compatible with Python 2.7.
diff --git a/Documentation/RelNotes/1.6.2.txt b/Documentation/RelNotes/1.6.2.txt
index 980adfb3154..166d73c60fb 100644
--- a/Documentation/RelNotes/1.6.2.txt
+++ b/Documentation/RelNotes/1.6.2.txt
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
push running this release will issue a big warning when the
configuration variable is missing. Please refer to:
- http://git.or.cz/gitwiki/GitFaq#non-bare
+ https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
for more details on the reason why this change is needed and the
diff --git a/Documentation/RelNotes/1.6.3.txt b/Documentation/RelNotes/1.6.3.txt
index 4bcff945e01..bbf177fc3c5 100644
--- a/Documentation/RelNotes/1.6.3.txt
+++ b/Documentation/RelNotes/1.6.3.txt
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
push running this release will issue a big warning when the
configuration variable is missing. Please refer to:
- http://git.or.cz/gitwiki/GitFaq#non-bare
+ https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
for more details on the reason why this change is needed and the
diff --git a/Documentation/RelNotes/1.6.4.txt b/Documentation/RelNotes/1.6.4.txt
index a2a34b43a75..0fccfb0bf0b 100644
--- a/Documentation/RelNotes/1.6.4.txt
+++ b/Documentation/RelNotes/1.6.4.txt
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
push running this release will issue a big warning when the
configuration variable is missing. Please refer to:
- http://git.or.cz/gitwiki/GitFaq#non-bare
+ https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
for more details on the reason why this change is needed and the
diff --git a/Documentation/RelNotes/1.6.5.txt b/Documentation/RelNotes/1.6.5.txt
index 6c7f7da7eb9..79cb1b2b6df 100644
--- a/Documentation/RelNotes/1.6.5.txt
+++ b/Documentation/RelNotes/1.6.5.txt
@@ -21,7 +21,7 @@ To ease the transition plan, the receiving repository of such a
push running this release will issue a big warning when the
configuration variable is missing. Please refer to:
- http://git.or.cz/gitwiki/GitFaq#non-bare
+ https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
for more details on the reason why this change is needed and the
diff --git a/Documentation/RelNotes/1.6.6.txt b/Documentation/RelNotes/1.6.6.txt
index 3ed1e014337..88b86a827e8 100644
--- a/Documentation/RelNotes/1.6.6.txt
+++ b/Documentation/RelNotes/1.6.6.txt
@@ -63,7 +63,7 @@ users will fare this time.
Please refer to:
- http://git.or.cz/gitwiki/GitFaq#non-bare
+ https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
for more details on the reason why this change is needed and the
diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index b3f27671a0c..ac03d7686cb 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -22,7 +22,7 @@ DESCRIPTION
deprecated; it does not work with cvsps version 3 and later. If you are
performing a one-shot import of a CVS repository consider using
http://cvs2svn.tigris.org/cvs2git.html[cvs2git] or
-http://www.catb.org/esr/cvs-fast-export/[cvs-fast-export].
+https://gitlab.com/esr/cvs-fast-export[cvs-fast-export].
Imports a CVS repository into Git. It will either create a new
repository, or incrementally import into an existing one.
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index aaafce24be2..414da6b73e7 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -610,8 +610,8 @@ Approach #3 (external editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The following Thunderbird extensions are needed:
-AboutConfig from http://aboutconfig.mozdev.org/ and
-External Editor from http://globs.org/articles.php?lng=en&pg=8
+AboutConfig from https://mjg.github.io/AboutConfig/ and
+External Editor from https://globs.org/articles.php?lng=en&pg=8
1. Prepare the patch as a text file using your method of choice.
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 2535a30194f..cf3468b3e99 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -1071,7 +1071,7 @@ Authors
-------
Git was started by Linus Torvalds, and is currently maintained by Junio
C Hamano. Numerous contributions have come from the Git mailing list
-<git@vger.kernel.org>. http://www.openhub.net/p/git/contributors/summary
+<git@vger.kernel.org>. https://openhub.net/p/git/contributors/summary
gives you a more complete list of contributors.
If you have a clone of git.git itself, the
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 3e5907a4609..2cbeaa483bb 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -2367,7 +2367,7 @@ proc do_quit {{rc {1}}} {
set ret_code $rc
# Briefly enable send again, working around Tk bug
- # http://sourceforge.net/tracker/?func=detail&atid=112997&aid=1821174&group_id=12997
+ # https://sourceforge.net/p/tktoolkit/bugs/2343/
tk appname [appname]
destroy .
diff --git a/gitk-git/gitk b/gitk-git/gitk
index df3ba2ea99b..dd80ab8f3ba 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -12472,7 +12472,7 @@ if {[tk windowingsystem] eq "aqua"} {
catch {
# follow the XDG base directory specification by default. See
- # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+ # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
if {[info exists env(XDG_CONFIG_HOME)] && $env(XDG_CONFIG_HOME) ne ""} {
# XDG_CONFIG_HOME environment variable is set
set config_file [file join $env(XDG_CONFIG_HOME) git gitk]
diff --git a/gitweb/static/js/lib/common-lib.js b/gitweb/static/js/lib/common-lib.js
index 018bbb7d4cb..0fdbc25728d 100644
--- a/gitweb/static/js/lib/common-lib.js
+++ b/gitweb/static/js/lib/common-lib.js
@@ -137,7 +137,7 @@ function addCssRule(selector, style) {
* http://www.dustindiaz.com/getelementsbyclass/
* http://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
*
- * See also http://ejohn.org/blog/getelementsbyclassname-speed-comparison/
+ * See also https://johnresig.com/blog/getelementsbyclassname-speed-comparison/
*
* @param {String} class: name of _single_ class to find
* @param {String} [taghint] limit search to given tags
diff --git a/http.c b/http.c
index 8f71bf00d89..8e5c4c91ea7 100644
--- a/http.c
+++ b/http.c
@@ -1902,7 +1902,7 @@ static void write_accept_language(struct strbuf *buf)
* MAX_DECIMAL_PLACES must not be larger than 3. If it is larger than
* that, q-value will be smaller than 0.001, the minimum q-value the
* HTTP specification allows. See
- * http://tools.ietf.org/html/rfc7231#section-5.3.1 for q-value.
+ * https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.1 for q-value.
*/
const int MAX_DECIMAL_PLACES = 3;
const int MAX_LANGUAGE_TAGS = 1000;
diff --git a/imap-send.c b/imap-send.c
index 996651e4f80..3d6fdf64868 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -860,7 +860,7 @@ static void imap_close_store(struct imap_store *ctx)
/*
* hexchar() and cram() functions are based on the code from the isync
- * project (http://isync.sf.net/).
+ * project (https://isync.sourceforge.io/).
*/
static char hexchar(unsigned int b)
{
diff --git a/json-writer.h b/json-writer.h
index 209355e0f12..75f4f99ab00 100644
--- a/json-writer.h
+++ b/json-writer.h
@@ -4,7 +4,7 @@
/*
* JSON data structures are defined at:
* [1] http://www.ietf.org/rfc/rfc7159.txt
- * [2] http://json.org/
+ * [2] https://www.json.org/
*
* The JSON-writer API allows one to build JSON data structures using a
* simple wrapper around a "struct strbuf" buffer. It is intended as a
--
gitgitgadget
^ permalink raw reply related
* [PATCH v3 4/4] doc: refer to internet archive
From: Josh Soref via GitGitGadget @ 2023-11-24 3:35 UTC (permalink / raw)
To: git; +Cc: Eric Sunshine, Josh Soref, Elijah Newren, Josh Soref, Josh Soref
In-Reply-To: <pull.1589.v3.git.1700796916.gitgitgadget@gmail.com>
From: Josh Soref <jsoref@gmail.com>
These pages are no longer reachable from their original locations,
which makes things difficult for readers. Instead, switch to linking to
the Internet Archive for the content.
Signed-off-by: Josh Soref <jsoref@gmail.com>
---
gitweb/gitweb.perl | 2 +-
sha1dc/sha1.c | 2 +-
t/lib-gpg.sh | 2 +-
t/t9816-git-p4-locked.sh | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b6659410ef1..6f139b8fc32 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -8193,7 +8193,7 @@ sub git_feed {
my $have_blame = gitweb_check_feature('blame');
# Atom: http://www.atomenabled.org/developers/syndication/
- # RSS: http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
+ # RSS: https://web.archive.org/web/20030729001534/http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
if ($format ne 'rss' && $format ne 'atom') {
die_error(400, "Unknown web feed format");
}
diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
index dede2cbddf9..f993ef9c690 100644
--- a/sha1dc/sha1.c
+++ b/sha1dc/sha1.c
@@ -88,7 +88,7 @@
/*
* Should define Big Endian for a whitelist of known processors. See
* https://sourceforge.net/p/predef/wiki/Endianness/ and
- * http://www.oracle.com/technetwork/server-storage/solaris/portingtosolaris-138514.html
+ * https://web.archive.org/web/20140421151132/http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html
*/
#define SHA1DC_BIGENDIAN
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index 83b83c9abb5..add11e88fc0 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -13,7 +13,7 @@ test_lazy_prereq GPG '
gpg_version=$(gpg --version 2>&1)
test $? != 127 || exit 1
- # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
+ # As said here: https://web.archive.org/web/20130212022238/https://www.gnupg.org/faq/gnupg-faq.html#why-does-gnupg-1.0.6-bail-out-on-keyrings-used-with-1.0.7
# the gpg version 1.0.6 did not parse trust packets correctly, so for
# that version, creation of signed tags using the generated key fails.
case "$gpg_version" in
diff --git a/t/t9816-git-p4-locked.sh b/t/t9816-git-p4-locked.sh
index 932841003cf..5e904ac80d8 100755
--- a/t/t9816-git-p4-locked.sh
+++ b/t/t9816-git-p4-locked.sh
@@ -9,7 +9,7 @@ test_expect_success 'start p4d' '
'
# See
-# http://www.perforce.com/perforce/doc.current/manuals/p4sag/03_superuser.html#1088563
+# https://web.archive.org/web/20150602090517/http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html#superuser.basic.typemap_locking
# for suggestions on how to configure "sitewide pessimistic locking"
# where only one person can have a file open for edit at a time.
test_expect_success 'init depot' '
--
gitgitgadget
^ permalink raw reply related
* [PATCH v3 2/4] doc: switch links to https
From: Josh Soref via GitGitGadget @ 2023-11-24 3:35 UTC (permalink / raw)
To: git; +Cc: Eric Sunshine, Josh Soref, Elijah Newren, Josh Soref, Josh Soref
In-Reply-To: <pull.1589.v3.git.1700796916.gitgitgadget@gmail.com>
From: Josh Soref <jsoref@gmail.com>
These sites offer https versions of their content.
Using the https versions provides some protection for users.
Signed-off-by: Josh Soref <jsoref@gmail.com>
---
Documentation/MyFirstContribution.txt | 2 +-
Documentation/git-cvsimport.txt | 2 +-
Documentation/git-imap-send.txt | 2 +-
Documentation/git-send-email.txt | 2 +-
Documentation/gitcore-tutorial.txt | 2 +-
Documentation/gitprotocol-http.txt | 4 ++--
Documentation/gitweb.conf.txt | 2 +-
Documentation/gitweb.txt | 2 +-
Documentation/howto/keep-canonical-history-correct.txt | 2 +-
Documentation/signoff-option.txt | 2 +-
INSTALL | 2 +-
Makefile | 4 ++--
README.md | 2 +-
git-cvsimport.perl | 2 +-
git-gui/git-gui.sh | 4 ++--
git-gui/lib/encoding.tcl | 2 +-
git-gui/po/README | 2 +-
git-instaweb.sh | 4 ++--
gitk-git/gitk | 2 +-
gitweb/gitweb.perl | 4 ++--
gitweb/static/js/lib/common-lib.js | 8 ++++----
graph.h | 4 ++--
imap-send.c | 2 +-
json-writer.h | 2 +-
kwset.c | 2 +-
kwset.h | 2 +-
list.h | 2 +-
perl/FromCPAN/Error.pm | 2 +-
perl/Git/SVN.pm | 2 +-
protocol.h | 2 +-
sh-i18n--envsubst.c | 4 ++--
t/README | 4 ++--
t/helper/test-regex.c | 2 +-
t/perf/perf-lib.sh | 2 +-
t/t9114-git-svn-dcommit-merge.sh | 2 +-
t/t9801-git-p4-branch.sh | 2 +-
t/test-lib-functions.sh | 2 +-
t/test-lib-github-workflow-markup.sh | 2 +-
t/test-lib-junit.sh | 2 +-
t/test-lib.sh | 2 +-
trace.c | 2 +-
utf8.c | 2 +-
utf8.h | 6 +++---
43 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
index 7cfed60c2e9..279f6a3e7ca 100644
--- a/Documentation/MyFirstContribution.txt
+++ b/Documentation/MyFirstContribution.txt
@@ -833,7 +833,7 @@ Johannes Schindelin to make life as a Git contributor easier for those used to
the GitHub PR workflow. It allows contributors to open pull requests against its
mirror of the Git project, and does some magic to turn the PR into a set of
emails and send them out for you. It also runs the Git continuous integration
-suite for you. It's documented at http://gitgitgadget.github.io.
+suite for you. It's documented at https://gitgitgadget.github.io/.
[[create-fork]]
=== Forking `git/git` on GitHub
diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index ac03d7686cb..90fdc2551a3 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -221,7 +221,7 @@ Problems related to tags:
If you suspect that any of these issues may apply to the repository you
want to import, consider using cvs2git:
-* cvs2git (part of cvs2svn), `http://subversion.apache.org/`
+* cvs2git (part of cvs2svn), `https://subversion.apache.org/`
GIT
---
diff --git a/Documentation/git-imap-send.txt b/Documentation/git-imap-send.txt
index f7b18515141..c8a89d7243b 100644
--- a/Documentation/git-imap-send.txt
+++ b/Documentation/git-imap-send.txt
@@ -135,7 +135,7 @@ flames ridiculing you if you don't check this.
Thunderbird in particular is known to be problematic. Thunderbird
users may wish to visit this web page for more information:
- http://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
+ https://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
SEE ALSO
--------
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 465011bad50..30deb7fe2a4 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -454,7 +454,7 @@ have been specified, in which case default to 'compose'.
998 characters unless a suitable transfer encoding
('auto', 'base64', or 'quoted-printable') is used;
this is due to SMTP limits as described by
- http://www.ietf.org/rfc/rfc5322.txt.
+ https://www.ietf.org/rfc/rfc5322.txt.
--
+
Default is the value of `sendemail.validate`; if this is not set,
diff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt
index c0b95256cc8..2122aeb9769 100644
--- a/Documentation/gitcore-tutorial.txt
+++ b/Documentation/gitcore-tutorial.txt
@@ -1089,7 +1089,7 @@ the remote repository URL in the local repository's config file
like this:
------------------------------------------------
-$ git config remote.linus.url http://www.kernel.org/pub/scm/git/git.git/
+$ git config remote.linus.url https://git.kernel.org/pub/scm/git/git.git/
------------------------------------------------
and use the "linus" keyword with 'git pull' instead of the full URL.
diff --git a/Documentation/gitprotocol-http.txt b/Documentation/gitprotocol-http.txt
index 21b73b7a1f5..836b3490ccd 100644
--- a/Documentation/gitprotocol-http.txt
+++ b/Documentation/gitprotocol-http.txt
@@ -529,8 +529,8 @@ TODO: Document this further.
REFERENCES
----------
-http://www.ietf.org/rfc/rfc1738.txt[RFC 1738: Uniform Resource Locators (URL)]
-http://www.ietf.org/rfc/rfc2616.txt[RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1]
+https://www.ietf.org/rfc/rfc1738.txt[RFC 1738: Uniform Resource Locators (URL)]
+https://www.ietf.org/rfc/rfc2616.txt[RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1]
SEE ALSO
--------
diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index b078fef6f5c..20df3f0e253 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -820,7 +820,7 @@ filesystem (i.e. "$projectroot/$project"), `%h` to the current hash
(\'h' gitweb parameter) and `%b` to the current hash base
(\'hb' gitweb parameter); `%%` expands to \'%'.
+
-For example, at the time this page was written, the http://repo.or.cz[]
+For example, at the time this page was written, the https://repo.or.cz[]
Git hosting site set it to the following to enable graphical log
(using the third party tool *git-browser*):
+
diff --git a/Documentation/gitweb.txt b/Documentation/gitweb.txt
index 1030e9667ea..ddd4a0fc705 100644
--- a/Documentation/gitweb.txt
+++ b/Documentation/gitweb.txt
@@ -28,7 +28,7 @@ Gitweb provides a web interface to Git repositories. Its features include:
revisions one at a time, viewing the history of the repository.
* Finding commits whose commit messages match a given search term.
-See http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
+See https://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
browsed using gitweb itself.
diff --git a/Documentation/howto/keep-canonical-history-correct.txt b/Documentation/howto/keep-canonical-history-correct.txt
index 35d48ef714e..5f800fd85a3 100644
--- a/Documentation/howto/keep-canonical-history-correct.txt
+++ b/Documentation/howto/keep-canonical-history-correct.txt
@@ -213,4 +213,4 @@ The procedure will result in a history that looks like this:
B0--B1---------B2
------------
-See also http://git-blame.blogspot.com/2013/09/fun-with-first-parent-history.html
+See also https://git-blame.blogspot.com/2013/09/fun-with-first-parent-history.html
diff --git a/Documentation/signoff-option.txt b/Documentation/signoff-option.txt
index 12aa2333e46..d98758f3cb7 100644
--- a/Documentation/signoff-option.txt
+++ b/Documentation/signoff-option.txt
@@ -9,7 +9,7 @@ endif::git-commit[]
the committer has the rights to submit the work under the
project's license or agrees to some contributor representation,
such as a Developer Certificate of Origin.
- (See http://developercertificate.org for the one used by the
+ (See https://developercertificate.org for the one used by the
Linux kernel and Git projects.) Consult the documentation or
leadership of the project to which you're contributing to
understand how the signoffs are used in that project.
diff --git a/INSTALL b/INSTALL
index 4b422888828..020eba62afb 100644
--- a/INSTALL
+++ b/INSTALL
@@ -124,7 +124,7 @@ Issues of note:
interacting with svn repositories with "git svn"). If you can
live without these, use NO_PERL. Note that recent releases of
Redhat/Fedora are reported to ship Perl binary package with some
- core modules stripped away (see http://lwn.net/Articles/477234/),
+ core modules stripped away (see https://lwn.net/Articles/477234/),
so you might need to install additional packages other than Perl
itself, e.g. Digest::MD5, File::Spec, File::Temp, Net::Domain,
Net::SMTP, and Time::HiRes.
diff --git a/Makefile b/Makefile
index 03adcb5a480..1618ee27d28 100644
--- a/Makefile
+++ b/Makefile
@@ -186,7 +186,7 @@ include shared.mak
# Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
#
# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
-# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
+# as the compiler can crash (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
#
# Define USE_NSEC below if you want git to care about sub-second file mtimes
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
@@ -2723,7 +2723,7 @@ $(OBJECTS): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
ifdef USE_COMPUTED_HEADER_DEPENDENCIES
# Take advantage of gcc's on-the-fly dependency generation
-# See <http://gcc.gnu.org/gcc-3.0/features.html>.
+# See <https://gcc.gnu.org/gcc-3.0/features.html>.
dep_files_present := $(wildcard $(dep_files))
ifneq ($(dep_files_present),)
include $(dep_files_present)
diff --git a/README.md b/README.md
index 7ce4f05bae8..2c3de2f9c80 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ string translations (localization l10) should see [po/README.md][]
To subscribe to the list, send an email with just "subscribe git" in
the body to majordomo@vger.kernel.org (not the Git list). The mailing
list archives are available at <https://lore.kernel.org/git/>,
-<http://marc.info/?l=git> and other archival sites.
+<https://marc.info/?l=git> and other archival sites.
Issues which are security relevant should be disclosed privately to
the Git Security mailing list <git-security@googlegroups.com>.
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 7bf3c12d678..da77a1bf157 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -329,7 +329,7 @@ sub conn {
# Use a HTTP Proxy. Only works for HTTP proxies that
# don't require user authentication
#
- # See: http://www.ietf.org/rfc/rfc2817.txt
+ # See: https://www.ietf.org/rfc/rfc2817.txt
$s = IO::Socket::INET->new(PeerHost => $proxyhost, PeerPort => $proxyport);
die "Socket to $proxyhost: $!\n" unless defined $s;
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 2cbeaa483bb..507fb2b6826 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -24,7 +24,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with this program; if not, see <http://www.gnu.org/licenses/>.}]
+along with this program; if not, see <https://www.gnu.org/licenses/>.}]
######################################################################
##
@@ -3052,7 +3052,7 @@ if {$doc_path ne {}} {
if {[file isfile $doc_path]} {
set doc_url "file:$doc_path"
} else {
- set doc_url {http://www.kernel.org/pub/software/scm/git/docs/}
+ set doc_url {https://www.kernel.org/pub/software/scm/git/docs/}
}
proc start_browser {url} {
diff --git a/git-gui/lib/encoding.tcl b/git-gui/lib/encoding.tcl
index 32668fc9c6d..d2e0fa60c3b 100644
--- a/git-gui/lib/encoding.tcl
+++ b/git-gui/lib/encoding.tcl
@@ -3,7 +3,7 @@
# (Copied from gitk, commit fd8ccbec4f0161)
# This list of encoding names and aliases is distilled from
-# http://www.iana.org/assignments/character-sets.
+# https://www.iana.org/assignments/character-sets.
# Not all of them are supported by Tcl.
set encoding_aliases {
{ ANSI_X3.4-1968 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII
diff --git a/git-gui/po/README b/git-gui/po/README
index 2514bc22abf..116233100d7 100644
--- a/git-gui/po/README
+++ b/git-gui/po/README
@@ -39,7 +39,7 @@ in your language?
If you do not know what your language should be named, you need to find
it. This currently follows ISO 639-1 two letter codes:
- http://www.loc.gov/standards/iso639-2/php/code_list.php
+ https://www.loc.gov/standards/iso639-2/php/code_list.php
For example, if you are preparing a translation for Afrikaans, the
language code is "af". If there already is a translation for your
diff --git a/git-instaweb.sh b/git-instaweb.sh
index c68f49454cd..994431c8872 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -432,7 +432,7 @@ mongoose_conf() {
# Mongoose web server configuration file.
# Lines starting with '#' and empty lines are ignored.
# For detailed description of every option, visit
-# http://code.google.com/p/mongoose/wiki/MongooseManual
+# https://code.google.com/p/mongoose/wiki/MongooseManual
root $root
ports $port
@@ -458,7 +458,7 @@ plackup_conf () {
#!$PERL
# gitweb - simple web interface to track changes in git repositories
-# PSGI wrapper and server starter (see http://plackperl.org)
+# PSGI wrapper and server starter (see https://plackperl.org)
use strict;
diff --git a/gitk-git/gitk b/gitk-git/gitk
index dd80ab8f3ba..7a087f123d7 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -11956,7 +11956,7 @@ proc formatdate {d} {
}
# This list of encoding names and aliases is distilled from
-# http://www.iana.org/assignments/character-sets.
+# https://www.iana.org/assignments/character-sets.
# Not all of them are supported by Tcl.
set encoding_aliases {
{ ANSI_X3.4-1968 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e66eb3d9bad..d23468690ed 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -122,9 +122,9 @@ our $favicon = "++GITWEB_FAVICON++";
our $javascript = "++GITWEB_JS++";
# URI and label (title) of GIT logo link
-#our $logo_url = "http://www.kernel.org/pub/software/scm/git/docs/";
+#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
#our $logo_label = "git documentation";
-our $logo_url = "http://git-scm.com/";
+our $logo_url = "https://git-scm.com/";
our $logo_label = "git homepage";
# source of projects list
diff --git a/gitweb/static/js/lib/common-lib.js b/gitweb/static/js/lib/common-lib.js
index 0fdbc25728d..99e3eb8c3d9 100644
--- a/gitweb/static/js/lib/common-lib.js
+++ b/gitweb/static/js/lib/common-lib.js
@@ -123,8 +123,8 @@ function addCssRule(selector, style) {
* NOTE that there are limits and differences compared to native
* getElementsByClassName as defined by e.g.:
* https://developer.mozilla.org/en/DOM/document.getElementsByClassName
- * http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-getelementsbyclassname
- * http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-getelementsbyclassname
+ * https://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-getelementsbyclassname
+ * https://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-getelementsbyclassname
*
* Namely, this implementation supports only single class name as
* argument and not set of space-separated tokens representing classes,
@@ -133,9 +133,9 @@ function addCssRule(selector, style) {
* (via getElementsByTagName).
*
* Based on
- * http://code.google.com/p/getelementsbyclassname/
+ * https://code.google.com/p/getelementsbyclassname/
* http://www.dustindiaz.com/getelementsbyclass/
- * http://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
+ * https://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
*
* See also https://johnresig.com/blog/getelementsbyclassname-speed-comparison/
*
diff --git a/graph.h b/graph.h
index e88632a0140..3fd1dcb2e94 100644
--- a/graph.h
+++ b/graph.h
@@ -130,7 +130,7 @@ void graph_setup_line_prefix(struct diff_options *diffopt);
* This functions must be called BEFORE graph_init() is called.
*
* NOTE: This function isn't used in Git outside graph.c but it is used
- * by CGit (http://git.zx2c4.com/cgit/) to use HTML for colors.
+ * by CGit (https://git.zx2c4.com/cgit/) to use HTML for colors.
*/
void graph_set_column_colors(const char **colors, unsigned short colors_max);
@@ -196,7 +196,7 @@ int graph_is_commit_finished(struct git_graph const *graph);
* graph_update() is called.
*
* NOTE: This function isn't used in Git outside graph.c but it is used
- * by CGit (http://git.zx2c4.com/cgit/) to wrap HTML around graph lines.
+ * by CGit (https://git.zx2c4.com/cgit/) to wrap HTML around graph lines.
*/
int graph_next_line(struct git_graph *graph, struct strbuf *sb);
diff --git a/imap-send.c b/imap-send.c
index 3d6fdf64868..448ca64c052 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#include "git-compat-util.h"
diff --git a/json-writer.h b/json-writer.h
index 75f4f99ab00..04413bd1afd 100644
--- a/json-writer.h
+++ b/json-writer.h
@@ -3,7 +3,7 @@
/*
* JSON data structures are defined at:
- * [1] http://www.ietf.org/rfc/rfc7159.txt
+ * [1] https://www.ietf.org/rfc/rfc7159.txt
* [2] https://www.json.org/
*
* The JSON-writer API allows one to build JSON data structures using a
diff --git a/kwset.c b/kwset.c
index bbfcf815a56..695e47b7ccf 100644
--- a/kwset.c
+++ b/kwset.c
@@ -18,7 +18,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
/* Written August 1989 by Mike Haertel.
The author may be reached (Email) at the address mike@ai.mit.edu,
diff --git a/kwset.h b/kwset.h
index d42a793a301..c722664e5a7 100644
--- a/kwset.h
+++ b/kwset.h
@@ -20,7 +20,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
/* Written August 1989 by Mike Haertel.
The author may be reached (Email) at the address mike@ai.mit.edu,
diff --git a/list.h b/list.h
index 362a4cd7f5f..98428010f4d 100644
--- a/list.h
+++ b/list.h
@@ -19,7 +19,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see
- * <http://www.gnu.org/licenses/>.
+ * <https://www.gnu.org/licenses/>.
*/
#ifndef LIST_H
diff --git a/perl/FromCPAN/Error.pm b/perl/FromCPAN/Error.pm
index d82b71325c6..5b97e0315d6 100644
--- a/perl/FromCPAN/Error.pm
+++ b/perl/FromCPAN/Error.pm
@@ -1025,7 +1025,7 @@ C<:warndie> handlers added by Paul Evans <leonerd@leonerd.org.uk>
=head1 MAINTAINER
-Shlomi Fish, L<http://www.shlomifish.org/> .
+Shlomi Fish, L<https://www.shlomifish.org/> .
=head1 PAST MAINTAINERS
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index 6ce2e283c8d..7721708ce5d 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -1752,7 +1752,7 @@ sub tie_for_persistent_memoization {
END {
# Force cache writeout explicitly instead of waiting for
# global destruction to avoid segfault in Storable:
- # http://rt.cpan.org/Public/Bug/Display.html?id=36087
+ # https://rt.cpan.org/Public/Bug/Display.html?id=36087
unmemoize_svn_mergeinfo_functions();
}
diff --git a/protocol.h b/protocol.h
index de66bf80f84..1e574bbd80b 100644
--- a/protocol.h
+++ b/protocol.h
@@ -18,7 +18,7 @@
* with Linus Torvalds <torvalds@osdl.org> as the point of
* contact. September 2005.
*
- * See http://www.iana.org/assignments/port-numbers
+ * See https://www.iana.org/assignments/port-numbers
*/
#define DEFAULT_GIT_PORT 9418
diff --git a/sh-i18n--envsubst.c b/sh-i18n--envsubst.c
index 133496bd4d9..f69fd166105 100644
--- a/sh-i18n--envsubst.c
+++ b/sh-i18n--envsubst.c
@@ -31,7 +31,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
/* closeout.c - close standard output and standard error
Copyright (C) 1998-2007 Free Software Foundation, Inc.
@@ -47,7 +47,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stdio.h>
diff --git a/t/README b/t/README
index a0ebe294848..36463d07425 100644
--- a/t/README
+++ b/t/README
@@ -32,7 +32,7 @@ the tests.
ok 2 - plain with GIT_WORK_TREE
ok 3 - plain bare
-Since the tests all output TAP (see http://testanything.org) they can
+Since the tests all output TAP (see https://testanything.org) they can
be run with any TAP harness. Here's an example of parallel testing
powered by a recent version of prove(1):
@@ -1278,7 +1278,7 @@ Devel::Cover module. To install it do:
sudo aptitude install libdevel-cover-perl
# From the CPAN with cpanminus
- curl -L http://cpanmin.us | perl - --sudo --self-upgrade
+ curl -L https://cpanmin.us/ | perl - --sudo --self-upgrade
cpanm --sudo Devel::Cover
Then, at the top-level:
diff --git a/t/helper/test-regex.c b/t/helper/test-regex.c
index bd871a735b4..80042eafc20 100644
--- a/t/helper/test-regex.c
+++ b/t/helper/test-regex.c
@@ -30,7 +30,7 @@ static int test_regex_bug(void)
if (regexec(&r, str, 1, m, 0))
die("no match of pattern '%s' to string '%s'", pat, str);
- /* http://sourceware.org/bugzilla/show_bug.cgi?id=3957 */
+ /* https://sourceware.org/bugzilla/show_bug.cgi?id=3957 */
if (m[0].rm_so == 3) /* matches '\n' when it should not */
die("regex bug confirmed: re-build git with NO_REGEX=1");
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index e7786775a90..def22e70aed 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -15,7 +15,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see http://www.gnu.org/licenses/ .
+# along with this program. If not, see https://www.gnu.org/licenses/ .
# These variables must be set before the inclusion of test-lib.sh below,
# because it will change our working directory.
diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh
index 32317d6bca5..e06538b1c85 100755
--- a/t/t9114-git-svn-dcommit-merge.sh
+++ b/t/t9114-git-svn-dcommit-merge.sh
@@ -27,7 +27,7 @@ cat << EOF
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
EOF
}
diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
index 73cca0d143d..c598011635a 100755
--- a/t/t9801-git-p4-branch.sh
+++ b/t/t9801-git-p4-branch.sh
@@ -466,7 +466,7 @@ test_expect_success 'git p4 clone complex branches with excluded files' '
)
'
-# From a report in http://stackoverflow.com/questions/11893688
+# From a report in https://stackoverflow.com/questions/11893688
# where --use-client-spec caused branch prefixes not to be removed;
# every file in git appeared into a subdirectory of the branch name.
test_expect_success 'use-client-spec detect-branches setup' '
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 9c3cf12b268..03292602fb0 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -14,7 +14,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see http://www.gnu.org/licenses/ .
+# along with this program. If not, see https://www.gnu.org/licenses/ .
# The semantics of the editor variables are that of invoking
# sh -c "$EDITOR \"$@\"" files ...
diff --git a/t/test-lib-github-workflow-markup.sh b/t/test-lib-github-workflow-markup.sh
index 9c5339c577a..970c6538cba 100644
--- a/t/test-lib-github-workflow-markup.sh
+++ b/t/test-lib-github-workflow-markup.sh
@@ -14,7 +14,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see http://www.gnu.org/licenses/ .
+# along with this program. If not, see https://www.gnu.org/licenses/ .
#
# The idea is for `test-lib.sh` to source this file when run in GitHub
# workflows; these functions will then override (empty) functions
diff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh
index 79c31c788b9..76cbbd3299d 100644
--- a/t/test-lib-junit.sh
+++ b/t/test-lib-junit.sh
@@ -15,7 +15,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see http://www.gnu.org/licenses/ .
+# along with this program. If not, see https://www.gnu.org/licenses/ .
#
# The idea is for `test-lib.sh` to source this file when the user asks
# for JUnit XML; these functions will then override (empty) functions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 1656c9eed00..876b99562a3 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -13,7 +13,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see http://www.gnu.org/licenses/ .
+# along with this program. If not, see https://www.gnu.org/licenses/ .
# Test the binaries we have just built. The tests are kept in
# t/ subdirectory and are run in 'trash directory' subdirectory.
diff --git a/trace.c b/trace.c
index 971a68abe84..8669ddfca25 100644
--- a/trace.c
+++ b/trace.c
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#include "git-compat-util.h"
diff --git a/utf8.c b/utf8.c
index 6a0dd25b0fe..6bfaefa28eb 100644
--- a/utf8.c
+++ b/utf8.c
@@ -2,7 +2,7 @@
#include "strbuf.h"
#include "utf8.h"
-/* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */
+/* This code is originally from https://www.cl.cam.ac.uk/~mgk25/ucs/ */
static const char utf16_be_bom[] = {'\xFE', '\xFF'};
static const char utf16_le_bom[] = {'\xFF', '\xFE'};
diff --git a/utf8.h b/utf8.h
index b68efef6f43..35df76086a6 100644
--- a/utf8.h
+++ b/utf8.h
@@ -83,7 +83,7 @@ void strbuf_utf8_align(struct strbuf *buf, align_type position, unsigned int wid
* BOM must not be used [1]. The same applies for the UTF-32 equivalents.
* The function returns true if this rule is violated.
*
- * [1] http://unicode.org/faq/utf_bom.html#bom10
+ * [1] https://unicode.org/faq/utf_bom.html#bom10
*/
int has_prohibited_utf_bom(const char *enc, const char *data, size_t len);
@@ -99,8 +99,8 @@ int has_prohibited_utf_bom(const char *enc, const char *data, size_t len);
* Therefore, strictly requiring a BOM seems to be the safest option for
* content in Git.
*
- * [1] http://unicode.org/faq/utf_bom.html#gen6
- * [2] http://www.unicode.org/versions/Unicode10.0.0/ch03.pdf
+ * [1] https://unicode.org/faq/utf_bom.html#gen6
+ * [2] https://www.unicode.org/versions/Unicode10.0.0/ch03.pdf
* Section 3.10, D98, page 132
* [3] https://encoding.spec.whatwg.org/#utf-16le
*/
--
gitgitgadget
^ permalink raw reply related
* [PATCH v3 3/4] doc: update links for andre-simon.de
From: Josh Soref via GitGitGadget @ 2023-11-24 3:35 UTC (permalink / raw)
To: git; +Cc: Eric Sunshine, Josh Soref, Elijah Newren, Josh Soref, Josh Soref
In-Reply-To: <pull.1589.v3.git.1700796916.gitgitgadget@gmail.com>
From: Josh Soref <jsoref@gmail.com>
Beyond the fact that it's somewhat traditional to respect sites'
self-identification, it's helpful for links to point to the things
that people expect them to reference. Here that means linking to
specific pages instead of a domain.
Signed-off-by: Josh Soref <jsoref@gmail.com>
---
Documentation/gitweb.conf.txt | 2 +-
gitweb/INSTALL | 2 +-
gitweb/gitweb.perl | 4 ++--
gitweb/static/gitweb.css | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Documentation/gitweb.conf.txt b/Documentation/gitweb.conf.txt
index 20df3f0e253..59fc1d27419 100644
--- a/Documentation/gitweb.conf.txt
+++ b/Documentation/gitweb.conf.txt
@@ -242,7 +242,7 @@ $mimetypes_file::
$highlight_bin::
Path to the highlight executable to use (it must be the one from
- http://www.andre-simon.de[] due to assumptions about parameters and output).
+ http://andre-simon.de/zip/download.php[] due to assumptions about parameters and output).
By default set to 'highlight'; set it to full path to highlight
executable if it is not installed on your web server's PATH.
Note that 'highlight' feature must be set for gitweb to actually
diff --git a/gitweb/INSTALL b/gitweb/INSTALL
index a58e6b3c44b..0f8bc39ad84 100644
--- a/gitweb/INSTALL
+++ b/gitweb/INSTALL
@@ -203,7 +203,7 @@ You can specify the following configuration variables when building GIT:
created. [Default: /etc/gitweb.conf]
* HIGHLIGHT_BIN
Path to the highlight executable to use (must be the one from
- http://www.andre-simon.de due to assumptions about parameters and output).
+ http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
Useful if highlight is not installed on your webserver's PATH.
[Default: highlight]
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d23468690ed..b6659410ef1 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -197,7 +197,7 @@ our @diff_opts = ('-M'); # taken from git_commit
our $prevent_xss = 0;
# Path to the highlight executable to use (must be the one from
-# http://www.andre-simon.de due to assumptions about parameters and output).
+# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
# Useful if highlight is not installed on your webserver's PATH.
# [Default: highlight]
our $highlight_bin = "++HIGHLIGHT_BIN++";
@@ -269,7 +269,7 @@ our %avatar_size = (
# Leave it undefined (or set to 'undef') to turn off load checking.
our $maxload = 300;
-# configuration for 'highlight' (http://www.andre-simon.de/)
+# configuration for 'highlight' (http://andre-simon.de/doku/highlight/en/highlight.php)
# match by basename
our %highlight_basename = (
#'Program' => 'py',
diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index 32126010326..48d2e510154 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -667,7 +667,7 @@ div.remote {
}
-/* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */
+/* Style definition generated by highlight 2.4.5, http://andre-simon.de/doku/highlight/en/highlight.php */
/* Highlighting theme definition: */
--
gitgitgadget
^ permalink raw reply related
* [PATCH v3 0/4] Switch links to https
From: Josh Soref via GitGitGadget @ 2023-11-24 3:35 UTC (permalink / raw)
To: git; +Cc: Eric Sunshine, Josh Soref, Elijah Newren, Josh Soref
In-Reply-To: <pull.1589.v2.git.1695553041.gitgitgadget@gmail.com>
There are a couple of categories of http links...
There are four categories worth changing:
* pages that have jittered a bit but are now available as https:
* pages which exist at both http: and https: and can be safely switched
* pages that have jittered a bit and are not available over https:
* pages that are gone and for which the best source is
https://web.archive.org
And some categories that aren't being changed:
* links that are required to be http: because they're copied from something
that mandates it (the apache license, xml namespaces, xsl docbook
things?)
* urls that were imaginary (e.g. http://example.com/repo.git)
* links in borrowed code where the http: form still works
In order:
* doc: update links to current pages -- I found the current pages for
these, it should be easy enough to verify these / reject them
* doc: switch links to https -- the simplest
* doc: update links for andre-simon.de -- I've split this out, I don't like
the idea of having to download binaries over http. If this were my
project, I'd be tempted to remove the feature or self-host w/ https...
* doc: refer to internet archive -- the original urls are dead, I've found
internet archive date links for them. (There are some in git already, so
this seemed like a very reasonable choice.)
Changes from v1:
* Commit messages have been adjusted since v1
* files were dropped based on feedback from Junio
Changes from v2:
* The first two commits have been swapped (favoring more complicated urls
over simply switching to https)
* The archive.org link for atomenabled.org has been dropped, we'll risk
users getting hacked content from an arbitrary MITM instead of taking
archived authenticated content based on the last time their web site was
properly maintained.
Josh Soref (4):
doc: update links to current pages
doc: switch links to https
doc: update links for andre-simon.de
doc: refer to internet archive
Documentation/CodingGuidelines | 2 +-
Documentation/MyFirstContribution.txt | 2 +-
Documentation/RelNotes/1.6.2.txt | 2 +-
Documentation/RelNotes/1.6.3.txt | 2 +-
Documentation/RelNotes/1.6.4.txt | 2 +-
Documentation/RelNotes/1.6.5.txt | 2 +-
Documentation/RelNotes/1.6.6.txt | 2 +-
Documentation/git-cvsimport.txt | 4 ++--
Documentation/git-format-patch.txt | 4 ++--
Documentation/git-imap-send.txt | 2 +-
Documentation/git-send-email.txt | 2 +-
Documentation/git.txt | 2 +-
Documentation/gitcore-tutorial.txt | 2 +-
Documentation/gitprotocol-http.txt | 4 ++--
Documentation/gitweb.conf.txt | 4 ++--
Documentation/gitweb.txt | 2 +-
Documentation/howto/keep-canonical-history-correct.txt | 2 +-
Documentation/signoff-option.txt | 2 +-
INSTALL | 2 +-
Makefile | 4 ++--
README.md | 2 +-
git-cvsimport.perl | 2 +-
git-gui/git-gui.sh | 6 +++---
git-gui/lib/encoding.tcl | 2 +-
git-gui/po/README | 2 +-
git-instaweb.sh | 4 ++--
gitk-git/gitk | 4 ++--
gitweb/INSTALL | 2 +-
gitweb/gitweb.perl | 10 +++++-----
gitweb/static/gitweb.css | 2 +-
gitweb/static/js/lib/common-lib.js | 10 +++++-----
graph.h | 4 ++--
http.c | 2 +-
imap-send.c | 4 ++--
json-writer.h | 4 ++--
kwset.c | 2 +-
kwset.h | 2 +-
list.h | 2 +-
perl/FromCPAN/Error.pm | 2 +-
perl/Git/SVN.pm | 2 +-
protocol.h | 2 +-
sh-i18n--envsubst.c | 4 ++--
sha1dc/sha1.c | 2 +-
t/README | 4 ++--
t/helper/test-regex.c | 2 +-
t/lib-gpg.sh | 2 +-
t/perf/perf-lib.sh | 2 +-
t/t9114-git-svn-dcommit-merge.sh | 2 +-
t/t9801-git-p4-branch.sh | 2 +-
t/t9816-git-p4-locked.sh | 2 +-
t/test-lib-functions.sh | 2 +-
t/test-lib-github-workflow-markup.sh | 2 +-
t/test-lib-junit.sh | 2 +-
t/test-lib.sh | 2 +-
trace.c | 2 +-
utf8.c | 2 +-
utf8.h | 6 +++---
57 files changed, 81 insertions(+), 81 deletions(-)
base-commit: 564d0252ca632e0264ed670534a51d18a689ef5d
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1589%2Fjsoref%2Fhttps-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1589/jsoref/https-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1589
Range-diff vs v2:
2: 80eb5da8ed4 ! 1: 54d3861aedf doc: update links to current pages
@@ Documentation/git-format-patch.txt: Approach #3 (external editor)
The following Thunderbird extensions are needed:
-AboutConfig from http://aboutconfig.mozdev.org/ and
+-External Editor from http://globs.org/articles.php?lng=en&pg=8
+AboutConfig from https://mjg.github.io/AboutConfig/ and
- External Editor from https://globs.org/articles.php?lng=en&pg=8
++External Editor from https://globs.org/articles.php?lng=en&pg=8
1. Prepare the patch as a text file using your method of choice.
+
## Documentation/git.txt ##
@@ Documentation/git.txt: Authors
@@ gitk-git/gitk: if {[tk windowingsystem] eq "aqua"} {
## gitweb/static/js/lib/common-lib.js ##
@@ gitweb/static/js/lib/common-lib.js: function addCssRule(selector, style) {
* http://www.dustindiaz.com/getelementsbyclass/
- * https://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
+ * http://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
*
- * See also http://ejohn.org/blog/getelementsbyclassname-speed-comparison/
+ * See also https://johnresig.com/blog/getelementsbyclassname-speed-comparison/
@@ json-writer.h
@@
/*
* JSON data structures are defined at:
- * [1] https://www.ietf.org/rfc/rfc7159.txt
+ * [1] http://www.ietf.org/rfc/rfc7159.txt
- * [2] http://json.org/
+ * [2] https://www.json.org/
*
1: 71ed1286d7f ! 2: cd44658f408 doc: switch links to https
@@ Metadata
## Commit message ##
doc: switch links to https
- It's somewhat traditional to respect sites' self-identification.
+ These sites offer https versions of their content.
+ Using the https versions provides some protection for users.
Signed-off-by: Josh Soref <jsoref@gmail.com>
- ## Documentation/CodingGuidelines ##
-@@ Documentation/CodingGuidelines: code. For Git in general, a few rough rules are:
-
- "Once it _is_ in the tree, it's not really worth the patch noise to
- go and fix it up."
-- Cf. http://lkml.iu.edu/hypermail/linux/kernel/1001.3/01069.html
-+ Cf. https://lkml.iu.edu/hypermail/linux/kernel/1001.3/01069.html
-
- - Log messages to explain your changes are as important as the
- changes themselves. Clearly written code and in-code comments
-
## Documentation/MyFirstContribution.txt ##
@@ Documentation/MyFirstContribution.txt: Johannes Schindelin to make life as a Git contributor easier for those used to
the GitHub PR workflow. It allows contributors to open pull requests against its
@@ Documentation/git-cvsimport.txt: Problems related to tags:
GIT
---
- ## Documentation/git-format-patch.txt ##
-@@ Documentation/git-format-patch.txt: Approach #3 (external editor)
-
- The following Thunderbird extensions are needed:
- AboutConfig from http://aboutconfig.mozdev.org/ and
--External Editor from http://globs.org/articles.php?lng=en&pg=8
-+External Editor from https://globs.org/articles.php?lng=en&pg=8
-
- 1. Prepare the patch as a text file using your method of choice.
-
-
## Documentation/git-imap-send.txt ##
@@ Documentation/git-imap-send.txt: flames ridiculing you if you don't check this.
@@ Documentation/gitweb.conf.txt: filesystem (i.e. "$projectroot/$project"), `%h` t
## Documentation/gitweb.txt ##
@@ Documentation/gitweb.txt: Gitweb provides a web interface to Git repositories. Its features include:
revisions one at a time, viewing the history of the repository.
- * Finding commits which commit messages matches given search term.
+ * Finding commits whose commit messages match a given search term.
-See http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
+See https://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
@@ gitweb/static/js/lib/common-lib.js: function addCssRule(selector, style) {
- * http://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
+ * https://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
*
- * See also http://ejohn.org/blog/getelementsbyclassname-speed-comparison/
+ * See also https://johnresig.com/blog/getelementsbyclassname-speed-comparison/
*
## graph.h ##
@@ json-writer.h
* JSON data structures are defined at:
- * [1] http://www.ietf.org/rfc/rfc7159.txt
+ * [1] https://www.ietf.org/rfc/rfc7159.txt
- * [2] http://json.org/
+ * [2] https://www.json.org/
*
* The JSON-writer API allows one to build JSON data structures using a
3: 7cfd7b244ea = 3: 649ce9a9bd4 doc: update links for andre-simon.de
4: 9f0bba69492 ! 4: 6d614a00a97 doc: refer to internet archive
@@ Commit message
## gitweb/gitweb.perl ##
@@ gitweb/gitweb.perl: sub git_feed {
- my $format = shift || 'atom';
my $have_blame = gitweb_check_feature('blame');
-- # Atom: http://www.atomenabled.org/developers/syndication/
+ # Atom: http://www.atomenabled.org/developers/syndication/
- # RSS: http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
-+ # Atom: https://web.archive.org/web/20230815171113/https://www.atomenabled.org/developers/syndication/
+ # RSS: https://web.archive.org/web/20030729001534/http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
if ($format ne 'rss' && $format ne 'atom') {
die_error(400, "Unknown web feed format");
--
gitgitgadget
^ permalink raw reply
* Re: [PATCH v2 4/4] doc: refer to internet archive
From: Josh Soref @ 2023-11-24 3:24 UTC (permalink / raw)
To: Elijah Newren; +Cc: Josh Soref via GitGitGadget, git
In-Reply-To: <CABPp-BFrVjzbVDBWv_zaeScFhZ4Z2v5whSLAVkU_SuerKcujVw@mail.gmail.com>
Elijah Newren wrote:
> Thanks, these all look good, except on of the old links works for me.
> Maybe it was just down the day you checked?
> More comments on that below...
> > - # Atom: http://www.atomenabled.org/developers/syndication/
> > - # RSS: http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
> > + # Atom: https://web.archive.org/web/20230815171113/https://www.atomenabled.org/developers/syndication/
> > + # RSS: https://web.archive.org/web/20030729001534/http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
>
> The original www.atomenabled.org link works for me.
That's odd. As you can see based on my archive.org link, at some point
they had `https` support (their certificate expired Feb 7, 2021 UTC).
Personally, as a former web browser developer, I'd rather people rely
on archived authenticated content than content that could be rewritten
in transit.
That said, I'm going to drop this change.
^ permalink raw reply
* Re: [PATCH v2 2/4] doc: update links to current pages
From: Josh Soref @ 2023-11-24 3:20 UTC (permalink / raw)
To: Elijah Newren; +Cc: Josh Soref via GitGitGadget, git
In-Reply-To: <CABPp-BF4dEaa_Ha4uwzVi3fcVKuCuWO=JLHF5RoUANoNCOfk-w@mail.gmail.com>
Elijah Newren wrote:
> > It's somewhat traditional to respect sites' self-identification.
>
> I don't understand this comment; was it meant for patch 1?
I'm trying to say that these sites tend to redirect to these forms as
opposed to the previous forms.
It applies to both commits.
The reason to retain two distinct commits is that ideally the https
only commit should be easier to review as it's generally just adding
an `s` (in one case I've added a trailing `/` before a `.` that was
used to end a sentence and which would result in a broken link if a
user clicked on it...).
> Ah, you did fix the http/https thing for json, you just moved it to
> patch 2 because you also added the 'www.'. Got it.
This confused too many people. I'm going to swap the order.
^ permalink raw reply
* Re: [PATCH v2 1/4] doc: switch links to https
From: Josh Soref @ 2023-11-24 3:12 UTC (permalink / raw)
To: Elijah Newren; +Cc: Josh Soref via GitGitGadget, git
In-Reply-To: <CABPp-BEbfsss39-cENw2BwnQPp4edp9_JSN_O1e7vcci9XE+cQ@mail.gmail.com>
Elijah Newren wrote:
> > -For example, at the time this page was written, the http://repo.or.cz[]
> > +For example, at the time this page was written, the https://repo.or.cz[]
>
> Given the "at the time this page was written" comment, I'm not sure we
> should switch to https here.
I claim that it refers to the file that is presented to the user,
which is current as of the time it was delivered by the specific
version of the git package.
> > -See http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
> > +See https://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
> > browsed using gitweb itself.
>
> The suggested link gives a "404 - No such tree". Granted, the http:
> link also does that, but it'd be nicer to provide a non-broken link,
> which you can do by stripping the '/[]' from the end of the URL.
The `[]` is part of AsciiDoc's [1] notation. I tripped on this when I
first looked into
this series (as I'm much more familiar w/ Markdown and Restructured Text).
[1] https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/
^ 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