{"thread":{"id":"55014","subject":"Question about 'git log', custom formats, and '--left-right' and friends","startedAt":"2021-01-20T03:43:30Z","lastAt":"2021-01-20T03:43:30Z","messageCount":1,"participants":["Philippe Blain"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"414772","messageId":"24504597-7c14-70aa-393b-2e18df2a51bb@gmail.com","threadId":"55014","inReplyTo":null,"subject":"Question about 'git log', custom formats, and '--left-right' and friends","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-01-20T03:40:18Z","receivedAt":"2021-01-20T03:43:30Z","isPatch":false,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi everyone,\n\nI think I've come across a limitation of using custom pretty formats\nalong with the '--left-right', '--boundary', '--cherry-mark'\noptions to 'git log'.\n\nI'm trying to replicate the behaviour of the 'oneline' pretty format when it\nis used with or without the options above and a symmetric difference. When not\nusing any of the options above, no mark is added before the commit hash in\nnon-graph mode, and a '*' is added in graph-mode. When using the options above,\nthe corresponding marks are used: '>', '<', for left/right, '-' for boundary ('o'\nin graph mode), '+' and '=' for cherry-mark, etc.\n\nI'd like to get this behaviour with a custom pretty format (I use it to add some\nmore informations to what '--oneline' shows), but it seems it is not possible. And\nthe '%m' placeholder does not help a lot, as it's 'always on'. The script below demonstrates\nwhat I'm talking about:\n\n~~~\n#!/bin/sh\n\nrun () {\necho\necho \"RUNNING: $@\"\n\"$@\"\n}\n\nrm -rf test\nmkdir test\ncd test\n\ngit init -b master remote\necho data>remote/file && git -C remote add file && git -C remote commit -m root\ngit clone remote clone\necho dato>remote/file && git -C remote add file && git -C remote commit -m L\necho date>clone/file  && git -C clone  add file && git -C clone  commit -m R\ngit -C clone fetch\ngit -C clone config pretty.ol     '%h %s'\ngit -C clone config pretty.ol2 '%m %h %s'\n\nrun git -C clone log --oneline --no-decorate --left-right @{u}...\nrun git -C clone log --format=ol  --left-right @{u}...\nrun git -C clone log --format=ol2 --left-right @{u}...\n\nrun git -C clone log --graph --oneline --no-decorate --left-right @{u}...\nrun git -C clone log --graph --format=ol  --left-right @{u}...\nrun git -C clone log --graph --format=ol2 --left-right @{u}...\n\nrun git -C clone log --oneline --no-decorate @{u}...\nrun git -C clone log --format=ol  @{u}...\nrun git -C clone log --format=ol2 @{u}...\n\nrun git -C clone log --graph --oneline --no-decorate @{u}...\nrun git -C clone log --graph --format=ol  @{u}...\nrun git -C clone log --graph --format=ol2 @{u}...\n~~~\n\nthe (commented) output looks like:\n---\nRUNNING: git -C clone log --oneline --no-decorate --left-right @{u}...\n< 10f70d1 L\n> 31e5b8e R\n\nRUNNING: git -C clone log --format=ol --left-right @{u}...\n10f70d1 L\n31e5b8e R\n\n-> NOT OK: no marks shown\n\nRUNNING: git -C clone log --format=ol2 --left-right @{u}...\n< 10f70d1 L\n> 31e5b8e R\n\n-> OK: marks shown\n\nRUNNING: git -C clone log --graph --oneline --no-decorate --left-right @{u}...\n< 10f70d1 L\n> 31e5b8e R\n\nRUNNING: git -C clone log --graph --format=ol --left-right @{u}...\n< 10f70d1 L\n> 31e5b8e R\n\n-> OK: marks shown\n\nRUNNING: git -C clone log --graph --format=ol2 --left-right @{u}...\n< < 10f70d1 L\n> > 31e5b8e R\n\n-> NOT OK: marks shown twice\n\nRUNNING: git -C clone log --oneline --no-decorate @{u}...\n10f70d1 L\n31e5b8e R\n\nRUNNING: git -C clone log --format=ol @{u}...\n10f70d1 L\n31e5b8e R\n\n-> OK: no marks shown\n\nRUNNING: git -C clone log --format=ol2 @{u}...\n< 10f70d1 L\n> 31e5b8e R\n\n-> NOT OK: marks shown\n\nRUNNING: git -C clone log --graph --oneline --no-decorate @{u}...\n* 10f70d1 L\n* 31e5b8e R\n\nRUNNING: git -C clone log --graph --format=ol @{u}...\n* 10f70d1 L\n* 31e5b8e R\n\n-> OK: no marks shown\n\nRUNNING: git -C clone log --graph --format=ol2 @{u}...\n* < 10f70d1 L\n* > 31e5b8e R\n\n-> NOT OK: different marks shown twice\n---\n\n\nAm I missing something here ? Is this a known limitation ?\n\n\nThanks and cheers,\n\nPhilippe.\n"}]}