diff --git a/.mailmap b/.mailmap index 7b3198171fad1e..3cf26b1add06cd 100644 --- a/.mailmap +++ b/.mailmap @@ -140,8 +140,8 @@ Junio C Hamano Kaartic Sivaraam Karl Wiberg Karl Hasselström Karl Wiberg -Karsten Blees -Karsten Blees +Karsten Blees +Karsten Blees Kay Sievers Kay Sievers Kazuki Saitoh kazuki saitoh diff --git a/Documentation/RelNotes/2.53.0.adoc b/Documentation/RelNotes/2.53.0.adoc index 32b6966c9e4dc4..35a1ab91edc7fd 100644 --- a/Documentation/RelNotes/2.53.0.adoc +++ b/Documentation/RelNotes/2.53.0.adoc @@ -238,6 +238,13 @@ Fixes since v2.52 has been corrected. (merge 979ee83e8a en/ort-recursive-d-f-conflict-fix later to maint). + * Diagnose invalid bundle-URI that lack the URI entry, instead of + crashing. + (merge 7796c14a1a sb/bundle-uri-without-uri later to maint). + + * Mailmap update for Karsten + (merge e97678c4ef js/mailmap-karsten-blees later to maint). + * Other code cleanup, docfix, build fix, etc. (merge 46207a54cc qj/doc-http-bad-want-response later to maint). (merge df90eccd93 kh/doc-commit-extra-references later to maint). @@ -263,3 +270,4 @@ Fixes since v2.52 (merge abf05d856f rs/show-branch-prio-queue later to maint). (merge 06188ea5f3 rs/parse-config-expiry-simplify later to maint). (merge 861dbb1586 dd/t5403-modernise later to maint). + (merge acffc5e9e5 ja/doc-synopsis-style-more later to maint). diff --git a/Documentation/git-remote.adoc b/Documentation/git-remote.adoc index 932a5c3ea4741c..eaae30aa88cc6e 100644 --- a/Documentation/git-remote.adoc +++ b/Documentation/git-remote.adoc @@ -8,20 +8,20 @@ git-remote - Manage set of tracked repositories SYNOPSIS -------- -[verse] -'git remote' [-v | --verbose] -'git remote add' [-t ] [-m ] [-f] [--[no-]tags] [--mirror=(fetch|push)] -'git remote rename' [--[no-]progress] -'git remote remove' -'git remote set-head' (-a | --auto | -d | --delete | ) -'git remote set-branches' [--add] ... -'git remote get-url' [--push] [--all] -'git remote set-url' [--push] [] -'git remote set-url --add' [--push] -'git remote set-url --delete' [--push] -'git remote' [-v | --verbose] 'show' [-n] ... -'git remote prune' [-n | --dry-run] ... -'git remote' [-v | --verbose] 'update' [-p | --prune] [( | )...] +[synopsis] +git remote [-v | --verbose] +git remote add [-t ] [-m ] [-f] [--[no-]tags] [--mirror=(fetch|push)] +git remote rename [--[no-]progress] +git remote remove +git remote set-head (-a | --auto | -d | --delete | ) +git remote set-branches [--add] ... +git remote get-url [--push] [--all] +git remote set-url [--push] [] +git remote set-url --add [--push] +git remote set-url --delete [--push] +git remote [-v | --verbose] show [-n] ... +git remote prune [-n | --dry-run] ... +git remote [-v | --verbose] update [-p | --prune] [( | )...] DESCRIPTION ----------- @@ -32,8 +32,8 @@ Manage the set of repositories ("remotes") whose branches you track. OPTIONS ------- --v:: ---verbose:: +`-v`:: +`--verbose`:: Be a little more verbose and show remote url after name. For promisor remotes, also show which filters (`blob:none` etc.) are configured. @@ -43,14 +43,14 @@ OPTIONS COMMANDS -------- -With no arguments, shows a list of existing remotes. Several +With no arguments, show a list of existing remotes. Several subcommands are available to perform operations on the remotes. -'add':: +`add`:: -Add a remote named for the repository at -. The command `git fetch ` can then be used to create and -update remote-tracking branches /. +Add a remote named __ for the repository at +__. The command `git fetch ` can then be used to create and +update remote-tracking branches `/`. + With `-f` option, `git fetch ` is run immediately after the remote information is set up. @@ -66,40 +66,40 @@ By default, only tags on fetched branches are imported + With `-t ` option, instead of the default glob refspec for the remote to track all branches under -the `refs/remotes//` namespace, a refspec to track only `` +the `refs/remotes//` namespace, a refspec to track only __ is created. You can give more than one `-t ` to track multiple branches without grabbing all branches. + With `-m ` option, a symbolic-ref `refs/remotes//HEAD` is set -up to point at remote's `` branch. See also the set-head command. +up to point at remote's __ branch. See also the set-head command. + When a fetch mirror is created with `--mirror=fetch`, the refs will not -be stored in the 'refs/remotes/' namespace, but rather everything in -'refs/' on the remote will be directly mirrored into 'refs/' in the +be stored in the `refs/remotes/` namespace, but rather everything in +`refs/` on the remote will be directly mirrored into `refs/` in the local repository. This option only makes sense in bare repositories, because a fetch would overwrite any local commits. + When a push mirror is created with `--mirror=push`, then `git push` will always behave as if `--mirror` was passed. -'rename':: +`rename`:: -Rename the remote named to . All remote-tracking branches and +Rename the remote named __ to __. All remote-tracking branches and configuration settings for the remote are updated. + -In case and are the same, and is a file under +In case __ and __ are the same, and __ is a file under `$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to the configuration file format. -'remove':: -'rm':: +`remove`:: +`rm`:: -Remove the remote named . All remote-tracking branches and +Remove the remote named __. All remote-tracking branches and configuration settings for the remote are removed. -'set-head':: +`set-head`:: -Sets or deletes the default branch (i.e. the target of the +Set or delete the default branch (i.e. the target of the symbolic-ref `refs/remotes//HEAD`) for the named remote. Having a default branch for a remote is not required, but allows the name of the remote to be specified in lieu of a specific @@ -116,15 +116,15 @@ the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This only work if `refs/remotes/origin/next` already exists; if not it must be fetched first. + -Use `` to set the symbolic-ref `refs/remotes//HEAD` explicitly. e.g., `git +Use __ to set the symbolic-ref `refs/remotes//HEAD` explicitly. e.g., `git remote set-head origin master` will set the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/master`. This will only work if `refs/remotes/origin/master` already exists; if not it must be fetched first. + -'set-branches':: +`set-branches`:: -Changes the list of branches tracked by the named remote. +Change the list of branches tracked by the named remote. This can be used to track a subset of the available remote branches after the initial setup for a remote. + @@ -134,7 +134,7 @@ The named branches will be interpreted as if specified with the With `--add`, instead of replacing the list of currently tracked branches, adds to that list. -'get-url':: +`get-url`:: Retrieves the URLs for a remote. Configurations for `insteadOf` and `pushInsteadOf` are expanded here. By default, only the first URL is listed. @@ -143,18 +143,18 @@ With `--push`, push URLs are queried rather than fetch URLs. + With `--all`, all URLs for the remote will be listed. -'set-url':: +`set-url`:: -Changes URLs for the remote. Sets first URL for remote that matches -regex (first URL if no is given) to . If - doesn't match any URL, an error occurs and nothing is changed. +Change URLs for the remote. Sets first URL for remote __ that matches +regex __ (first URL if no __ is given) to __. If +__ doesn't match any URL, an error occurs and nothing is changed. + With `--push`, push URLs are manipulated instead of fetch URLs. + With `--add`, instead of changing existing URLs, new URL is added. + With `--delete`, instead of changing existing URLs, all URLs matching -regex are deleted for remote . Trying to delete all +regex __ are deleted for remote __. Trying to delete all non-push URLs is an error. + Note that the push URL and the fetch URL, even though they can @@ -165,17 +165,17 @@ fetch from one place (e.g. your upstream) and push to another (e.g. your publishing repository), use two separate remotes. -'show':: +`show`:: -Gives some information about the remote . +Give some information about the remote __. + With `-n` option, the remote heads are not queried first with `git ls-remote `; cached information is used instead. -'prune':: +`prune`:: -Deletes stale references associated with . By default, stale -remote-tracking branches under are deleted, but depending on +Delete stale references associated with __. By default, stale +remote-tracking branches under __ are deleted, but depending on global configuration and the configuration of the remote we might even prune local tags that haven't been pushed there. Equivalent to `git fetch --prune `, except that no new references will be fetched. @@ -186,13 +186,13 @@ depending on various configuration. With `--dry-run` option, report what branches would be pruned, but do not actually prune them. -'update':: +`update`:: Fetch updates for remotes or remote groups in the repository as defined by `remotes.`. If neither group nor remote is specified on the command line, -the configuration parameter remotes.default will be used; if -remotes.default is not defined, all remotes which do not have the -configuration parameter `remote..skipDefaultUpdate` set to true will +the configuration parameter `remotes.default` will be used; if +`remotes.default` is not defined, all remotes which do not have the +configuration parameter `remote..skipDefaultUpdate` set to `true` will be updated. (See linkgit:git-config[1]). + With `--prune` option, run pruning against all the remotes that are updated. @@ -210,7 +210,7 @@ EXIT STATUS On success, the exit status is `0`. -When subcommands such as 'add', 'rename', and 'remove' can't find the +When subcommands such as `add`, `rename`, and `remove` can't find the remote in question, the exit status is `2`. When the remote already exists, the exit status is `3`. @@ -247,7 +247,7 @@ $ git switch -c staging staging/master ... ------------ -* Imitate 'git clone' but track only selected branches +* Imitate `git clone` but track only selected branches + ------------ $ mkdir project.git diff --git a/Documentation/git-stage.adoc b/Documentation/git-stage.adoc index 2f6aaa75b9a3f9..753a8176390130 100644 --- a/Documentation/git-stage.adoc +++ b/Documentation/git-stage.adoc @@ -8,8 +8,8 @@ git-stage - Add file contents to the staging area SYNOPSIS -------- -[verse] -'git stage' ... +[synopsis] +git stage ... DESCRIPTION diff --git a/Documentation/git-status.adoc b/Documentation/git-status.adoc index 9a376886a5867a..9acca52bfb1abd 100644 --- a/Documentation/git-status.adoc +++ b/Documentation/git-status.adoc @@ -8,8 +8,9 @@ git-status - Show the working tree status SYNOPSIS -------- -[verse] -'git status' [] [--] [...] + +[synopsis] +git status [] [--] [...] DESCRIPTION ----------- @@ -18,57 +19,57 @@ current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by Git (and are not ignored by linkgit:gitignore[5]). The first are what you _would_ commit by running `git commit`; the second and -third are what you _could_ commit by running 'git add' before running +third are what you _could_ commit by running `git add` before running `git commit`. OPTIONS ------- --s:: ---short:: +`-s`:: +`--short`:: Give the output in the short-format. --b:: ---branch:: +`-b`:: +`--branch`:: Show the branch and tracking info even in short-format. ---show-stash:: +`--show-stash`:: Show the number of entries currently stashed away. ---porcelain[=]:: +`--porcelain[=]`:: Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across Git versions and regardless of user configuration. See below for details. + -The version parameter is used to specify the format version. -This is optional and defaults to the original version 'v1' format. +The __ parameter is used to specify the format version. +This is optional and defaults to the original version `v1` format. ---long:: +`--long`:: Give the output in the long-format. This is the default. --v:: ---verbose:: +`-v`:: +`--verbose`:: In addition to the names of files that have been changed, also show the textual changes that are staged to be committed (i.e., like the output of `git diff --cached`). If `-v` is specified twice, then also show the changes in the working tree that have not yet been staged (i.e., like the output of `git diff`). --u[]:: ---untracked-files[=]:: +`-u[]`:: +`--untracked-files[=]`:: Show untracked files. + -- The mode parameter is used to specify the handling of untracked files. -It is optional: it defaults to 'all', and if specified, it must be +It is optional: it defaults to `all`, and if specified, it must be stuck to the option (e.g. `-uno`, but not `-u no`). The possible options are: - - 'no' - Show no untracked files. - - 'normal' - Shows untracked files and directories. - - 'all' - Also shows individual files in untracked directories. +`no`:: Show no untracked files. +`normal`:: Show untracked files and directories. +`all`:: Also show individual files in untracked directories. When `-u` option is not used, untracked files and directories are shown (i.e. the same as specifying `normal`), to help you avoid @@ -82,76 +83,78 @@ return more quickly without showing untracked files. All usual spellings for Boolean value `true` are taken as `normal` and `false` as `no`. -The default can be changed using the status.showUntrackedFiles +The default can be changed using the `status.showUntrackedFiles` configuration variable documented in linkgit:git-config[1]. -- ---ignore-submodules[=]:: - Ignore changes to submodules when looking for changes. can be - either "none", "untracked", "dirty" or "all", which is the default. - Using "none" will consider the submodule modified when it either contains +`--ignore-submodules[=]`:: + Ignore changes to submodules when looking for changes. __ can be + either `none`, `untracked`, `dirty` or `all`, which is the default. +`none`;; will consider the submodule modified when it either contains untracked or modified files or its HEAD differs from the commit recorded in the superproject and can be used to override any settings of the - 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When - "untracked" is used submodules are not considered dirty when they only + `ignore` option in linkgit:git-config[1] or linkgit:gitmodules[5]. +`untracked`;; submodules are not considered dirty when they only contain untracked content (but they are still scanned for modified - content). Using "dirty" ignores all changes to the work tree of submodules, + content). +`dirty`;; ignore all changes to the work tree of submodules, only changes to the commits stored in the superproject are shown (this was - the behavior before 1.7.0). Using "all" hides all changes to submodules + the behavior before 1.7.0). +`all`;; hide all changes to submodules (and suppresses the output of submodule summaries when the config option `status.submoduleSummary` is set). ---ignored[=]:: +`--ignored[=]`:: Show ignored files as well. + -- The mode parameter is used to specify the handling of ignored files. -It is optional: it defaults to 'traditional'. +It is optional: it defaults to `traditional`. The possible options are: - - 'traditional' - Shows ignored files and directories, unless - --untracked-files=all is specified, in which case - individual files in ignored directories are - displayed. - - 'no' - Show no ignored files. - - 'matching' - Shows ignored files and directories matching an - ignore pattern. - -When 'matching' mode is specified, paths that explicitly match an +`traditional`:: Show ignored files and directories, unless +`--untracked-files=all` is specified, in which case + individual files in ignored directories are + displayed. +`no`:: Show no ignored files. +`matching`:: Show ignored files and directories matching an +ignore pattern. ++ +Paths that explicitly match an ignored pattern are shown. If a directory matches an ignore pattern, then it is shown, but not paths contained in the ignored directory. If a directory does not match an ignore pattern, but all contents are ignored, then the directory is not shown, but all contents are shown. -- --z:: - Terminate entries with NUL, instead of LF. This implies +`-z`:: + Terminate entries with _NUL_, instead of _LF_. This implies the `--porcelain=v1` output format if no other format is given. ---column[=]:: ---no-column:: +`--column[=]`:: +`--no-column`:: Display untracked files in columns. See configuration variable `column.status` for option syntax. `--column` and `--no-column` - without options are equivalent to 'always' and 'never' + without options are equivalent to `always` and `never` respectively. ---ahead-behind:: ---no-ahead-behind:: +`--ahead-behind`:: +`--no-ahead-behind`:: Display or do not display detailed ahead/behind counts for the - branch relative to its upstream branch. Defaults to true. + branch relative to its upstream branch. Defaults to `true`. ---renames:: ---no-renames:: +`--renames`:: +`--no-renames`:: Turn on/off rename detection regardless of user configuration. See also linkgit:git-diff[1] `--no-renames`. ---find-renames[=]:: +`--find-renames[=]`:: Turn on rename detection, optionally setting the similarity threshold. See also linkgit:git-diff[1] `--find-renames`. -...:: +`...`:: See the 'pathspec' entry in linkgit:gitglossary[7]. OUTPUT @@ -173,12 +176,12 @@ Short Format In the short-format, the status of each path is shown as one of these forms - XY PATH - XY ORIG_PATH -> PATH + + -> -where `ORIG_PATH` is where the renamed/copied contents came -from. `ORIG_PATH` is only shown when the entry is renamed or -copied. The `XY` is a two-letter status code. +where __ is where the renamed/copied contents came +from. __ is only shown when the entry is renamed or +copied. The __ is a two-letter status code `XY`. The fields (including the `->`) are separated from each other by a single space. If a filename contains whitespace or other nonprintable @@ -187,7 +190,7 @@ literal: surrounded by ASCII double quote (34) characters, and with interior special characters backslash-escaped. There are three different types of states that are shown using this format, and -each one uses the `XY` syntax differently: +each one uses the __ syntax differently: * When a merge is occurring and the merge was successful, or outside of a merge situation, `X` shows the status of the index and `Y` shows the status of the @@ -207,60 +210,59 @@ In the following table, these three classes are shown in separate sections, and these characters are used for `X` and `Y` fields for the first two sections that show tracked paths: -* ' ' = unmodified -* 'M' = modified -* 'T' = file type changed (regular file, symbolic link or submodule) -* 'A' = added -* 'D' = deleted -* 'R' = renamed -* 'C' = copied (if config option status.renames is set to "copies") -* 'U' = updated but unmerged - -.... -X Y Meaning -------------------------------------------------- - [AMD] not updated -M [ MTD] updated in index -T [ MTD] type changed in index -A [ MTD] added to index -D deleted from index -R [ MTD] renamed in index -C [ MTD] copied in index -[MTARC] index and work tree matches -[ MTARC] M work tree changed since index -[ MTARC] T type changed in work tree since index -[ MTARC] D deleted in work tree - R renamed in work tree - C copied in work tree -------------------------------------------------- -D D unmerged, both deleted -A U unmerged, added by us -U D unmerged, deleted by them -U A unmerged, added by them -D U unmerged, deleted by us -A A unmerged, both added -U U unmerged, both modified -------------------------------------------------- -? ? untracked -! ! ignored -------------------------------------------------- -.... +' ':: unmodified +`M`:: modified +`T`:: file type changed (regular file, symbolic link or submodule) +`A`:: added +`D`:: deleted +`R`:: renamed +`C`:: copied (if config option status.renames is set to "copies") +`U`:: updated but unmerged + +[cols="^1m,^1m,<2",options="header"] +|=== +|X | Y |Meaning +| |[AMD] |not updated +|M |[ MTD] |updated in index +|T |[ MTD] |type changed in index +|A |[ MTD] |added to index +|D | |deleted from index +|R |[ MTD] |renamed in index +|C |[ MTD] |copied in index +|[MTARC] | |index and work tree matches +|[ MTARC] |M |work tree changed since index +|[ MTARC] |T |type changed in work tree since index +|[ MTARC] |D |deleted in work tree +| |R |renamed in work tree +| |C |copied in work tree +|D |D |unmerged, both deleted +|A |U |unmerged, added by us +|U |D |unmerged, deleted by them +|U |A |unmerged, added by them +|D |U |unmerged, deleted by us +|A |A |unmerged, both added +|U |U |unmerged, both modified +|? |? |untracked +|! |! |ignored +|=== Submodules have more state and instead report -* 'M' = the submodule has a different HEAD than recorded in the index -* 'm' = the submodule has modified content -* '?' = the submodule has untracked files +`M`:: the submodule has a different HEAD than recorded in the index +`m`:: the submodule has modified content +`?`:: the submodule has untracked files This is since modified content or untracked files in a submodule cannot be added via `git add` in the superproject to prepare a commit. -'m' and '?' are applied recursively. For example if a nested submodule -in a submodule contains an untracked file, this is reported as '?' as well. +`m` and `?` are applied recursively. For example if a nested submodule +in a submodule contains an untracked file, this is reported as `?` as well. + +If `-b` is used the short-format status is preceded by a line -If -b is used the short-format status is preceded by a line +[synopsis] +{empty}## - ## branchname tracking info Porcelain Format Version 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -271,16 +273,16 @@ based on user configuration. This makes it ideal for parsing by scripts. The description of the short format above also describes the porcelain format, with a few exceptions: -1. The user's color.status configuration is not respected; color will +1. The user's `color.status` configuration is not respected; color will always be off. -2. The user's status.relativePaths configuration is not respected; paths +2. The user's `status.relativePaths` configuration is not respected; paths shown will always be relative to the repository root. -There is also an alternate -z format recommended for machine parsing. In +There is also an alternate `-z` format recommended for machine parsing. In that format, the status field is the same, but some other things -change. First, the '\->' is omitted from rename entries and the field -order is reversed (e.g 'from \-> to' becomes 'to from'). Second, a NUL +change. First, the `->` is omitted from rename entries and the field +order is reversed (e.g `from -> to` becomes `to from`). Second, a _NUL_ (ASCII 0) follows each filename, replacing space as a field separator and the terminating newline (but a space still separates the status field from the first filename). Third, filenames containing special @@ -296,7 +298,7 @@ Version 2 format adds more detailed information about the state of the worktree and changed items. Version 2 also defines an extensible set of easy to parse optional headers. -Header lines start with "#" and are added in response to specific +Header lines start with `#` and are added in response to specific command line arguments. Parsers should ignore headers they don't recognize. @@ -306,16 +308,15 @@ Branch Headers If `--branch` is given, a series of header lines are printed with information about the current branch. -.... -Line Notes ------------------------------------------------------------- -# branch.oid | (initial) Current commit. -# branch.head | (detached) Current branch. -# branch.upstream If upstream is set. -# branch.ab + - If upstream is set and - the commit is present. ------------------------------------------------------------- -.... +[cols="<1,<1",options="header"] +|=== +|Line |Notes +|`# branch.oid \| (initial)` |Current commit. +|`# branch.head \| (detached)` |Current branch. +|`# branch.upstream ` |If upstream is set. +|`# branch.ab + -` |If upstream is set and + the commit is present. +|=== Stash Information ^^^^^^^^^^^^^^^^^ @@ -336,66 +337,73 @@ line types in any order. Ordinary changed entries have the following format: - 1 +[synopsis] +1 Renamed or copied entries have the following format: - 2 - -.... -Field Meaning --------------------------------------------------------- - A 2 character field containing the staged and - unstaged XY values described in the short format, - with unchanged indicated by a "." rather than - a space. - A 4 character field describing the submodule state. - "N..." when the entry is not a submodule. - "S" when the entry is a submodule. - is "C" if the commit changed; otherwise ".". - is "M" if it has tracked changes; otherwise ".". - is "U" if there are untracked changes; otherwise ".". - The octal file mode in HEAD. - The octal file mode in the index. - The octal file mode in the worktree. - The object name in HEAD. - The object name in the index. - The rename or copy score (denoting the percentage - of similarity between the source and target of the - move or copy). For example "R100" or "C75". - The pathname. In a renamed/copied entry, this - is the target path. - When the `-z` option is used, the 2 pathnames are separated - with a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09) - byte separates them. - The pathname in the commit at HEAD or in the index. - This is only present in a renamed/copied entry, and - tells where the renamed/copied contents came from. --------------------------------------------------------- -.... +[synopsis] +2 + +[cols="<1,<1a",options="header"] +|=== +|Field | Meaning + +|__ +|A 2 character field containing the staged and +unstaged XY values described in the short format, +with unchanged indicated by a "." rather than +a space. +|__ +|A 4 character field describing the submodule state. +"N..." when the entry is not a submodule. +`S` when the entry is a submodule. + +* __ is "C" if the commit changed; otherwise ".". +* __ is "M" if it has tracked changes; otherwise ".". +* __ is "U" if there are untracked changes; otherwise ".". +|__ |The octal file mode in HEAD. +|__ |The octal file mode in the index. +|__ |The octal file mode in the worktree. +|__ |The object name in HEAD. +|__ |The object name in the index. +|__ |The rename or copy score (denoting the percentage +of similarity between the source and target of the +move or copy). For example "R100" or "C75". +|__ +|The pathname. In a renamed/copied entry, this is the target path. +|__ +|When the `-z` option is used, the 2 pathnames are separated +with a _NUL_ (ASCII 0x00) byte; otherwise, a _TAB_ (ASCII 0x09) +byte separates them. +|__ +|The pathname in the commit at HEAD or in the index. +This is only present in a renamed/copied entry, and +tells where the renamed/copied contents came from. +|=== Unmerged entries have the following format; the first character is a "u" to distinguish from ordinary changed entries. - u

+[synopsis] +u

-.... -Field Meaning --------------------------------------------------------- - A 2 character field describing the conflict type +[cols="<1,<1a",options="header"] +|=== +|Field |Meaning +|__ |A 2 character field describing the conflict type as described in the short format. - A 4 character field describing the submodule state +|__ |A 4 character field describing the submodule state as described above. - The octal file mode in stage 1. - The octal file mode in stage 2. - The octal file mode in stage 3. - The octal file mode in the worktree. -

The object name in stage 1. -

The object name in stage 2. -

The object name in stage 3. - The pathname. --------------------------------------------------------- -.... +|__ |The octal file mode in stage 1. +|__ |The octal file mode in stage 2. +|__ |The octal file mode in stage 3. +|__ |The octal file mode in the worktree. +|_

_ |The object name in stage 1. +|_

_ |The object name in stage 2. +|_

_ |The object name in stage 3. +|__ |The pathname. +|=== Other Items ^^^^^^^^^^^ @@ -416,7 +424,7 @@ Pathname Format Notes and -z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ When the `-z` option is given, pathnames are printed as is and -without any quoting and lines are terminated with a NUL (ASCII 0x00) +without any quoting and lines are terminated with a _NUL_ (ASCII 0x00) byte. Without the `-z` option, pathnames with "unusual" characters are @@ -439,11 +447,11 @@ directory. If `status.submoduleSummary` is set to a non zero number or true (identical to -1 or an unlimited number), the submodule summary will be enabled for the long format and a summary of commits for modified submodules will be -shown (see --summary-limit option of linkgit:git-submodule[1]). Please note +shown (see `--summary-limit` option of linkgit:git-submodule[1]). Please note that the summary output from the status command will be suppressed for all -submodules when `diff.ignoreSubmodules` is set to 'all' or only for those +submodules when `diff.ignoreSubmodules` is set to `all` or only for those submodules where `submodule..ignore=all`. To also view the summary for -ignored submodules you can either use the --ignore-submodules=dirty command +ignored submodules you can either use the `--ignore-submodules=dirty` command line option or the 'git submodule summary' command, which shows a similar output but does not honor these settings. @@ -484,7 +492,7 @@ results, so it could be faster on subsequent runs. setting this variable to `false` disables the warning message given when enumerating untracked files takes more than 2 seconds. In a large project, it may take longer and the user - may have already accepted the trade off (e.g. using "-uno" may + may have already accepted the trade off (e.g. using `-uno` may not be an acceptable option for the user), in which case, there is no point issuing the warning message, and in such a case, disabling the warning may be the best. diff --git a/builtin/log.c b/builtin/log.c index d4cf9c59c81a83..5c9a8ef3632906 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1896,11 +1896,11 @@ int cmd_format_patch(int argc, { struct format_config cfg; struct commit *commit; - struct commit **list = NULL; + struct commit_stack list = COMMIT_STACK_INIT; struct rev_info rev; char *to_free = NULL; struct setup_revision_opt s_r_opt; - size_t nr = 0, total, i; + size_t total, i; int use_stdout = 0; int start_number = -1; int just_numbers = 0; @@ -2283,14 +2283,12 @@ int cmd_format_patch(int argc, if (ignore_if_in_upstream && has_commit_patch_id(commit, &ids)) continue; - nr++; - REALLOC_ARRAY(list, nr); - list[nr - 1] = commit; + commit_stack_push(&list, commit); } - if (nr == 0) + if (!list.nr) /* nothing to do */ goto done; - total = nr; + total = list.nr; if (cover_letter == -1) { if (cfg.config_cover_letter == COVER_AUTO) cover_letter = (total > 1); @@ -2308,7 +2306,7 @@ int cmd_format_patch(int argc, if (!cover_letter && total != 1) die(_("--interdiff requires --cover-letter or single patch")); rev.idiff_oid1 = &idiff_prev.oid[idiff_prev.nr - 1]; - rev.idiff_oid2 = get_commit_tree_oid(list[0]); + rev.idiff_oid2 = get_commit_tree_oid(list.items[0]); rev.idiff_title = diff_title(&idiff_title, reroll_count, _("Interdiff:"), _("Interdiff against v%d:")); @@ -2324,7 +2322,7 @@ int cmd_format_patch(int argc, die(_("--range-diff requires --cover-letter or single patch")); infer_range_diff_ranges(&rdiff1, &rdiff2, rdiff_prev, - origin, list[0]); + origin, list.items[0]); rev.rdiff1 = rdiff1.buf; rev.rdiff2 = rdiff2.buf; rev.creation_factor = creation_factor; @@ -2360,11 +2358,11 @@ int cmd_format_patch(int argc, } memset(&bases, 0, sizeof(bases)); - base = get_base_commit(&cfg, list, nr); + base = get_base_commit(&cfg, list.items, list.nr); if (base) { reset_revision_walk(); clear_object_flags(the_repository, UNINTERESTING); - prepare_bases(&bases, base, list, nr); + prepare_bases(&bases, base, list.items, list.nr); } if (in_reply_to || cfg.thread || cover_letter) { @@ -2381,7 +2379,8 @@ int cmd_format_patch(int argc, if (cfg.thread) gen_message_id(&rev, "cover"); make_cover_letter(&rev, !!output_directory, - origin, nr, list, description_file, branch_name, quiet, &cfg); + origin, list.nr, list.items, + description_file, branch_name, quiet, &cfg); print_bases(&bases, rev.diffopt.file); print_signature(signature, rev.diffopt.file); total++; @@ -2395,12 +2394,12 @@ int cmd_format_patch(int argc, if (show_progress) progress = start_delayed_progress(the_repository, _("Generating patches"), total); - for (i = 0; i < nr; i++) { - size_t idx = nr - i - 1; + while (list.nr) { + size_t idx = list.nr - 1; int shown; display_progress(progress, total - idx); - commit = list[idx]; + commit = commit_stack_pop(&list); rev.nr = total - idx + (start_number - 1); /* Make the second and subsequent mails replies to the first */ @@ -2469,7 +2468,7 @@ int cmd_format_patch(int argc, } } stop_progress(&progress); - free(list); + commit_stack_clear(&list); if (ignore_if_in_upstream) free_patch_ids(&ids); diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 615f7d1aae4987..6188cf98ce0157 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -180,8 +180,7 @@ static void name_rev(struct commit *start_commit, { struct prio_queue queue; struct commit *commit; - struct commit **parents_to_queue = NULL; - size_t parents_to_queue_nr, parents_to_queue_alloc = 0; + struct commit_stack parents_to_queue = COMMIT_STACK_INIT; struct rev_name *start_name; repo_parse_commit(the_repository, start_commit); @@ -206,7 +205,7 @@ static void name_rev(struct commit *start_commit, struct commit_list *parents; int parent_number = 1; - parents_to_queue_nr = 0; + parents_to_queue.nr = 0; for (parents = commit->parents; parents; @@ -238,22 +237,18 @@ static void name_rev(struct commit *start_commit, string_pool); else parent_name->tip_name = name->tip_name; - ALLOC_GROW(parents_to_queue, - parents_to_queue_nr + 1, - parents_to_queue_alloc); - parents_to_queue[parents_to_queue_nr] = parent; - parents_to_queue_nr++; + commit_stack_push(&parents_to_queue, parent); } } /* The first parent must come out first from the prio_queue */ - while (parents_to_queue_nr) + while (parents_to_queue.nr) prio_queue_put(&queue, - parents_to_queue[--parents_to_queue_nr]); + commit_stack_pop(&parents_to_queue)); } clear_prio_queue(&queue); - free(parents_to_queue); + commit_stack_clear(&parents_to_queue); } static int subpath_matches(const char *path, const char *filter) diff --git a/bundle-uri.c b/bundle-uri.c index 57cccfc6b8ee1f..3b2e347288c3b7 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -89,7 +89,10 @@ static int summarize_bundle(struct remote_bundle_info *info, void *data) { FILE *fp = data; fprintf(fp, "[bundle \"%s\"]\n", info->id); - fprintf(fp, "\turi = %s\n", info->uri); + if (info->uri) + fprintf(fp, "\turi = %s\n", info->uri); + else + fprintf(fp, "\t# uri = (missing)\n"); if (info->creationToken) fprintf(fp, "\tcreationToken = %"PRIu64"\n", info->creationToken); @@ -267,6 +270,19 @@ int bundle_uri_parse_config_format(const char *uri, result = 1; } + if (!result) { + struct hashmap_iter iter; + struct remote_bundle_info *bundle; + + hashmap_for_each_entry(&list->bundles, &iter, bundle, ent) { + if (!bundle->uri) { + error(_("bundle list at '%s': bundle '%s' has no uri"), + uri, bundle->id ? bundle->id : ""); + result = 1; + } + } + } + return result; } @@ -751,6 +767,12 @@ static int fetch_bundle_uri_internal(struct repository *r, return -1; } + if (!bundle->uri) { + error(_("bundle '%s' has no uri"), + bundle->id ? bundle->id : ""); + return -1; + } + if (!bundle->file && !(bundle->file = find_temp_filename())) { result = -1; diff --git a/commit-graph.c b/commit-graph.c index 80be2ff2c39842..00e8193adcab81 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1127,18 +1127,12 @@ struct tree *get_commit_tree_in_graph(struct repository *r, const struct commit return get_commit_tree_in_graph_one(r->objects->commit_graph, c); } -struct packed_commit_list { - struct commit **list; - size_t nr; - size_t alloc; -}; - struct write_commit_graph_context { struct repository *r; struct odb_source *odb_source; char *graph_name; struct oid_array oids; - struct packed_commit_list commits; + struct commit_stack commits; int num_extra_edges; int num_generation_data_overflows; unsigned long approx_nr_objects; @@ -1180,7 +1174,7 @@ static int write_graph_chunk_fanout(struct hashfile *f, { struct write_commit_graph_context *ctx = data; int i, count = 0; - struct commit **list = ctx->commits.list; + struct commit **list = ctx->commits.items; /* * Write the first-level table (the list is sorted, @@ -1206,7 +1200,7 @@ static int write_graph_chunk_oids(struct hashfile *f, void *data) { struct write_commit_graph_context *ctx = data; - struct commit **list = ctx->commits.list; + struct commit **list = ctx->commits.items; int count; for (count = 0; count < ctx->commits.nr; count++, list++) { display_progress(ctx->progress, ++ctx->progress_cnt); @@ -1226,8 +1220,8 @@ static int write_graph_chunk_data(struct hashfile *f, void *data) { struct write_commit_graph_context *ctx = data; - struct commit **list = ctx->commits.list; - struct commit **last = ctx->commits.list + ctx->commits.nr; + struct commit **list = ctx->commits.items; + struct commit **last = ctx->commits.items + ctx->commits.nr; uint32_t num_extra_edges = 0; while (list < last) { @@ -1249,7 +1243,7 @@ static int write_graph_chunk_data(struct hashfile *f, edge_value = GRAPH_PARENT_NONE; else { edge_value = oid_pos(&parent->item->object.oid, - ctx->commits.list, + ctx->commits.items, ctx->commits.nr, commit_to_oid); @@ -1280,7 +1274,7 @@ static int write_graph_chunk_data(struct hashfile *f, edge_value = GRAPH_EXTRA_EDGES_NEEDED | num_extra_edges; else { edge_value = oid_pos(&parent->item->object.oid, - ctx->commits.list, + ctx->commits.items, ctx->commits.nr, commit_to_oid); @@ -1332,7 +1326,7 @@ static int write_graph_chunk_generation_data(struct hashfile *f, int i, num_generation_data_overflows = 0; for (i = 0; i < ctx->commits.nr; i++) { - struct commit *c = ctx->commits.list[i]; + struct commit *c = ctx->commits.items[i]; timestamp_t offset; repo_parse_commit(ctx->r, c); offset = commit_graph_data_at(c)->generation - c->date; @@ -1355,7 +1349,7 @@ static int write_graph_chunk_generation_data_overflow(struct hashfile *f, struct write_commit_graph_context *ctx = data; int i; for (i = 0; i < ctx->commits.nr; i++) { - struct commit *c = ctx->commits.list[i]; + struct commit *c = ctx->commits.items[i]; timestamp_t offset = commit_graph_data_at(c)->generation - c->date; display_progress(ctx->progress, ++ctx->progress_cnt); @@ -1372,8 +1366,8 @@ static int write_graph_chunk_extra_edges(struct hashfile *f, void *data) { struct write_commit_graph_context *ctx = data; - struct commit **list = ctx->commits.list; - struct commit **last = ctx->commits.list + ctx->commits.nr; + struct commit **list = ctx->commits.items; + struct commit **last = ctx->commits.items + ctx->commits.nr; struct commit_list *parent; while (list < last) { @@ -1393,7 +1387,7 @@ static int write_graph_chunk_extra_edges(struct hashfile *f, /* Since num_parents > 2, this initializer is safe. */ for (parent = (*list)->parents->next; parent; parent = parent->next) { int edge_value = oid_pos(&parent->item->object.oid, - ctx->commits.list, + ctx->commits.items, ctx->commits.nr, commit_to_oid); @@ -1427,8 +1421,8 @@ static int write_graph_chunk_bloom_indexes(struct hashfile *f, void *data) { struct write_commit_graph_context *ctx = data; - struct commit **list = ctx->commits.list; - struct commit **last = ctx->commits.list + ctx->commits.nr; + struct commit **list = ctx->commits.items; + struct commit **last = ctx->commits.items + ctx->commits.nr; uint32_t cur_pos = 0; while (list < last) { @@ -1463,8 +1457,8 @@ static int write_graph_chunk_bloom_data(struct hashfile *f, void *data) { struct write_commit_graph_context *ctx = data; - struct commit **list = ctx->commits.list; - struct commit **last = ctx->commits.list + ctx->commits.nr; + struct commit **list = ctx->commits.items; + struct commit **last = ctx->commits.items + ctx->commits.nr; trace2_bloom_filter_settings(ctx); @@ -1585,7 +1579,7 @@ static void close_reachable(struct write_commit_graph_context *ctx) struct compute_generation_info { struct repository *r; - struct packed_commit_list *commits; + struct commit_stack *commits; struct progress *progress; int progress_cnt; @@ -1622,7 +1616,7 @@ static void compute_reachable_generation_numbers( struct commit_list *list = NULL; for (i = 0; i < info->commits->nr; i++) { - struct commit *c = info->commits->list[i]; + struct commit *c = info->commits->items[i]; timestamp_t gen; repo_parse_commit(info->r, c); gen = info->get_generation(c, info->data); @@ -1729,7 +1723,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx) if (!ctx->trust_generation_numbers) { for (i = 0; i < ctx->commits.nr; i++) { - struct commit *c = ctx->commits.list[i]; + struct commit *c = ctx->commits.items[i]; repo_parse_commit(ctx->r, c); commit_graph_data_at(c)->generation = GENERATION_NUMBER_ZERO; } @@ -1738,7 +1732,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx) compute_reachable_generation_numbers(&info, 2); for (i = 0; i < ctx->commits.nr; i++) { - struct commit *c = ctx->commits.list[i]; + struct commit *c = ctx->commits.items[i]; timestamp_t offset = commit_graph_data_at(c)->generation - c->date; if (offset > GENERATION_NUMBER_V2_OFFSET_MAX) ctx->num_generation_data_overflows++; @@ -1760,8 +1754,8 @@ void ensure_generations_valid(struct repository *r, struct commit **commits, size_t nr) { int generation_version = get_configured_generation_version(r); - struct packed_commit_list list = { - .list = commits, + struct commit_stack list = { + .items = commits, .alloc = nr, .nr = nr, }; @@ -1804,7 +1798,7 @@ static void compute_bloom_filters(struct write_commit_graph_context *ctx) _("Computing commit changed paths Bloom filters"), ctx->commits.nr); - DUP_ARRAY(sorted_commits, ctx->commits.list, ctx->commits.nr); + DUP_ARRAY(sorted_commits, ctx->commits.items, ctx->commits.nr); if (ctx->order_by_pack) QSORT(sorted_commits, ctx->commits.nr, commit_pos_cmp); @@ -1992,26 +1986,26 @@ static void copy_oids_to_commits(struct write_commit_graph_context *ctx) oid_array_sort(&ctx->oids); for (i = 0; i < ctx->oids.nr; i = oid_array_next_unique(&ctx->oids, i)) { unsigned int num_parents; + struct commit *commit; display_progress(ctx->progress, i + 1); - ALLOC_GROW(ctx->commits.list, ctx->commits.nr + 1, ctx->commits.alloc); - ctx->commits.list[ctx->commits.nr] = lookup_commit(ctx->r, &ctx->oids.oid[i]); + commit = lookup_commit(ctx->r, &ctx->oids.oid[i]); if (ctx->split && flags != COMMIT_GRAPH_SPLIT_REPLACE && - commit_graph_position(ctx->commits.list[ctx->commits.nr]) != COMMIT_NOT_FROM_GRAPH) + commit_graph_position(commit) != COMMIT_NOT_FROM_GRAPH) continue; if (ctx->split && flags == COMMIT_GRAPH_SPLIT_REPLACE) - repo_parse_commit(ctx->r, ctx->commits.list[ctx->commits.nr]); + repo_parse_commit(ctx->r, commit); else - repo_parse_commit_no_graph(ctx->r, ctx->commits.list[ctx->commits.nr]); + repo_parse_commit_no_graph(ctx->r, commit); - num_parents = commit_list_count(ctx->commits.list[ctx->commits.nr]->parents); + num_parents = commit_list_count(commit->parents); if (num_parents > 2) ctx->num_extra_edges += num_parents - 1; - ctx->commits.nr++; + commit_stack_push(&ctx->commits, commit); } stop_progress(&ctx->progress); } @@ -2330,7 +2324,7 @@ static void merge_commit_graph(struct write_commit_graph_context *ctx, oid_to_hex(&g->oid), (uintmax_t)st_add(ctx->commits.nr, g->num_commits)); - ALLOC_GROW(ctx->commits.list, ctx->commits.nr + g->num_commits, ctx->commits.alloc); + commit_stack_grow(&ctx->commits, g->num_commits); for (i = 0; i < g->num_commits; i++) { struct object_id oid; @@ -2343,10 +2337,8 @@ static void merge_commit_graph(struct write_commit_graph_context *ctx, /* only add commits if they still exist in the repo */ result = lookup_commit_reference_gently(ctx->r, &oid, 1); - if (result) { - ctx->commits.list[ctx->commits.nr] = result; - ctx->commits.nr++; - } + if (result) + commit_stack_push(&ctx->commits, result); } } @@ -2367,14 +2359,14 @@ static void sort_and_scan_merged_commits(struct write_commit_graph_context *ctx) _("Scanning merged commits"), ctx->commits.nr); - QSORT(ctx->commits.list, ctx->commits.nr, commit_compare); + QSORT(ctx->commits.items, ctx->commits.nr, commit_compare); ctx->num_extra_edges = 0; for (i = 0; i < ctx->commits.nr; i++) { display_progress(ctx->progress, i + 1); - if (i && oideq(&ctx->commits.list[i - 1]->object.oid, - &ctx->commits.list[i]->object.oid)) { + if (i && oideq(&ctx->commits.items[i - 1]->object.oid, + &ctx->commits.items[i]->object.oid)) { /* * Silently ignore duplicates. These were likely * created due to a commit appearing in multiple @@ -2385,10 +2377,10 @@ static void sort_and_scan_merged_commits(struct write_commit_graph_context *ctx) } else { unsigned int num_parents; - ctx->commits.list[dedup_i] = ctx->commits.list[i]; + ctx->commits.items[dedup_i] = ctx->commits.items[i]; dedup_i++; - num_parents = commit_list_count(ctx->commits.list[i]->parents); + num_parents = commit_list_count(ctx->commits.items[i]->parents); if (num_parents > 2) ctx->num_extra_edges += num_parents - 1; } @@ -2666,7 +2658,7 @@ int write_commit_graph(struct odb_source *source, cleanup: free(ctx.graph_name); free(ctx.base_graph_name); - free(ctx.commits.list); + commit_stack_clear(&ctx.commits); oid_array_clear(&ctx.oids); clear_topo_level_slab(&topo_levels); diff --git a/commit-reach.c b/commit-reach.c index cc18c86d3bb315..e7d9b3208fabc4 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -283,8 +283,8 @@ static int remove_redundant_with_gen(struct repository *r, { size_t i, count_non_stale = 0, count_still_independent = cnt; timestamp_t min_generation = GENERATION_NUMBER_INFINITY; - struct commit **walk_start, **sorted; - size_t walk_start_nr = 0, walk_start_alloc = cnt; + struct commit **sorted; + struct commit_stack walk_start = COMMIT_STACK_INIT; size_t min_gen_pos = 0; /* @@ -298,7 +298,7 @@ static int remove_redundant_with_gen(struct repository *r, QSORT(sorted, cnt, compare_commits_by_gen); min_generation = commit_graph_generation(sorted[0]); - ALLOC_ARRAY(walk_start, walk_start_alloc); + commit_stack_grow(&walk_start, cnt); /* Mark all parents of the input as STALE */ for (i = 0; i < cnt; i++) { @@ -312,18 +312,17 @@ static int remove_redundant_with_gen(struct repository *r, repo_parse_commit(r, parents->item); if (!(parents->item->object.flags & STALE)) { parents->item->object.flags |= STALE; - ALLOC_GROW(walk_start, walk_start_nr + 1, walk_start_alloc); - walk_start[walk_start_nr++] = parents->item; + commit_stack_push(&walk_start, parents->item); } parents = parents->next; } } - QSORT(walk_start, walk_start_nr, compare_commits_by_gen); + QSORT(walk_start.items, walk_start.nr, compare_commits_by_gen); /* remove STALE bit for now to allow walking through parents */ - for (i = 0; i < walk_start_nr; i++) - walk_start[i]->object.flags &= ~STALE; + for (i = 0; i < walk_start.nr; i++) + walk_start.items[i]->object.flags &= ~STALE; /* * Start walking from the highest generation. Hopefully, it will @@ -331,12 +330,12 @@ static int remove_redundant_with_gen(struct repository *r, * terminate early. Otherwise, we will do the same amount of work * as before. */ - for (i = walk_start_nr; i && count_still_independent > 1; i--) { + for (i = walk_start.nr; i && count_still_independent > 1; i--) { /* push the STALE bits up to min generation */ struct commit_list *stack = NULL; - commit_list_insert(walk_start[i - 1], &stack); - walk_start[i - 1]->object.flags |= STALE; + commit_list_insert(walk_start.items[i - 1], &stack); + walk_start.items[i - 1]->object.flags |= STALE; while (stack) { struct commit_list *parents; @@ -390,8 +389,8 @@ static int remove_redundant_with_gen(struct repository *r, } /* clear marks */ - clear_commit_marks_many(walk_start_nr, walk_start, STALE); - free(walk_start); + clear_commit_marks_many(walk_start.nr, walk_start.items, STALE); + commit_stack_clear(&walk_start); *dedup_cnt = count_non_stale; return 0; diff --git a/commit.c b/commit.c index 2527f15d9de3ac..efd0c026831e6b 100644 --- a/commit.c +++ b/commit.c @@ -1984,3 +1984,31 @@ int run_commit_hook(int editor_is_used, const char *index_file, opt.invoked_hook = invoked_hook; return run_hooks_opt(the_repository, name, &opt); } + +void commit_stack_init(struct commit_stack *stack) +{ + stack->items = NULL; + stack->nr = stack->alloc = 0; +} + +void commit_stack_grow(struct commit_stack *stack, size_t extra) +{ + ALLOC_GROW(stack->items, st_add(stack->nr, extra), stack->alloc); +} + +void commit_stack_push(struct commit_stack *stack, struct commit *commit) +{ + commit_stack_grow(stack, 1); + stack->items[stack->nr++] = commit; +} + +struct commit *commit_stack_pop(struct commit_stack *stack) +{ + return stack->nr ? stack->items[--stack->nr] : NULL; +} + +void commit_stack_clear(struct commit_stack *stack) +{ + free(stack->items); + commit_stack_init(stack); +} diff --git a/commit.h b/commit.h index 5406dd266327d4..79a761c37df023 100644 --- a/commit.h +++ b/commit.h @@ -381,4 +381,16 @@ int parse_buffer_signed_by_header(const char *buffer, const struct git_hash_algo *algop); int add_header_signature(struct strbuf *buf, struct strbuf *sig, const struct git_hash_algo *algo); +struct commit_stack { + struct commit **items; + size_t nr, alloc; +}; +#define COMMIT_STACK_INIT { 0 } + +void commit_stack_init(struct commit_stack *); +void commit_stack_grow(struct commit_stack *, size_t); +void commit_stack_push(struct commit_stack *, struct commit *); +struct commit *commit_stack_pop(struct commit_stack *); +void commit_stack_clear(struct commit_stack *); + #endif /* COMMIT_H */ diff --git a/midx-write.c b/midx-write.c index ce459b02c319cf..87b97c70872271 100644 --- a/midx-write.c +++ b/midx-write.c @@ -723,9 +723,7 @@ static int add_ref_to_pending(const struct reference *ref, void *cb_data) } struct bitmap_commit_cb { - struct commit **commits; - size_t commits_nr, commits_alloc; - + struct commit_stack *commits; struct write_midx_context *ctx; }; @@ -745,8 +743,7 @@ static void bitmap_show_commit(struct commit *commit, void *_data) if (pos < 0) return; - ALLOC_GROW(data->commits, data->commits_nr + 1, data->commits_alloc); - data->commits[data->commits_nr++] = commit; + commit_stack_push(data->commits, commit); } static int read_refs_snapshot(const char *refs_snapshot, @@ -784,17 +781,15 @@ static int read_refs_snapshot(const char *refs_snapshot, return 0; } -static struct commit **find_commits_for_midx_bitmap(uint32_t *indexed_commits_nr_p, - const char *refs_snapshot, - struct write_midx_context *ctx) +static void find_commits_for_midx_bitmap(struct commit_stack *commits, + const char *refs_snapshot, + struct write_midx_context *ctx) { struct rev_info revs; - struct bitmap_commit_cb cb = {0}; + struct bitmap_commit_cb cb = { .commits = commits, .ctx = ctx }; trace2_region_enter("midx", "find_commits_for_midx_bitmap", ctx->repo); - cb.ctx = ctx; - repo_init_revisions(ctx->repo, &revs, NULL); if (refs_snapshot) { read_refs_snapshot(refs_snapshot, &revs); @@ -823,14 +818,10 @@ static struct commit **find_commits_for_midx_bitmap(uint32_t *indexed_commits_nr die(_("revision walk setup failed")); traverse_commit_list(&revs, bitmap_show_commit, NULL, &cb); - if (indexed_commits_nr_p) - *indexed_commits_nr_p = cb.commits_nr; release_revisions(&revs); trace2_region_leave("midx", "find_commits_for_midx_bitmap", ctx->repo); - - return cb.commits; } static int write_midx_bitmap(struct write_midx_context *ctx, @@ -1447,15 +1438,14 @@ static int write_midx_internal(struct odb_source *source, if (flags & MIDX_WRITE_BITMAP) { struct packing_data pdata; - struct commit **commits; - uint32_t commits_nr; + struct commit_stack commits = COMMIT_STACK_INIT; if (!ctx.entries_nr) BUG("cannot write a bitmap without any objects"); prepare_midx_packing_data(&pdata, &ctx); - commits = find_commits_for_midx_bitmap(&commits_nr, refs_snapshot, &ctx); + find_commits_for_midx_bitmap(&commits, refs_snapshot, &ctx); /* * The previous steps translated the information from @@ -1466,17 +1456,16 @@ static int write_midx_internal(struct odb_source *source, FREE_AND_NULL(ctx.entries); ctx.entries_nr = 0; - if (write_midx_bitmap(&ctx, - midx_hash, &pdata, commits, commits_nr, - flags) < 0) { + if (write_midx_bitmap(&ctx, midx_hash, &pdata, + commits.items, commits.nr, flags) < 0) { error(_("could not write multi-pack bitmap")); clear_packing_data(&pdata); - free(commits); + commit_stack_clear(&commits); goto cleanup; } clear_packing_data(&pdata); - free(commits); + commit_stack_clear(&commits); } /* * NOTE: Do not use ctx.entries beyond this point, since it might diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 4404921521ca34..bf73ce5710abcc 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -315,8 +315,7 @@ define_commit_slab(bb_data, struct bb_commit); struct bitmap_builder { struct bb_data data; - struct commit **commits; - size_t commits_nr, commits_alloc; + struct commit_stack commits; }; static void bitmap_builder_init(struct bitmap_builder *bb, @@ -329,8 +328,8 @@ static void bitmap_builder_init(struct bitmap_builder *bb, struct commit_list *r; unsigned int i, num_maximal = 0; - memset(bb, 0, sizeof(*bb)); init_bb_data(&bb->data); + commit_stack_init(&bb->commits); reset_revision_walk(); repo_init_revisions(writer->to_pack->repo, &revs, NULL); @@ -390,8 +389,7 @@ static void bitmap_builder_init(struct bitmap_builder *bb, if (c_ent->maximal) { num_maximal++; - ALLOC_GROW(bb->commits, bb->commits_nr + 1, bb->commits_alloc); - bb->commits[bb->commits_nr++] = commit; + commit_stack_push(&bb->commits, commit); } if (p) { @@ -438,8 +436,7 @@ static void bitmap_builder_init(struct bitmap_builder *bb, } for (r = reusable; r; r = r->next) { - ALLOC_GROW(bb->commits, bb->commits_nr + 1, bb->commits_alloc); - bb->commits[bb->commits_nr++] = r->item; + commit_stack_push(&bb->commits, r->item); } trace2_data_intmax("pack-bitmap-write", writer->repo, @@ -454,8 +451,7 @@ static void bitmap_builder_init(struct bitmap_builder *bb, static void bitmap_builder_clear(struct bitmap_builder *bb) { deep_clear_bb_data(&bb->data, clear_bb_commit); - free(bb->commits); - bb->commits_nr = bb->commits_alloc = 0; + commit_stack_clear(&bb->commits); } static int fill_bitmap_tree(struct bitmap_writer *writer, @@ -630,8 +626,8 @@ int bitmap_writer_build(struct bitmap_writer *writer) mapping = NULL; bitmap_builder_init(&bb, writer, old_bitmap); - for (i = bb.commits_nr; i > 0; i--) { - struct commit *commit = bb.commits[i-1]; + for (i = bb.commits.nr; i > 0; i--) { + struct commit *commit = bb.commits.items[i-1]; struct bb_commit *ent = bb_data_at(&bb.data, commit); struct commit *child; int reused = 0; diff --git a/remote.c b/remote.c index 59b371512084eb..b756ff6f1594d9 100644 --- a/remote.c +++ b/remote.c @@ -1381,12 +1381,7 @@ static struct ref **tail_ref(struct ref **head) return tail; } -struct tips { - struct commit **tip; - size_t nr, alloc; -}; - -static void add_to_tips(struct tips *tips, const struct object_id *oid) +static void add_to_tips(struct commit_stack *tips, const struct object_id *oid) { struct commit *commit; @@ -1396,8 +1391,7 @@ static void add_to_tips(struct tips *tips, const struct object_id *oid) if (!commit || (commit->object.flags & TMP_MARK)) return; commit->object.flags |= TMP_MARK; - ALLOC_GROW(tips->tip, tips->nr + 1, tips->alloc); - tips->tip[tips->nr++] = commit; + commit_stack_push(tips, commit); } static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***dst_tail) @@ -1406,13 +1400,12 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds struct string_list src_tag = STRING_LIST_INIT_NODUP; struct string_list_item *item; struct ref *ref; - struct tips sent_tips; + struct commit_stack sent_tips = COMMIT_STACK_INIT; /* * Collect everything we know they would have at the end of * this push, and collect all tags they have. */ - memset(&sent_tips, 0, sizeof(sent_tips)); for (ref = *dst; ref; ref = ref->next) { if (ref->peer_ref && !is_null_oid(&ref->peer_ref->new_oid)) @@ -1422,7 +1415,7 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds if (starts_with(ref->name, "refs/tags/")) string_list_append(&dst_tag, ref->name); } - clear_commit_marks_many(sent_tips.nr, sent_tips.tip, TMP_MARK); + clear_commit_marks_many(sent_tips.nr, sent_tips.items, TMP_MARK); string_list_sort(&dst_tag); @@ -1450,9 +1443,7 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds if (sent_tips.nr) { const int reachable_flag = 1; struct commit_list *found_commits; - struct commit **src_commits; - size_t nr_src_commits = 0, alloc_src_commits = 16; - ALLOC_ARRAY(src_commits, alloc_src_commits); + struct commit_stack src_commits = COMMIT_STACK_INIT; for_each_string_list_item(item, &src_tag) { struct ref *ref = item->util; @@ -1467,12 +1458,13 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds /* not pushing a commit, which is not an error */ continue; - ALLOC_GROW(src_commits, nr_src_commits + 1, alloc_src_commits); - src_commits[nr_src_commits++] = commit; + commit_stack_push(&src_commits, commit); } - found_commits = get_reachable_subset(sent_tips.tip, sent_tips.nr, - src_commits, nr_src_commits, + found_commits = get_reachable_subset(sent_tips.items, + sent_tips.nr, + src_commits.items, + src_commits.nr, reachable_flag); for_each_string_list_item(item, &src_tag) { @@ -1502,13 +1494,14 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds dst_ref->peer_ref = copy_ref(ref); } - clear_commit_marks_many(nr_src_commits, src_commits, reachable_flag); - free(src_commits); + clear_commit_marks_many(src_commits.nr, src_commits.items, + reachable_flag); + commit_stack_clear(&src_commits); free_commit_list(found_commits); } string_list_clear(&src_tag, 0); - free(sent_tips.tip); + commit_stack_clear(&sent_tips); } struct ref *find_ref_by_name(const struct ref *list, const char *name) @@ -2544,36 +2537,9 @@ static int remote_tracking(struct remote *remote, const char *refname, return 0; } -/* - * The struct "reflog_commit_array" and related helper functions - * are used for collecting commits into an array during reflog - * traversals in "check_and_collect_until()". - */ -struct reflog_commit_array { - struct commit **item; - size_t nr, alloc; -}; - -#define REFLOG_COMMIT_ARRAY_INIT { 0 } - -/* Append a commit to the array. */ -static void append_commit(struct reflog_commit_array *arr, - struct commit *commit) -{ - ALLOC_GROW(arr->item, arr->nr + 1, arr->alloc); - arr->item[arr->nr++] = commit; -} - -/* Free and reset the array. */ -static void free_commit_array(struct reflog_commit_array *arr) -{ - FREE_AND_NULL(arr->item); - arr->nr = arr->alloc = 0; -} - struct check_and_collect_until_cb_data { struct commit *remote_commit; - struct reflog_commit_array *local_commits; + struct commit_stack *local_commits; timestamp_t remote_reflog_timestamp; }; @@ -2605,7 +2571,7 @@ static int check_and_collect_until(const char *refname UNUSED, return 1; if ((commit = lookup_commit_reference(the_repository, n_oid))) - append_commit(cb->local_commits, commit); + commit_stack_push(cb->local_commits, commit); /* * If the reflog entry timestamp is older than the remote ref's @@ -2633,7 +2599,7 @@ static int is_reachable_in_reflog(const char *local, const struct ref *remote) struct commit *commit; struct commit **chunk; struct check_and_collect_until_cb_data cb; - struct reflog_commit_array arr = REFLOG_COMMIT_ARRAY_INIT; + struct commit_stack arr = COMMIT_STACK_INIT; size_t size = 0; int ret = 0; @@ -2664,8 +2630,8 @@ static int is_reachable_in_reflog(const char *local, const struct ref *remote) * Check if the remote commit is reachable from any * of the commits in the collected array, in batches. */ - for (chunk = arr.item; chunk < arr.item + arr.nr; chunk += size) { - size = arr.item + arr.nr - chunk; + for (chunk = arr.items; chunk < arr.items + arr.nr; chunk += size) { + size = arr.items + arr.nr - chunk; if (MERGE_BASES_BATCH_SIZE < size) size = MERGE_BASES_BATCH_SIZE; @@ -2674,7 +2640,7 @@ static int is_reachable_in_reflog(const char *local, const struct ref *remote) } cleanup_return: - free_commit_array(&arr); + commit_stack_clear(&arr); return ret; } diff --git a/revision.c b/revision.c index 5f0850ae5c9c1a..1858e093eeeb89 100644 --- a/revision.c +++ b/revision.c @@ -250,29 +250,6 @@ void mark_trees_uninteresting_sparse(struct repository *r, paths_and_oids_clear(&map); } -struct commit_stack { - struct commit **items; - size_t nr, alloc; -}; -#define COMMIT_STACK_INIT { 0 } - -static void commit_stack_push(struct commit_stack *stack, struct commit *commit) -{ - ALLOC_GROW(stack->items, stack->nr + 1, stack->alloc); - stack->items[stack->nr++] = commit; -} - -static struct commit *commit_stack_pop(struct commit_stack *stack) -{ - return stack->nr ? stack->items[--stack->nr] : NULL; -} - -static void commit_stack_clear(struct commit_stack *stack) -{ - FREE_AND_NULL(stack->items); - stack->nr = stack->alloc = 0; -} - static void mark_one_parent_uninteresting(struct rev_info *revs, struct commit *commit, struct commit_stack *pending) { diff --git a/shallow.c b/shallow.c index 186e9178f32c33..c870efcefcac4a 100644 --- a/shallow.c +++ b/shallow.c @@ -471,6 +471,7 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa) { trace_printf_key(&trace_shallow, "shallow: prepare_shallow_info\n"); memset(info, 0, sizeof(*info)); + commit_stack_init(&info->commits); info->shallow = sa; if (!sa) return; @@ -503,6 +504,7 @@ void clear_shallow_info(struct shallow_info *info) free(info->shallow_ref); free(info->ours); free(info->theirs); + commit_stack_clear(&info->commits); } /* Step 4, remove non-existent ones in "theirs" after getting the pack */ @@ -733,19 +735,13 @@ void assign_shallow_commits_to_refs(struct shallow_info *info, free(shallow); } -struct commit_array { - struct commit **commits; - size_t nr, alloc; -}; - static int add_ref(const struct reference *ref, void *cb_data) { - struct commit_array *ca = cb_data; - ALLOC_GROW(ca->commits, ca->nr + 1, ca->alloc); - ca->commits[ca->nr] = lookup_commit_reference_gently(the_repository, - ref->oid, 1); - if (ca->commits[ca->nr]) - ca->nr++; + struct commit_stack *cs = cb_data; + struct commit *commit = lookup_commit_reference_gently(the_repository, + ref->oid, 1); + if (commit) + commit_stack_push(cs, commit); return 0; } @@ -770,7 +766,7 @@ static void post_assign_shallow(struct shallow_info *info, uint32_t **bitmap; size_t dst, i, j; size_t bitmap_nr = DIV_ROUND_UP(info->ref->nr, 32); - struct commit_array ca; + struct commit_stack cs = COMMIT_STACK_INIT; trace_printf_key(&trace_shallow, "shallow: post_assign_shallow\n"); if (ref_status) @@ -793,9 +789,8 @@ static void post_assign_shallow(struct shallow_info *info, } info->nr_theirs = dst; - memset(&ca, 0, sizeof(ca)); - refs_head_ref(get_main_ref_store(the_repository), add_ref, &ca); - refs_for_each_ref(get_main_ref_store(the_repository), add_ref, &ca); + refs_head_ref(get_main_ref_store(the_repository), add_ref, &cs); + refs_for_each_ref(get_main_ref_store(the_repository), add_ref, &cs); /* Remove unreachable shallow commits from "ours" */ for (i = dst = 0; i < info->nr_ours; i++) { @@ -808,7 +803,7 @@ static void post_assign_shallow(struct shallow_info *info, for (j = 0; j < bitmap_nr; j++) if (bitmap[0][j]) { /* Step 7, reachability test at commit level */ - int ret = repo_in_merge_bases_many(the_repository, c, ca.nr, ca.commits, 1); + int ret = repo_in_merge_bases_many(the_repository, c, cs.nr, cs.items, 1); if (ret < 0) exit(128); if (!ret) { @@ -820,7 +815,7 @@ static void post_assign_shallow(struct shallow_info *info, } info->nr_ours = dst; - free(ca.commits); + commit_stack_clear(&cs); } /* (Delayed) step 7, reachability test at commit level */ @@ -830,22 +825,17 @@ int delayed_reachability_test(struct shallow_info *si, int c) struct commit *commit = lookup_commit(the_repository, &si->shallow->oid[c]); - if (!si->commits) { - struct commit_array ca; - - memset(&ca, 0, sizeof(ca)); + if (!si->commits.nr) { refs_head_ref(get_main_ref_store(the_repository), - add_ref, &ca); + add_ref, &si->commits); refs_for_each_ref(get_main_ref_store(the_repository), - add_ref, &ca); - si->commits = ca.commits; - si->nr_commits = ca.nr; + add_ref, &si->commits); } si->reachable[c] = repo_in_merge_bases_many(the_repository, commit, - si->nr_commits, - si->commits, + si->commits.nr, + si->commits.items, 1); if (si->reachable[c] < 0) exit(128); diff --git a/shallow.h b/shallow.h index ad591bd1396854..1c0787de1d66b9 100644 --- a/shallow.h +++ b/shallow.h @@ -1,6 +1,7 @@ #ifndef SHALLOW_H #define SHALLOW_H +#include "commit.h" #include "lockfile.h" #include "object.h" #include "repository.h" @@ -69,8 +70,7 @@ struct shallow_info { int *need_reachability_test; int *reachable; int *shallow_ref; - struct commit **commits; - size_t nr_commits; + struct commit_stack commits; }; void prepare_shallow_info(struct shallow_info *, struct oid_array *); diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c index c58c93800f3232..feabeb29c25d89 100644 --- a/t/helper/test-reach.c +++ b/t/helper/test-reach.c @@ -34,8 +34,8 @@ int cmd__reach(int ac, const char **av) struct commit *A, *B; struct commit_list *X, *Y; struct object_array X_obj = OBJECT_ARRAY_INIT; - struct commit **X_array, **Y_array; - size_t X_nr, X_alloc, Y_nr, Y_alloc; + struct commit_stack X_stack = COMMIT_STACK_INIT; + struct commit_stack Y_stack = COMMIT_STACK_INIT; struct strbuf buf = STRBUF_INIT; struct repository *r = the_repository; @@ -46,10 +46,6 @@ int cmd__reach(int ac, const char **av) A = B = NULL; X = Y = NULL; - X_nr = Y_nr = 0; - X_alloc = Y_alloc = 16; - ALLOC_ARRAY(X_array, X_alloc); - ALLOC_ARRAY(Y_array, Y_alloc); while (strbuf_getline(&buf, stdin) != EOF) { struct object_id oid; @@ -88,15 +84,13 @@ int cmd__reach(int ac, const char **av) case 'X': commit_list_insert(c, &X); - ALLOC_GROW(X_array, X_nr + 1, X_alloc); - X_array[X_nr++] = c; + commit_stack_push(&X_stack, c); add_object_array(orig, NULL, &X_obj); break; case 'Y': commit_list_insert(c, &Y); - ALLOC_GROW(Y_array, Y_nr + 1, Y_alloc); - Y_array[Y_nr++] = c; + commit_stack_push(&Y_stack, c); break; default: @@ -112,16 +106,16 @@ int cmd__reach(int ac, const char **av) repo_in_merge_bases(the_repository, A, B)); else if (!strcmp(av[1], "in_merge_bases_many")) printf("%s(A,X):%d\n", av[1], - repo_in_merge_bases_many(the_repository, A, X_nr, X_array, 0)); + repo_in_merge_bases_many(the_repository, A, X_stack.nr, X_stack.items, 0)); else if (!strcmp(av[1], "is_descendant_of")) printf("%s(A,X):%d\n", av[1], repo_is_descendant_of(r, A, X)); else if (!strcmp(av[1], "get_branch_base_for_tip")) - printf("%s(A,X):%d\n", av[1], get_branch_base_for_tip(r, A, X_array, X_nr)); + printf("%s(A,X):%d\n", av[1], get_branch_base_for_tip(r, A, X_stack.items, X_stack.nr)); else if (!strcmp(av[1], "get_merge_bases_many")) { struct commit_list *list = NULL; if (repo_get_merge_bases_many(the_repository, - A, X_nr, - X_array, + A, X_stack.nr, + X_stack.items, &list) < 0) exit(128); printf("%s(A,X):\n", av[1]); @@ -159,8 +153,8 @@ int cmd__reach(int ac, const char **av) const int reachable_flag = 1; int count = 0; struct commit_list *current; - struct commit_list *list = get_reachable_subset(X_array, X_nr, - Y_array, Y_nr, + struct commit_list *list = get_reachable_subset(X_stack.items, X_stack.nr, + Y_stack.items, Y_stack.nr, reachable_flag); printf("get_reachable_subset(X,Y)\n"); for (current = list; current; current = current->next) { @@ -169,8 +163,8 @@ int cmd__reach(int ac, const char **av) oid_to_hex(&list->item->object.oid)); count++; } - for (size_t i = 0; i < Y_nr; i++) { - if (Y_array[i]->object.flags & reachable_flag) + for (size_t i = 0; i < Y_stack.nr; i++) { + if (Y_stack.items[i]->object.flags & reachable_flag) count--; } @@ -185,7 +179,7 @@ int cmd__reach(int ac, const char **av) strbuf_release(&buf); free_commit_list(X); free_commit_list(Y); - free(X_array); - free(Y_array); + commit_stack_clear(&X_stack); + commit_stack_clear(&Y_stack); return 0; } diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh index e12e18f97f02eb..822b0d55a50ae7 100755 --- a/t/t0450-txt-doc-vs-help.sh +++ b/t/t0450-txt-doc-vs-help.sh @@ -56,7 +56,7 @@ adoc_to_synopsis () { b2t="$(builtin_to_adoc "$builtin")" && sed -n \ -E '/^\[(verse|synopsis)\]$/,/^$/ { - /^$/d; + /^$/q; /^\[(verse|synopsis)\]$/d; s/\{litdd\}/--/g; s/'\''(git[ a-z-]*)'\''/\1/g; diff --git a/t/t1300-config.sh b/t/t1300-config.sh index 358d6363796f48..9850fcd5b567a5 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -1232,12 +1232,12 @@ test_expect_success SYMLINKS 'symlinked configuration' ' test_when_finished "rm myconfig" && ln -s notyet myconfig && git config --file=myconfig test.frotz nitfol && - test -h myconfig && - test -f notyet && + test_path_is_symlink myconfig && + test_path_is_file notyet && test "z$(git config --file=notyet test.frotz)" = znitfol && git config --file=myconfig test.xyzzy rezrov && - test -h myconfig && - test -f notyet && + test_path_is_symlink myconfig && + test_path_is_file notyet && cat >expect <<-\EOF && nitfol rezrov diff --git a/t/t2021-checkout-overwrite.sh b/t/t2021-checkout-overwrite.sh index a5c03d5d4a2c5a..38c41ae37321ce 100755 --- a/t/t2021-checkout-overwrite.sh +++ b/t/t2021-checkout-overwrite.sh @@ -27,7 +27,7 @@ test_expect_success 'checkout commit with dir must not remove untracked a/b' ' git rm --cached a/b && git commit -m "un-track the file" && test_must_fail git checkout start && - test -f a/b + test_path_is_file a/b ' test_expect_success 'create a commit where dir a/b changed to symlink' ' @@ -49,7 +49,7 @@ test_expect_success 'checkout commit with dir must not remove untracked a/b' ' test_expect_success SYMLINKS 'the symlink remained' ' - test -h a/b + test_path_is_symlink a/b ' test_expect_success 'cleanup after previous symlink tests' ' diff --git a/t/t5750-bundle-uri-parse.sh b/t/t5750-bundle-uri-parse.sh index 80a3f83ffb7e60..294f9d9c6455d4 100755 --- a/t/t5750-bundle-uri-parse.sh +++ b/t/t5750-bundle-uri-parse.sh @@ -286,4 +286,30 @@ test_expect_success 'parse config format edge cases: creationToken heuristic' ' grep "could not parse bundle list key creationToken with value '\''bogus'\''" err ' +test_expect_success 'parse config format: bundle with missing uri' ' + cat >input <<-\EOF && + [bundle] + version = 1 + mode = all + [bundle "missing-uri"] + creationToken = 1 + EOF + + test_must_fail test-tool bundle-uri parse-config input 2>err && + grep "bundle '\''missing-uri'\'' has no uri" err +' + +test_expect_success 'parse config format: bundle with url instead of uri' ' + cat >input <<-\EOF && + [bundle] + version = 1 + mode = all + [bundle "typo"] + url = https://example.com/bundle.bdl + EOF + + test_must_fail test-tool bundle-uri parse-config input 2>err && + grep "bundle '\''typo'\'' has no uri" err +' + test_done