# BUG. Git config pager when --edit

9 messages from 2011-11-07 to 2011-11-08. Participants: Alexey Shumkin, Frans Klaver, Emily, Konstantin Khomoutov, Jeff King, Emily Ren, Junio C Hamano.
Thread: https://gitlist.dev/t/28873

## Alexey Shumkin, 2011-11-07 13:26

Subject: BUG. Git config pager when --edit
Message-ID: <20111107172652.0faade61@ashu.dyn.rarus.ru>
URL: https://gitlist.dev/e/20111107172652.0faade61%40ashu.dyn.rarus.ru

```
Hello!

I've found an annoying bug.
When I wanna review my config I run
$ git config --list

When I wanna edit config I run
$ git config --edit [--global]

As far as my config is large enough to be paged I set pager.config=less
setting. But since that moment when I run
$ git config --edit
I get 
Vim: Warning: Output is not to a terminal
And some messed config output

The same happens if to run
$ vim .git/config | less

Can anybody skilled enough fix it? :)

```

## Frans Klaver, 2011-11-07 13:43

Subject: Re: BUG. Git config pager when --edit
Message-ID: <CAH6sp9Ox+6p4RkjCZ0j3tXG9F4u7SPuwbSrOWmLSXic9DxSKiQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAH6sp9Ox%2B6p4RkjCZ0j3tXG9F4u7SPuwbSrOWmLSXic9DxSKiQ%40mail.gmail.com
In-Reply-To: <20111107172652.0faade61@ashu.dyn.rarus.ru>

```
Hi,

On Mon, Nov 7, 2011 at 2:26 PM, Alexey Shumkin <Alex.Crezoff@gmail.com> wrote:

> As far as my config is large enough to be paged I set pager.config=less
> setting. But since that moment when I run
> $ git config --edit
> I get
> Vim: Warning: Output is not to a terminal
> And some messed config output
>
> The same happens if to run
> $ vim .git/config | less

So git is trying to tell vim to pipe its output to less. vim can't do
that because it needs a terminal, as it's the only way vim is usable.

Should pager.config then only be used with --list?

```

## Emily, 2011-11-07 14:54

Subject: how to merge sub directory or file?
Message-ID: <8B3D19E0-2181-4E9C-943F-CA26A399E0D9@gmail.com>
URL: https://gitlist.dev/e/8B3D19E0-2181-4E9C-943F-CA26A399E0D9%40gmail.com
In-Reply-To: <20111107172652.0faade61@ashu.dyn.rarus.ru>

```
Hi,

I have two git projects A and B, content of B is subset of A. For example, Project  A and B's tree are as below:

A
--- dir1
--- dir2
--- dir3
       |---file1
       |---dir4
       |---dir5
--- dir6
--- dir7

B
--- dir1
--- dir3
      |--- file1
      |--- dir4

When there's new changes in project A, how can I merge them to project B without changing B's directory structure?

Your help will be highly appreciated.

Thanks,
Emily

```

## Konstantin Khomoutov, 2011-11-07 15:37

Subject: Re: how to merge sub directory or file?
Message-ID: <20111107193708.6cf2ae81.kostix@domain007.com>
URL: https://gitlist.dev/e/20111107193708.6cf2ae81.kostix%40domain007.com
In-Reply-To: <8B3D19E0-2181-4E9C-943F-CA26A399E0D9@gmail.com>

```
On Mon, 7 Nov 2011 22:54:18 +0800
Emily <lingyan.ren@gmail.com> wrote:

> I have two git projects A and B, content of B is subset of A. For
> example, Project  A and B's tree are as below:
[...]
> When there's new changes in project A, how can I merge them to
> project B without changing B's directory structure?
> 
> Your help will be highly appreciated.
Subtree merging maybe?
See http://progit.org/book/ch6-7.html

```

## Jeff King, 2011-11-07 16:42

Subject: Re: BUG. Git config pager when --edit
Message-ID: <20111107164250.GC27055@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20111107164250.GC27055%40sigill.intra.peff.net
In-Reply-To: <CAH6sp9Ox+6p4RkjCZ0j3tXG9F4u7SPuwbSrOWmLSXic9DxSKiQ@mail.gmail.com>

```
On Mon, Nov 07, 2011 at 02:43:41PM +0100, Frans Klaver wrote:

> > As far as my config is large enough to be paged I set pager.config=less
> > setting. But since that moment when I run
> > $ git config --edit
> > I get
> > Vim: Warning: Output is not to a terminal
> > And some messed config output
> >
> > The same happens if to run
> > $ vim .git/config | less
> 
> So git is trying to tell vim to pipe its output to less. vim can't do
> that because it needs a terminal, as it's the only way vim is usable.
> 
> Should pager.config then only be used with --list?

Yes, but it can't, because it is not the config command, but the git
wrapper that respects "pager.config". We have similar issues with
setting "pager.tag" (you want it for listing, but not for tag creation)
and others.

I should probably polish and submit the patch here:

  http://thread.gmane.org/gmane.comp.version-control.git/182238/focus=182475

-Peff

```

## Junio C Hamano, 2011-11-07 17:02

Subject: Re: BUG. Git config pager when --edit
Message-ID: <7vpqh327ds.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vpqh327ds.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20111107164250.GC27055@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> I should probably polish and submit the patch here:
>
>   http://thread.gmane.org/gmane.comp.version-control.git/182238/focus=182475

I was actually hoping that you won't go that route, but the route to push
further to decide/spawn pager as late as possible. Clearly no sane person
would want to run --edit subcommand under pager and "pager.config = less"

```

## Jeff King, 2011-11-07 17:18

Subject: Re: BUG. Git config pager when --edit
Message-ID: <20111107171800.GA3621@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20111107171800.GA3621%40sigill.intra.peff.net
In-Reply-To: <7vpqh327ds.fsf@alter.siamese.dyndns.org>

```
On Mon, Nov 07, 2011 at 09:02:23AM -0800, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > I should probably polish and submit the patch here:
> >
> >   http://thread.gmane.org/gmane.comp.version-control.git/182238/focus=182475
> 
> I was actually hoping that you won't go that route, but the route to push
> further to decide/spawn pager as late as possible. Clearly no sane person
> would want to run --edit subcommand under pager and "pager.config = less"
> should just be ignored in such a case.

The problem with that is that it dumps the responsibility for running
the pager to every subcommand. For builtins, we can have a flag that
says "respect the pager.log config" or "foo will handle this itself;
don't respect pager.tag".

But what about externals? If "pager.stash" does nothing in git.c, and
leaves it to "git-stash.sh" to start the pager if and when it's
appropriate, then what about my personal "git-foo" that I drop into my
PATH? Now I can't use "config.foo" without carrying code to do so in my
external command.

Maybe that's an OK tradeoff. But it's more of a pain for existing
scripts, and it's not backwards compatible. What do you think?

-Peff

```

## Frans Klaver, 2011-11-07 20:45

Subject: Re: BUG. Git config pager when --edit
Message-ID: <op.v4lfxck60aolir@keputer.lokaal>
URL: https://gitlist.dev/e/op.v4lfxck60aolir%40keputer.lokaal
In-Reply-To: <20111107171800.GA3621@sigill.intra.peff.net>

```
On Mon, 07 Nov 2011 18:18:00 +0100, Jeff King <peff@peff.net> wrote:

>> I was actually hoping that you won't go that route, but the route to  
>> push
>> further to decide/spawn pager as late as possible. Clearly no sane  
>> person
>> would want to run --edit subcommand under pager and "pager.config =  
>> less"
>> should just be ignored in such a case.
>
> The problem with that is that it dumps the responsibility for running
> the pager to every subcommand. For builtins, we can have a flag that
> says "respect the pager.log config" or "foo will handle this itself;
> don't respect pager.tag".
>
> But what about externals? If "pager.stash" does nothing in git.c, and
> leaves it to "git-stash.sh" to start the pager if and when it's
> appropriate, then what about my personal "git-foo" that I drop into my
> PATH? Now I can't use "config.foo" without carrying code to do so in my
> external command.
>
> Maybe that's an OK tradeoff. But it's more of a pain for existing
> scripts, and it's not backwards compatible. What do you think?

For both cases there's something to say. In any new design I might dump  
the responsibility on the external, but I would prefer to keep the  
decision logic centralized. But as I understand, removing the  
responsibility from git.c is going to require a whole bunch of other  
changes to get the pager functional again in the scripts. So if there is a  
somewhat decent way to be sure about whether or not to use the pager (i.e.  
no editing) in git.c, why not keep it there? If, on the other hand, the  
code is going to turn out to be a big hack, I'd say move it out.

Frans

```

## Emily Ren, 2011-11-08 07:08

Subject: Re: how to merge sub directory or file?
Message-ID: <CAP_m3yKehN1-KtMCVxKdu2ca59GzYE0w2X2=UhH2X9PgzYiMAg@mail.gmail.com>
URL: https://gitlist.dev/e/CAP_m3yKehN1-KtMCVxKdu2ca59GzYE0w2X2%3DUhH2X9PgzYiMAg%40mail.gmail.com
In-Reply-To: <20111107193708.6cf2ae81.kostix@domain007.com>

```
Hi Kon,

Thank you !  I tried that method, it failed on read-tree because
B/dir3 already exists, Cannot bind.

$ git read-tree --prefix=dir3 -u A:dir3
error: Entry 'dir3/file1' overlaps with 'dir3/file1'.  Cannot bind.

And my case is that not all A's sub direcotries are in B.
For example, in A's dir3, there are file1, dir4 and dir5. But in B's
dir3, only file1 and dir4 exist, there's no dir5. How to handle this
case ?

Thanks,
Emily

On Mon, Nov 7, 2011 at 11:37 PM, Konstantin Khomoutov
<flatworm@users.sourceforge.net> wrote:
>
> On Mon, 7 Nov 2011 22:54:18 +0800
> Emily <lingyan.ren@gmail.com> wrote:
>
> > I have two git projects A and B, content of B is subset of A. For
> > example, Project  A and B's tree are as below:
> [...]
> > When there's new changes in project A, how can I merge them to
> > project B without changing B's directory structure?
> >
> > Your help will be highly appreciated.
> Subtree merging maybe?
> See http://progit.org/book/ch6-7.html

```
