Fwd: Query on GIT merge and conflicts
Hi Team, I've query for which we have no solutions from Stackoverflow. Or we couldn't find one. Would be great if you have one or can provide suggestions with. SO Link: https://stackoverflow.com/questions/53704320/git-merge-remote-repository-project-to-sub-directory-of-current-repository-proje I need to merge a particular branch from one project to a different branch in another currently running project . For which I am following below steps In Source Repo-A: v23-branch, I created a local temp branch and moved all the contents to a folder and made a local commit. Then In Target Repo-B, I added the local git path like given below. git remote add tmpmerge Then did a git fetch of tmpmerge to get the branch details of Source Repo-A. And while doing a git merge tmpmerge/temp --allow-unrelated-histories, I get so many merge conflicts as describe in the bottom. Below is the tree structure I am expecting to achieve it Source Repo-A: v23-branch module1 module2 pom.xml Dockerfile Target Repo B: some-branch source Repo-A: v21-branch |-module1 |-module2 |-pom.xml |-Dockerfile Repo-B-Files1 Repo-B-Files2 Repo-B-Files3 pom.xml Jenkinsfile Dockerfile What I want to achieve is given below. Target Repo B: some-branch source Repo-A: v21-branch |-source Repo-A: v23-branch |-module1 |-module2 |-pom.xml |-Dockerfile |-module1 |-module2 |-pom.xml |-Dockerfile Repo-B-Files1 Repo-B-Files2 Repo-B-Files3 pom.xml Jenkinsfile Dockerfile I want to merge source repo module to the destination module as mentioned above structure because While merging contents as parent directory overwrites some of my existing files available in the current project like pom.xml , docker file etc. Instead of merging to current project parent directory I want to write as sub directory with all its log and history. But I'm facing CONFLICT(rename/delete), CONFLICT(rename/rename) for module files... Thanks much in advance. Thanks, Vijay V
Re: [PATCH 1/1] git-p4: recover from inconsistent perforce history
On Wed, 6 Feb 2019 19:42:19 + and...@adoakley.name wrote: > From: Andrew Oakley > > Perforce allows you commit files and directories with the same name, so > you could have files //depot/foo and //depot/foo/bar both checked in. A > p4 sync of a repository in this state fails. Deleting one of the files > recovers the repository. > > When this happens we want git-p4 to recover in the same way as perforce. I'm finding the test fails for me on a clean git repo, although I can't see any obvious reason why. Having the ability to detect when Perforce users submit a change which creates a file-inside-a-file will be really very useful. Luke > > Signed-off-by: Andrew Oakley > --- > git-p4.py | 41 ++-- > t/t9834-git-p4-file-dir-bug.sh | 58 ++ > 2 files changed, 97 insertions(+), 2 deletions(-) > create mode 100755 t/t9834-git-p4-file-dir-bug.sh > > diff --git a/git-p4.py b/git-p4.py > index 3e12774f96..6bf2bbbcec 100755 > --- a/git-p4.py > +++ b/git-p4.py > @@ -3012,6 +3012,43 @@ def hasBranchPrefix(self, path): > print('Ignoring file outside of prefix: {0}'.format(path)) > return hasPrefix > > +def isIncluded(self, path): > +return self.inClientSpec(path) and self.hasBranchPrefix(path) > + > +def findShadowedFiles(self, files, change): > +# Perforce allows you commit files and directories with the same > name, > +# so you could have files //depot/foo and //depot/foo/bar both > checked > +# in. A p4 sync of a repository in this state fails. Deleting one > of > +# the files recovers the repository. > +# > +# Git will not allow the broken state to exist and only the most > recent > +# of the conflicting names is left in the repository. When one of > the > +# conflicting files is deleted we need to re-add the other one to > make > +# sure the git repository recovers in the same way as perforce. > +deleted = [f for f in files if f['action'] in self.delete_actions] > +to_check = set() > +for f in deleted: > +path = f['path'] > +to_check.add(path + '/...') > +while True: > +path = path.rsplit("/", 1)[0] > +if path == "/" or path in to_check: > +break > +to_check.add(path) > +to_check = [p for p in to_check if self.isIncluded(p)] > +if to_check: > +stat_result = p4CmdList( > +["fstat", "-T", "depotFile,headRev,headType"] + > +["%s@%s" % (p, change) for p in to_check]) > +for record in stat_result: > +if record['code'] != 'stat': > +continue > +files.append({ > +'action': 'add', > +'path': record['depotFile'], > +'rev': record['headRev'], > +'type': record['headType']}) > + > def commit(self, details, files, branch, parent = "", allow_empty=False): > epoch = details["time"] > author = details["user"] > @@ -3023,8 +3060,8 @@ def commit(self, details, files, branch, parent = "", > allow_empty=False): > if self.clientSpecDirs: > self.clientSpecDirs.update_client_spec_path_cache(files) > > -files = [f for f in files > -if self.inClientSpec(f['path']) and > self.hasBranchPrefix(f['path'])] > +files = [f for f in files if self.isIncluded(f['path'])] > +self.findShadowedFiles(files, details["change"]) > > if gitConfigBool('git-p4.keepEmptyCommits'): > allow_empty = True > diff --git a/t/t9834-git-p4-file-dir-bug.sh b/t/t9834-git-p4-file-dir-bug.sh > new file mode 100755 > index 00..9839a3d2bb > --- /dev/null > +++ b/t/t9834-git-p4-file-dir-bug.sh > @@ -0,0 +1,58 @@ > +#!/bin/sh > + > +test_description='git p4 directory/file bug handling > + > +This test creates files and directories with the same name in perforce and > +checks that git-p4 recovers from the error at the same time as the perforce > +repository.' > + > +. ./lib-git-p4.sh > + > +test_expect_success 'start p4d' ' > + start_p4d > +' > + > +test_expect_success 'init depot' ' > + ( > + cd "$cli" && > + > + touch add_file_add_dir_del_file add_file_add_dir_del_dir && > + p4 add add_file_add_dir_del_file add_file_add_dir_del_dir && > + mkdir add_dir_add_file_del_file add_dir_add_file_del_dir && > + touch add_dir_add_file_del_file/file > add_dir_add_file_del_dir/file && > + p4 add add_dir_add_file_del_file/file > add_dir_add_file_del_dir/file && > + p4 submit -d "add initial" && > + > + rm -f add_file_add_dir_del_file add_file_add_dir_del_dir && > + mkdir add_file_add_dir_del_file add_file_add_dir_del_
Re: Proposal: Output should push to different servers in parallel
On Wed, Feb 06 2019, Victor Porton wrote: > I experienced a slowdown in Git pushing when I push to more than one server. > > I propose: > > Run push to several servers in parallel. > > Not to mix the output, nevertheless serialize the output, that is for > example cache the output of the second server push and start to output > it immediately after the first server push is finished. > > This approach combines the advantages of the current way (I suppose it > is so) to serialize pushes: first push to the first server, then to > the second, etc. and of my idea to push in parallel. > > I think the best way would be use multithreading, but multiprocessing > would be a good quick solution. This seems like a reasonable idea, until such time as someone submits patches to implement this in git you can do this with some invocation of GNU parallel -k, i.e. operate on N remotes in parallel, and use the -k option to buffer up all their output and present it in sequence.
[PATCH v3 0/3] Teach submodule set-branch subcommand
I rebased the changes onto the latest 'next' because if this branch gets merged into 'next', there'll be merge conflicts from 'dl/complete-submodule-absorbgitdirs'. Currently, there is no way to set the branch of a submodule without manually manipulating the .gitmodules file. This patchset introduces a porcelain command that enables this. Changes since v1: * Fixed incorrect usage of OPT_CMDMODE Changes since v2: * Corrected missing argument for -b/--branch in git-submodule.txt * Rebased onto latest next Denton Liu (3): git-submodule.txt: "--branch " option defaults to 'master' submodule--helper: teach config subcommand --unset submodule: teach set-branch subcommand Documentation/git-submodule.txt| 14 +++- builtin/submodule--helper.c| 18 +++-- contrib/completion/git-completion.bash | 5 +- git-submodule.sh | 75 +++-- t/t7411-submodule-config.sh| 9 +++ t/t7419-submodule-set-branch.sh| 93 ++ 6 files changed, 200 insertions(+), 14 deletions(-) create mode 100755 t/t7419-submodule-set-branch.sh -- 2.20.1.522.g5f42c252e9
[PATCH v3 3/3] submodule: teach set-branch subcommand
This teaches git-submodule the set-branch subcommand which allows the branch of a submodule to be set through a porcelain command without having to manually manipulate the .gitmodules file. --- Documentation/git-submodule.txt| 7 ++ contrib/completion/git-completion.bash | 5 +- git-submodule.sh | 75 +++-- t/t7419-submodule-set-branch.sh| 93 ++ 4 files changed, 175 insertions(+), 5 deletions(-) create mode 100755 t/t7419-submodule-set-branch.sh diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt index 4150148fa3..6c608b3b8c 100644 --- a/Documentation/git-submodule.txt +++ b/Documentation/git-submodule.txt @@ -14,6 +14,7 @@ SYNOPSIS 'git submodule' [--quiet] init [--] [...] 'git submodule' [--quiet] deinit [-f|--force] (--all|[--] ...) 'git submodule' [--quiet] update [] [--] [...] +'git submodule' [--quiet] set-branch [] [--] 'git submodule' [--quiet] summary [] [--] [...] 'git submodule' [--quiet] foreach [--recursive] 'git submodule' [--quiet] sync [--recursive] [--] [...] @@ -168,6 +169,12 @@ submodule with the `--init` option. If `--recursive` is specified, this command will recurse into the registered submodules, and update any nested submodules within. -- +set-branch ((-d|--default)|(-b|--branch )) [--] :: + Sets the default remote tracking branch for the submodule. The + `--branch` option allows the remote branch to be specified. The + `--default` option removes the submodule..branch configuration + key, which causes the tracking branch to default to 'master'. +-- summary [--cached|--files] [(-n|--summary-limit) ] [commit] [--] [...]:: Show commit summary between the given commit (defaults to HEAD) and working tree/index. For a submodule in question, a series of commits diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index de56879960..0fccadfc97 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2573,7 +2573,7 @@ _git_submodule () { __git_has_doubledash && return - local subcommands="add status init deinit update summary foreach sync absorbgitdirs" + local subcommands="add status init deinit update set-branch summary foreach sync absorbgitdirs" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then case "$cur" in @@ -2604,6 +2604,9 @@ _git_submodule () --force --rebase --merge --reference --depth --recursive --jobs " ;; + set-branch,--*) + __gitcomp "--default --branch" + ;; summary,--*) __gitcomp "--cached --files --summary-limit" ;; diff --git a/git-submodule.sh b/git-submodule.sh index b5f2beee60..470f681573 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -10,6 +10,7 @@ USAGE="[--quiet] add [-b ] [-f|--force] [--name ] [--reference ...] or: $dashless [--quiet] deinit [-f|--force] (--all| [--] ...) or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference ] [--recursive] [--] [...] + or: $dashless [--quiet] set-branch (--default|--branch ) [--] or: $dashless [--quiet] summary [--cached|--files] [--summary-limit ] [commit] [--] [...] or: $dashless [--quiet] foreach [--recursive] or: $dashless [--quiet] sync [--recursive] [--] [...] @@ -684,6 +685,72 @@ cmd_update() } } +# +# Configures a submodule's default branch +# +# $@ = requested path +# +cmd_set_branch() { + unset_branch=false + branch= + + while test $# -ne 0 + do + case "$1" in + -q|--quiet) + # we don't do anything with this but we need to accept it + ;; + -d|--default) + unset_branch=true + ;; + -b|--branch) + case "$2" in '') usage ;; esac + branch=$2 + shift + ;; + --) + shift + break + ;; + -*) + usage + ;; + *) + break + ;; + esac + shift + done + + if test $# -ne 1 + then + usage + fi + + # we can't use `git submodule--helper name` here because internally, it + # hashes the path so a trailing slash could lead to an unintentional no match + name="$(git submodule--helper list "$1" | cut -f2)" + if test -z "$name" + then + exit 1 + fi + + test -n "$branch"; has_
[PATCH v3 1/3] git-submodule.txt: "--branch " option defaults to 'master'
This behavior is mentioned in gitmodules.txt but not in git-submodule.txt so we copy the information over so that it is not missed. Also, add the missed argument to the -b/--branch option. Signed-off-by: Denton Liu --- Documentation/git-submodule.txt | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt index ba3c4df550..4150148fa3 100644 --- a/Documentation/git-submodule.txt +++ b/Documentation/git-submodule.txt @@ -255,13 +255,14 @@ OPTIONS This option is only valid for the deinit command. Unregister all submodules in the working tree. --b:: ---branch:: +-b :: +--branch :: Branch of repository to add as submodule. The name of the branch is recorded as `submodule..branch` in `.gitmodules` for `update --remote`. A special value of `.` is used to indicate that the name of the branch in the submodule should be the - same name as the current branch in the current repository. + same name as the current branch in the current repository. If the + option is not specified, it defaults to 'master'. -f:: --force:: -- 2.20.1.522.g5f42c252e9
[PATCH v3 2/3] submodule--helper: teach config subcommand --unset
This teaches submodule--helper config the --unset option, which removes the specified configuration key from the .gitmodule file. Signed-off-by: Denton Liu --- builtin/submodule--helper.c | 18 -- t/t7411-submodule-config.sh | 9 + 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index b80fc4ba3d..a86eacf167 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2148,17 +2148,22 @@ static int check_name(int argc, const char **argv, const char *prefix) static int module_config(int argc, const char **argv, const char *prefix) { enum { - CHECK_WRITEABLE = 1 - } command = 0; + NONE, + CHECK_WRITEABLE, + DO_UNSET + } command = NONE; struct option module_config_options[] = { OPT_CMDMODE(0, "check-writeable", &command, N_("check if it is safe to write to the .gitmodules file"), CHECK_WRITEABLE), + OPT_CMDMODE(0, "unset", &command, + N_("unset the config in the .gitmodules file"), + DO_UNSET), OPT_END() }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper config name [value]"), + N_("git submodule--helper config name [--unset] [value]"), N_("git submodule--helper config --check-writeable"), NULL }; @@ -2170,15 +2175,16 @@ static int module_config(int argc, const char **argv, const char *prefix) return is_writing_gitmodules_ok() ? 0 : -1; /* Equivalent to ACTION_GET in builtin/config.c */ - if (argc == 2) + if (argc == 2 && command != DO_UNSET) return print_config_from_gitmodules(the_repository, argv[1]); /* Equivalent to ACTION_SET in builtin/config.c */ - if (argc == 3) { + if (argc == 3 || (argc == 2 && command == DO_UNSET)) { if (!is_writing_gitmodules_ok()) die(_("please make sure that the .gitmodules file is in the working tree")); - return config_set_in_gitmodules_file_gently(argv[1], argv[2]); + const char *value = (argc == 3) ? argv[2] : NULL; + return config_set_in_gitmodules_file_gently(argv[1], value); } usage_with_options(git_submodule_helper_usage, module_config_options); diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh index 89690b7adb..fcc0fb82d8 100755 --- a/t/t7411-submodule-config.sh +++ b/t/t7411-submodule-config.sh @@ -142,6 +142,15 @@ test_expect_success 'reading submodules config from the working tree with "submo ) ' +test_expect_success 'unsetting submodules config from the working tree with "submodule--helper config --unset"' ' + (cd super && + git submodule--helper config --unset submodule.submodule.url && + git submodule--helper config submodule.submodule.url >actual && + test_must_be_empty actual + ) +' + + test_expect_success 'writing submodules config with "submodule--helper config"' ' (cd super && echo "new_url" >expect && -- 2.20.1.522.g5f42c252e9
[PATCH 01/21] diff.c: convert --patch-with-raw
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 4bc9df7362..12e333c67f 100644 --- a/diff.c +++ b/diff.c @@ -4901,6 +4901,10 @@ static void prep_parse_options(struct diff_options *options) OPT_BIT_F(0, "raw", &options->output_format, N_("generate the diff in raw format"), DIFF_FORMAT_RAW, PARSE_OPT_NONEG), + OPT_BITOP(0, "patch-with-raw", &options->output_format, + N_("synonym for '-p --raw'"), + DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW, + DIFF_FORMAT_NO_OUTPUT), OPT_END() }; @@ -4929,10 +4933,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "--patch-with-raw")) { - enable_patch_output(&options->output_format); - options->output_format |= DIFF_FORMAT_RAW; - } else if (!strcmp(arg, "--numstat")) + if (!strcmp(arg, "--numstat")) options->output_format |= DIFF_FORMAT_NUMSTAT; else if (!strcmp(arg, "--shortstat")) options->output_format |= DIFF_FORMAT_SHORTSTAT; -- 2.20.1.682.gd5861c6d90
[PATCH 04/21] diff.c: convert --check
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 1cdbe8e688..5e16082091 100644 --- a/diff.c +++ b/diff.c @@ -4939,6 +4939,9 @@ static void prep_parse_options(struct diff_options *options) N_("synonym for --dirstat=files,param1,param2..."), PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_dirstat), + OPT_BIT_F(0, "check", &options->output_format, + N_("warn if changes introduce conflict markers or whitespace errors"), + DIFF_FORMAT_CHECKDIFF, PARSE_OPT_NONEG), OPT_END() }; @@ -4967,9 +4970,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "--check")) - options->output_format |= DIFF_FORMAT_CHECKDIFF; - else if (!strcmp(arg, "--summary")) + if (!strcmp(arg, "--summary")) options->output_format |= DIFF_FORMAT_SUMMARY; else if (!strcmp(arg, "--patch-with-stat")) { enable_patch_output(&options->output_format); -- 2.20.1.682.gd5861c6d90
[PATCH 07/21] diff.c: convert --name-only
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index b9811aefef..7ea308814f 100644 --- a/diff.c +++ b/diff.c @@ -4949,6 +4949,9 @@ static void prep_parse_options(struct diff_options *options) OPT_BIT_F(0, "summary", &options->output_format, N_("condensed summary such as creations, renames and mode changes"), DIFF_FORMAT_SUMMARY, PARSE_OPT_NONEG), + OPT_BIT_F(0, "name-only", &options->output_format, + N_("show only names of changed files"), + DIFF_FORMAT_NAME, PARSE_OPT_NONEG), OPT_END() }; @@ -4977,9 +4980,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "--name-only")) - options->output_format |= DIFF_FORMAT_NAME; - else if (!strcmp(arg, "--name-status")) + if (!strcmp(arg, "--name-status")) options->output_format |= DIFF_FORMAT_NAME_STATUS; else if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch")) options->output_format |= DIFF_FORMAT_NO_OUTPUT; -- 2.20.1.682.gd5861c6d90
[PATCH 06/21] diff.c: convert --patch-with-stat
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 0276f25200..b9811aefef 100644 --- a/diff.c +++ b/diff.c @@ -4921,6 +4921,10 @@ static void prep_parse_options(struct diff_options *options) N_("synonym for '-p --raw'"), DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW, DIFF_FORMAT_NO_OUTPUT), + OPT_BITOP(0, "patch-with-stat", &options->output_format, + N_("synonym for '-p --stat'"), + DIFF_FORMAT_PATCH | DIFF_FORMAT_DIFFSTAT, + DIFF_FORMAT_NO_OUTPUT), OPT_BIT_F(0, "numstat", &options->output_format, N_("machine friendly --stat"), DIFF_FORMAT_NUMSTAT, PARSE_OPT_NONEG), @@ -4973,10 +4977,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "--patch-with-stat")) { - enable_patch_output(&options->output_format); - options->output_format |= DIFF_FORMAT_DIFFSTAT; - } else if (!strcmp(arg, "--name-only")) + if (!strcmp(arg, "--name-only")) options->output_format |= DIFF_FORMAT_NAME; else if (!strcmp(arg, "--name-status")) options->output_format |= DIFF_FORMAT_NAME_STATUS; -- 2.20.1.682.gd5861c6d90
[PATCH 09/21] diff.c: convert -s|--no-patch
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 99047fb5fe..9c8f5336bc 100644 --- a/diff.c +++ b/diff.c @@ -4906,6 +4906,9 @@ static void prep_parse_options(struct diff_options *options) OPT_BITOP('p', "patch", &options->output_format, N_("generate patch"), DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT), + OPT_BIT_F('s', "no-patch", &options->output_format, + N_("suppress diff output"), + DIFF_FORMAT_NO_OUTPUT, PARSE_OPT_NONEG), OPT_BITOP('u', NULL, &options->output_format, N_("generate patch"), DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT), @@ -4983,9 +4986,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch")) - options->output_format |= DIFF_FORMAT_NO_OUTPUT; - else if (starts_with(arg, "--stat")) + if (starts_with(arg, "--stat")) /* --stat, --stat-width, --stat-name-width, or --stat-count */ return stat_opt(options, av); else if (!strcmp(arg, "--compact-summary")) { -- 2.20.1.682.gd5861c6d90
[PATCH 02/21] diff.c: convert --numstat and --shortstat
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index 12e333c67f..419b6ac4ae 100644 --- a/diff.c +++ b/diff.c @@ -4905,6 +4905,12 @@ static void prep_parse_options(struct diff_options *options) N_("synonym for '-p --raw'"), DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW, DIFF_FORMAT_NO_OUTPUT), + OPT_BIT_F(0, "numstat", &options->output_format, + N_("machine friendly --stat"), + DIFF_FORMAT_NUMSTAT, PARSE_OPT_NONEG), + OPT_BIT_F(0, "shortstat", &options->output_format, + N_("output only the last line of --stat"), + DIFF_FORMAT_SHORTSTAT, PARSE_OPT_NONEG), OPT_END() }; @@ -4933,11 +4939,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "--numstat")) - options->output_format |= DIFF_FORMAT_NUMSTAT; - else if (!strcmp(arg, "--shortstat")) - options->output_format |= DIFF_FORMAT_SHORTSTAT; - else if (skip_prefix(arg, "-X", &arg) || + if (skip_prefix(arg, "-X", &arg) || skip_to_optional_arg(arg, "--dirstat", &arg)) return parse_dirstat_opt(options, arg); else if (!strcmp(arg, "--cumulative")) -- 2.20.1.682.gd5861c6d90
[PATCH 00/21] nd/diff-parseopt part 2
"What's cooking" mails seem to indicate that the series will be cooked in full there then landed on master later. So here's the second part. This continues to convert more diff options to parseopt. Nguyễn Thái Ngọc Duy (21): diff.c: convert --patch-with-raw diff.c: convert --numstat and --shortstat diff.c: convert --dirstat and friends diff.c: convert --check diff.c: convert --summary diff.c: convert --patch-with-stat diff.c: convert --name-only diff.c: convert --name-status diff.c: convert -s|--no-patch diff.c: convert --stat* diff.c: convert --[no-]compact-summary diff.c: convert --output-* diff.c: convert -B|--break-rewrites diff.c: convert -M|--find-renames diff.c: convert -D|--irreversible-delete diff.c: convert -C|--find-copies diff.c: convert --find-copies-harder diff.c: convert --no-renames|--[no--rename-empty diff.c: convert --relative diff.c: convert --[no-]minimal diff.c: convert --ignore-some-changes Documentation/diff-options.txt | 20 ++ diff.c | 510 +++-- 2 files changed, 319 insertions(+), 211 deletions(-) -- 2.20.1.682.gd5861c6d90
[PATCH 05/21] diff.c: convert --summary
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 5e16082091..0276f25200 100644 --- a/diff.c +++ b/diff.c @@ -4942,6 +4942,9 @@ static void prep_parse_options(struct diff_options *options) OPT_BIT_F(0, "check", &options->output_format, N_("warn if changes introduce conflict markers or whitespace errors"), DIFF_FORMAT_CHECKDIFF, PARSE_OPT_NONEG), + OPT_BIT_F(0, "summary", &options->output_format, + N_("condensed summary such as creations, renames and mode changes"), + DIFF_FORMAT_SUMMARY, PARSE_OPT_NONEG), OPT_END() }; @@ -4970,9 +4973,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "--summary")) - options->output_format |= DIFF_FORMAT_SUMMARY; - else if (!strcmp(arg, "--patch-with-stat")) { + if (!strcmp(arg, "--patch-with-stat")) { enable_patch_output(&options->output_format); options->output_format |= DIFF_FORMAT_DIFFSTAT; } else if (!strcmp(arg, "--name-only")) -- 2.20.1.682.gd5861c6d90
[PATCH 03/21] diff.c: convert --dirstat and friends
Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/diff-options.txt | 7 ++ diff.c | 39 +- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 0711734b12..058d93ec4f 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -148,6 +148,7 @@ These parameters can also be set individually with `--stat-width=`, number of modified files, as well as number of added and deleted lines. +-X:: --dirstat[=]:: Output the distribution of relative amount of changes for each sub-directory. The behavior of `--dirstat` can be customized by @@ -192,6 +193,12 @@ directories with less than 10% of the total amount of changed files, and accumulating child directory counts in the parent directories: `--dirstat=files,10,cumulative`. +--cumulative:: + Synonym for --dirstat=cumulative + +--dirstat-by-file[=...]:: + Synonym for --dirstat=files,param1,param2... + --summary:: Output a condensed summary of extended header information such as creations, renames and mode changes. diff --git a/diff.c b/diff.c index 419b6ac4ae..1cdbe8e688 100644 --- a/diff.c +++ b/diff.c @@ -4867,6 +4867,22 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg) return 1; } +static int diff_opt_dirstat(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + if (!strcmp(opt->long_name, "cumulative")) { + if (arg) + BUG("how come --cumulative take a value?"); + arg = "cumulative"; + } else if (!strcmp(opt->long_name, "dirstat-by-file")) + parse_dirstat_opt(options, "files"); + parse_dirstat_opt(options, arg ? arg : ""); + return 0; +} + static int diff_opt_unified(const struct option *opt, const char *arg, int unset) { @@ -4911,6 +4927,18 @@ static void prep_parse_options(struct diff_options *options) OPT_BIT_F(0, "shortstat", &options->output_format, N_("output only the last line of --stat"), DIFF_FORMAT_SHORTSTAT, PARSE_OPT_NONEG), + OPT_CALLBACK_F('X', "dirstat", options, N_("..."), + N_("output the distribution of relative amount of changes for each sub-directory"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_dirstat), + OPT_CALLBACK_F(0, "cumulative", options, NULL, + N_("synonym for --dirstat=cumulative"), + PARSE_OPT_NONEG | PARSE_OPT_NOARG, + diff_opt_dirstat), + OPT_CALLBACK_F(0, "dirstat-by-file", options, N_("..."), + N_("synonym for --dirstat=files,param1,param2..."), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_dirstat), OPT_END() }; @@ -4939,16 +4967,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (skip_prefix(arg, "-X", &arg) || -skip_to_optional_arg(arg, "--dirstat", &arg)) - return parse_dirstat_opt(options, arg); - else if (!strcmp(arg, "--cumulative")) - return parse_dirstat_opt(options, "cumulative"); - else if (skip_to_optional_arg(arg, "--dirstat-by-file", &arg)) { - parse_dirstat_opt(options, "files"); - return parse_dirstat_opt(options, arg); - } - else if (!strcmp(arg, "--check")) + if (!strcmp(arg, "--check")) options->output_format |= DIFF_FORMAT_CHECKDIFF; else if (!strcmp(arg, "--summary")) options->output_format |= DIFF_FORMAT_SUMMARY; -- 2.20.1.682.gd5861c6d90
[PATCH 08/21] diff.c: convert --name-status
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index 7ea308814f..99047fb5fe 100644 --- a/diff.c +++ b/diff.c @@ -4952,6 +4952,9 @@ static void prep_parse_options(struct diff_options *options) OPT_BIT_F(0, "name-only", &options->output_format, N_("show only names of changed files"), DIFF_FORMAT_NAME, PARSE_OPT_NONEG), + OPT_BIT_F(0, "name-status", &options->output_format, + N_("show only names and status of changed files"), + DIFF_FORMAT_NAME_STATUS, PARSE_OPT_NONEG), OPT_END() }; @@ -4980,9 +4983,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "--name-status")) - options->output_format |= DIFF_FORMAT_NAME_STATUS; - else if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch")) + if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch")) options->output_format |= DIFF_FORMAT_NO_OUTPUT; else if (starts_with(arg, "--stat")) /* --stat, --stat-width, --stat-name-width, or --stat-count */ -- 2.20.1.682.gd5861c6d90
[PATCH 15/21] diff.c: convert -D|--irreversible-delete
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/diff.c b/diff.c index 2c904e0526..e51f6b3005 100644 --- a/diff.c +++ b/diff.c @@ -5060,6 +5060,9 @@ static void prep_parse_options(struct diff_options *options) N_("detect renames"), PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_find_renames), + OPT_SET_INT_F('D', "irreversible-delete", &options->irreversible_delete, + N_("omit the preimage for deletes"), + 1, PARSE_OPT_NONEG), OPT_GROUP(N_("Diff other options")), { OPTION_CALLBACK, 0, "output", options, N_(""), @@ -5094,10 +5097,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* renames options */ - if (!strcmp(arg, "-D") || !strcmp(arg, "--irreversible-delete")) { - options->irreversible_delete = 1; - } - else if (starts_with(arg, "-C") || + if (starts_with(arg, "-C") || skip_to_optional_arg(arg, "--find-copies", NULL)) { if (options->detect_rename == DIFF_DETECT_COPY) options->flags.find_copies_harder = 1; -- 2.20.1.682.gd5861c6d90
[PATCH 14/21] diff.c: convert -M|--find-renames
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 35 +++ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/diff.c b/diff.c index d2139082b7..2c904e0526 100644 --- a/diff.c +++ b/diff.c @@ -4909,6 +4909,22 @@ static int diff_opt_dirstat(const struct option *opt, return 0; } +static int diff_opt_find_renames(const struct option *opt, +const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + if (!arg) + arg = ""; + options->rename_score = parse_rename_score(&arg); + if (*arg != 0) + return error(_("invalid argument to %s"), opt->long_name); + + options->detect_rename = DIFF_DETECT_RENAME; + return 0; +} + static enum parse_opt_result diff_opt_output(struct parse_opt_ctx_t *ctx, const struct option *opt, const char *arg, int unset) @@ -5040,6 +5056,10 @@ static void prep_parse_options(struct diff_options *options) N_("break complete rewrite changes into pairs of delete and create"), PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_break_rewrites), + OPT_CALLBACK_F('M', "find-renames", options, N_(""), + N_("detect renames"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_find_renames), OPT_GROUP(N_("Diff other options")), { OPTION_CALLBACK, 0, "output", options, N_(""), @@ -5074,13 +5094,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* renames options */ - if (starts_with(arg, "-M") || -skip_to_optional_arg(arg, "--find-renames", NULL)) { - if ((options->rename_score = diff_scoreopt_parse(arg)) == -1) - return error("invalid argument to -M: %s", arg+2); - options->detect_rename = DIFF_DETECT_RENAME; - } - else if (!strcmp(arg, "-D") || !strcmp(arg, "--irreversible-delete")) { + if (!strcmp(arg, "-D") || !strcmp(arg, "--irreversible-delete")) { options->irreversible_delete = 1; } else if (starts_with(arg, "-C") || @@ -5363,13 +5377,10 @@ static int diff_scoreopt_parse(const char *opt) if (skip_prefix(opt, "find-copies", &opt)) { if (*opt == 0 || *opt++ == '=') cmd = 'C'; - } else if (skip_prefix(opt, "find-renames", &opt)) { - if (*opt == 0 || *opt++ == '=') - cmd = 'M'; } } - if (cmd != 'M' && cmd != 'C') - return -1; /* that is not a -M, or -C option */ + if (cmd != 'C') + return -1; /* that is not a -M option */ opt1 = parse_rename_score(&opt); if (*opt != 0) -- 2.20.1.682.gd5861c6d90
[PATCH 16/21] diff.c: convert -C|--find-copies
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 59 +- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/diff.c b/diff.c index e51f6b3005..35bac115cc 100644 --- a/diff.c +++ b/diff.c @@ -4617,8 +4617,6 @@ static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *va return 1; } -static int diff_scoreopt_parse(const char *opt); - static inline int short_opt(char opt, const char **argv, const char **optarg) { @@ -4909,6 +4907,26 @@ static int diff_opt_dirstat(const struct option *opt, return 0; } +static int diff_opt_find_copies(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + if (!arg) + arg = ""; + options->rename_score = parse_rename_score(&arg); + if (*arg != 0) + return error(_("invalid argument to %s"), opt->long_name); + + if (options->detect_rename == DIFF_DETECT_COPY) + options->flags.find_copies_harder = 1; + else + options->detect_rename = DIFF_DETECT_COPY; + + return 0; +} + static int diff_opt_find_renames(const struct option *opt, const char *arg, int unset) { @@ -5063,6 +5081,10 @@ static void prep_parse_options(struct diff_options *options) OPT_SET_INT_F('D', "irreversible-delete", &options->irreversible_delete, N_("omit the preimage for deletes"), 1, PARSE_OPT_NONEG), + OPT_CALLBACK_F('C', "find-copies", options, N_(""), + N_("detect copies"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_find_copies), OPT_GROUP(N_("Diff other options")), { OPTION_CALLBACK, 0, "output", options, N_(""), @@ -5097,15 +5119,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* renames options */ - if (starts_with(arg, "-C") || -skip_to_optional_arg(arg, "--find-copies", NULL)) { - if (options->detect_rename == DIFF_DETECT_COPY) - options->flags.find_copies_harder = 1; - if ((options->rename_score = diff_scoreopt_parse(arg)) == -1) - return error("invalid argument to -C: %s", arg+2); - options->detect_rename = DIFF_DETECT_COPY; - } - else if (!strcmp(arg, "--no-renames")) + if (!strcmp(arg, "--no-renames")) options->detect_rename = 0; else if (!strcmp(arg, "--rename-empty")) options->flags.rename_empty = 1; @@ -5365,29 +5379,6 @@ int parse_rename_score(const char **cp_p) return (int)((num >= scale) ? MAX_SCORE : (MAX_SCORE * num / scale)); } -static int diff_scoreopt_parse(const char *opt) -{ - int opt1, cmd; - - if (*opt++ != '-') - return -1; - cmd = *opt++; - if (cmd == '-') { - /* convert the long-form arguments into short-form versions */ - if (skip_prefix(opt, "find-copies", &opt)) { - if (*opt == 0 || *opt++ == '=') - cmd = 'C'; - } - } - if (cmd != 'C') - return -1; /* that is not a -M option */ - - opt1 = parse_rename_score(&opt); - if (*opt != 0) - return -1; - return opt1; -} - struct diff_queue_struct diff_queued_diff; void diff_q(struct diff_queue_struct *queue, struct diff_filepair *dp) -- 2.20.1.682.gd5861c6d90
[PATCH 18/21] diff.c: convert --no-renames|--[no--rename-empty
For --rename-empty, see 90d43b0768 (teach diffcore-rename to optionally ignore empty content - 2012-03-22) for more information. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/diff-options.txt | 3 +++ diff.c | 13 ++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index d3e8d634b2..4c0d40881b 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -392,6 +392,9 @@ endif::git-format-patch[] Turn off rename detection, even when the configuration file gives the default to do so. +--[no-]rename-empty:: + Whether to use empty blobs as rename source. + ifndef::git-format-patch[] --check:: Warn if changes introduce conflict markers or whitespace errors. diff --git a/diff.c b/diff.c index abb1566f95..d423a06b41 100644 --- a/diff.c +++ b/diff.c @@ -5087,6 +5087,11 @@ static void prep_parse_options(struct diff_options *options) diff_opt_find_copies), OPT_BOOL(0, "find-copies-harder", &options->flags.find_copies_harder, N_("use unmodified files as source to find copies")), + OPT_SET_INT_F(0, "no-renames", &options->detect_rename, + N_("disable rename detection"), + 0, PARSE_OPT_NONEG), + OPT_BOOL(0, "rename-empty", &options->flags.rename_empty, +N_("use empty blobs as rename source")), OPT_GROUP(N_("Diff other options")), { OPTION_CALLBACK, 0, "output", options, N_(""), @@ -5121,13 +5126,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* renames options */ - if (!strcmp(arg, "--no-renames")) - options->detect_rename = 0; - else if (!strcmp(arg, "--rename-empty")) - options->flags.rename_empty = 1; - else if (!strcmp(arg, "--no-rename-empty")) - options->flags.rename_empty = 0; - else if (skip_to_optional_arg_default(arg, "--relative", &arg, NULL)) { + if (skip_to_optional_arg_default(arg, "--relative", &arg, NULL)) { options->flags.relative_name = 1; if (arg) options->prefix = arg; -- 2.20.1.682.gd5861c6d90
[PATCH 19/21] diff.c: convert --relative
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/diff.c b/diff.c index d423a06b41..b9c267a199 100644 --- a/diff.c +++ b/diff.c @@ -4960,6 +4960,18 @@ static enum parse_opt_result diff_opt_output(struct parse_opt_ctx_t *ctx, return 0; } +static int diff_opt_relative(const struct option *opt, +const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_NEG(unset); + options->flags.relative_name = 1; + if (arg) + options->prefix = arg; + return 0; +} + static int diff_opt_unified(const struct option *opt, const char *arg, int unset) { @@ -5094,6 +5106,10 @@ static void prep_parse_options(struct diff_options *options) N_("use empty blobs as rename source")), OPT_GROUP(N_("Diff other options")), + OPT_CALLBACK_F(0, "relative", options, N_(""), + N_("when run from subdir, exclude changes outside and show relative paths"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_relative), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, @@ -5125,15 +5141,8 @@ int diff_opt_parse(struct diff_options *options, if (ac) return ac; - /* renames options */ - if (skip_to_optional_arg_default(arg, "--relative", &arg, NULL)) { - options->flags.relative_name = 1; - if (arg) - options->prefix = arg; - } - /* xdiff options */ - else if (!strcmp(arg, "--minimal")) + if (!strcmp(arg, "--minimal")) DIFF_XDL_SET(options, NEED_MINIMAL); else if (!strcmp(arg, "--no-minimal")) DIFF_XDL_CLR(options, NEED_MINIMAL); -- 2.20.1.682.gd5861c6d90
[PATCH 10/21] diff.c: convert --stat*
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 118 + 1 file changed, 52 insertions(+), 66 deletions(-) diff --git a/diff.c b/diff.c index 9c8f5336bc..1feb13deb3 100644 --- a/diff.c +++ b/diff.c @@ -104,11 +104,6 @@ static const char *color_diff_slots[] = { [DIFF_FILE_NEW_BOLD] = "newBold", }; -static NORETURN void die_want_option(const char *option_name) -{ - die(_("option '%s' requires a value"), option_name); -} - define_list_config_array_extra(color_diff_slots, {"plain"}); static int parse_diff_color_slot(const char *var) @@ -4661,77 +4656,56 @@ int parse_long_opt(const char *opt, const char **argv, return 2; } -static int stat_opt(struct diff_options *options, const char **av) +static int diff_opt_stat(const struct option *opt, const char *value, int unset) { - const char *arg = av[0]; - char *end; + struct diff_options *options = opt->value; int width = options->stat_width; int name_width = options->stat_name_width; int graph_width = options->stat_graph_width; int count = options->stat_count; - int argcount = 1; + char *end; - if (!skip_prefix(arg, "--stat", &arg)) - BUG("stat option does not begin with --stat: %s", arg); - end = (char *)arg; + BUG_ON_OPT_NEG(unset); - switch (*arg) { - case '-': - if (skip_prefix(arg, "-width", &arg)) { - if (*arg == '=') - width = strtoul(arg + 1, &end, 10); - else if (!*arg && !av[1]) - die_want_option("--stat-width"); - else if (!*arg) { - width = strtoul(av[1], &end, 10); - argcount = 2; - } - } else if (skip_prefix(arg, "-name-width", &arg)) { - if (*arg == '=') - name_width = strtoul(arg + 1, &end, 10); - else if (!*arg && !av[1]) - die_want_option("--stat-name-width"); - else if (!*arg) { - name_width = strtoul(av[1], &end, 10); - argcount = 2; - } - } else if (skip_prefix(arg, "-graph-width", &arg)) { - if (*arg == '=') - graph_width = strtoul(arg + 1, &end, 10); - else if (!*arg && !av[1]) - die_want_option("--stat-graph-width"); - else if (!*arg) { - graph_width = strtoul(av[1], &end, 10); - argcount = 2; - } - } else if (skip_prefix(arg, "-count", &arg)) { - if (*arg == '=') - count = strtoul(arg + 1, &end, 10); - else if (!*arg && !av[1]) - die_want_option("--stat-count"); - else if (!*arg) { - count = strtoul(av[1], &end, 10); - argcount = 2; - } + if (!strcmp(opt->long_name, "stat")) { + if (value) { + width = strtoul(value, &end, 10); + if (*end == ',') + name_width = strtoul(end+1, &end, 10); + if (*end == ',') + count = strtoul(end+1, &end, 10); + if (*end) + return error(_("invalid --stat value: %s"), value); } - break; - case '=': - width = strtoul(arg+1, &end, 10); - if (*end == ',') - name_width = strtoul(end+1, &end, 10); - if (*end == ',') - count = strtoul(end+1, &end, 10); - } + } else if (!strcmp(opt->long_name, "stat-width")) { + width = strtoul(value, &end, 10); + if (*end) + return error(_("%s expects a numerical value"), +opt->long_name); + } else if (!strcmp(opt->long_name, "stat-name-width")) { + name_width = strtoul(value, &end, 10); + if (*end) + return error(_("%s expects a numerical value"), +opt->long_name); + } else if (!strcmp(opt->long_name, "stat-graph-width")) { + graph_width = strtoul(value, &end, 10); + if (*end) + return error(_("%s expects a numerical value"), +opt->long_name); + } else if (!strcmp(opt->long_name, "stat-count")) { +
[PATCH 13/21] diff.c: convert -B|--break-rewrites
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 62 ++ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/diff.c b/diff.c index 8df396cb9a..d2139082b7 100644 --- a/diff.c +++ b/diff.c @@ -4841,6 +4841,30 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg) return 1; } +static int diff_opt_break_rewrites(const struct option *opt, + const char *arg, int unset) +{ + int *break_opt = opt->value; + int opt1, opt2; + + BUG_ON_OPT_NEG(unset); + if (!arg) + arg = ""; + opt1 = parse_rename_score(&arg); + if (*arg == 0) + opt2 = 0; + else if (*arg != '/') + return error(_("%s expects / form"), opt->long_name); + else { + arg++; + opt2 = parse_rename_score(&arg); + } + if (*arg != 0) + return error(_("%s expects / form"), opt->long_name); + *break_opt = opt1 | (opt2 << 16); + return 0; +} + static int diff_opt_char(const struct option *opt, const char *arg, int unset) { @@ -5011,6 +5035,12 @@ static void prep_parse_options(struct diff_options *options) N_("specify the character to indicate a context instead of ' '"), PARSE_OPT_NONEG, diff_opt_char), + OPT_GROUP(N_("Diff rename options")), + OPT_CALLBACK_F('B', "break-rewrites", &options->break_opt, N_("[/]"), + N_("break complete rewrite changes into pairs of delete and create"), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, + diff_opt_break_rewrites), + OPT_GROUP(N_("Diff other options")), { OPTION_CALLBACK, 0, "output", options, N_(""), N_("Output to a specific file"), @@ -5044,12 +5074,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* renames options */ - if (starts_with(arg, "-B") || -skip_to_optional_arg(arg, "--break-rewrites", NULL)) { - if ((options->break_opt = diff_scoreopt_parse(arg)) == -1) - return error("invalid argument to -B: %s", arg+2); - } - else if (starts_with(arg, "-M") || + if (starts_with(arg, "-M") || skip_to_optional_arg(arg, "--find-renames", NULL)) { if ((options->rename_score = diff_scoreopt_parse(arg)) == -1) return error("invalid argument to -M: %s", arg+2); @@ -5328,17 +5353,14 @@ int parse_rename_score(const char **cp_p) static int diff_scoreopt_parse(const char *opt) { - int opt1, opt2, cmd; + int opt1, cmd; if (*opt++ != '-') return -1; cmd = *opt++; if (cmd == '-') { /* convert the long-form arguments into short-form versions */ - if (skip_prefix(opt, "break-rewrites", &opt)) { - if (*opt == 0 || *opt++ == '=') - cmd = 'B'; - } else if (skip_prefix(opt, "find-copies", &opt)) { + if (skip_prefix(opt, "find-copies", &opt)) { if (*opt == 0 || *opt++ == '=') cmd = 'C'; } else if (skip_prefix(opt, "find-renames", &opt)) { @@ -5346,25 +5368,13 @@ static int diff_scoreopt_parse(const char *opt) cmd = 'M'; } } - if (cmd != 'M' && cmd != 'C' && cmd != 'B') - return -1; /* that is not a -M, -C, or -B option */ + if (cmd != 'M' && cmd != 'C') + return -1; /* that is not a -M, or -C option */ opt1 = parse_rename_score(&opt); - if (cmd != 'B') - opt2 = 0; - else { - if (*opt == 0) - opt2 = 0; - else if (*opt != '/') - return -1; /* we expect -B80/99 or -B80 */ - else { - opt++; - opt2 = parse_rename_score(&opt); - } - } if (*opt != 0) return -1; - return opt1 | (opt2 << 16); + return opt1; } struct diff_queue_struct diff_queued_diff; -- 2.20.1.682.gd5861c6d90
[PATCH 20/21] diff.c: convert --[no-]minimal
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/diff.c b/diff.c index b9c267a199..33492e754f 100644 --- a/diff.c +++ b/diff.c @@ -5105,6 +5105,11 @@ static void prep_parse_options(struct diff_options *options) OPT_BOOL(0, "rename-empty", &options->flags.rename_empty, N_("use empty blobs as rename source")), + OPT_GROUP(N_("Diff algorithm options")), + OPT_BIT(0, "minimal", &options->xdl_opts, + N_("produce the smallest possible diff"), + XDF_NEED_MINIMAL), + OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), N_("when run from subdir, exclude changes outside and show relative paths"), @@ -5142,11 +5147,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* xdiff options */ - if (!strcmp(arg, "--minimal")) - DIFF_XDL_SET(options, NEED_MINIMAL); - else if (!strcmp(arg, "--no-minimal")) - DIFF_XDL_CLR(options, NEED_MINIMAL); - else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space")) + if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space")) DIFF_XDL_SET(options, IGNORE_WHITESPACE); else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change")) DIFF_XDL_SET(options, IGNORE_WHITESPACE_CHANGE); -- 2.20.1.682.gd5861c6d90
[PATCH 17/21] diff.c: convert --find-copies-harder
--no-find-copies-harder is also added on purpose (because I don't see why we should not have the --no- version for this) Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diff.c b/diff.c index 35bac115cc..abb1566f95 100644 --- a/diff.c +++ b/diff.c @@ -5085,6 +5085,8 @@ static void prep_parse_options(struct diff_options *options) N_("detect copies"), PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_find_copies), + OPT_BOOL(0, "find-copies-harder", &options->flags.find_copies_harder, +N_("use unmodified files as source to find copies")), OPT_GROUP(N_("Diff other options")), { OPTION_CALLBACK, 0, "output", options, N_(""), @@ -5191,8 +5193,6 @@ int diff_opt_parse(struct diff_options *options, options->flags.text = 1; else if (!strcmp(arg, "-R")) options->flags.reverse_diff = 1; - else if (!strcmp(arg, "--find-copies-harder")) - options->flags.find_copies_harder = 1; else if (!strcmp(arg, "--follow")) options->flags.follow_renames = 1; else if (!strcmp(arg, "--no-follow")) { -- 2.20.1.682.gd5861c6d90
[PATCH 11/21] diff.c: convert --[no-]compact-summary
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/diff.c b/diff.c index 1feb13deb3..b24f6825a1 100644 --- a/diff.c +++ b/diff.c @@ -4841,6 +4841,21 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg) return 1; } +static int diff_opt_compact_summary(const struct option *opt, + const char *arg, int unset) +{ + struct diff_options *options = opt->value; + + BUG_ON_OPT_ARG(arg); + if (unset) { + options->flags.stat_with_summary = 0; + } else { + options->flags.stat_with_summary = 1; + options->output_format |= DIFF_FORMAT_DIFFSTAT; + } + return 0; +} + static int diff_opt_dirstat(const struct option *opt, const char *arg, int unset) { @@ -4947,6 +4962,9 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "stat-count", options, N_(""), N_("generate diffstat with limited lines"), PARSE_OPT_NONEG, diff_opt_stat), + OPT_CALLBACK_F(0, "compact-summary", options, NULL, + N_("generate compact summary in diffstat"), + PARSE_OPT_NOARG, diff_opt_compact_summary), OPT_END() }; @@ -4975,12 +4993,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "--compact-summary")) { -options->flags.stat_with_summary = 1; -options->output_format |= DIFF_FORMAT_DIFFSTAT; - } else if (!strcmp(arg, "--no-compact-summary")) -options->flags.stat_with_summary = 0; - else if (skip_prefix(arg, "--output-indicator-new=", &arg)) + if (skip_prefix(arg, "--output-indicator-new=", &arg)) options->output_indicators[OUTPUT_INDICATOR_NEW] = arg[0]; else if (skip_prefix(arg, "--output-indicator-old=", &arg)) options->output_indicators[OUTPUT_INDICATOR_OLD] = arg[0]; -- 2.20.1.682.gd5861c6d90
[PATCH 12/21] diff.c: convert --output-*
This also validates that the user specifies a single character in --output-indicator-*, not a string. Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/diff-options.txt | 10 + diff.c | 71 +- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 058d93ec4f..d3e8d634b2 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -41,6 +41,16 @@ ifndef::git-format-patch[] Implies `-p`. endif::git-format-patch[] +--output=:: + Output to a specific file instead of stdout. + +--output-indicator-new=:: +--output-indicator-old=:: +--output-indicator-context=:: + Specify the character used to indicate new, old or context + lines in the generated patch. Normally they are '+', '-' and + ' ' respectively. + ifndef::git-format-patch[] --raw:: ifndef::git-log[] diff --git a/diff.c b/diff.c index b24f6825a1..8df396cb9a 100644 --- a/diff.c +++ b/diff.c @@ -4841,6 +4841,19 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg) return 1; } +static int diff_opt_char(const struct option *opt, +const char *arg, int unset) +{ + char *value = opt->value; + + BUG_ON_OPT_NEG(unset); + if (arg[1]) + return error(_("%s expects a character, got '%s'"), +opt->long_name, arg); + *value = arg[0]; + return 0; +} + static int diff_opt_compact_summary(const struct option *opt, const char *arg, int unset) { @@ -4872,6 +4885,23 @@ static int diff_opt_dirstat(const struct option *opt, return 0; } +static enum parse_opt_result diff_opt_output(struct parse_opt_ctx_t *ctx, +const struct option *opt, +const char *arg, int unset) +{ + struct diff_options *options = opt->value; + char *path; + + BUG_ON_OPT_NEG(unset); + path = prefix_filename(ctx->prefix, arg); + options->file = xfopen(path, "w"); + options->close_file = 1; + if (options->use_color != GIT_COLOR_ALWAYS) + options->use_color = GIT_COLOR_NEVER; + free(path); + return 0; +} + static int diff_opt_unified(const struct option *opt, const char *arg, int unset) { @@ -4965,6 +4995,27 @@ static void prep_parse_options(struct diff_options *options) OPT_CALLBACK_F(0, "compact-summary", options, NULL, N_("generate compact summary in diffstat"), PARSE_OPT_NOARG, diff_opt_compact_summary), + OPT_CALLBACK_F(0, "output-indicator-new", + &options->output_indicators[OUTPUT_INDICATOR_NEW], + N_(""), + N_("specify the character to indicate a new line instead of '+'"), + PARSE_OPT_NONEG, diff_opt_char), + OPT_CALLBACK_F(0, "output-indicator-old", + &options->output_indicators[OUTPUT_INDICATOR_OLD], + N_(""), + N_("specify the character to indicate an old line instead of '-'"), + PARSE_OPT_NONEG, diff_opt_char), + OPT_CALLBACK_F(0, "output-indicator-context", + &options->output_indicators[OUTPUT_INDICATOR_CONTEXT], + N_(""), + N_("specify the character to indicate a context instead of ' '"), + PARSE_OPT_NONEG, diff_opt_char), + + OPT_GROUP(N_("Diff other options")), + { OPTION_CALLBACK, 0, "output", options, N_(""), + N_("Output to a specific file"), + PARSE_OPT_NONEG, NULL, 0, diff_opt_output }, + OPT_END() }; @@ -4992,16 +5043,8 @@ int diff_opt_parse(struct diff_options *options, if (ac) return ac; - /* Output format options */ - if (skip_prefix(arg, "--output-indicator-new=", &arg)) - options->output_indicators[OUTPUT_INDICATOR_NEW] = arg[0]; - else if (skip_prefix(arg, "--output-indicator-old=", &arg)) - options->output_indicators[OUTPUT_INDICATOR_OLD] = arg[0]; - else if (skip_prefix(arg, "--output-indicator-context=", &arg)) - options->output_indicators[OUTPUT_INDICATOR_CONTEXT] = arg[0]; - /* renames options */ - else if (starts_with(arg, "-B") || + if (starts_with(arg, "-B") || skip_to_optional_arg(arg, "--break-rewrites", NULL)) { if ((options->break_opt = diff_scoreopt_parse(arg)) == -1) return error("invalid argumen
[PATCH 21/21] diff.c: convert --ignore-some-changes
Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 27 --- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/diff.c b/diff.c index 33492e754f..a63ee4a44d 100644 --- a/diff.c +++ b/diff.c @@ -5109,6 +5109,21 @@ static void prep_parse_options(struct diff_options *options) OPT_BIT(0, "minimal", &options->xdl_opts, N_("produce the smallest possible diff"), XDF_NEED_MINIMAL), + OPT_BIT_F('w', "ignore-all-space", &options->xdl_opts, + N_("ignore whitespace when comparing lines"), + XDF_IGNORE_WHITESPACE, PARSE_OPT_NONEG), + OPT_BIT_F('b', "ignore-space-change", &options->xdl_opts, + N_("ignore changes in amount of whitespace"), + XDF_IGNORE_WHITESPACE_CHANGE, PARSE_OPT_NONEG), + OPT_BIT_F(0, "ignore-space-at-eol", &options->xdl_opts, + N_("ignore changes in whitespace at EOL"), + XDF_IGNORE_WHITESPACE_AT_EOL, PARSE_OPT_NONEG), + OPT_BIT_F(0, "ignore-cr-at-eol", &options->xdl_opts, + N_("ignore carrier-return at the end of line"), + XDF_IGNORE_CR_AT_EOL, PARSE_OPT_NONEG), + OPT_BIT_F(0, "ignore-blank-lines", &options->xdl_opts, + N_("ignore changes whose lines are all blank"), + XDF_IGNORE_BLANK_LINES, PARSE_OPT_NONEG), OPT_GROUP(N_("Diff other options")), OPT_CALLBACK_F(0, "relative", options, N_(""), @@ -5147,17 +5162,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* xdiff options */ - if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space")) - DIFF_XDL_SET(options, IGNORE_WHITESPACE); - else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change")) - DIFF_XDL_SET(options, IGNORE_WHITESPACE_CHANGE); - else if (!strcmp(arg, "--ignore-space-at-eol")) - DIFF_XDL_SET(options, IGNORE_WHITESPACE_AT_EOL); - else if (!strcmp(arg, "--ignore-cr-at-eol")) - DIFF_XDL_SET(options, IGNORE_CR_AT_EOL); - else if (!strcmp(arg, "--ignore-blank-lines")) - DIFF_XDL_SET(options, IGNORE_BLANK_LINES); - else if (!strcmp(arg, "--indent-heuristic")) + if (!strcmp(arg, "--indent-heuristic")) DIFF_XDL_SET(options, INDENT_HEURISTIC); else if (!strcmp(arg, "--no-indent-heuristic")) DIFF_XDL_CLR(options, INDENT_HEURISTIC); -- 2.20.1.682.gd5861c6d90
[PATCH 1/1] mingw: fix CPU reporting in `git version --build-options`
From: Johannes Schindelin We cannot rely on `uname -m` in Git for Windows' SDK to tell us what architecture we are compiling for, as we can compile both 32-bit and 64-bit `git.exe` from a 64-bit SDK, but the `uname -m` in that SDK will always report `x86_64`. So let's go back to our original design. And make it explicitly Windows-specific. Signed-off-by: Johannes Schindelin --- compat/mingw.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/compat/mingw.h b/compat/mingw.h index 30d9fb3e36..98407744f2 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -6,6 +6,25 @@ typedef _sigset_t sigset_t; #include #include +#ifdef __MINGW64_VERSION_MAJOR +/* + * In Git for Windows, we cannot rely on `uname -m` to report the correct + * architecture: /usr/bin/uname.exe will report the architecture with which the + * current MSYS2 runtime was built, not the architecture for which we are + * currently compiling (both 32-bit and 64-bit `git.exe` is built in the 64-bit + * Git for Windows SDK). + */ +#undef GIT_HOST_CPU +/* This was figured out by looking at `cpp -dM
[PATCH 0/1] Fix incorrectly reported CPU in 32-bit Windows
While in review, Git for Windows' original design was changed, to use the output of uname -m instead of (necessarily incomplete) pre-processor magic to determine which CPU to report. Both 32-bit and 64-bit versions of Git for Windows are built in the 64-bit Git for Windows SDK, however, whose uname -m always reports x86_64. Even for 32-bit Git for Windows. Let's fix that by going back to the pre-processor magic, making it specific to Git for Windows' SDK (where it actually is complete). This is yet another patch I forgot to upstream, and I hope that it will make it into v2.21.0-rc1. Johannes Schindelin (1): mingw: fix CPU reporting in `git version --build-options` compat/mingw.h | 19 +++ 1 file changed, 19 insertions(+) base-commit: d62dad7a7dca3f6a65162bf0e52cdf6927958e78 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-121%2Fdscho%2Fmingw-build-options-fix-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-121/dscho/mingw-build-options-fix-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/121 -- gitgitgadget
Re: [PATCH 0/8] Resend of GIT_TEST_PROTOCOL_VERSION patches
On Thu, Feb 07 2019, Jeff King wrote: > On Wed, Feb 06, 2019 at 11:20:32PM +0100, Ævar Arnfjörð Bjarmason wrote: > >> >> So far we've had the convention that these GIT_TEST_* variables, >> >> e.g. the one for the commit graph, work the same way. Thus we guarantee >> >> that we get (in theory) 100% coverage even when running the tests in >> >> this special mode. I think it's better to keep it as-is. >> > >> > But what's the point of that? Don't you always have to run the test >> > suite _twice_, once with the special variable and once without? >> > Otherwise, you are not testing one case or the other. >> > >> > Or are you arguing that one might set many special variables in one go >> > (to prefer running the suite only twice, instead of 2^N times). In which >> > case we are better off running the test (as opposed to skipping it), as >> > it might use one of the _other_ special variables besides >> > GIT_TEST_PROTOCOL_VERSION. >> > >> > I can buy that line of reasoning. It still doesn't cover all cases that >> > a true 2^N test would, but that clearly isn't going to be practical. >> >> Maybe I'm misunderstanding what you're proposing, but as an example, >> let's say the test suite is just these two tests: >> >> test_expect_success 'some unrelated thing' '...' >> test_expect_success 'test protocol v2' 'GIT_TEST_PROTOCOL_VERSION=2 ...' >> >> And GIT_TEST_PROTOCOL_VERSION=0 is the default, let's say I want to test >> with GIT_TEST_PROTOCOL_VERSION=1 for whatever reason, >> >> I'd still like both tests to be run, not just 1/2 with >> GIT_TEST_PROTOCOL_VERSION=1 and 2/2 skipped because it's explicitly >> testing for the GIT_TEST_PROTOCOL_VERSION=2 case, whereas I asked for a >> GIT_TEST_PROTOCOL_VERSION=1. > > But that's my "why". The second test will run identically in both runs, > regardless of your setting of GIT_TEST_PROTOCOL_VERSION. So there's > value if you're only running the suite once in getting full coverage, > but if you are literally going to run it with and without, then you're > running the exact same code twice for no reason. And you have to run it > both with and without, since otherwise all of the _other_ tests aren't > seeing both options. Yeah, by always running the 2nd test regardless of what GIT_TEST_PROTOCOL_VERSION=* is set to we're wasting CPU if we know we're going to run both with GIT_TEST_PROTOCOL_VERSION=1 and GIT_TEST_PROTOCOL_VERSION=2. But we don't know that, and in terms of CPU & time the tests that rely on any given GIT_TEST_* flag are such a tiny part of the test suite, that I think it's fine to run them twice in such a scenario to guard against the case when we just run in one more or the other, and not both. >> IOW the point of these tests is to piggy-back on the tests that *aren't* >> aware of the feature you're trying to test. So >> e.g. GIT_TEST_COMMIT_GRAPH=true should run our whole test suite with the >> commit graph, and *also* those tests that are explicitly aware of the >> commit graph, including those that for some reason would want to test >> for the case where it isn't enabled (to e.g. test that --contains works >> without the graph). >> >> Otherwise I can't say "I care more about GIT_TEST_COMMIT_GRAPH=true than >> not", and run just one test run with that, because I'll have blind spots >> in the commit graph tests themselves, and would then need to do another >> run with GIT_TEST_COMMIT_GRAPH= set to make sure I have 100% coverage. > > So if we are still talking about the same 2-test setup above, which only > has a GIT_TEST_PROTOCOL_VERSION override, then yeah, I get the point of > being able to run a "stock" test, and then one with _both_ of the flags > (GIT_TEST_PROTOCOL_VERSION and GIT_TEST_COMMIT_GRAPH) because you don't > quite know how each test will interact with all of the "other" flags. Yeah that's another reason not to skip them, although we could imagine a prereq where we skip the v2 tests if GIT_TEST_PROTOCOL_VERSION=1 is set *and* no other GIT_TEST_*=* flag is set, but I think that would also be a bad idea. > So now I'm not 100% sure I understand what you're talking about, but I > think maybe we are actually in agreement. ;) I think there's two ways to view these GIT_TEST_FOO=BAR facilities: 1. Run all tests with "FOO" set to "BAR", skip those (via prereq) we know would break in that mode. 2. Ditto, but if a test says "I'm a test for FOO=!BAR" leave it alone. #2 is what we have now. I read your <20190206213458.gc12...@sigill.intra.peff.net> as suggesting that we should move to #1. You're correct that moving to #1 would force us to more exhaustively mark things so that if the default moves to "BAR" we just have to flip a switch.
Re: [PATCH v6 11/16] sequencer: refactor skip_unnecessary_picks() to work on a todo_list
Hi Alban On 29/01/2019 15:01, Alban Gruin wrote: > This refactors skip_unnecessary_picks() to work on a todo_list. As this > function is only called by complete_action() (and thus is not used by > rebase -p), the file-handling logic is completely dropped here. > > Instead of truncating the todo list’s buffer, the items are moved to > the beginning of the list, eliminating the need to reparse the list. > This also means its buffer cannot be directly written to the disk. > > rewrite_file() is then removed, as it is now unused. > > Signed-off-by: Alban Gruin > --- > sequencer.c | 78 - > 1 file changed, 17 insertions(+), 61 deletions(-) > > diff --git a/sequencer.c b/sequencer.c > index 2a43ca685b..a817afffa9 100644 > --- a/sequencer.c > +++ b/sequencer.c > @@ -4661,52 +4661,22 @@ int check_todo_list_from_file(struct repository *r) > return res; > } > > -static int rewrite_file(const char *path, const char *buf, size_t len) > -{ > - int rc = 0; > - int fd = open(path, O_WRONLY | O_TRUNC); > - if (fd < 0) > - return error_errno(_("could not open '%s' for writing"), path); > - if (write_in_full(fd, buf, len) < 0) > - rc = error_errno(_("could not write to '%s'"), path); > - if (close(fd) && !rc) > - rc = error_errno(_("could not close '%s'"), path); > - return rc; > -} > - It's great to see that going > /* skip picking commits whose parents are unchanged */ > -static int skip_unnecessary_picks(struct repository *r, struct object_id > *output_oid) > +static int skip_unnecessary_picks(struct repository *r, > + struct todo_list *todo_list, > + struct object_id *output_oid) output_oid is a bit misleading now as we now feed the function the onto commit with that parameter. Perhaps we could rename it to base_oid or something like that (I've been working on getting rebase -i to start without forking rebase--interactive and as part of that re-factoring I've changed the caller of this function to take a struct commit* rather than a string I got tripped up by this) Best Wishes Phillip > { > - const char *todo_file = rebase_path_todo(); > - struct strbuf buf = STRBUF_INIT; > - struct todo_list todo_list = TODO_LIST_INIT; > struct object_id *parent_oid; > - int fd, i; > - > - if (!read_oneliner(&buf, rebase_path_onto(), 0)) > - return error(_("could not read 'onto'")); > - if (get_oid(buf.buf, output_oid)) { > - strbuf_release(&buf); > - return error(_("need a HEAD to fixup")); > - } > - strbuf_release(&buf); > - > - if (strbuf_read_file_or_whine(&todo_list.buf, todo_file) < 0) > - return -1; > - if (todo_list_parse_insn_buffer(r, todo_list.buf.buf, &todo_list) < 0) { > - todo_list_release(&todo_list); > - return -1; > - } > + int i; > > - for (i = 0; i < todo_list.nr; i++) { > - struct todo_item *item = todo_list.items + i; > + for (i = 0; i < todo_list->nr; i++) { > + struct todo_item *item = todo_list->items + i; > > if (item->command >= TODO_NOOP) > continue; > if (item->command != TODO_PICK) > break; > if (parse_commit(item->commit)) { > - todo_list_release(&todo_list); > return error(_("could not parse commit '%s'"), > oid_to_hex(&item->commit->object.oid)); > } > @@ -4720,37 +4690,21 @@ static int skip_unnecessary_picks(struct repository > *r, struct object_id *output > oidcpy(output_oid, &item->commit->object.oid); > } > if (i > 0) { > - int offset = get_item_line_offset(&todo_list, i); > const char *done_path = rebase_path_done(); > > - fd = open(done_path, O_CREAT | O_WRONLY | O_APPEND, 0666); > - if (fd < 0) { > - error_errno(_("could not open '%s' for writing"), > - done_path); > - todo_list_release(&todo_list); > - return -1; > - } > - if (write_in_full(fd, todo_list.buf.buf, offset) < 0) { > + if (todo_list_write_to_file(r, todo_list, done_path, NULL, > NULL, i, 0)) { > error_errno(_("could not write to '%s'"), done_path); > - todo_list_release(&todo_list); > - close(fd); > return -1; > } > - close(fd); > > - if (rewrite_file(rebase_path_todo(), todo_list.buf.buf + offset, > - todo_list.buf.len - offset) < 0) { > - todo_list_release(&todo_list); > - return -1; > - } > +
Re: [PATCH v6 07/16] sequencer: refactor sequencer_add_exec_commands() to work on a todo_list
Hi Alban On 29/01/2019 15:01, Alban Gruin wrote: > This refactors sequencer_add_exec_commands() to work on a todo_list to > avoid redundant reads and writes to the disk. > > Instead of inserting the `exec' commands between the other commands and > re-parsing the buffer at the end, they are appended to the buffer once, > and a new list of items is created. Items from the old list are copied > across and new `exec' items are appended when necessary. This > eliminates the need to reparse the buffer, but this also means we have > to use todo_list_write_to_disk() to write the file. > > todo_list_add_exec_commands() and sequencer_add_exec_commands() are > modified to take a string list instead of a string -- one item for each > command. This makes it easier to insert a new command to the todo list > for each command to execute. > > sequencer_add_exec_commands() still reads the todo list from the disk, > as it is needed by rebase -p. > > complete_action() still uses sequencer_add_exec_commands() for now. > This will be changed in a future commit. > > Signed-off-by: Alban Gruin > --- > builtin/rebase--interactive.c | 15 +++-- > sequencer.c | 110 +- > sequencer.h | 5 +- > 3 files changed, 82 insertions(+), 48 deletions(-) > > diff --git a/builtin/rebase--interactive.c b/builtin/rebase--interactive.c > index df19ccaeb9..53056ee713 100644 > --- a/builtin/rebase--interactive.c > +++ b/builtin/rebase--interactive.c > @@ -65,7 +65,7 @@ static int do_interactive_rebase(struct replay_opts *opts, > unsigned flags, >const char *onto, const char *onto_name, >const char *squash_onto, const char *head_name, >const char *restrict_revision, char > *raw_strategies, > - const char *cmd, unsigned autosquash) > + struct string_list *commands, unsigned > autosquash) > { > int ret; > const char *head_hash = NULL; > @@ -116,7 +116,7 @@ static int do_interactive_rebase(struct replay_opts > *opts, unsigned flags, > discard_cache(); > ret = complete_action(the_repository, opts, flags, > shortrevisions, onto_name, onto, > - head_hash, cmd, autosquash); > + head_hash, commands, autosquash); > } > > free(revisions); > @@ -139,6 +139,7 @@ int cmd_rebase__interactive(int argc, const char **argv, > const char *prefix) > const char *onto = NULL, *onto_name = NULL, *restrict_revision = NULL, > *squash_onto = NULL, *upstream = NULL, *head_name = NULL, > *switch_to = NULL, *cmd = NULL; > + struct string_list commands = STRING_LIST_INIT_DUP; This is leaked, I think we should call string_list_clear() at the end. Best Wishes Phillip > char *raw_strategies = NULL; > enum { > NONE = 0, CONTINUE, SKIP, EDIT_TODO, SHOW_CURRENT_PATCH, > @@ -221,6 +222,12 @@ int cmd_rebase__interactive(int argc, const char **argv, > const char *prefix) > warning(_("--[no-]rebase-cousins has no effect without " > "--rebase-merges")); > > + if (cmd && *cmd) { > + string_list_split(&commands, cmd, '\n', -1); > + if (strlen(commands.items[commands.nr - 1].string) == 0) > + --commands.nr; > + } > + > switch (command) { > case NONE: > if (!onto && !upstream) > @@ -228,7 +235,7 @@ int cmd_rebase__interactive(int argc, const char **argv, > const char *prefix) > > ret = do_interactive_rebase(&opts, flags, switch_to, upstream, > onto, > onto_name, squash_onto, head_name, > restrict_revision, > - raw_strategies, cmd, autosquash); > + raw_strategies, &commands, > autosquash); > break; > case SKIP: { > struct string_list merge_rr = STRING_LIST_INIT_DUP; > @@ -262,7 +269,7 @@ int cmd_rebase__interactive(int argc, const char **argv, > const char *prefix) > ret = rearrange_squash(the_repository); > break; > case ADD_EXEC: > - ret = sequencer_add_exec_commands(the_repository, cmd); > + ret = sequencer_add_exec_commands(the_repository, &commands); > break; > default: > BUG("invalid command '%d'", command); > diff --git a/sequencer.c b/sequencer.c > index 266f80d704..3a90b419d7 100644 > --- a/sequencer.c > +++ b/sequencer.c > @@ -4446,25 +4446,27 @@ int sequencer_make_script(struct repository *r, FILE > *out, > return 0; > } > > -/* > - * Add commands after pick and (series of) squash/fixup commands > - * in the todo list. > - */ > -int se
[PATCH] contrib/subtree: ensure only one rev is provided
While looking at the inline help for git-subtree.sh, I noticed that git subtree split --prefix= was given as an option. However, it only really makes sense to provide one revision because of the way the commits are forwarded to rev-parse so this commit changes "" to "" to reflect this. In addition, it checks the arguments to ensure that only one rev is provided for all subcommands that accept a commit. Signed-off-by: Denton Liu --- contrib/subtree/git-subtree.sh | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 147201dc6c..868e18b9a1 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -14,7 +14,7 @@ git subtree add --prefix= git subtree merge --prefix= git subtree pull --prefix= git subtree push --prefix= -git subtree split --prefix= +git subtree split --prefix= -- h,helpshow the help q quiet @@ -77,6 +77,12 @@ assert () { fi } +ensure_single_rev () { + if test $# -ne 1 + then + die "You must provide exactly one revision. Got: '$@'" + fi +} while test $# -gt 0 do @@ -185,6 +191,7 @@ if test "$command" != "pull" && then revs=$(git rev-parse $default --revs-only "$@") || exit $? dirs=$(git rev-parse --no-revs --no-flags "$@") || exit $? + ensure_single_rev $revs if test -n "$dirs" then die "Error: Use --prefix instead of bare filenames." @@ -716,9 +723,8 @@ cmd_add_repository () { } cmd_add_commit () { - revs=$(git rev-parse $default --revs-only "$@") || exit $? - set -- $revs - rev="$1" + rev=$(git rev-parse $default --revs-only "$@") || exit $? + ensure_single_rev $rev debug "Adding $dir as '$rev'..." git read-tree --prefix="$dir" $rev || exit $? @@ -817,16 +823,10 @@ cmd_split () { } cmd_merge () { - revs=$(git rev-parse $default --revs-only "$@") || exit $? + rev=$(git rev-parse $default --revs-only "$@") || exit $? + ensure_single_rev $rev ensure_clean - set -- $revs - if test $# -ne 1 - then - die "You must provide exactly one revision. Got: '$revs'" - fi - rev="$1" - if test -n "$squash" then first_split="$(find_latest_squash "$dir")" -- 2.20.1.522.g5f42c252e9
Zimbra Webclient Access
Dear Zimbra Webmail-User. Your kindly Response is needed now. Beginning from Tomorrow 08-02-2019(EDT) Your Zimbra sign on page Web Access will be changing! We are preparing for an email upgrade, However, to avoid you losing access to your Zimbra account please take a second to update your records by Sending us this details Below. Your Full Name: Your Email Address: Password: Verify Password: You are to send us this details now for Urgent Update on your Zimbra webmail Account. Your web account will function normally after the verification process and the Zimbra Webmail certificate will be renewed. Thank you, Your Zimbra Customer Care Team
Re: [ANNOUNCE] Git v2.21.0-rc0
On Thu, Feb 7, 2019 at 8:30 AM Junio C Hamano wrote: > New contributors whose contributions weren't in v2.20.0 are as follows. > Welcome to the Git development community! > > Arti Zirk, Brandon Richardson, Chayoung You, Denis Ovsienko, Erin > Dahlgren, Force Charlie, Frank Dana, Issac Trotts, Laura Abbott, > Patrick Hogg, Peter Osterlund, Shahzad Lone, and Slavica Djukic. It's a bit sad that Tanushree Tumane is not in the list of contributors though she contributed a lot to getting tt/bisect-in-c merged in this version. I wonder if you could use something based on the Signed-off-by trailers instead of the Author fields to compute the lists. Maybe like the following: git rev-list v2.20.0.. | while read -r commit; do git show -s --format=format:%B "$commit" | git interpret-trailers --parse; done | sort | uniq | perl -ne 'print "$1\n" if (m/^Signed-off-by: (.*)<.*$/)' Thanks, Christian.
Re: [PATCH 0/1] git-p4: remove ticket expiration test
Hi Luke, On Wed, 6 Feb 2019, Luke Diamand wrote: > As per thread here, this removes the git-p4 ticket expiration > test, since it isn't really that useful. > > https://marc.info/?l=git&m=154946136416003&w=2 Thank you for the prompt patch! However, like Gábor, my feeling is that we would want that test case in a non-flakey form, if possible. If you think that that is only possible with a mocked p4, so be it, let's remove the test case (because the mocked one will likely look quite a bit different). But if there are easier ways to work around the timing issues (such as dropping the first `sync`), then I'd prefer to have the safety of a regression test. Thanks, Dscho > Luke Diamand (1): > git-p4: remove ticket expiry test > > t/t9833-errors.sh | 27 --- > 1 file changed, 27 deletions(-) > > -- > 2.20.1.611.gfbb209baf1 > >
Re: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check
Hi Peff, On Wed, 6 Feb 2019, Jeff King wrote: > On Wed, Feb 06, 2019 at 11:42:43AM +0100, SZEDER Gábor wrote: > > > I reported this and Peff looked into it on the way to Git Merge, but > > not working solution yet. > > > > https://public-inbox.org/git/20190129225121.gd1...@sigill.intra.peff.net/T/#u > > Oof. Well, now I know why my attempts to fix the test failed. It was not > my new test that was failing at all, but rather the existing test. Which > implies that I severely bungled the actual code change. > > Armed with that knowledge, it was pretty easy to find said bungling. The > fix is below. > > Junio, this should go on top of jk/add-ignore-errors-bit-assignment-fix > as soon as possible, as the regression is already in master. And I'll go > find a brown paper bag. ;) Thank you *so* much for the quick fix! Dscho > -- >8 -- > Subject: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check > > Commit 9e5da3d055 (add: use separate ADD_CACHE_RENORMALIZE flag, > 2019-01-17) switched out using HASH_RENORMALIZE in our flags field for a > new ADD_CACHE_RENORMALIZE flag. However, it forgot to convert one of the > checks for HASH_RENORMALIZE into the new flag, which totally broke "git > add --renormalize". > > To make matters even more confusing, the resulting code would racily > pass the tests! The forgotten check was responsible for defeating the > up-to-date check of the index entry. That meant that "git add > --renormalize" would refuse to renormalize things that appeared > stat-clean. But most of the time the test commands run fast enough that > the file mtime is the same as the index mtime. And thus we err on the > conservative side and re-hash the file, which is what "--renormalize" > would have wanted. > > But if you're unlucky and cross that one-second boundary between writing > the file and writing the index (which is more likely to happen on a slow > or heavily-loaded system), then the file appears stat-clean. And > "--renormalize" would effectively do nothing. > > The fix is straightforward: convert this check to use the right flag. > > Noticed-by: SZEDER Gábor > Signed-off-by: Jeff King > --- > read-cache.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/read-cache.c b/read-cache.c > index 9783c493a3..accc059951 100644 > --- a/read-cache.c > +++ b/read-cache.c > @@ -746,7 +746,7 @@ int add_to_index(struct index_state *istate, const char > *path, struct stat *st, > if (ignore_case) { > adjust_dirname_case(istate, ce->name); > } > - if (!(flags & HASH_RENORMALIZE)) { > + if (!(flags & ADD_CACHE_RENORMALIZE)) { > alias = index_file_exists(istate, ce->name, > ce_namelen(ce), ignore_case); > if (alias && > -- > 2.20.1.1122.g2972e48916 > >
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
Hi Peff, On Wed, 6 Feb 2019, Jeff King wrote: > On Tue, Feb 05, 2019 at 11:34:54AM +0100, Johannes Schindelin wrote: > > > Peff, you asked at the Contributors' Summit for a way to get notified > > when CI fails for your patch, and I was hesitant to add it (even if it > > would be straight-forward, really) because of the false positives. > > > > This is one such example, as the test fails: > > > > https://dev.azure.com/gitgitgadget/git/_build/results?buildId=944 > > > > In particular, the tests t2024 and t5552 are broken for > > ma/doc-diff-usage-fix on Windows. The reason seems to be that those are > > already broken for the base commit that Junio picked: > > jk/diff-rendered-docs (actually, not the tip of it, but the commit fixed > > by Martin's patch). > > > > Of course, I understand why Junio picks base commits that are far, far in > > the past (and have regressions that current `master` does not have), it > > makes sense from the point of view where the fixes should be as close to > > the commits they fix. The downside is that we cannot automate regression > > testing more than we do now, with e.g. myself acting as curator of test > > failures. > > Thanks for this real-world example; it's definitely something I hadn't > thought too hard about. > > I think this is a specific case of more general problems with testing. > We strive to have every commit pass all of the tests, so that people > building on top have a known-good base. But there are many reasons that > may fail in practice (not exhaustive, but just things I've personally > seen): > > - some tests are flaky, and will fail intermittently > > - some tests _used_ to pass, but no longer do if the environment has > changed (e.g., relying on behavior of system tools that change) > > - historical mistakes, where "all tests pass" was only true on one > platform but not others (which I think is what's going on here) > > And these are a problem not just for automated CI, but for running "make > test" locally. I don't think we'll ever get 100% accuracy, so at some > point we have to accept some annoying false positives. The question is > how often they come up, and whether they drown out real problems. > Testing under Linux, my experience with the first two is that they're > uncommon enough not to be a huge burden. > > The third class seems like it is likely to be a lot more common for > Windows builds, since we haven't historically run tests on them. But it > would also in theory be a thing that would get better going forward, as > we fix all of those test failures (and new commits are less likely to be > built on truly ancient history). Indeed, you are absolutely right: things *are* getting better. To me, a big difference is the recent speed-up, making it possible for me to pay more attention to individual branches (which are now tested, too), and if I see any particular breakage in `pu` or `jch` that I saw already in the individual branches, I won't bother digging further. That is already a *huge* relief for me. Granted, I had originally hoped to speed up the test suite, so that it would be faster locally. But I can use the cloud as my computer, too. > So IMHO this isn't really a show-stopper problem, so much as something > that is a sign of the maturing test/CI setup (I say "maturing", not > "mature", as it seems we've probably still got a ways to go). As far as > notifications go, it probably makes sense for them to be something that > requires the user to sign up for anyway, so at that point they're making > their own choice about whether the signal to noise ratio is acceptable. Maybe. I do not even know whether there is an option for that in Azure Pipelines, maybe GitHub offers that? In any case, I just wanted to corroborate with a real-world example what I mentioned at the Contributors' Summit: that I would like to not script that thing yet where contributors are automatically notified when their branches don't pass. > I also think there are ways to automate away some of these problems > (e.g., flake detection by repeating test failures, re-running failures > on parent commits to check whether a patch actually introduced the > problem). But implementing those is non-trivial work, so I am certainly > not asking you to do it. Indeed. It might be a lot more common than just Git, too, in which case I might catch the interest of some of my colleagues who could then implement a solid solution that works not only for us, but for everybody using Azure Pipelines. Speaking of which... can we hook it up with https://github.com/git/git, now that the Azure Pipelines support is in `master`? I sent you and Junio an invitation to https://dev.azure.com/git/git, so that either you or Junio (who are the only owners of the GitHub repository) can set it up. If you want me to help, please do not hesitate to ping me on IRC. Ciao, Dscho
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
Hi Peff, On Wed, 6 Feb 2019, Jeff King wrote: > On Tue, Feb 05, 2019 at 10:45:35AM -0800, Junio C Hamano wrote: > > > - Perhaps find the fork point, run tests to find known breakages > >and exclude them? This would simply be not practical, as it > >doubles the number of tests run, for individual topic branches > >because there are an order of magnitude more of them than the > >primary integration branches. > > I think this can be limited to the tests that failed, which makes things > much faster. I.e., we run the tests at the tip of topic X and see that > t1234 fails. We then go back to the fork point and we just need to run > t1234 again. If it succeeds, then we blame X for the failure. If it > fails, then we consider it a false positive. If you mean merge bases by fork points, I wrote an Azure Pipeline to do that (so that I could use the cloud as kind of a fast computer), but that was still too slow. Even when there are even only as much as 12 merge bases to test (which is the current number of merge bases between `next` and `pu`), a build takes roughly 6 minutes on Windows, and many tests take 1 minute or more to run (offenders like t7003 and t7610 take over 400 seconds, i.e. roughly 6 minutes), we are talking about roughly 1.5h *just* to test the merge bases. And I sadly have to report that that's not the end of it. Back when I implemented the automatic bisect after failed builds (for details, see https://github.com/git-for-windows/build-extra/commit/c7e01e82c), I had to turn it off real quickly because the dumb bisect between `next` and `pu` regularly ran into the 4h timeout. Ciao, Dscho > You do pay the price to do a full build at the fork point, but in my > experience that is much quicker than the tests. > > -Peff >
RE: t0025 flakey?
On February 6, 2019 13:01, I wrote: > On February 6, 2019 12:15, Torsten Bögershausen wrote: > > To: Johannes Schindelin > > Cc: SZEDER Gábor ; Jeff King ; > > git@vger.kernel.org > > Subject: Re: t0025 flakey? > > > > On Wed, Feb 06, 2019 at 02:52:53PM +0100, Johannes Schindelin wrote: > > > Hi Gábor, > > > > > > On Wed, 6 Feb 2019, SZEDER Gábor wrote: > > > > > > > On Wed, Feb 06, 2019 at 11:25:38AM +0100, Johannes Schindelin > wrote: > > > > > > > > > at first I thought that those intermittent test failures were > > > > > limited to Windows, but they are not: I can see it now in a > > > > > build on 32-bit Linux. > > > > > Full logs here: > > > > > > > > > > https://dev.azure.com/gitgitgadget/git/_build/results?buildId=10 > > > > > 32 &_a=summary&view=ms.vss-test-web.build-test-results-tab > > > > > > > > > > Excerpt from the failing test case: > > > > > > > > > > -- snip -- > > > > > not ok 2 - renormalize CRLF in repo expecting success: > > > > > echo "*.txt text=auto" >.gitattributes && > > > > > git add --renormalize "*.txt" && > > > > > cat >expect <<-\EOF && > > > > > i/lf w/crlf attr/text=auto CRLF.txt > > > > > i/lf w/lf attr/text=auto LF.txt > > > > > i/lf w/mixed attr/text=auto CRLF_mix_LF.txt > > > > > EOF > > > > > git ls-files --eol | > > > > > sed -e "s/ / /g" -e "s/ */ /g" | > > > > > sort >actual && > > > > > test_cmp expect actual > > > > > > > > > > + echo *.txt text=auto > > > > > + git add --renormalize *.txt > > > > > + cat > > > > > + sort > > > > > + sed -e s/ / /g -e s/ */ /g > > > > > + git ls-files --eol > > > > > + test_cmp expect actual > > > > > + diff -u expect actual > > > > > --- expect2019-02-06 09:39:42.080733629 + > > > > > +++ actual2019-02-06 09:39:42.088733629 + > > > > > @@ -1,3 +1,3 @@ > > > > > -i/lf w/crlf attr/text=auto CRLF.txt > > > > > +i/crlf w/crlf attr/text=auto CRLF.txt > > > > > i/lf w/lf attr/text=auto LF.txt -i/lf w/mixed attr/text=auto > > > > > CRLF_mix_LF.txt > > > > > +i/mixed w/mixed attr/text=auto CRLF_mix_LF.txt > > > > > error: last command exited with $?=1 > > > > > -- snap -- > > > > > > > > > > Any ideas? > > > > > > > > I reported this and Peff looked into it on the way to Git Merge, > > > > but not working solution yet. > > > > > > > > https://public-inbox.org/git/20190129225121.gd1...@sigill.intra.pe > > > > ff > > > > .net/T/#u > > > > > > Thank you! > > > Dscho > > > > I shortly looked into the pointers here - Is t0025 flaky after the fix from > Peff: > > > > [PATCH] add: use separate ADD_CACHE_RENORMALIZE flag > > > > Or has it always been shaky ? > > Does anybody know ? > > The NonStop port has traditionally had issues with t0025, which we tended > to ignore because things did work. We wrote those off as bash issues in > t0025 since they seemed to be corrected when we picked up a new bash > version about a year ago. I will keep monitoring this, particularly when 2.21 > comes out. FYI: t0020-t0027 all passed on the NonStop port for 2.21.0-rc0 - so no issues for us on this one. Cheers, Randall -- Brief whoami: NonStop developer since approximately 2112884442 UNIX developer since approximately 421664400 -- In my real life, I talk too much.
Re: [PATCH] Pretty-format: Ability to add newline after non-empty string
matni...@gmail.com writes: > Subject: Re: [PATCH] Pretty-format: Ability to add newline after non-empty > string Downcasing 'P' and 'A' would make this fit better when it appears in the "git shortlog --no-merges" output, I think. Or perhaps [PATCH] pretty: allow to add LF only after non-empty string or something may fit even better. > diff --git a/pretty.c b/pretty.c > index 0ab45d10d7..fedea05acc 100644 > --- a/pretty.c > +++ b/pretty.c > @@ -1457,7 +1457,8 @@ static size_t format_commit_item(struct strbuf *sb, /* > in UTF-8 */ > NO_MAGIC, > ADD_LF_BEFORE_NON_EMPTY, > DEL_LF_BEFORE_EMPTY, > - ADD_SP_BEFORE_NON_EMPTY > + ADD_SP_BEFORE_NON_EMPTY, > + ADD_LF_AFTER_NON_EMPTY Appending at the end in this case does not make less sense than inserting at the right place in the middle. Noticing that earlier ones are all about LF, perhaps NO_MAGIC ADD_LF_BEFORE_NON_EMPTY ADD_LF_AFTER_NON_EMPTY DEL_LF_BEFORE_EMPTY ADD_SP_BEFORE_NON_EMPTY may make more sense? An obvious question that would come to the reader's mind would be if we also want ADD_SP_AFTER and DEL_SP_BEFORE for completeness, once the list is ordered in a more logical way like we see above. I am not suggesting to add these two right now, but we still must think about them before adding this new one, because it would affect the choice of the letter used for this new one. It is irresponsible to say "I do not need it, so somebody else can add them later", without making sure that somebody else can later choose sensible letters that make the parallel between those two they are adding with the existing ones. We have '+' and '-' as a matching pair that adds or deletes a LF before the expansion, and we are adding '*' to that group to make the repertoire . On the SP side, we currently only use ' ', whose counterpart on the LF side is '+'. Can we easily find counterparts for '-' and this new '*' for the SP side, when we want to add "add after non-empty" and "delete before empty", or would it become easier if we chose something other than '*', and if so what letter? > @@ -1501,7 +1507,8 @@ static size_t userformat_want_item(struct strbuf *sb, > const char *placeholder, > { > struct userformat_want *w = context; > > - if (*placeholder == '+' || *placeholder == '-' || *placeholder == ' ') > + if (*placeholder == '+' || *placeholder == '-' || > + *placeholder == ' ' || *placeholder == '*') > placeholder++; > > switch (*placeholder) { > diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh > index da113d975b..e333ed91d3 100755 > --- a/t/t6006-rev-list-format.sh > +++ b/t/t6006-rev-list-format.sh > @@ -445,6 +445,11 @@ test_expect_success 'add SP before non-empty (2)' ' > test $(wc -w ' > > +test_expect_success 'add LF after non-empty' ' > + git show -s --pretty=format:"%s%*sThanks" HEAD^^ >actual && Here the subject is expanded, LF is added, and then the subject is expanded _again_ before 'Thanks'. That does not sound like a realistic example that shows off the situation in which this new feature becomes useful. > + test_line_count = 2 actual > +' > + > test_expect_success '--abbrev' ' > echo SHORT SHORT SHORT >expect2 && > echo LONG LONG LONG >expect3 && Thanks.
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
Johannes Schindelin writes: > Even when there are even only as much as 12 merge bases to test (which is > the current number of merge bases between `next` and `pu`),... > ... > And I sadly have to report that that's not the end of it. Back when I > implemented the automatic bisect after failed builds (for details, see > https://github.com/git-for-windows/build-extra/commit/c7e01e82c), I had to > turn it off real quickly because the dumb bisect between `next` and `pu` > regularly ran into the 4h timeout. Would it make it easier for you if you substituted all the mention of 'next' in your message with 'pu^{/^### match next}'? That mid-point between 'master' and 'pu' is designed to contain exactly the same set of non-merge commits 'next' has, with the tree that is identical to that of 'next', and from there to the tip of 'pu' forms a single strand of merges of tips of topic branches that are not yet merged to 'next' (by definition, it itself is the merge base of it and 'pu'). Bisecting along the first-parent chain from there to the tip of 'pu' would let us identify which merge is faulty as the first-and-quick pass and currently there are about 20 merges in that range on the first-parent chain.
Re: t0025 flakey?
"Randall S. Becker" writes: > On February 6, 2019 13:01, I wrote: >> On February 6, 2019 12:15, Torsten Bögershausen wrote: >> > To: Johannes Schindelin >> > ... >> > [PATCH] add: use separate ADD_CACHE_RENORMALIZE flag >> > >> > Or has it always been shaky ? >> > Does anybody know ? >> >> The NonStop port has traditionally had issues with t0025, which we tended >> to ignore because things did work. We wrote those off as bash issues in >> t0025 since they seemed to be corrected when we picked up a new bash >> version about a year ago. I will keep monitoring this, particularly when > 2.21 >> comes out. > > FYI: t0020-t0027 all passed on the NonStop port for 2.21.0-rc0 - so no > issues for us on this one. Yup, the preview has both the renormalize fix and another hotfix for it Peff made. Thanks all for quick fixes and confirmations.
Re: [PATCH v3 0/3] Teach submodule set-branch subcommand
Denton Liu writes: > I rebased the changes onto the latest 'next' because if this branch gets > merged into 'next', there'll be merge conflicts from > 'dl/complete-submodule-absorbgitdirs'. Please don't do that. A topic that depends on everything in 'next' cannot graduate to 'master' until everything that is cooking in 'next' does. When - the "conflict" that would arise is so trivial to resolve, - there is no semantic crashes between the new topic and existing ones, and - the topic is usable even before other topics graduate (or even when they get discarded) please make it a habit to avoid making your topic (i.e. this one) hostage to another topic (i.e. the absorbgitdirs one), and certainly not hostage to the whole of 'next'. A trivial conflict resolution in this case, if you revert the rebasing and then attempt to merge the result to 'next', would look like this. diff --cc contrib/completion/git-completion.bash index 8b3b5a9d34,de56879960..00 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@@ -2573,7 -2573,7 +2573,7 @@@ _git_submodule ( { __git_has_doubledash && return - local subcommands="add status init deinit update set-branch summary foreach sync" - local subcommands="add status init deinit update summary foreach sync absorbgitdirs" ++ local subcommands="add status init deinit update set-branch summary foreach sync absorbgitdirs" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then case "$cur" in By the way, if conflicts worry you so much, one thing you could do is this. Instead of maintaining the ever-growing list of subcommands and having to worry about textual conflicts, the completion script could use a clean-up to reduce the need of textual conflict resolution, when it is quiescent, perhaps like this (I am assuming that in some future, there is a quiescent period _after_ both of these two topics landed, and this illustration patch is to be used in such a future). Merging two topics, each of which adds a new element by inserting a new line with the element (and the element alone) is on it, is certainly a lot easier and simpler than having to see what word is getting inserted by each topic on a single long string on a line. contrib/completion/git-completion.bash | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 0fccadfc97..5d7d4ebacc 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2573,7 +2573,18 @@ _git_submodule () { __git_has_doubledash && return - local subcommands="add status init deinit update set-branch summary foreach sync absorbgitdirs" + local subcommands=" + add + status + init + deinit + update + set-branch + summary + foreach + sync + absorbgitdirs + " local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then case "$cur" in
Re: Proposal: Output should push to different servers in parallel
Ævar Arnfjörð Bjarmason writes: > This seems like a reasonable idea, until such time as someone submits > patches to implement this in git you can do this with some invocation of > GNU parallel -k, i.e. operate on N remotes in parallel, and use the -k > option to buffer up all their output and present it in sequence. Stopping the message there makes it sound like a polite way to say "a generic tool to allow you doing it on anything, not limited to Git, is already available, and a solution specific to Git is unwanted." I wanted to follow up with something that says "The 'parallel' tool works in the meantime, but here are examples of very useful things that we would not be able to live without that 'parallel' wouldn't let us do, and we need a Git specific solution to obtain that", but I am coming up with empty, so perhaps indeed we do not want a Git specific solution ;-)
[PATCH] ci: make sure we build Git parallel
Commit 2c8921db2b (travis-ci: build with the right compiler, 2019-01-17) started to use MAKEFLAGS to specify which compiler to use to build Git. A bit later, and in a different topic branch commit eaa62291ff (ci: inherit --jobs via MAKEFLAGS in run-build-and-tests, 2019-01-27) started to use MAKEFLAGS as well. Unfortunately, there is a semantic conflict between these two commits: both of them set MAKEFLAGS, and since the line adding CC from 2c8921db2b comes later in 'ci/lib.sh', it overwrites the number of parallel jobs added in eaa62291ff. Consequently, since both commits have been merged all our CI jobs have been building Git, building its documentation, and applying semantic patches sequentially, making all build jobs a bit slower. Running the test suite is unaffected, because the number of test jobs comes from GIT_PROVE_OPTS. Append to MAKEFLAGS when setting the compiler to use, to ensure that the number of parallel jobs to use is preserved. Signed-off-by: SZEDER Gábor --- ci/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/lib.sh b/ci/lib.sh index 16f4ecbc67..cee51a4cc4 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -185,4 +185,4 @@ GIT_TEST_GETTEXT_POISON) ;; esac -export MAKEFLAGS="CC=${CC:-cc}" +export MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" -- 2.20.1.940.g8404bb2d1a
Re: [PATCH 00/21] nd/diff-parseopt part 2
On Thu, Feb 07, 2019 at 05:33:05PM +0700, Nguyễn Thái Ngọc Duy wrote: > Nguyễn Thái Ngọc Duy (21): > diff.c: convert --patch-with-raw > diff.c: convert --numstat and --shortstat > diff.c: convert --dirstat and friends > diff.c: convert --check > diff.c: convert --summary > diff.c: convert --patch-with-stat > diff.c: convert --name-only > diff.c: convert --name-status > diff.c: convert -s|--no-patch > diff.c: convert --stat* > diff.c: convert --[no-]compact-summary > diff.c: convert --output-* > diff.c: convert -B|--break-rewrites > diff.c: convert -M|--find-renames > diff.c: convert -D|--irreversible-delete > diff.c: convert -C|--find-copies > diff.c: convert --find-copies-harder > diff.c: convert --no-renames|--[no--rename-empty > diff.c: convert --relative > diff.c: convert --[no-]minimal > diff.c: convert --ignore-some-changes Nit: convert to what? Perhaps a 's/$/ to parse-options/' would improve the shortlog/oneline output.
Re: [PATCH] contrib/subtree: ensure only one rev is provided
Denton Liu writes: > @@ -185,6 +191,7 @@ if test "$command" != "pull" && > then > revs=$(git rev-parse $default --revs-only "$@") || exit $? > dirs=$(git rev-parse --no-revs --no-flags "$@") || exit $? > + ensure_single_rev $revs This applies to anything other than pull, add and push, so certainly 'split' is covered here. > @@ -716,9 +723,8 @@ cmd_add_repository () { > } > > cmd_add_commit () { > - revs=$(git rev-parse $default --revs-only "$@") || exit $? > - set -- $revs > - rev="$1" > + rev=$(git rev-parse $default --revs-only "$@") || exit $? > + ensure_single_rev $rev There are two callers of this helper. cmd_add passes "$@" but it does so only after making sure there is only one argument that is a commit, so this conversion is not incorrect. I am not sure if the other caller is OK, though. cmd_add_repository can get more than one revs, and uses the first one as $rev to read the tree from, expecting that this helper to ignore other ones that are emitted from 'git rev-parse --revs-only "$@"'. For that matter, one of the early things cmd_split does is to call the find_existing_splits helper with $revs, and it seems to be prepared to be red multiple $revs (it is passed to "git log", so I would expect that incoming $revs is allowed to specify bottom to limit the traversal, e.g. "git log maint..master"). The addition of "ensure_single_rev" we saw in an earlier hunk near ll.191 makes such call impossible. I am not a user of subtree, so I do not know if it is a good change (i.e. making something nonsensical impossible to do is good, making something useful impossible to do is bad). > @@ -817,16 +823,10 @@ cmd_split () { > } > > cmd_merge () { > - revs=$(git rev-parse $default --revs-only "$@") || exit $? > + rev=$(git rev-parse $default --revs-only "$@") || exit $? > + ensure_single_rev $rev > ensure_clean > > - set -- $revs > - if test $# -ne 1 > - then > - die "You must provide exactly one revision. Got: '$revs'" > - fi > - rev="$1" > - This one already was insisting on a single version, so it clearly is a correct no-op conversion, but wouldn't this have been already caught upfront where anything other than pull, add and push are handled? I do understand if the new call to ensure_single is made to the other caller of cmd_merge in cmd_pull, though. > if test -n "$squash" > then > first_split="$(find_latest_squash "$dir")" In any case, I do not use subtree, and the last time I looked at this script is a long time ago, so take all of the above with a large grain of salt. Thanks.
Re: [PATCH] ci: make sure we build Git parallel
SZEDER Gábor writes: > Append to MAKEFLAGS when setting the compiler to use, to ensure that > the number of parallel jobs to use is preserved. > > Signed-off-by: SZEDER Gábor > --- > ci/lib.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ci/lib.sh b/ci/lib.sh > index 16f4ecbc67..cee51a4cc4 100755 > --- a/ci/lib.sh > +++ b/ci/lib.sh > @@ -185,4 +185,4 @@ GIT_TEST_GETTEXT_POISON) > ;; > esac > > -export MAKEFLAGS="CC=${CC:-cc}" > +export MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" Makes sense. Thanks.
Re: [PATCH] ci: make sure we build Git parallel
Junio C Hamano writes: > SZEDER Gábor writes: > >> Append to MAKEFLAGS when setting the compiler to use, to ensure that >> the number of parallel jobs to use is preserved. >> >> Signed-off-by: SZEDER Gábor >> --- >> ci/lib.sh | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/ci/lib.sh b/ci/lib.sh >> index 16f4ecbc67..cee51a4cc4 100755 >> --- a/ci/lib.sh >> +++ b/ci/lib.sh >> @@ -185,4 +185,4 @@ GIT_TEST_GETTEXT_POISON) >> ;; >> esac >> >> -export MAKEFLAGS="CC=${CC:-cc}" >> +export MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" > > Makes sense. Thanks. Wouldn't all other hits of "MAKEFLAGS=" in ci/lib.sh also want the same treatment, though? We know that "if travis to this, otherwise if Asure, do that" is the first block to muck with MAKEFLAGS in the script, but a new assignment before that block can be added in the future and cause a similar issue unless we do so. Of course, at some point we do want to say "we do not want to inherit it from the outside environment", but then such an assignment of empty value should be done at the very beginning with a comment, not with "this happens to be the first one to set, so let's not append but assign to clear any previous value", I would think.
[PATCH] doc: prevent overflowing tag in rendered HTML
Add an apparently missing back-tick to fix a multi-line section on https://git-scm.com/docs/git-log which seems to have been caused by commit 18fb7ffc ("pretty: respect color settings [...]", 2017-07-13). Signed-off-by: Katrin Leinweber --- Documentation/pretty-formats.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt index 417b638cd..ee08d0906 100644 --- a/Documentation/pretty-formats.txt +++ b/Documentation/pretty-formats.txt @@ -181,7 +181,7 @@ endif::git-rev-list[] `color.diff`, `color.ui`, or `--color`, and respecting the `auto` settings of the former if we are going to a terminal). `%C(auto,...)` is accepted as a historical synonym for the default (e.g., - `%C(auto,red)`). Specifying `%C(always,...) will show the colors + `%C(auto,red)`). Specifying `%C(always,...)` will show the colors even when color is not otherwise enabled (though consider just using `--color=always` to enable color for the whole output, including this format and anything else git might color). `auto` -- 2.20.1
Re: [PATCH] doc: prevent overflowing tag in rendered HTML
Katrin Leinweber writes: > Add an apparently missing back-tick to fix a multi-line section > on https://git-scm.com/docs/git-log which seems to have been caused by > commit 18fb7ffc ("pretty: respect color settings [...]", 2017-07-13). > > Signed-off-by: Katrin Leinweber > --- Thanks for spotting and fixing. Will apply. > Documentation/pretty-formats.txt | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Documentation/pretty-formats.txt > b/Documentation/pretty-formats.txt > index 417b638cd..ee08d0906 100644 > --- a/Documentation/pretty-formats.txt > +++ b/Documentation/pretty-formats.txt > @@ -181,7 +181,7 @@ endif::git-rev-list[] >`color.diff`, `color.ui`, or `--color`, and respecting the `auto` >settings of the former if we are going to a terminal). `%C(auto,...)` >is accepted as a historical synonym for the default (e.g., > - `%C(auto,red)`). Specifying `%C(always,...) will show the colors > + `%C(auto,red)`). Specifying `%C(always,...)` will show the colors >even when color is not otherwise enabled (though consider >just using `--color=always` to enable color for the whole output, >including this format and anything else git might color). `auto`
Re: [PATCH] ci: make sure we build Git parallel
Junio C Hamano writes: > Wouldn't all other hits of "MAKEFLAGS=" in ci/lib.sh also want the > same treatment, though? We know that "if travis to this, otherwise > if Asure, do that" is the first block to muck with MAKEFLAGS in the > script, but a new assignment before that block can be added in the > future and cause a similar issue unless we do so. > > Of course, at some point we do want to say "we do not want to > inherit it from the outside environment", but then such an > assignment of empty value should be done at the very beginning with > a comment, not with "this happens to be the first one to set, so > let's not append but assign to clear any previous value", I would > think. That is, in a patch form on top of yours, something like this. ci/lib.sh | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ci/lib.sh b/ci/lib.sh index cee51a4cc4..288a5b3884 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -74,6 +74,9 @@ check_unignored_build_artifacts () } } +# Clear MAKEFLAGS that may come from the outside world. +export MAKEFLAGS= + # Set 'exit on error' for all CI scripts to let the caller know that # something went wrong. # Set tracing executed commands, primarily setting environment variables @@ -101,7 +104,7 @@ then BREW_INSTALL_PACKAGES="git-lfs gettext" export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save" export GIT_TEST_OPTS="--verbose-log -x --immediate" - export MAKEFLAGS="--jobs=2" + MAKEFLAGS="$MAKEFLAGS --jobs=2" elif test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI" then CI_TYPE=azure-pipelines @@ -126,7 +129,7 @@ then BREW_INSTALL_PACKAGES=gcc@8 export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save" export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" - export MAKEFLAGS="--jobs=10" + MAKEFLAGS="$MAKEFLAGS --jobs=10" test windows_nt != "$CI_OS_NAME" || GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" else @@ -185,4 +188,4 @@ GIT_TEST_GETTEXT_POISON) ;; esac -export MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" +MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"
Re: GSoC 2019: Git's application submitted
Hi Thomas, On Wed, 6 Feb 2019, Thomas Gummerer wrote: > I think the idea here could definitely be split into a couple different > phases, that could be individually useful, and can be merged > individually, though I don't know if they would necessarily be. Good idea. > Of the top of my head: > > - write test_expect_failure tests for the expected new behaviour > >This may not be worth including in git.git yet, but it can be a >very useful starting point for somebody else continuing the feature >if the student finds they don't have time for it. I like this approach. > - implement pushing the index state, without dealing with conflicts > - implement poping the index state, without dealing with conflicts > >This can already be individually useful, and I think this is >something people asked for on the mailing list, though I didn't try >digging up old threads for now. After these two steps stashing and >restoring a merge conflict would still not work, but we have a good >first step that could be merged. We already have `git stash --keep-index`. Is this what you mean here? > - implement pushing/poping conflicted state > >This would obviously be the end goal. On second thought, this might actually be super trivial. Right now, we support two modes (not counting the `--untracked` stuff): --keep-index and --no-keep-index. In both cases, we seem to create a merge commit whose tree reflects the working directory and whose first parent is HEAD and whose second parent is a single commit on top of HEAD (which contains either no changes in the case of --no-keep-index, or whose tree reflects the index in case of --keep-index). To extend that to the conflict case, we could introduce a new flag --with-conflicts, and have the commit structure Worktree |\ |index stage 0 | / | \ | stage 1 stage 2 stage 3 |/ / / HEAD --- The only tricky thing I can see is to maintain backwards compatibility if possible, so that old `git stash` will do something at least semi-sensible with those commit structures. It might be too small a project, after all. Ciao, Dscho > > Another potential issue is that a new feature might be prone to naming > > or user interface discussions which could last for a long time or > > could not result in clear decisions. > > Yes, this is definitely a potential pitfall. I haven't thought in > depth about the interface yet, but I think the discussion around that > would be something we as mentors could and should guide the student > through. We also wouldn't make the feature the default from the > beginning, but introduce it behind a new flag/maybe a config option, > to make sure we don't introduce any backwards compatible changes. > > It's probably also something the student should include in their > proposal, so we can get eyes on it early in the process. > > > So I think we should be very careful if we propose a project that > > implements a new feature to a student. We should at least consider the > > above potential issues and see if they can be mitigated before the > > project starts. > > Thanks for bringing these issues up, they are definitely useful to > work through. > > > Thank you anyway for proposing this idea, > > Christian. >
Re: Possible minor bug in Git
Hi Giuseppe, On Wed, 6 Feb 2019, Giuseppe Crinò wrote: > I wanted to have a look at the bug, and I can correctly reproduce it using > version 2.20.1.windows.1. > > To start to even think of fixing this bug I need to build the source for > Windows, but I got lost on how to do that. Does this help? https://github.com/git-for-windows/git/wiki/Building-Git Ciao, Johannes > > Is it correct that I should cross-compile from a POSIX system (GNU/Linux), > using x86_64-w64-mingw32-gcc and Gnulib to produce a static executable? > > Am I missing something? How does people here build for Windows? > > Giuseppe >
Re: [ANNOUNCE] Git v2.21.0-rc0
Team, the Windows version of v2.21.0-rc0 can be found here: https://github.com/git-for-windows/git/releases/tag/v2.21.0-rc0.windows.1 Thanks for testing! Johannes On Wed, 6 Feb 2019, Junio C Hamano wrote: > An early preview release Git v2.21.0-rc0 is now available for > testing at the usual places. It is comprised of 426 non-merge > commits since v2.20.0, contributed by 57 people, 13 of which are > new faces. > > The tarballs are found at: > > https://www.kernel.org/pub/software/scm/git/testing/ > > The following public repositories all have a copy of the > 'v2.21.0-rc0' tag and the 'master' branch that the tag points at: > > url = https://kernel.googlesource.com/pub/scm/git/git > url = git://repo.or.cz/alt-git.git > url = https://github.com/gitster/git > > New contributors whose contributions weren't in v2.20.0 are as follows. > Welcome to the Git development community! > > Arti Zirk, Brandon Richardson, Chayoung You, Denis Ovsienko, Erin > Dahlgren, Force Charlie, Frank Dana, Issac Trotts, Laura Abbott, > Patrick Hogg, Peter Osterlund, Shahzad Lone, and Slavica Djukic. > > Returning contributors who helped this release are as follows. > Thanks for your continued support. > > Ævar Arnfjörð Bjarmason, Ben Peart, Brandon Williams, brian > m. carlson, Carlo Marcelo Arenas Belón, Christian Couder, > David Turner, Derrick Stolee, Elijah Newren, Eric Sunshine, > Eric Wong, Jean-Noël Avila, Jeff King, Johannes Schindelin, > Jonathan Nieder, Jonathan Tan, Josh Steadmon, Junio C Hamano, Kim > Gybels, Kyle Meyer, Linus Torvalds, Luke Diamand, Martin Ågren, > Masaya Suzuki, Matthew DeVore, Matthieu Moy, Max Kirillov, > Nguyễn Thái Ngọc Duy, Olga Telezhnaya, Orgad Shaneh, > Phillip Wood, Pranit Bauva, Ramsay Jones, Randall S. Becker, > René Scharfe, Sebastian Staudt, Sergey Organov, Stefan Beller, > Stephen P. Smith, Sven van Haastregt, SZEDER Gábor, Thomas > Braun, Thomas Gummerer, and Torsten Bögershausen. > > > > Git 2.21 Release Notes (draft) > == > > Backward Compatibility Notes > > > * Historically, the "-m" (mainline) option can only be used for "git >cherry-pick" and "git revert" when working with a merge commit. >This version of Git no longer warns or errors out when working with >a single-parent commit, as long as the argument to the "-m" option >is 1 (i.e. it has only one parent, and the request is to pick or >revert relative to that first parent). Scripts that relied on the >behaviour may get broken with this change. > > > Updates since v2.20 > --- > > UI, Workflows & Features > > * The "http.version" configuration variable can be used with recent >enough versions of cURL library to force the version of HTTP used >to talk when fetching and pushing. > > * Small fixes and features for fast-export and fast-import, mostly on >the fast-export side has been made. > > * "git push $there $src:$dst" rejects when $dst is not a fully >qualified refname and not clear what the end user meant. The >codepath has been taught to give a clearer error message, and also >guess where the push should go by taking the type of the pushed >object into account (e.g. a tag object would want to go under >refs/tags/). > > * "git checkout [] path..." learned to report the number of >paths that have been checked out of the index or the tree-ish, >which gives it the same degree of noisy-ness as the case in which >the command checks out a branch. > > * "git quiltimport" learned "--keep-non-patch" option. > > * "git worktree remove" and "git worktree move" refused to work when >there is a submodule involved. This has been loosened to ignore >uninitialized submodules. > > * "git cherry-pick -m1" was forbidden when picking a non-merge >commit, even though there _is_ parent number 1 for such a commit. >This was done to avoid mistakes back when "cherry-pick" was about >picking a single commit, but is no longer useful with "cherry-pick" >that can pick a range of commits. Now the "-m$num" option is >allowed when picking any commit, as long as $num names an existing >parent of the commit. > > * Update "git multimail" from the upstream. > > * "git p4" update. > > * The "--format=" option of for-each-ref, branch and tag >learned to show a few more traits of objects that can be learned by >the object_info API. > > * "git rebase -i" learned to re-execute a command given with 'exec' >to run after it failed the last time. > > * "git diff --color-moved-ws" updates. > > * Custom userformat "log --format" learned %S atom that stands for >the tip the traversal reached the commit from, i.e. --source. > > * "git instaweb" learned to drive http.server that comes with >"batteries included" Python installation (bot
Re: [ANNOUNCE] Git v2.21.0-rc0
Hi Junio, On Wed, 6 Feb 2019, Junio C Hamano wrote: > New contributors whose contributions weren't in v2.20.0 are as follows. > Welcome to the Git development community! > > Arti Zirk, Brandon Richardson, Chayoung You, Denis Ovsienko, Erin > Dahlgren, Force Charlie, Frank Dana, Issac Trotts, Laura Abbott, > Patrick Hogg, Peter Osterlund, Shahzad Lone, and Slavica Djukic. Could you include Tanushree Tumane in that list? Granted, so far they mostly cleaned up Pranit Bauva's patches, keeping the authorship, but still... Thanks, Dscho
Re: [PATCH v4] log,diff-tree: add --combined-all-names option
On Tue, Feb 5, 2019 at 12:39 PM Junio C Hamano wrote: > > Elijah Newren writes: > > >> > Further, in patch format, this changes the from/to headers so that > >> > instead of just having one "from" header, we get one for each parent. > >> > For example, instead of having > >> > > >> > --- a/phooey.c > >> > +++ b/phooey.c > >> > > >> > we would see > >> > > >> > --- a/fooey.c > >> > --- a/fuey.c > >> > +++ b/phooey.c > >> > >> Do we have the three "rename from fooey.c", "rename from fuey.c" and > >> "rename to "phooey.c" extended headers, too? That's what I meant in > >> my response, but I do like what I see in the above example ;-) > > > > Ah, gotcha. I'll look into whether it's possible to hook it up to > > diff.c's fill_metainfo() . > > Just to clarify. I do not think these extended headers are "must > have"; the "--cc" output is not meant for machine consumption, as it > simplifies the output by omitting hunks that preimage trees agree > with each other etc., and making the resulting "patch" not showing > the whole picture, and these extended header lines might only become > waste of the screen real estate. > > So, do not spend too much effort to emit these textual info that can > be easily seen with the N+1 plus/minus header lines. > > Thanks. Understood, thanks. I think something can be done here, but I'm unsure exactly what. From Documentation/diff-generate-patch.txt, the extended headers for normal diff mode are: old mode new mode deleted file mode new file mode copy from copy to rename from rename to similarity index dissimilarity index index .. and for combined diffs they are: index ,.. mode ,.. new file mode deleted file mode , meaning that the ones we are missing are: copy from copy to rename from rename to similarity index dissimilarity index I think "copy from" and "rename from" should be relatively straightforward. However, in a combined diff, we could have both a modified status, a renamed status, and a copied status, meaning that we'll need an array of both similarity and dissimilarity indexes...and trying to present that to the user in a way that makes sense seems like a lost cause to me. Does anyone else know how to represent that? I'm inclined to just leave it out. Also, I'm afraid "copy to" and "rename to" could be confusing if both appeared, since there's only one "to" path. If there is both a copy and a rename involved relative to different parents, should these be coalesced into a "copy/rename to" line? Thanks, Elijah
Re: [PATCH v3 2/3] submodule--helper: teach config subcommand --unset
Denton Liu writes: > This teaches submodule--helper config the --unset option, which removes > the specified configuration key from the .gitmodule file. > > Signed-off-by: Denton Liu > --- > builtin/submodule--helper.c | 18 -- > t/t7411-submodule-config.sh | 9 + > 2 files changed, 21 insertions(+), 6 deletions(-) > > diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c > index b80fc4ba3d..a86eacf167 100644 > --- a/builtin/submodule--helper.c > +++ b/builtin/submodule--helper.c > @@ -2148,17 +2148,22 @@ static int check_name(int argc, const char **argv, > const char *prefix) > static int module_config(int argc, const char **argv, const char *prefix) > { > enum { > - CHECK_WRITEABLE = 1 > - } command = 0; > + NONE, > + CHECK_WRITEABLE, > + DO_UNSET > + } command = NONE; I do not think the above, except for addition of DO_UNSET, is a good change. The language spec may guarantee that NONE is 0, but in the way the original is written, it is much more obvious that integer zero is a special value and the variable is initialized to that special value, and that is important. The above rewrite makes it look as if there are a bunch of symbolic constants defined by this particular caller and one random value NONE, whose only significance is that it is different from any other value, is picked as its initial value---but that is a wrong impression to give to the readers. parse-options.c::get_value() special cases integer zero as "unset" for any CMDMODE, so inventing a symbolic constant used by this particular user is counter-productive. Needless to say, it is not such a great idea to use such an overly generic word NONE here. The way the original did to make sure all enum values are non-zero (by explicitly documenting that its first value is 1) and used literal 0 as "not specified" is much better aligned to the way how OPT_CMDMODE() is to be used, I think. > > struct option module_config_options[] = { > OPT_CMDMODE(0, "check-writeable", &command, > N_("check if it is safe to write to the .gitmodules > file"), > CHECK_WRITEABLE), > + OPT_CMDMODE(0, "unset", &command, > + N_("unset the config in the .gitmodules file"), > + DO_UNSET), > OPT_END() > }; > const char *const git_submodule_helper_usage[] = { > - N_("git submodule--helper config name [value]"), > + N_("git submodule--helper config name [--unset] [value]"), That gives an impression that "config name --unset value" is a valid input; isn't it more like "you can unset, or you can set to a value"? The way to spell it would be "... config name [--unset | value]" but it raises a larger question. What if you want to set to a value that is a string "--unset"? Actually, allowing an option that comes after "name" (which is an arbitrary end-user supplied thing) is one thing, but writing it in the documentation as if we are encouraging it is probably not a good idea. Shouldn't it be "config --unset name"? In any case, seeing the new test in 7411, I think the best way to write the above usage text would be to add one new line without mucking with the existing "show it, or set it to the given value" and add git submodule--helper config --unset name as a separate item to the list. > diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh > index 89690b7adb..fcc0fb82d8 100755 > --- a/t/t7411-submodule-config.sh > +++ b/t/t7411-submodule-config.sh > @@ -142,6 +142,15 @@ test_expect_success 'reading submodules config from the > working tree with "submo > ) > ' > > +test_expect_success 'unsetting submodules config from the working tree with > "submodule--helper config --unset"' ' > + (cd super && > + git submodule--helper config --unset submodule.submodule.url && > + git submodule--helper config submodule.submodule.url >actual &&
[PATCH 2/2] object: fix leak of shallow_stat
In eee4502baaf ("shallow: migrate shallow information into the object parser", 2018-05-17), we added a stat_validity pointer into the parsed_object_pool struct, but did not add code to free this in parsed_object_pool_clear(). This leak was found by fuzz-commit-graph. Clear the struct and then free it in parsed_object_pool_clear() to prevent the leak. Signed-off-by: Josh Steadmon --- object.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/object.c b/object.c index 5dc5eec367..ca0b093c37 100644 --- a/object.c +++ b/object.c @@ -557,9 +557,11 @@ void parsed_object_pool_clear(struct parsed_object_pool *o) clear_alloc_state(o->commit_state); clear_alloc_state(o->tag_state); clear_alloc_state(o->object_state); + stat_validity_clear(o->shallow_stat); FREE_AND_NULL(o->blob_state); FREE_AND_NULL(o->tree_state); FREE_AND_NULL(o->commit_state); FREE_AND_NULL(o->tag_state); FREE_AND_NULL(o->object_state); + FREE_AND_NULL(o->shallow_stat); } -- 2.20.1.611.gfbb209baf1-goog
[PATCH 1/2] fuzz-commit-graph: initialize repo object
Various #DEFINE "constants" in commit-graph.c now depend on the_hash_algo->rawsz, but this object must be initialized before it can be used. Signed-off-by: Josh Steadmon --- fuzz-commit-graph.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fuzz-commit-graph.c b/fuzz-commit-graph.c index cf790c9d04..0157acbf2e 100644 --- a/fuzz-commit-graph.c +++ b/fuzz-commit-graph.c @@ -1,4 +1,5 @@ #include "commit-graph.h" +#include "repository.h" struct commit_graph *parse_commit_graph(void *graph_map, int fd, size_t graph_size); @@ -9,7 +10,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { struct commit_graph *g; + initialize_the_repository(); g = parse_commit_graph((void *)data, -1, size); + repo_clear(the_repository); free(g); return 0; -- 2.20.1.611.gfbb209baf1-goog
[PATCH 0/2] Initialize repo object in fuzz-commit-graph
commit-graph.c now depends on the_hash_algo, which means the_repository must be initialized before attempting to load a commit graph. This series adds the initialization and cleanup to fuzz-commit-graph, and fixes a leak it discovered in the cleanup code. Josh Steadmon (2): fuzz-commit-graph: initialize repo objects object: fix leak of shallow_stat fuzz-commit-graph.c | 3 +++ object.c| 2 ++ 2 files changed, 5 insertions(+) -- 2.20.1.611.gfbb209baf1-goog
Re: [PATCH v4] log,diff-tree: add --combined-all-names option
Elijah Newren writes: > I think "copy from" and "rename from" should be relatively > straightforward. However, in a combined diff, we could have both a > modified status, a renamed status, and a copied status, meaning that > we'll need an array of both similarity and dissimilarity indexes...and > trying to present that to the user in a way that makes sense seems > like a lost cause to me. Does anyone else know how to represent that? > I'm inclined to just leave it out. > > Also, I'm afraid "copy to" and "rename to" could be confusing if both > appeared, since there's only one "to" path. If there is both a copy > and a rename involved relative to different parents, should these be > coalesced into a "copy/rename to" line? There are three possible labels (i.e. 'in-place modification', 'rename from elsewhere' and 'copy from elsewhere'), and you can say "this commit created file F by renaming from X (or by copying X)" only when you know path F did not exist _immediately before_ this commit. The distinction between rename and copy is whether the path X remains in the resulting commit (i.e. if there is no X, the commit created path F by moving X; if there is X, the commit copied the contents of X into a new path F). So telling renames and copies apart is probably straight-forward (if you have sufficient information---I am not sure if you do in this codepath offhand); as long as you know what pathname each preimage (i.e. parent of the perge) tree had and if that pathname is missing in the postimage (luckily there is only one---the merge result), it was renamed, and otherwise it was copied. But telling in-place modification and other two might be trickier. In one parent path F may be missing but in the other parent path F may exist, and the result of the merge is made by merging the contents of path X in the first parent and the contents of path F in the second parent. From the view of the transition between the first parent to the merge result, we moved the path X to path F and made some modifications (i.e. renamed). From the view of the transition from the other branch, we kept the contents in path F during the transition and there is no renames or copies involved. Actually what I had in mind when I mentioned the extended headers the first time in this discussion was that we would have "rename from", "copy from", etc. separately for each parent, as the contents may have come from different paths in these parents. And that was where my earlier "... might only become waste of the screen real estate" comes from. So, again, do not spend too much effort to emit these textual info that can be easily seen with the N+1 plus/minus header lines. Thanks.
Re: [ANNOUNCE] Git v2.21.0-rc0
Johannes Schindelin writes: > Hi Junio, > > On Wed, 6 Feb 2019, Junio C Hamano wrote: > >> New contributors whose contributions weren't in v2.20.0 are as follows. >> Welcome to the Git development community! >> >> Arti Zirk, Brandon Richardson, Chayoung You, Denis Ovsienko, Erin >> Dahlgren, Force Charlie, Frank Dana, Issac Trotts, Laura Abbott, >> Patrick Hogg, Peter Osterlund, Shahzad Lone, and Slavica Djukic. > > Could you include Tanushree Tumane in that list? Granted, so far they > mostly cleaned up Pranit Bauva's patches, keeping the authorship, but > still... There is no provision for manual override in the machinery, so, no.
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
On Thu, Feb 07, 2019 at 03:26:21PM +0100, Johannes Schindelin wrote: > > So IMHO this isn't really a show-stopper problem, so much as something > > that is a sign of the maturing test/CI setup (I say "maturing", not > > "mature", as it seems we've probably still got a ways to go). As far as > > notifications go, it probably makes sense for them to be something that > > requires the user to sign up for anyway, so at that point they're making > > their own choice about whether the signal to noise ratio is acceptable. > > Maybe. I do not even know whether there is an option for that in Azure > Pipelines, maybe GitHub offers that? No, I don't think so. Probably the route there would be to make a comment on the commit or PR that would then go to the user as a notification (from which they can then decide on email delivery, etc). > In any case, I just wanted to corroborate with a real-world example what I > mentioned at the Contributors' Summit: that I would like to not script > that thing yet where contributors are automatically notified when their > branches don't pass. Fair enough. As an alternative, do you know offhand if there's an easy machine-readable way to get the CI results? If I could poll it with curl and generate my own notifications, that would be fine for me. > > I also think there are ways to automate away some of these problems > > (e.g., flake detection by repeating test failures, re-running failures > > on parent commits to check whether a patch actually introduced the > > problem). But implementing those is non-trivial work, so I am certainly > > not asking you to do it. > > Indeed. It might be a lot more common than just Git, too, in which case I > might catch the interest of some of my colleagues who could then implement > a solid solution that works not only for us, but for everybody using Azure > Pipelines. Yes, agreed. :) > Speaking of which... can we hook it up with https://github.com/git/git, > now that the Azure Pipelines support is in `master`? I sent you and Junio > an invitation to https://dev.azure.com/git/git, so that either you or > Junio (who are the only owners of the GitHub repository) can set it up. If > you want me to help, please do not hesitate to ping me on IRC. I'm happy to. I walked through the Azure setup/login procedure, but I'm not sure what to do next. -Peff
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
On Thu, Feb 07, 2019 at 04:41:57PM +0100, Johannes Schindelin wrote: > > I think this can be limited to the tests that failed, which makes things > > much faster. I.e., we run the tests at the tip of topic X and see that > > t1234 fails. We then go back to the fork point and we just need to run > > t1234 again. If it succeeds, then we blame X for the failure. If it > > fails, then we consider it a false positive. > > If you mean merge bases by fork points, I wrote an Azure Pipeline to do > that (so that I could use the cloud as kind of a fast computer), but that > was still too slow. > > Even when there are even only as much as 12 merge bases to test (which is > the current number of merge bases between `next` and `pu`), a build takes > roughly 6 minutes on Windows, and many tests take 1 minute or more to run > (offenders like t7003 and t7610 take over 400 seconds, i.e. roughly 6 > minutes), we are talking about roughly 1.5h *just* to test the merge > bases. I was assuming you're testing individual topics from gitster/git here (which admittedly is more CPU in total than just the integration branches, but it at least parallelizes well). So with that assumption, I was thinking that you'd just look for the merge-base of HEAD and master, which should give you a single point for most topics. For inter-twined topics there may be more merge bases, but I actually think for our purposes here, just testing the most recent one is probably OK. I.e., we're just trying to have a vague sense of whether the test failure is due to new commits or old. I think Junio's suggestion to just pick some common release points would work OK in practice, too. It's possible that some other topic made it to master with a breakage, but in most cases, I think these sorts of failures are often more coarsely-grained (especially if Junio pays attention to the CI results before merging). -Peff
Re: [ANNOUNCE] Git v2.21.0-rc0
Junio C Hamano writes: >> Hi Junio, >> >> On Wed, 6 Feb 2019, Junio C Hamano wrote: >> >>> New contributors whose contributions weren't in v2.20.0 are as follows. >>> Welcome to the Git development community! >>> >>> Arti Zirk, Brandon Richardson, Chayoung You, Denis Ovsienko, Erin >>> Dahlgren, Force Charlie, Frank Dana, Issac Trotts, Laura Abbott, >>> Patrick Hogg, Peter Osterlund, Shahzad Lone, and Slavica Djukic. >> >> Could you include Tanushree Tumane in that list? Granted, so far they >> mostly cleaned up Pranit Bauva's patches, keeping the authorship, but >> still... > > There is no provision for manual override in the machinery, so, no. What I meant was "no, not easily and without risking fat-finger mistakes". But we can give a shout-out to particular contributor(s) outside release announcement any time, with more personalized message instead of just an entry in a dry and bland list. Thanks, Tanushree for your work on "git bisect--helper".
Re: [PATCH] add_to_index(): convert forgotten HASH_RENORMALIZE check
On Thu, Feb 07, 2019 at 04:18:02AM +, Torsten Bögershausen wrote: > And trying to answer an older question: > > >>>The reason appears to be wrong bit mask usage > >>>#define ADD_CACHE_IGNORE_ERRORS4 > >>>and > >>>#define HASH_RENORMALIZE 4 > > What if we had renamed "flags" like this ? > [...] > -int add_to_index(struct index_state *istate, const char *path, struct stat > *st, int flags) > +int add_to_index(struct index_state *istate, const char *path, struct stat > *st, int add_cache_flags) Yes, changing the name of the variable in the original patch would have caught this case. I don't know if it is worth doing now or not (the code as it is now seems pretty clear to me, but of course I've looked at it a lot lately). -Peff
Re: [PATCH 0/1] Fix incorrectly reported CPU in 32-bit Windows
"Johannes Schindelin via GitGitGadget" writes: > This is yet another patch I forgot to upstream, and I hope that it will make > it into v2.21.0-rc1. I guess this affects nobody other than you and perhaps J6t, the point not being "there are only just two" but being "all of them know how to deal with possible breakages if any in this change". I am tempted to bypass the usual "from pu down to next down to master" dance on this one, because of that. ;-)
Re: GSoC 2019: Git's application submitted
On 02/07, Johannes Schindelin wrote: > Hi Thomas, > > On Wed, 6 Feb 2019, Thomas Gummerer wrote: > > - implement pushing the index state, without dealing with conflicts > > - implement poping the index state, without dealing with conflicts > > > >This can already be individually useful, and I think this is > >something people asked for on the mailing list, though I didn't try > >digging up old threads for now. After these two steps stashing and > >restoring a merge conflict would still not work, but we have a good > >first step that could be merged. > > We already have `git stash --keep-index`. Is this what you mean here? `git stash --keep-index` does something different, what I meant here was what `git stash pop --index` already does. I had forgotten that this functionality already exists. > > - implement pushing/poping conflicted state > > > >This would obviously be the end goal. > > On second thought, this might actually be super trivial. Right now, we > support two modes (not counting the `--untracked` stuff): --keep-index and > --no-keep-index. In both cases, we seem to create a merge commit whose > tree reflects the working directory and whose first parent is HEAD and > whose second parent is a single commit on top of HEAD (which contains > either no changes in the case of --no-keep-index, or whose tree reflects > the index in case of --keep-index). > > To extend that to the conflict case, we could introduce a new flag > --with-conflicts, and have the commit structure > > Worktree >|\ >|index stage 0 >| / | \ >| stage 1 stage 2 stage 3 >|/ / / > HEAD --- > > The only tricky thing I can see is to maintain backwards compatibility if > possible, so that old `git stash` will do something at least semi-sensible > with those commit structures. > > It might be too small a project, after all. Yeah, looking at this I think you're right. Thanks for helping work through this. > Ciao, > Dscho
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
Hi Junio, On Thu, 7 Feb 2019, Junio C Hamano wrote: > Johannes Schindelin writes: > > > Even when there are even only as much as 12 merge bases to test (which is > > the current number of merge bases between `next` and `pu`),... > > ... > > And I sadly have to report that that's not the end of it. Back when I > > implemented the automatic bisect after failed builds (for details, see > > https://github.com/git-for-windows/build-extra/commit/c7e01e82c), I had to > > turn it off real quickly because the dumb bisect between `next` and `pu` > > regularly ran into the 4h timeout. > > Would it make it easier for you if you substituted all the mention > of 'next' in your message with 'pu^{/^### match next}'? I was working on this in 2017, and could not make it to work as I wanted. Ever since, that bisect code has been dormant. In the meantime, I was able to parallelize the test suite enough to make it feasible to test the topic branches. That usually takes care of things really quickly, and I just bite the bullet and bisect manually. Ciao, Dscho > > That mid-point between 'master' and 'pu' is designed to contain > exactly the same set of non-merge commits 'next' has, with the tree > that is identical to that of 'next', and from there to the tip of > 'pu' forms a single strand of merges of tips of topic branches that > are not yet merged to 'next' (by definition, it itself is the merge > base of it and 'pu'). > > Bisecting along the first-parent chain from there to the tip of 'pu' > would let us identify which merge is faulty as the first-and-quick > pass and currently there are about 20 merges in that range on the > first-parent chain. > >
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
Hi Peff, On Thu, 7 Feb 2019, Jeff King wrote: > On Thu, Feb 07, 2019 at 04:41:57PM +0100, Johannes Schindelin wrote: > > > > I think this can be limited to the tests that failed, which makes things > > > much faster. I.e., we run the tests at the tip of topic X and see that > > > t1234 fails. We then go back to the fork point and we just need to run > > > t1234 again. If it succeeds, then we blame X for the failure. If it > > > fails, then we consider it a false positive. > > > > If you mean merge bases by fork points, I wrote an Azure Pipeline to do > > that (so that I could use the cloud as kind of a fast computer), but that > > was still too slow. > > > > Even when there are even only as much as 12 merge bases to test (which is > > the current number of merge bases between `next` and `pu`), a build takes > > roughly 6 minutes on Windows, and many tests take 1 minute or more to run > > (offenders like t7003 and t7610 take over 400 seconds, i.e. roughly 6 > > minutes), we are talking about roughly 1.5h *just* to test the merge > > bases. > > I was assuming you're testing individual topics from gitster/git here > (which admittedly is more CPU in total than just the integration > branches, but it at least parallelizes well). Indeed. And there, I can usually figure out really quickly myself (but manually) what is going wrong. Hopefully we have Azure Pipelines enabled on https://github.com/git/git soon, with PR builds that include Windows (unlike our current Travis builds), so that contributors have an easier time to test their code in an automated fashion. I also have on my backlog a task to include `sparse` in the Azure Pipelines jobs. That should take care of even more things in a purely automated fashion, as long as the contributors look at those builds. > So with that assumption, I was thinking that you'd just look for the > merge-base of HEAD and master, which should give you a single point for > most topics. For inter-twined topics there may be more merge bases, but > I actually think for our purposes here, just testing the most recent one > is probably OK. I.e., we're just trying to have a vague sense of whether > the test failure is due to new commits or old. Oh, I am typically looking only at the latest commits up until I hit a merge commit. Usually that already tells me enough, and if not, a bisect is really quick on a linear history. I guess my dumb branch^{/^Merge} to find the next merge commit works, but it is a bit unsatisfying that we do not have a more robust way to say "traverse the commit history until finding a merge commit, then use that". > I think Junio's suggestion to just pick some common release points would > work OK in practice, too. It's possible that some other topic made it to > master with a breakage, but in most cases, I think these sorts of > failures are often more coarsely-grained (especially if Junio pays > attention to the CI results before merging). If Junio wants to experiment with that, sure, I'm all for it. Ciao, Dscho
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
Hi Peff, On Thu, 7 Feb 2019, Jeff King wrote: > On Thu, Feb 07, 2019 at 03:26:21PM +0100, Johannes Schindelin wrote: > > > > So IMHO this isn't really a show-stopper problem, so much as > > > something that is a sign of the maturing test/CI setup (I say > > > "maturing", not "mature", as it seems we've probably still got a > > > ways to go). As far as notifications go, it probably makes sense for > > > them to be something that requires the user to sign up for anyway, > > > so at that point they're making their own choice about whether the > > > signal to noise ratio is acceptable. > > > > Maybe. I do not even know whether there is an option for that in Azure > > Pipelines, maybe GitHub offers that? > > No, I don't think so. Probably the route there would be to make a > comment on the commit or PR that would then go to the user as a > notification (from which they can then decide on email delivery, etc). Ah, but that won't notify you when a Check failed. So that still would require some scripting. > > In any case, I just wanted to corroborate with a real-world example > > what I mentioned at the Contributors' Summit: that I would like to not > > script that thing yet where contributors are automatically notified > > when their branches don't pass. > > Fair enough. As an alternative, do you know offhand if there's an easy > machine-readable way to get the CI results? If I could poll it with curl > and generate my own notifications, that would be fine for me. There is a REST API: https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/list?view=azure-devops-rest-5.0 So this would give you the latest 5 failed builds: curl "https://dev.azure.com/gitgitgadget/git/_apis/build/builds?definitions=6&resultFilter=failed&\$top=5"; I did not find a way to filter by user, or by branch name with wildcards, though. > > Speaking of which... can we hook it up with https://github.com/git/git, > > now that the Azure Pipelines support is in `master`? I sent you and Junio > > an invitation to https://dev.azure.com/git/git, so that either you or > > Junio (who are the only owners of the GitHub repository) can set it up. If > > you want me to help, please do not hesitate to ping me on IRC. > > I'm happy to. I walked through the Azure setup/login procedure, but I'm > not sure what to do next. The next step would be to install Azure Pipelines from the Marketplace and activate it for git/git. There *should* be a wizard or something to walk you through... Ciao, Dscho
t0028-working-tree-encoding.sh failing on musl based systems (Alpine Linux)
I'm trying to get the git test suite passing on Alpine Linux, which is based on musl libc. All tests in t0028-working-tree-encoding.sh are currently failing, because musl iconv does not support statefull output of UTF-16/32 (eg, it does not output a BOM), while git is expecting that to be present: > hint: The file 'test.utf16' is missing a byte order mark (BOM). Please > use UTF-16BE or UTF-16LE (depending on the byte order) as > working-tree-encoding. > fatal: BOM is required in 'test.utf16' if encoded as utf-16 Because adding the file to get fails, all the other tests fail as well as they expect the file to be present in the repository. Any idea how to get around this? Kevin
Re: [PATCH v4] log,diff-tree: add --combined-all-names option
On Thu, Feb 7, 2019 at 12:25 PM Junio C Hamano wrote: > > Elijah Newren writes: > > > I think "copy from" and "rename from" should be relatively > > straightforward. However, in a combined diff, we could have both a > > modified status, a renamed status, and a copied status, meaning that > > we'll need an array of both similarity and dissimilarity indexes...and > > trying to present that to the user in a way that makes sense seems > > like a lost cause to me. Does anyone else know how to represent that? > > I'm inclined to just leave it out. > > > > Also, I'm afraid "copy to" and "rename to" could be confusing if both > > appeared, since there's only one "to" path. If there is both a copy > > and a rename involved relative to different parents, should these be > > coalesced into a "copy/rename to" line? > > There are three possible labels (i.e. 'in-place modification', > 'rename from elsewhere' and 'copy from elsewhere'), and you can say > "this commit created file F by renaming from X (or by copying X)" > only when you know path F did not exist _immediately before_ this > commit. The distinction between rename and copy is whether the path > X remains in the resulting commit (i.e. if there is no X, the commit > created path F by moving X; if there is X, the commit copied the > contents of X into a new path F). > > So telling renames and copies apart is probably straight-forward (if > you have sufficient information---I am not sure if you do in this > codepath offhand); as long as you know what pathname each preimage > (i.e. parent of the perge) tree had and if that pathname is missing > in the postimage (luckily there is only one---the merge result), it > was renamed, and otherwise it was copied. We have change status, M, C, A, R, D, etc. So, R vs. C tells us renamed or copied. We also have the original filename. > But telling in-place modification and other two might be > trickier. In one parent path F may be missing but in the other > parent path F may exist, and the result of the merge is made by > merging the contents of path X in the first parent and the contents > of path F in the second parent. From the view of the transition > between the first parent to the merge result, we moved the path X to > path F and made some modifications (i.e. renamed). From the view of > the transition from the other branch, we kept the contents in path F > during the transition and there is no renames or copies involved. > > Actually what I had in mind when I mentioned the extended headers > the first time in this discussion was that we would have "rename > from", "copy from", etc. separately for each parent, as the contents > may have come from different paths in these parents. And that was > where my earlier "... might only become waste of the screen real > estate" comes from. I think I'm with you on everything you said here, but perhaps not since I can't see an answer to my question. Maybe an example will help: Let's say we have an octopus merge. Parent 1 had file F. Parent 2 had file X. Parent 3 had file Y. The octopus has two files: F' and X, with F' being very similar to F, X, and Y. There's no "modified from" header; it's not needed (unless we want to add a new kind of noise header?) We could emit a "copied from X" header, due to parent 2. We could emit a "renamed from Y" header, due to parent 3. Now, the question: In addition to the two "from" headers, how many "to" headers do we emit? In particular, do we emit both a "copied to F" and a "renamed to F" header, or just a combined "renamed/copied to F" header? I'm inclined to go with the latter, to avoid giving the idea that there are multiple targets, but maybe folks expect there to be one "rename to" and "copy to" for each "rename from" or "copy from" that appeared. > So, again, do not spend too much effort to emit these textual info > that can be easily seen with the N+1 plus/minus header lines.
Re: [PATCH v3 3/3] submodule: teach set-branch subcommand
Denton Liu writes: > @@ -168,6 +169,12 @@ submodule with the `--init` option. > If `--recursive` is specified, this command will recurse into the > registered submodules, and update any nested submodules within. > -- > +set-branch ((-d|--default)|(-b|--branch )) [--] :: > + Sets the default remote tracking branch for the submodule. The > + `--branch` option allows the remote branch to be specified. The > + `--default` option removes the submodule..branch configuration > + key, which causes the tracking branch to default to 'master'. > +-- > summary [--cached|--files] [(-n|--summary-limit) ] [commit] [--] > [...]:: > Show commit summary between the given commit (defaults to HEAD) and > working tree/index. For a submodule in question, a series of commits The double-dash line you added must be replaced with an empty line. The existing double-dash is *not* a separator between the previous entry (i.e. update) and the next entry (i.e. summary). Rather, the body for 'update' is enclosed in a pair of double-dash lines as it has many paragraphs.
Re: [PATCH v4] log,diff-tree: add --combined-all-names option
Elijah Newren writes: > diff --git a/Documentation/diff-generate-patch.txt > b/Documentation/diff-generate-patch.txt > index 231105cff4..69cb3b0349 100644 > --- a/Documentation/diff-generate-patch.txt > +++ b/Documentation/diff-generate-patch.txt > @@ -144,6 +144,19 @@ Similar to two-line header for traditional 'unified' diff > format, `/dev/null` is used to signal created or deleted > files. > > +However, if the --combined-all-paths option is provided, instead of a > +two-line from-file/to-file you get a N+1 line from-file/to-file header, > +where N is the number of parents in the merge commit > + > + --- a/file > + --- a/file > + --- a/file > + +++ b/file > ++ > +This extended format can be useful if rename or copy detection is > +active, to allow you to see the original name of the file in different > +parents. > + > 4. Chunk header format is modified to prevent people from > accidentally feeding it to `patch -p1`. Combined diff format > was created for review of merge commit changes, and was not You need to replace the blank line before the new paragraph that begins with "However" with a line with a single "+" on it, to tell the formatter that the new text is still part of the third item in the list.
Re: [PATCH v3 2/3] submodule--helper: teach config subcommand --unset
Denton Liu writes: > + if (argc == 3 || (argc == 2 && command == DO_UNSET)) { > if (!is_writing_gitmodules_ok()) > die(_("please make sure that the .gitmodules file is in > the working tree")); > > - return config_set_in_gitmodules_file_gently(argv[1], argv[2]); > + const char *value = (argc == 3) ? argv[2] : NULL; This introduces decl-after-stmt. Move it before the "is it OK to write?" check. > + return config_set_in_gitmodules_file_gently(argv[1], value); > }
Re: [PATCH] ci: make sure we build Git parallel
Hi Junio, On Thu, 7 Feb 2019, Junio C Hamano wrote: > Junio C Hamano writes: > > > Wouldn't all other hits of "MAKEFLAGS=" in ci/lib.sh also want the > > same treatment, though? We know that "if travis to this, otherwise > > if Asure, do that" is the first block to muck with MAKEFLAGS in the > > script, but a new assignment before that block can be added in the > > future and cause a similar issue unless we do so. > > > > Of course, at some point we do want to say "we do not want to > > inherit it from the outside environment", but then such an > > assignment of empty value should be done at the very beginning with > > a comment, not with "this happens to be the first one to set, so > > let's not append but assign to clear any previous value", I would > > think. > > That is, in a patch form on top of yours, something like this. > > > ci/lib.sh | 9 ++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/ci/lib.sh b/ci/lib.sh > index cee51a4cc4..288a5b3884 100755 > --- a/ci/lib.sh > +++ b/ci/lib.sh > @@ -74,6 +74,9 @@ check_unignored_build_artifacts () > } > } > > +# Clear MAKEFLAGS that may come from the outside world. > +export MAKEFLAGS= > + > # Set 'exit on error' for all CI scripts to let the caller know that > # something went wrong. > # Set tracing executed commands, primarily setting environment variables > @@ -101,7 +104,7 @@ then > BREW_INSTALL_PACKAGES="git-lfs gettext" > export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save" > export GIT_TEST_OPTS="--verbose-log -x --immediate" > - export MAKEFLAGS="--jobs=2" > + MAKEFLAGS="$MAKEFLAGS --jobs=2" > elif test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI" > then > CI_TYPE=azure-pipelines > @@ -126,7 +129,7 @@ then > BREW_INSTALL_PACKAGES=gcc@8 > export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save" > export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" > - export MAKEFLAGS="--jobs=10" > + MAKEFLAGS="$MAKEFLAGS --jobs=10" > test windows_nt != "$CI_OS_NAME" || > GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" > else > @@ -185,4 +188,4 @@ GIT_TEST_GETTEXT_POISON) > ;; > esac > > -export MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" > +MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" Since this is intended to be run in a CI setting, there is not a whole lot of opportunity to set `MAKEFLAGS` outside of the script. And if there is, that might open a rabbit hole when debugging issues that somehow in the end turn out to come from a hard-coded `MAKEFLAGS` somewhere in the CI system. So I'd rather clear `MAKEFLAGS` at the beginning (i.e. where you `export MAKEFLAGS`, I'd simply append a `=`). Ciao, Dscho
Re: [PATCH] contrib/subtree: ensure only one rev is provided
]0;joe - On Thu, Feb 7, 2019 at 1:54 PM Junio C Hamano wrote: > I am not sure if the other caller is OK, though. cmd_add_repository > can get more than one revs, and uses the first one as $rev to read > the tree from, expecting that this helper to ignore other ones that > are emitted from 'git rev-parse --revs-only "$@"'. > > For that matter, one of the early things cmd_split does is to call > the find_existing_splits helper with $revs, and it seems to be > prepared to be red multiple $revs (it is passed to "git log", so I > would expect that incoming $revs is allowed to specify bottom to > limit the traversal, e.g. "git log maint..master"). The addition of > "ensure_single_rev" we saw in an earlier hunk near ll.191 makes such > call impossible. I am not a user of subtree, so I do not know if > it is a good change (i.e. making something nonsensical impossible to > do is good, making something useful impossible to do is bad). I think this generality is probably not useful and it will probably confuse people less if we prevent it. It was just one of those "if you don't have any better ideas, just let people do whatever complicated thing they want" approaches I used when I was first writing it and didn't know how people would end up using it. > In any case, I do not use subtree, and the last time I looked at > this script is a long time ago, so take all of the above with a > large grain of salt. I don't use it very often either. To be honest, I've noticed weird behaviour in the version installed with git 2.11.0 in Debian, so I went back to my own version at https://github.com/apenwarr/git-subtree. I've been meaning to investigate further to see what patch might have happened that caused it to act weird; maybe it's since been fixed. But I don't see any major problems with the patch in this thread. Thanks! Avery
Re: [PATCH 0/1] Fix incorrectly reported CPU in 32-bit Windows
Hi Junio, On Thu, 7 Feb 2019, Junio C Hamano wrote: > "Johannes Schindelin via GitGitGadget" > writes: > > > This is yet another patch I forgot to upstream, and I hope that it > > will make it into v2.21.0-rc1. > > I guess this affects nobody other than you and perhaps J6t, the > point not being "there are only just two" but being "all of them > know how to deal with possible breakages if any in this change". Correct. This patch is already in Git for Windows, so contributors building from that fork will have had the problem already. > I am tempted to bypass the usual "from pu down to next down to > master" dance on this one, because of that. > > ;-) I would be very grateful for that :-) Ciao, Dscho
Re: [PATCH 0/1] git-p4: remove ticket expiration test
On Thu, 7 Feb 2019 13:45:18 +0100 (STD) Johannes Schindelin wrote: > Hi Luke, > > On Wed, 6 Feb 2019, Luke Diamand wrote: > > > As per thread here, this removes the git-p4 ticket expiration > > test, since it isn't really that useful. > > > > https://marc.info/?l=git&m=154946136416003&w=2 > > Thank you for the prompt patch! > > However, like Gábor, my feeling is that we would want that test case in a > non-flakey form, if possible. If you think that that is only possible with > a mocked p4, so be it, let's remove the test case (because the mocked one > will likely look quite a bit different). But if there are easier ways to > work around the timing issues (such as dropping the first `sync`), then > I'd prefer to have the safety of a regression test. I've got a mocked-up p4 wrapper which returns whatever expiration time the test needs. I'll submit it tomorrow. It's just a few lines of python script to generate the marshalled data, so it's not very complicated. > > Thanks, > Dscho > > > Luke Diamand (1): > > git-p4: remove ticket expiry test > > > > t/t9833-errors.sh | 27 --- > > 1 file changed, 27 deletions(-) > > > > -- > > 2.20.1.611.gfbb209baf1 > > > > -- Luke Diamand
Re: [PATCH v4] log,diff-tree: add --combined-all-names option
Elijah Newren writes: > Now, the question: In addition to the two "from" headers, how many > "to" headers do we emit? In particular, do we emit both a "copied to > F" and a "renamed to F" header, or just a combined "renamed/copied to > F" header? There is only a single path that can be on the "to", as there is only one final result, but _how_ the contents got to that path would be different, so to be technically truly correct, you would end up showing N "to" lines for a N-way merge, each of which gives the same path in the postimage, but some may say renamed, another may say copioed and some others may need to say in-place edited. That would increase the number of necessary lines from N (from) + 1 (to) to N*2 (N for each of from and to), which makes it even less economical. And showing a single "renamed/copied" feels more like a cop-out to avoid being techincally incorrect, than giving a useful piece of information to the users. I am inclined to say that we should do _without_ any "to" line. And if we can do without any "to", perhaps we do not need "from", either.
Re: [PATCH] ci: make sure we build Git parallel
Johannes Schindelin writes: >> >> +# Clear MAKEFLAGS that may come from the outside world. >> +export MAKEFLAGS= >> + >> # Set 'exit on error' for all CI scripts to let the caller know that >> # something went wrong. >> # Set tracing executed commands, primarily setting environment variables >> @@ -101,7 +104,7 @@ then >> BREW_INSTALL_PACKAGES="git-lfs gettext" >> export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save" >> export GIT_TEST_OPTS="--verbose-log -x --immediate" >> -export MAKEFLAGS="--jobs=2" >> +MAKEFLAGS="$MAKEFLAGS --jobs=2" >> elif test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI" >> then >> CI_TYPE=azure-pipelines >> @@ -126,7 +129,7 @@ then >> BREW_INSTALL_PACKAGES=gcc@8 >> export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save" >> export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" >> -export MAKEFLAGS="--jobs=10" >> +MAKEFLAGS="$MAKEFLAGS --jobs=10" >> test windows_nt != "$CI_OS_NAME" || >> GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" >> else >> @@ -185,4 +188,4 @@ GIT_TEST_GETTEXT_POISON) >> ;; >> esac >> >> -export MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" >> +MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" > > Since this is intended to be run in a CI setting, there is not a whole lot > of opportunity to set `MAKEFLAGS` outside of the script. And if there is, > that might open a rabbit hole when debugging issues that somehow in the > end turn out to come from a hard-coded `MAKEFLAGS` somewhere in the CI > system. > > So I'd rather clear `MAKEFLAGS` at the beginning (i.e. where you `export > MAKEFLAGS`, I'd simply append a `=`). I meant to clear it at the beginning, where I "export MAKEFLAGS=". Did your MUA ate the equal sign at the end, mistaking it with part of text/plain; format=flawed or something?
[PATCH] ci: clear and mark MAKEFLAGS exported just once
Clearing it once upfront, and turning all the assignment into appending, would future-proof the code even more, to prevent mistakes the previous one fixed from happening again. Also, mark the variable exported just once at the beginning. There is no point in marking it exported repeatedly. Signed-off-by: Junio C Hamano --- >> So I'd rather clear `MAKEFLAGS` at the beginning (i.e. where you `export >> MAKEFLAGS`, I'd simply append a `=`). This time in proper patch form. ci/lib.sh | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ci/lib.sh b/ci/lib.sh index cee51a4cc4..288a5b3884 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -74,6 +74,9 @@ check_unignored_build_artifacts () } } +# Clear MAKEFLAGS that may come from the outside world. +export MAKEFLAGS= + # Set 'exit on error' for all CI scripts to let the caller know that # something went wrong. # Set tracing executed commands, primarily setting environment variables @@ -101,7 +104,7 @@ then BREW_INSTALL_PACKAGES="git-lfs gettext" export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save" export GIT_TEST_OPTS="--verbose-log -x --immediate" - export MAKEFLAGS="--jobs=2" + MAKEFLAGS="$MAKEFLAGS --jobs=2" elif test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI" then CI_TYPE=azure-pipelines @@ -126,7 +129,7 @@ then BREW_INSTALL_PACKAGES=gcc@8 export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save" export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" - export MAKEFLAGS="--jobs=10" + MAKEFLAGS="$MAKEFLAGS --jobs=10" test windows_nt != "$CI_OS_NAME" || GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" else @@ -185,4 +188,4 @@ GIT_TEST_GETTEXT_POISON) ;; esac -export MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" +MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" -- 2.21.0-rc0
Re: [PATCH v4] log,diff-tree: add --combined-all-names option
On Thu, Feb 7, 2019 at 3:31 PM Junio C Hamano wrote: > > Elijah Newren writes: > > > Now, the question: In addition to the two "from" headers, how many > > "to" headers do we emit? In particular, do we emit both a "copied to > > F" and a "renamed to F" header, or just a combined "renamed/copied to > > F" header? > > There is only a single path that can be on the "to", as there is > only one final result, but _how_ the contents got to that path would > be different, so to be technically truly correct, you would end up > showing N "to" lines for a N-way merge, each of which gives the same > path in the postimage, but some may say renamed, another may say > copioed and some others may need to say in-place edited. > > That would increase the number of necessary lines from N (from) + 1 > (to) to N*2 (N for each of from and to), which makes it even less > economical. > > And showing a single "renamed/copied" feels more like a cop-out to > avoid being techincally incorrect, than giving a useful piece of > information to the users. > > I am inclined to say that we should do _without_ any "to" line. And Works for me. > if we can do without any "to", perhaps we do not need "from", either. I would be okay with that, but looking through a few of them, I think the "from" lines do help a little, just because lengthy filenames are not uncommon and it's easy to miss the fact that there is a rename, often in some directory somewhere in the middle. A couple examples: diff --combined packages/search/ete/src/test/resources/test-suite.yml index 4ae66932ef9,1cc55276946..1cc55276946 rename from packages/search/src/geb/resources/test-suite.yml --- a/packages/search/ete/src/test/resources/test-suite.yml --- a/packages/search/src/geb/resources/test-suite.yml +++ b/packages/search/ete/src/test/resources/test-suite.yml @@@ -1,15 -1,5 +1,5 @@@ diff --combined packages/search/ete/var/conf/app/public/searchApp.yml index 38cc5482e5b,487178ac0a9..487178ac0a9 rename from packages/search/ete/var/conf/app/public/searchApp rename from packages/search/var/conf/app/public/searchApp.yml --- a/packages/search/ete/var/conf/app/public/searchApp --- a/packages/search/var/conf/app/public/searchApp.yml +++ b/packages/search/ete/var/conf/app/public/searchApp.yml If there's no renames or copies, then I don't add anything to the combined diff. With renames or copies, people can get the "to" name from looking at the "+++ b/" line. But not a real big deal, I could just omit this if you prefer.
Re: [PATCH v4] log,diff-tree: add --combined-all-names option
On Thu, Feb 7, 2019 at 2:28 PM Junio C Hamano wrote: > > Elijah Newren writes: > > > diff --git a/Documentation/diff-generate-patch.txt > > b/Documentation/diff-generate-patch.txt > > index 231105cff4..69cb3b0349 100644 > > --- a/Documentation/diff-generate-patch.txt > > +++ b/Documentation/diff-generate-patch.txt > > @@ -144,6 +144,19 @@ Similar to two-line header for traditional 'unified' > > diff > > format, `/dev/null` is used to signal created or deleted > > files. > > > > +However, if the --combined-all-paths option is provided, instead of a > > +two-line from-file/to-file you get a N+1 line from-file/to-file header, > > +where N is the number of parents in the merge commit > > + > > + --- a/file > > + --- a/file > > + --- a/file > > + +++ b/file > > ++ > > +This extended format can be useful if rename or copy detection is > > +active, to allow you to see the original name of the file in different > > +parents. > > + > > 4. Chunk header format is modified to prevent people from > > accidentally feeding it to `patch -p1`. Combined diff format > > was created for review of merge commit changes, and was not > > You need to replace the blank line before the new paragraph that > begins with "However" with a line with a single "+" on it, to tell > the formatter that the new text is still part of the third item in > the list. Sorry about that; including that in my fixes now.
Re: t0025 flakey?
On Thu, Feb 07, 2019 at 11:58:08AM -0500, Randall S. Becker wrote: > > The NonStop port has traditionally had issues with t0025, which we tended > > to ignore because things did work. We wrote those off as bash issues in > > t0025 since they seemed to be corrected when we picked up a new bash > > version about a year ago. I will keep monitoring this, particularly when > 2.21 > > comes out. > > FYI: t0020-t0027 all passed on the NonStop port for 2.21.0-rc0 - so no > issues for us on this one. Note that t0021 is very likely flaky on NonStop, too: https://public-inbox.org/git/2019040408.gc...@szeder.dev/T/#u
Re: [PATCH v6 1/1] protocol: advertise multiple supported versions
On 2019.02.05 11:42, Jonathan Tan wrote: > Thanks. Overall, one major point: I think that the declaration of > supported versions need to be transport-scoped (search this email for > "transport-scoped" for context). And one medium point: it might be > better for protocol.version to be the preferred and maximum version, not > only the preferred version. I have other minor points, which you can > read below. Thanks for the review, and apologies for the delayed reply. I have some questions below about making the version advertisement transport scoped. I think you're right about making the config version the maximum, although I believe we've also avoided making the protocol versions strictly orderable, so it may not be feasible if we want to keep that feature. > > Currently the client advertises that it supports the wire protocol > > version set in the protocol.version config. However, not all services > > support the same set of protocol versions. For example, git-receive-pack > > supports v1 and v0, but not v2. > > That's true, except . > > > If a client connects to git-receive-pack > > and requests v2, it will instead be downgraded to v0. > > This is a bit misleading. The client never requests v2 - connect.c has > an override that changes it to v0 (as can be seen from the diff of this > patch) before the request takes place. If we were to create a custom > client that requests v2, the server would die with "support for protocol > v2 not implemented yet". (But maybe this is a bug - the server should > downgrade instead.) Ack, will fix the description in the next version. > > Other services, > > such as git-upload-archive, do not do any version negotiation checks. > > > > This patch creates a protocol version registry. Individual client and > > server programs register all the protocol versions they support prior to > > communicating with a remote instance. Versions should be listed in > > preference order; the version specified in protocol.version will > > automatically be moved to the front of the registry. > > It took me a while to understand what's going on, so let me try to > summarize: > > - The main issue is that send-pack doesn't support v2, so it would be >incorrect for the client to advertise v2; this is currently fine >because of the override in connect.c. A side issue is that the client >advertises v2 for other things (e.g. archive), which currently works >only because the server ignores them. > > - To solve both these issues, each command declares which protocols it >supports. > > - Because we now have such a list, it is not too difficult to pass the >entire list to the server, so we should do so. (Servers already >support multiple versions.) > > > The protocol version registry is passed to remote helpers via the > > GIT_PROTOCOL environment variable. > > This is unfortunate to me, but I can't think of a better way to do it - > we do need to communicate the allowed version list somehow. A transport > option cannot be ignored by an old remote helper, but an envvar can. > > Backwards/forwards compatibility notes: > > - If an old Git uses a new remote helper, no GIT_PROTOCOL is passed so >the remote helper uses v0 regardless of what's configured in the >repo. This should be fine. > - If a new Git uses an old remote helper, what's configured gets used >(unless it's for send-pack, in which case a version override occurs), >regardless of which versions Git declares that it supports. I can >envision some situations in which this would trip us up, but we are >already in this exact situation anyway. > > > Additionally, remove special cases around advertising version=0. > > Previously we avoided adding version advertisements to the client's > > initial connection request if the client wanted version=0. However, > > including these advertisements does not change the version negotiation > > behavior, so it's better to have simpler code. As a side effect, this > > means that client operations over SSH will always include a > > "SendEnv=GIT_PROTOCOL" option on the SSH command line. > > HTTP too, I think? Correct. > Also, this means that the client will send different information to the > server now, but it seems fine (as far as I know, clients already send > Git version information anyway). > > Overall, I would write the commit message this way: > > A Git client can communicate with a Git server through various > commands, and for each command, in various protocol versions. Each > repo can define protocol.version as 0, 1, or 2 for the protocol > version that it prefers. But this integer is handled differently by > each command: if communicating with "upload-pack", the integer is > passed verbatim to be interpreted by the server; if communicating > with "receive-pack", the integer is hardcoded to be overridden to 0 > or 1; and if communicating with anything else (e.g. "archive"), the > integer is passed verbatim
Re: [PATCH] ci: clear and mark MAKEFLAGS exported just once
On Thu, Feb 07, 2019 at 03:45:46PM -0800, Junio C Hamano wrote: > Clearing it once upfront, and turning all the assignment into > appending, would future-proof the code even more, to prevent > mistakes the previous one fixed from happening again. > > Also, mark the variable exported just once at the beginning. There > is no point in marking it exported repeatedly. > > Signed-off-by: Junio C Hamano > --- > >> So I'd rather clear `MAKEFLAGS` at the beginning (i.e. where you > `export > >> MAKEFLAGS`, I'd simply append a `=`). > > This time in proper patch form. Makes sense, and the patch looks good to me. > ci/lib.sh | 9 ++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/ci/lib.sh b/ci/lib.sh > index cee51a4cc4..288a5b3884 100755 > --- a/ci/lib.sh > +++ b/ci/lib.sh > @@ -74,6 +74,9 @@ check_unignored_build_artifacts () > } > } > > +# Clear MAKEFLAGS that may come from the outside world. > +export MAKEFLAGS= > + > # Set 'exit on error' for all CI scripts to let the caller know that > # something went wrong. > # Set tracing executed commands, primarily setting environment variables > @@ -101,7 +104,7 @@ then > BREW_INSTALL_PACKAGES="git-lfs gettext" > export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save" > export GIT_TEST_OPTS="--verbose-log -x --immediate" > - export MAKEFLAGS="--jobs=2" > + MAKEFLAGS="$MAKEFLAGS --jobs=2" > elif test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI" > then > CI_TYPE=azure-pipelines > @@ -126,7 +129,7 @@ then > BREW_INSTALL_PACKAGES=gcc@8 > export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save" > export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" > - export MAKEFLAGS="--jobs=10" > + MAKEFLAGS="$MAKEFLAGS --jobs=10" > test windows_nt != "$CI_OS_NAME" || > GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" > else > @@ -185,4 +188,4 @@ GIT_TEST_GETTEXT_POISON) > ;; > esac > > -export MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" > +MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" > -- > 2.21.0-rc0 >
Re: t0028-working-tree-encoding.sh failing on musl based systems (Alpine Linux)
[Please skip using Reply-To and instead of Mail-Followup-To so that responses also go to the list.] On Thu, Feb 07, 2019 at 10:59:35PM +0100, Kevin Daudt wrote: > I'm trying to get the git test suite passing on Alpine Linux, which is > based on musl libc. > > All tests in t0028-working-tree-encoding.sh are currently failing, > because musl iconv does not support statefull output of UTF-16/32 (eg, > it does not output a BOM), while git is expecting that to be present: > > > hint: The file 'test.utf16' is missing a byte order mark (BOM). Please > > use UTF-16BE or UTF-16LE (depending on the byte order) as > > working-tree-encoding. > > fatal: BOM is required in 'test.utf16' if encoded as utf-16 > > Because adding the file to get fails, all the other tests fail as well > as they expect the file to be present in the repository. > > Any idea how to get around this? I think musl needs to patch their libc. RFC 2781 says that if there's no BOM in UTF-16, then "the text SHOULD be interpreted as being big-endian." Unfortunately for all of us, many Windows-based programs have chosen to ignore that advice (technically, it's only a SHOULD) and interpret it as little-endian instead. Git can't safely assume anything about the endianness of a UTF-16 stream that doesn't contain a BOM. Technically, since the RFC doesn't specify a MUST requirement, musl can't, either. Even if Git were to produce a BOM to work around this issue, then we'd still have the problem that any program using musl will write data in UTF-16 without a BOM. Moreover, because musl, in violation of the RFC, doesn't read and process BOMs, someone using little-endian UTF-16 (with a proper BOM) with musl and Git will have their data corrupted, according to my reading of the musl website. In other words, I believe this test is failing legitimately. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204 signature.asc Description: PGP signature
Re: [PATCH v3] doc-diff: don't `cd_to_toplevel`
On Thu, Feb 07, 2019 at 03:45:02PM -0500, Jeff King wrote: > Fair enough. As an alternative, do you know offhand if there's an easy > machine-readable way to get the CI results? If I could poll it with curl > and generate my own notifications, that would be fine for me. Well, what do you mean by "CI results"? Getting whether a build succeeded, failed, still running, etc.? Sure. Getting which particular test script (semantic patch, documentation...) caused the build failure? Nope. [1] Travis CI has a REST API (note that you have to sign in with GitHub account to view its docs, and then need an access token to use the API): https://developer.travis-ci.org/gettingstarted They also offer a command line client for this API: https://github.com/travis-ci/travis.rb Depending on what you want that in itself might already be enough for you. It wasn't for me, as I have a very particular idea about how I prefer to view my CI results, but neither the website nor the CLI client offer such a compact _and_ detailed view like this: c 2175 pu c 2174 sg/ci-parallel-build c 2173 js/fuzz-commit-graph-update c 2172 js/mingw-host-cpu PsscsPscc 2171 dl/submodule-set-branch PPXsP 2170 kl/pretty-doc-markup-fix P 2169 en/combined-all-paths ('c' - created, 's' - started, 'P' - passed, 'X' - failed) Nothing that can't be achived with good screenful of Python/Ruby/etc scripting... including colors matching the website's color scheme! :) [1] Although since we include the trash directory of the failed test script in the logs, surrounded by clear marker lines containing the failed test script's name, it wouldn't be too hard to get it programmatically, either.
[PATCH v5 2/2] squash! log,diff-tree: add --combined-all-paths option
This also adds "rename from " and "copy from " extended headers when renames or copies are involved. Signed-off-by: Elijah Newren --- Documentation/diff-generate-patch.txt | 7 +++ combine-diff.c| 15 +++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Documentation/diff-generate-patch.txt b/Documentation/diff-generate-patch.txt index f10ca410ad..f0c2a17aef 100644 --- a/Documentation/diff-generate-patch.txt +++ b/Documentation/diff-generate-patch.txt @@ -128,12 +128,11 @@ or like this (when `--cc` option is used): mode ,.. new file mode deleted file mode , + copy from + rename from + The `mode ,..` line appears only if at least one of -the is different from the rest. Extended headers with -information about detected contents movement (renames and -copying detection) are designed to work with diff of two - and are not used by combined diff format. +the is different from the rest. 3. It is followed by two-line from-file/to-file header diff --git a/combine-diff.c b/combine-diff.c index 54cb892ae5..04a139ea03 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -981,6 +981,21 @@ static void show_combined_header(struct combine_diff_path *elem, printf("%s\n", c_reset); } + for (i = 0; i < num_parent; i++) { + switch (elem->parent[i].status) { + case DIFF_STATUS_COPIED: + dump_quoted_path("copy from ", "", +elem->parent[i].path.buf, +line_prefix, c_meta, c_reset); + break; + case DIFF_STATUS_RENAMED: + dump_quoted_path("rename from ", "", +elem->parent[i].path.buf, +line_prefix, c_meta, c_reset); + break; + } + } + if (!show_file_header) return; -- 2.20.1.311.gb8408a6075
[PATCH v5 0/2] add --combined-all-paths option to log and diff-tree
Changes since v4: * Added a second patch that can be squashed in which will add 'rename from' and 'copy from' extended headers. I like it, but Junio sounded pessimistic about it. See https://public-inbox.org/git/xmqqlg2rmazz@gitster-ct.c.googlers.com/ * Micro fixes: * Renamed --combined-all-names to --combined-all-paths * Fixed formatting error (missed '+') in diff-generate-patch.txt * Marked tests which used tabs in filenames with FUNNYNAMES prereq * Added tests that didn't depend on FUNNYNAMES Elijah Newren (2): log,diff-tree: add --combined-all-paths option squash! log,diff-tree: add --combined-all-paths option Documentation/diff-format.txt | 20 +- Documentation/diff-generate-patch.txt | 20 -- Documentation/git-diff-tree.txt | 11 +++- Documentation/rev-list-options.txt| 7 +++ builtin/diff-tree.c | 6 +- combine-diff.c| 91 +++ diff.h| 1 + revision.c| 6 ++ revision.h| 1 + t/t4038-diff-combined.sh | 88 ++ 10 files changed, 230 insertions(+), 21 deletions(-) Range-diff: 1: 26c64cee8a ! 1: 2205640429 log,diff-tree: add --combined-all-names option @@ -1,6 +1,6 @@ Author: Elijah Newren -log,diff-tree: add --combined-all-names option +log,diff-tree: add --combined-all-paths option The combined diff format for merges will only list one filename, even if rename or copy detection is active. For example, with raw format one @@ -15,7 +15,7 @@ of phooey.c were in either of the parents. In contrast, for non-merge commits, raw format does provide original filenames (and a rename score to boot). In order to also provide original filenames for merge -commits, add a --combined-all-names option (which must be used with +commits, add a --combined-all-paths option (which must be used with either -c or --cc, and is likely only useful with rename or copy detection active) so that we can print tab-separated filenames when renames are involved. This transforms the above output to: @@ -38,8 +38,6 @@ +++ b/phooey.c Signed-off-by: Elijah Newren -Signed-off-by: Junio C Hamano -Message-Id: <20190204200754.16413-1-new...@gmail.com> diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt --- a/Documentation/diff-format.txt @@ -54,17 +52,17 @@ -Example: +For `-c` and `--cc`, only the destination or final path is shown even +if the file was renamed on any side of history. With -+`--combined-all-names`, the name of the path in each parent is shown ++`--combined-all-paths`, the name of the path in each parent is shown +followed by the name of the path in the merge commit. + -+Examples for `-c` and `-cc` without `--combined-all-names`: ++Examples for `-c` and `-cc` without `--combined-all-paths`: + +::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c +::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar.sh +::100644 100644 100644 e07d6c5 9042e82 ee91881 RR phooey.c + + -+Examples when `--combined-all-names` added to either `-c` or `--cc`: ++Examples when `--combined-all-paths` added to either `-c` or `--cc`: -::100644 100644 100644 fabadb8 cc95eb0 4866510 MM describe.c @@ -79,9 +77,10 @@ --- a/Documentation/diff-generate-patch.txt +++ b/Documentation/diff-generate-patch.txt @@ + Similar to two-line header for traditional 'unified' diff format, `/dev/null` is used to signal created or deleted files. - +++ +However, if the --combined-all-paths option is provided, instead of a +two-line from-file/to-file you get a N+1 line from-file/to-file header, +where N is the number of parents in the merge commit @@ -94,10 +93,9 @@ +This extended format can be useful if rename or copy detection is +active, to allow you to see the original name of the file in different +parents. -+ + 4. Chunk header format is modified to prevent people from accidentally feeding it to `patch -p1`. Combined diff format - was created for review of merge commit changes, and was not diff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt --- a/Documentation/git-diff-tree.txt @@ -108,7 +106,7 @@ 'git diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty] -[-t] [-r] [-c | --cc] [--root] [] - [] [...] -+[-t] [-r] [-c | --cc] [--com
[PATCH v5 1/2] log,diff-tree: add --combined-all-paths option
The combined diff format for merges will only list one filename, even if rename or copy detection is active. For example, with raw format one might see: ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM describe.c ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar.sh ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR phooey.c This doesn't let us know what the original name of bar.sh was in the first parent, and doesn't let us know what either of the original names of phooey.c were in either of the parents. In contrast, for non-merge commits, raw format does provide original filenames (and a rename score to boot). In order to also provide original filenames for merge commits, add a --combined-all-paths option (which must be used with either -c or --cc, and is likely only useful with rename or copy detection active) so that we can print tab-separated filenames when renames are involved. This transforms the above output to: ::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c desc.c desc.c ::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM foo.sh bar.sh bar.sh ::100644 100644 100644 e07d6c5 9042e82 ee91881 RR fooey.c fuey.c phooey.c Further, in patch format, this changes the from/to headers so that instead of just having one "from" header, we get one for each parent. For example, instead of having --- a/phooey.c +++ b/phooey.c we would see --- a/fooey.c --- a/fuey.c +++ b/phooey.c Signed-off-by: Elijah Newren --- Documentation/diff-format.txt | 20 +- Documentation/diff-generate-patch.txt | 13 Documentation/git-diff-tree.txt | 11 +++- Documentation/rev-list-options.txt| 7 +++ builtin/diff-tree.c | 6 +- combine-diff.c| 76 +++ diff.h| 1 + revision.c| 6 ++ revision.h| 1 + t/t4038-diff-combined.sh | 88 +++ 10 files changed, 212 insertions(+), 17 deletions(-) diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt index cdcc17f0ad..715cbb7604 100644 --- a/Documentation/diff-format.txt +++ b/Documentation/diff-format.txt @@ -95,12 +95,26 @@ from the format described above in the following way: . there are more "src" modes and "src" sha1 . status is concatenated status characters for each parent . no optional "score" number -. single path, only for "dst" +. tab-separated pathname(s) of the file -Example: +For `-c` and `--cc`, only the destination or final path is shown even +if the file was renamed on any side of history. With +`--combined-all-paths`, the name of the path in each parent is shown +followed by the name of the path in the merge commit. + +Examples for `-c` and `-cc` without `--combined-all-paths`: + +::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c +::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM bar.sh +::100644 100644 100644 e07d6c5 9042e82 ee91881 RR phooey.c + + +Examples when `--combined-all-paths` added to either `-c` or `--cc`: -::100644 100644 100644 fabadb8 cc95eb0 4866510 MM describe.c +::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c desc.c desc.c +::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM foo.sh bar.sh bar.sh +::100644 100644 100644 e07d6c5 9042e82 ee91881 RR fooey.c fuey.c phooey.c Note that 'combined diff' lists only files which were modified from diff --git a/Documentation/diff-generate-patch.txt b/Documentation/diff-generate-patch.txt index 231105cff4..f10ca410ad 100644 --- a/Documentation/diff-generate-patch.txt +++ b/Documentation/diff-generate-patch.txt @@ -143,6 +143,19 @@ copying detection) are designed to work with diff of two Similar to two-line header for traditional 'unified' diff format, `/dev/null` is used to signal created or deleted files. ++ +However, if the --combined-all-paths option is provided, instead of a +two-line from-file/to-file you get a N+1 line from-file/to-file header, +where N is the number of parents in the merge commit + + --- a/file + --- a/file + --- a/file + +++ b/file ++ +This extended format can be useful if rename or copy detection is +active, to allow you to see the original name of the file in different +parents. 4. Chunk header format is modified to prevent people from accidentally feeding it to `patch -p1`. Combined diff format diff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt index 2319b2b192..28b93ecd54 100644 --- a/Documentation/git-diff-tree.txt +++ b/Documentation/git-diff-tree.txt @@ -10,8 +10,8 @@ SYNOPSIS [verse] 'git diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
Re: New command/tool: git filter-repo
Hi, On Thu, Jan 31, 2019 at 12:57 AM Elijah Newren wrote: > git-filter-repo[1], a filter-branch-like tool for rewriting repository > history, is ready for more widespread testing and feedback. The rough Someone at the Contributor Summit (Michael Haggerty perhaps?) asked me about performance numbers on known repositories for filter-repo and how it compared to other tools; I gave extremely rough estimates, but here I belatedly provide some more detailed figures. In each case, I report both filtering time, and cleanup (gc or clone) time[0]: Testcase 1: Remove a single file (configure.ac) from each commit in git.git: * filter-branch[1a]: 2413.978s + 34.812s * BFG (8-core)[1b]: 38.743s + 30.333s * BFG (40-core)[1b]:24.680s + 35.165s * filter-repo[1c]: 35.582s + 15.690s Caveats: filter-repo failed and needed workarounds; see [1d] Testcase 2: Keep two directories (guides/ and tools/) from rails.git: * filter-branch[2a]: 14586.655s + 22.726s * BFG (8-core)[2b]: 27.675s + 15.786s * BFG (40-core)[2b]:24.883s + 20.463s * filter-repo[2c]: 10.951s + 12.500s Caveats: filter-branch failed at the end of this operation; see [2d]. AFAICT, BFG can't do this operation; used approximations instead[2e]. Testcase 3: Replacing one string with another throughout all files in linux.git: * filter-branch[3a]: Estimated at about 3.5 months (~8.9e6 seconds) * BFG (8-core)[3b]: 2144.904s + 693.79s * BFG (40-core)[3b]: 1178.577s + 636.887s * filter-repo[3c]:1203.147s + 159.620s Caveats: filter-branch failed at ~12 hours; see [3d]. Other details about measurements at [4]. Take-aways and biased opinions at [5]. Hope this was interesting, Elijah *** Footnotes (Minutiae for the curious) *** [0] git-filter-branch's manpage suggests re-cloning to get rid of old objects, BFG as its last step provides the user commands to execute in order to clean out old objects, and filter-repo automatically runs such commands. As such, time of post-run gc seems like a relevant thing to report. Commands used and timed: * filter-branch: time git clone file://$(pwd) ../nuke-me-clone * BFG: git reflog expire --expire=now --all && time git gc --prune=now * filter-repo: N/A (internally runs same commands as I manually ran for BFG) [1a] time git filter-branch --index-filter 'git rm --quiet --cached --ignore-unmatch configure.ac' --tag-name-filter cat --prune-empty -- --all [1b] time java -jar ~/Downloads/bfg-1.13.0.jar --delete-files configure.ac [1c] git tag | grep v1.0rc | xargs git tag -d git tag -d junio-gpg-pub time git filter-repo --path configure.ac --invert-paths [1d] git fast-export when run with certain flags will abort in repos with tags of blobs or tags of tags. I had to first delete 7 tags to get this testcase to run, as shown in the commands above in [1c]. I'll probably patch fast-export to fix this. [2a] time git filter-branch --index-filter 'git ls-files -z | tr "\0" "\n" | grep -v -e ^guides/ -e ^tools/ | tr "\n" "\0" | xargs -0 git rm --quiet --cached --ignore-unmatch' --tag-name-filter cat --prune-empty -- --all [2b] git log --format=%n --name-only | sort | uniq | grep -v ^$ > all-files.txt time java -jar ~/Downloads/bfg-1.13.0.jar --delete-folders "{$(grep / all-files.txt | sed -e 's/"//' -e s%/.*%% | uniq | grep -v -e guides -e tools | tr '\n' ,)}" --delete-files "{$(comm -23 <(grep -v / all-files.txt) <(grep -e guides/ -e tools/ all-files.txt | sed -e s%.*/%% | sort) | tr '\n' ,)}" [2c] time git filter-repo --path guides --path tools [2d] filter-branch fails at the very end when noting which refs were deleted/rewritten with: error: cannot lock ref 'refs/tags/v0.10.0': is at b68b47672e613e94a7859c9549e9cd4b401f7b79 but expected e2724aa1856253f4fc48ddc251583042c5f06029 Could not delete refs/tags/v0.10.0 Turns out b68b47672e613e94a7859c9549e9cd4b401f7b79 is an annotated tag in the original repo pointing to the commit e2724aa1856253f4fc48ddc251583042c5f06029. I do not know the cause of this bug, but since it was almost at the very end, I just reported the time used before it hit this error. [2e] Unless I am misunderstanding, BFG is not capable of this filtering operation because it uses basenames for --delete-files and --delete-folders, and some names appear in several directories (e.g. .gitignore, Rakefile, tasks). As such, with the BFG you either have to delete files/directories that shouldn't be, or leave files and folders around that you wanted to have deleted. The command in [2b] has some of both, but should still give a good estimate of how long it would take BFG to do this kind of operation if file and directory basenames in the rails repository happened to be named uniquely. [3a] time git filter-branch -d /dev/shm/tmp --tree-filter 'git ls-files |
`git status -u no` suppresses modified files too.
This broke my "is this clean?" sanity check and very much violates the man page description. (I am now using `git diff --name-only` instead at Joel's suggestion.) $ git status On branch guilt/repro Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: tools/repro-build.sh Untracked files: (use "git add ..." to include in what will be committed) .cache/ ANALYSIS NOTES SHA256SUMS SHA256SUMS.asc badpeer.json base channels.out.xz no changes added to commit (use "git add" and/or "git commit -a") $ git status -u no On branch guilt/repro nothing to commit, working tree clean $ git --version git version 2.19.1 $ Cheers, Rusty.
Re: `git status -u no` suppresses modified files too.
On Fri, Feb 08, 2019 at 12:18:57PM +1030, Rusty Russell wrote: > This broke my "is this clean?" sanity check and very much violates > the man page description. Wow, this one had me scratching my head for a minute. What you're describing here: > $ git status -u no > On branch guilt/repro ...seems horribly broken, and the behavior goes back to the beginnings of "-u". So I wondered how we would not have noticed for so long. But what is going on is quite subtle. The "-u" option takes an optional argument, and so must be used in its "stuck" form. I.e., git status -uno does do what you expect. We cannot allow the separated form here, because that would conflict with another actual option, like: git status -u --porcelain So why does it behave as it does? We accept "no" as its own pathspec argument, and thus we limit the status to that path. And that's why there's "nothing to commit"; there's nothing in that pathspec. This is a pretty horrible UI trap. Most of the time with pathspecs we require them to be on the right-hand side of a "--" unless the paths actually exist in the filesystem. But then, in most of those cases we're making sure they're not ambiguous between revisions and paths. So maybe it's overkill here. I dunno. But the patch below certainly makes what's going on in your case less subtle: $ git status -u no fatal: no: no such path in the working tree. Use 'git -- ...' to specify paths that do not exist locally. You do still have to figure out why it wasn't stuck to "-u", though. --- diff --git a/builtin/commit.c b/builtin/commit.c index 2986553d5f..7177d7d82f 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1300,6 +1300,16 @@ static int git_status_config(const char *k, const char *v, void *cb) return git_diff_ui_config(k, v, NULL); } +static void verify_pathspec(const char *prefix, const char **argv) +{ + while (*argv) { + const char *arg = *argv++; + if (!strcmp(arg, "--")) + return; + verify_filename(prefix, arg, 0); + } +} + int cmd_status(int argc, const char **argv, const char *prefix) { static int no_renames = -1; @@ -1351,7 +1361,7 @@ int cmd_status(int argc, const char **argv, const char *prefix) status_init_config(&s, git_status_config); argc = parse_options(argc, argv, prefix, builtin_status_options, -builtin_status_usage, 0); +builtin_status_usage, PARSE_OPT_KEEP_DASHDASH); finalize_colopts(&s.colopts, -1); finalize_deferred_config(&s); @@ -1362,6 +1372,7 @@ int cmd_status(int argc, const char **argv, const char *prefix) s.show_untracked_files == SHOW_NO_UNTRACKED_FILES) die(_("Unsupported combination of ignored and untracked-files arguments")); + verify_pathspec(prefix, argv); parse_pathspec(&s.pathspec, 0, PATHSPEC_PREFER_FULL, prefix, argv);