git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git rebase -i --exec and changing directory
@ 2018-05-19 16:38 Ondrej Mosnáček
  2018-05-27 10:59 ` Ondrej Mosnáček
  0 siblings, 1 reply; 8+ messages in thread
From: Ondrej Mosnáček @ 2018-05-19 16:38 UTC (permalink / raw)
  To: git

Hello,

I am trying to run a script to edit multiple commits using 'git rebase
-i --exec ...' and I ran into a strange behavior when I run 'cd'
inside the --exec command and subsequently run a git command. For
example, if the command is 'cd src && git status', then git status
reports as if all files in the repository are deleted.

Example command sequence to reproduce the problem:

    # Setup:
    touch a
    mkdir dir
    touch dir/x

    git init .
    git add --all
    git commit -m commit1
    git tag base
    touch b
    git add --all
    git commit -m commit2

    # Here we go:
    git rebase -i --exec 'cd dir && git status' base

    # Spawning a sub-shell doesn't help:
    git rebase -i --exec '(cd dir && git status)' base

Is this expected behavior or did I found a bug? Is there any
workaround, other than cd'ing to the toplevel directory every time I
want to run a git command when I am inside a subdirectory?

$ git --version
git version 2.17.0

Thanks,

Ondrej Mosnacek

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-28  2:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-19 16:38 git rebase -i --exec and changing directory Ondrej Mosnáček
2018-05-27 10:59 ` Ondrej Mosnáček
2018-05-27 12:28   ` Philip Oakley
2018-05-27 12:53     ` Ondrej Mosnáček
2018-05-27 16:07       ` Phillip Wood
2018-05-27 17:25         ` Philip Oakley
2018-05-27 17:25         ` Philip Oakley
2018-05-28  2:45         ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).