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

Add reference types stash and other #1172

Merged
merged 1 commit into from
Jan 4, 2022
Merged
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
8 changes: 5 additions & 3 deletions doc/tigrc.5.adoc
Original file line number Diff line number Diff line change
@@ -185,12 +185,14 @@ The following variables can be set:
Prefix with `hide:` to not show that reference type, e.g. `hide:remote`.
Supported reference types are:
- head : The current HEAD.
- tag : A signed tag.
- local-tag : An unsigned tag.
- tag : An annotated tag.
- local-tag : A lightweight tag.
- remote : A remote.
- tracked-remote : The remote tracked by current HEAD.
- replace : A replaced reference.
- branch : Any other reference.
- branch : A branch.
- stash : The stash.
- other : Any other reference.

'line-graphics' (mixed) [ascii|default|utf-8|auto|<bool>]::

2 changes: 2 additions & 0 deletions include/tig/types.h
Original file line number Diff line number Diff line change
@@ -143,7 +143,9 @@ bool map_enum_do(const struct enum_map_entry *map, size_t map_size, int *value,

#define REFERENCE_ENUM(_) \
_(REFERENCE, HEAD), \
_(REFERENCE, STASH), \
_(REFERENCE, BRANCH), \
_(REFERENCE, OTHER), \
_(REFERENCE, TRACKED_REMOTE), \
_(REFERENCE, REMOTE), \
_(REFERENCE, TAG), \
6 changes: 6 additions & 0 deletions src/refdb.c
Original file line number Diff line number Diff line change
@@ -230,6 +230,12 @@ add_to_refs(const char *id, size_t idlen, char *name, size_t namelen, struct ref
if (*opt->head)
return SUCCESS;
type = REFERENCE_HEAD;

} else if (!strcmp(name, "refs/stash")) {
type = REFERENCE_STASH;

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

/* If we are reloading or it's an annotated tag, replace the
8 changes: 5 additions & 3 deletions tigrc
Original file line number Diff line number Diff line change
@@ -93,12 +93,14 @@ set truncation-delimiter = ~ # Character drawn for truncations, or "utf-8"

# Format reference names based on type.
# - head : The current HEAD.
# - tag : A signed tag.
# - local-tag : An unsigned tag.
# - tag : An annotated tag.
# - local-tag : A lightweight tag.
# - remote : A remote.
# - tracked-remote : The remote tracked by current HEAD.
# - replace : A replaced reference.
# - branch : Any other reference.
# - branch : A branch.
# - stash : The stash.
# - 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`.