1
0
mirror of https://github.com/git/git.git synced 2024-09-29 05:01:36 +02:00
git/builtin
Rafael Ascensão 65516f586b log: add option to choose which refs to decorate
When `log --decorate` is used, git will decorate commits with all
available refs. While in most cases this may give the desired effect,
under some conditions it can lead to excessively verbose output.

Introduce two command line options, `--decorate-refs=<pattern>` and
`--decorate-refs-exclude=<pattern>` to allow the user to select which
refs are used in decoration.

When "--decorate-refs=<pattern>" is given, only the refs that match the
pattern are used in decoration. The refs that match the pattern when
"--decorate-refs-exclude=<pattern>" is given, are never used in
decoration.

These options follow the same convention for mixing negative and
positive patterns across the system, assuming that the inclusive default
is to match all refs available.

 (1) if there is no positive pattern given, pretend as if an
     inclusive default positive pattern was given;

 (2) for each candidate, reject it if it matches no positive
     pattern, or if it matches any one of the negative patterns.

The rules for what is considered a match are slightly different from the
rules used elsewhere.

Commands like `log --glob` assume a trailing '/*' when glob chars are
not present in the pattern. This makes it difficult to specify a single
ref.  On the other hand, commands like `describe --match --all` allow
specifying exact refs, but do not have the convenience of allowing
"shorthand refs" like 'refs/heads' or 'heads' to refer to
'refs/heads/*'.

The commands introduced in this patch consider a match if:

  (a) the pattern contains globs chars,
	and regular pattern matching returns a match.

  (b) the pattern does not contain glob chars,
         and ref '<pattern>' exists, or if ref exists under '<pattern>/'

This allows both behaviours (allowing single refs and shorthand refs)
yet remaining compatible with existent commands.

Helped-by: Kevin Daudt <me@ikke.info>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Rafael Ascensão <rafa.almas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-22 13:18:59 +09:00
..
add.c diff: make struct diff_flags members lowercase 2017-11-01 11:51:40 +09:00
am.c Merge branch 'mh/tidy-ref-update-flags' 2017-11-15 12:14:29 +09:00
annotate.c
apply.c
archive.c
bisect--helper.c bisect: mention "view" as an alternative to "visualize" 2017-11-13 10:51:14 +09:00
blame.c diff: make struct diff_flags members lowercase 2017-11-01 11:51:40 +09:00
branch.c Merge branch 'bc/object-id' 2017-11-06 14:24:27 +09:00
bundle.c
cat-file.c Merge branch 'jk/diff-blob' into maint 2017-10-18 14:19:01 +09:00
check-attr.c
check-ignore.c
check-mailmap.c
check-ref-format.c Merge branch 'jc/check-ref-format-oor' 2017-11-06 14:24:28 +09:00
checkout-index.c
checkout.c Merge branch 'mh/tidy-ref-update-flags' 2017-11-15 12:14:29 +09:00
clean.c Merge branch 'jk/ref-filter-colors-fix' 2017-10-18 10:19:08 +09:00
clone.c Merge branch 'mh/tidy-ref-update-flags' 2017-11-15 12:14:29 +09:00
column.c
commit-tree.c
commit.c Merge branch 'ma/reduce-heads-leakfix' 2017-11-15 12:14:32 +09:00
config.c
count-objects.c
credential.c
describe.c Merge branch 'bc/object-id' 2017-11-06 14:24:27 +09:00
diff-files.c
diff-index.c
diff-tree.c
diff.c Merge branch 'bw/diff-opt-impl-to-bitfields' 2017-11-09 14:31:27 +09:00
difftool.c
fast-export.c Merge branch 'bw/diff-opt-impl-to-bitfields' 2017-11-09 14:31:27 +09:00
fetch-pack.c
fetch.c Convert check_connected to use struct object_id 2017-10-16 11:05:50 +09:00
fmt-merge-msg.c Merge branch 'ma/reduce-heads-leakfix' 2017-11-15 12:14:32 +09:00
for-each-ref.c
fsck.c Merge branch 'bp/read-index-from-skip-verification' 2017-11-15 12:14:37 +09:00
gc.c Merge branch 'aw/gc-lockfile-fscanf-fix' into maint 2017-10-18 14:18:59 +09:00
get-tar-commit-id.c
grep.c Merge branch 'bw/grep-recurse-submodules' 2017-11-06 13:11:27 +09:00
hash-object.c
help.c
index-pack.c cleanup: fix possible overflow errors in binary search 2017-10-10 08:57:24 +09:00
init-db.c
interpret-trailers.c
log.c log: add option to choose which refs to decorate 2017-11-22 13:18:59 +09:00
ls-files.c Merge branch 'bp/fsmonitor' 2017-11-21 14:07:50 +09:00
ls-remote.c
ls-tree.c
mailinfo.c
mailsplit.c
merge-base.c Merge branch 'ma/reduce-heads-leakfix' 2017-11-15 12:14:32 +09:00
merge-file.c
merge-index.c
merge-ours.c Merge branch 'bw/diff-opt-impl-to-bitfields' 2017-11-09 14:31:27 +09:00
merge-recursive.c
merge-tree.c
merge.c Merge branch 'ma/reduce-heads-leakfix' 2017-11-15 12:14:32 +09:00
mktag.c
mktree.c
mv.c
name-rev.c Merge branch 'mg/timestamp-t-fix' into maint 2017-10-18 14:19:09 +09:00
notes.c refs: rename constant REF_NODEREF to REF_NO_DEREF 2017-11-06 10:31:08 +09:00
pack-objects.c Merge branch 'rj/no-sign-compare' into maint 2017-10-23 14:20:18 +09:00
pack-redundant.c
pack-refs.c
patch-id.c
prune-packed.c
prune.c
pull.c Merge branch 'ma/reduce-heads-leakfix' 2017-11-15 12:14:32 +09:00
push.c builtin/push.c: add push.pushOption config 2017-10-24 09:57:54 +09:00
read-tree.c
rebase--helper.c
receive-pack.c Convert check_connected to use struct object_id 2017-10-16 11:05:50 +09:00
reflog.c refs: convert reflog_expire parameter to struct object_id 2017-10-16 11:05:51 +09:00
remote-ext.c
remote-fd.c
remote.c Merge branch 'mh/tidy-ref-update-flags' 2017-11-15 12:14:29 +09:00
repack.c
replace.c refs: convert read_ref and read_ref_full to object_id 2017-10-16 11:05:50 +09:00
rerere.c
reset.c Merge branch 'bw/diff-opt-impl-to-bitfields' 2017-11-09 14:31:27 +09:00
rev-list.c Merge branch 'ma/bisect-leakfix' 2017-11-15 12:14:28 +09:00
rev-parse.c Merge branch 'mh/packed-ref-store-prep' into maint 2017-10-18 14:18:58 +09:00
revert.c
rm.c
send-pack.c
shortlog.c
show-branch.c Merge branch 'bc/object-id' 2017-11-06 14:24:27 +09:00
show-ref.c refs: convert peel_ref to struct object_id 2017-10-16 11:05:51 +09:00
stripspace.c
submodule--helper.c Merge branch 'bc/object-id' 2017-11-06 14:24:27 +09:00
symbolic-ref.c refs: rename constant REF_NODEREF to REF_NO_DEREF 2017-11-06 10:31:08 +09:00
tag.c Merge branch 'bc/object-id' 2017-11-06 14:24:27 +09:00
unpack-file.c
unpack-objects.c cleanup: fix possible overflow errors in binary search 2017-10-10 08:57:24 +09:00
update-index.c Merge branch 'bp/fsmonitor' 2017-11-21 14:07:50 +09:00
update-ref.c refs: rename constant REF_NODEREF to REF_NO_DEREF 2017-11-06 10:31:08 +09:00
update-server-info.c
upload-archive.c
var.c
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c worktree: convert struct worktree to object_id 2017-10-16 11:05:51 +09:00
write-tree.c