Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refdb: ignore prefetch refs #1318

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Improvements:
- Use HTTPS for GitHub clone URLs. (#1310)
- Move default log view options to tigrc.
- Allow to go to stage view without Enter. (#1284)
- Add new "prefetch" reference type for refs created by `git maintenance`
(hidden in default config). (#1318)

Bug fixes:

Expand Down
5 changes: 4 additions & 1 deletion doc/tigrc.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ The following variables can be set:
names. Wrap the name of the reference type with the characters you would
like to use for formatting, e.g. `[tag]` and `<remote>`. If no format is
specified for `local-tag`, the format for `tag` is used. Similarly, if no
format is specified for `tracked-remote` the `remote` format is used.
format is specified for `tracked-remote`, the format for `remote` is used,
and if no format is specified for any other reference type, the format for
`branch` is used.
Prefix with `hide:` to not show that reference type, e.g. `hide:remote`.
Supported reference types are:
- head : The current HEAD.
Expand All @@ -192,6 +194,7 @@ The following variables can be set:
- replace : A replaced reference.
- branch : A branch.
- stash : The stash.
- prefetch : Refs prefetched by `git maintenance`.
- other : Any other reference.

'line-graphics' (mixed) [ascii|default|utf-8|auto|<bool>]::
Expand Down
3 changes: 2 additions & 1 deletion include/tig/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ bool map_enum_do(const struct enum_map_entry *map, size_t map_size, int *value,
_(REFERENCE, REMOTE), \
_(REFERENCE, TAG), \
_(REFERENCE, LOCAL_TAG), \
_(REFERENCE, REPLACE)
_(REFERENCE, REPLACE), \
_(REFERENCE, PREFETCH)

#define STATUS_LABEL_ENUM(_) \
_(STATUS_LABEL, NO), \
Expand Down
3 changes: 3 additions & 0 deletions src/refdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ add_to_refs(const char *id, size_t idlen, char *name, size_t namelen, struct ref
!strncmp(opt->head, name, namelen))
type = REFERENCE_HEAD;

} else if (!prefixcmp(name, "refs/prefetch/")) {
type = REFERENCE_PREFETCH;

} else if (!strcmp(name, "HEAD")) {
/* Handle the case of HEAD not being a symbolic ref,
* i.e. during a rebase. */
Expand Down
11 changes: 7 additions & 4 deletions tigrc
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ set truncation-delimiter = ~ # Character drawn for truncations, or "utf-8"
# - replace : A replaced reference.
# - branch : A branch.
# - stash : The stash.
# - prefetch : Refs prefetched by `git maintenance`.
# - other : Any other reference.
# If no format is defined for `local-tag` then the one for `tag` is used.
# Similarly, `remote` is used if no `tracked-remote` format exists.
# Prefix with `hide:` to not show that reference type, e.g. `hide:remote`.
#
# Expects a space-separated list of format strings.
set reference-format = [branch] <tag> {remote} ~replace~
# - If no format is specified for `local-tag`, the format for `tag` is used.
# - If no format is specified for `tracked-remote`, the format for `remote` is used.
# - If no format is specified for any other reference type, the format for `branch` is used.
# Prefix with `hide:` to not show that reference type, e.g. `hide:remote`.
set reference-format = [branch] <tag> {remote} ~replace~ hide:prefetch

# Settings controlling how content is read from Git
set commit-order = auto # Enum: auto, default, topo, date, reverse (main)
Expand Down