# glob escaping doesn't work with git mv

2 messages from 2014-08-07 to 2014-08-07. Participants: Alan Grover, Duy Nguyen.
Thread: https://gitlist.dev/t/37305

## Alan Grover, 2014-08-07 01:52

Subject: glob escaping doesn't work with git mv
Message-ID: <CA+cJFMm_vJwk=D0dkhEvfXwWk1S74hONb_g7O9W0iMZD3yAdLg@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2BcJFMm_vJwk%3DD0dkhEvfXwWk1S74hONb_g7O9W0iMZD3yAdLg%40mail.gmail.com

```
I tried using escaped globs with git mv, but globs don't seem to be
expanded with git mv.

So, for example, I've got files file1 & file2, and have been editing
them, so I've got file1~ and file2~ also, and *~ is in .gitignore.

If I do:

$ mkdir newdir
$ git mv file* newdir

I get a 'fatal: not in repository' error because I'm trying to move
untracked files.

Since we can do git add file\*, I tried:

$ git mv file\* newdir

I get a 'bad source, source=file* destination=file*' error. It seems
to be looking for a file named 'file*' rather than performing glob
expansion.

If I do:

$ rm *~
$ git mv file* newdir

Everything works as expected. It would be convenient if git mv
expanded escaped globs.

Thanks!

```

## Duy Nguyen, 2014-08-07 02:10

Subject: Re: glob escaping doesn't work with git mv
Message-ID: <CACsJy8APd6JH=32eWqK0m3e9bEWcrme3xZUewCyQxv08w=CyUQ@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8APd6JH%3D32eWqK0m3e9bEWcrme3xZUewCyQxv08w%3DCyUQ%40mail.gmail.com
In-Reply-To: <CA+cJFMm_vJwk=D0dkhEvfXwWk1S74hONb_g7O9W0iMZD3yAdLg@mail.gmail.com>

```
On Thu, Aug 7, 2014 at 8:52 AM, Alan Grover <alan.grover@gmail.com> wrote:
> Since we can do git add file\*, I tried:
>
> $ git mv file\* newdir
>
> I get a 'bad source, source=file* destination=file*' error. It seems
> to be looking for a file named 'file*' rather than performing glob
> expansion.

This is a known problem (to me at least). Source path processing in
git-mv is a bit complicated and it scared me away from converting to
using pathspec (which supports globbing and stuff). But perhaps if I
just expand pathspec and feed the final path list to git-mv (pretty
much like how shells expand glob) then it probably works..
-- 
Duy

```
