[PATCH 0/2] Option to modify revision mark for root commits
- From
- Kyle Marek <kmarek@pdinc.us>
- Date
- Jan 17, 2021, 11:03 UTC
- Message-ID
- <20210117110337.429994-1-kmarek@pdinc.us>
- In-Reply-To
- <196101d6eab6$20714550$6153cff0$@pdinc.us>
This patch series allows --show-linear-break to be used with --graph, allowing for the revision mark to be changed for root commits.
Feel free to squash away PATCH 1, or maybe even discard PATCH 2.
Jason: tested against Cygwin x86_64/release/git/git-2.30.0-1-src.tar.xz
Note: PATCH 2 revision.c:2410 makes a second copy of optarg. This may not be necessary.
Background:
The use case is --graph --oneline with unrelated histories. For example, in a hypothetical repository with an orphaned "prebuilt" branch containing builds of the master branch, the history may look like:
kmarek@kyle-ppc64le /tmp/somerepo $ git log --graph --all --oneline * 02190b6 (prebuilt) add aarch64 * 7b873f6 add x86_64 * 26cc783 add ppc64le * 5b7186e (HEAD -> master) add Makefile * ea69093 implement cmdline parsing * a65df8a add main.c * 7727eb3 Initial commit
At first sight, the above log implies that 26cc783's parent is 5b7186e, or that master is an ancestor to prebuilt, but 26cc783 is the start of a new history:
kmarek@kyle-ppc64le /tmp/somerepo $ git log --graph --oneline master * 5b7186e (HEAD -> master) add Makefile * ea69093 implement cmdline parsing * a65df8a add main.c * 7727eb3 Initial commit
kmarek@kyle-ppc64le /tmp/somerepo $ git log --graph --oneline prebuilt * 02190b6 (prebuilt) add aarch64 * 7b873f6 add x86_64 * 26cc783 add ppc64le
To identify the start of a new history:
kmarek@kyle-ppc64le /tmp/somerepo $ git log --graph --all --oneline --show-linear-break * 02190b6 (prebuilt) add aarch64 * 7b873f6 add x86_64 # 26cc783 add ppc64le * 5b7186e (HEAD -> master) add Makefile * ea69093 implement cmdline parsing * a65df8a add main.c # 7727eb3 Initial commit
kmarek@kyle-ppc64le /tmp/somerepo $ git log --graph --all --oneline --show-linear-break=I * 02190b6 (prebuilt) add aarch64 * 7b873f6 add x86_64 I 26cc783 add ppc64le * 5b7186e (HEAD -> master) add Makefile * ea69093 implement cmdline parsing * a65df8a add main.c I 7727eb3 Initial commit
Kyle Marek (2): revision: Denote root commits with '#' revision: implement --show-linear-break for --graph
Documentation/rev-list-options.txt | 7 +++++++ log-tree.c | 2 +- revision.c | 10 ++++++---- revision.h | 1 + 4 files changed, 15 insertions(+), 5 deletions(-)
-- 2.29.2