Search code examples
gittig

How to display full file path in tig view


I use tig to view what's changed. But how to show the full path in the changed file list instead of only part of long file path?

for example, I want to see the full path of SpecialAnswList.java, instead of the ... prefix.

---
   │  .../ui/component/SpeciaAnswList.java       | 44 ++++++++--------------
   │  1 file changed, 16 insertions(+), 28 deletions(-) 

Solution

  • Since Tig's uses git-show(1) to display diffs you can use the --stat diff option. For example:

    $ tig --stat=200,180
    

    Unfortunately, there is no option to scale it by a percentage, so you have to do that manually.

    Here's the documentation for the option:

    --stat[=<width>[,<name-width>[,<count>]]]
    
           Generate a diffstat. By default, as much space as necessary will be used for the
           filename part, and the rest for the graph part. Maximum width defaults to terminal
           width, or 80 columns if not connected to a terminal, and can be overridden by
           <width>. The width of the filename part can be limited by giving another width
           <name-width> after a comma. The width of the graph part can be limited by using
           --stat-graph-width=<width> (affects all commands generating a stat graph) or by
           setting diff.statGraphWidth=<width> (does not affect git format-patch). By giving a
           third parameter <count>, you can limit the output to the first <count> lines,
           followed by ...  if there are more.
    
           These parameters can also be set individually with --stat-width=<width>,
           --stat-name-width=<name-width> and --stat-count=<count>.