feat(gitter): importer endpoints#5690
Conversation
5225fef to
f92281d
Compare
| ) | ||
|
|
||
| // getEmptyTreeHash calculates and caches the empty tree hash | ||
| func getEmptyTreeHash(ctx context.Context, repoPath string) string { |
There was a problem hiding this comment.
huh is this meant to be difference from the fallback value?
| } | ||
|
|
||
| /** | ||
| Possible status letters are: |
There was a problem hiding this comment.
Link to the docs here?
There was a problem hiding this comment.
Also, I think this is actually copied from the wrong part of the doc, so is missing the B status.
See https://git-scm.com/docs/git-diff-tree (--name-status)
Show only the name(s) and status of each changed file. See the description of the --diff-filter option on what the status letters mean. Just like --name-only the file names are often encoded in UTF-8.
then see --diff-filter:
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, …) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected.Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.
Note that not all diffs can feature all types. For instance, copied and renamed entries cannot appear if detection for those types is disabled.
But this part of the doc is from the raw git-diff-files command.
There was a problem hiding this comment.
Added doc link, it's actually from https://git-scm.com/docs/diff-format.
The diff-* (index / tree / files) commands all share this raw output format, so their respective docs link back to the same diff-format section via an include::. So, this status list would apply to git diff-tree as well.
Re: the "B" status:
TL;DR: In terms of output, "B" is never a real status that will show up.
It is associated with the -B (--break-rewrites) flag.
If enabled, it breaks large modifications into separate add (A) and delete (D) pairs. But later in the diffcore transformation, these broken-up pairs will either resolve as a rename (R) or merge back into a modified (M).
(ref: https://git-scm.com/docs/gitdiffcore)
While the B option in --diff-filter can be used to filter files with large modifications (thus "broken" at one point), the transformations within git diff will not be printed it as a "B" status in either the --name-status or --raw output.
Adds:
/file-diffs: List file diffs from last_synced_commit to HEAD of target branch (defaults to remote's origin/HEAD if not provided in request)/file-content: Given commit hash and file path,git cat-filethe content of the fileAlso did some small refactoring to move code that handles repo fetching, cloning, etc into
git.go.There will be a follow-up PR to update importer to use these new endpoints.