From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Vitali Lovich <vlovich@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: rev-parse --show-toplevel broken during exec'ed rebase?
Date: Thu, 12 Jul 2018 17:02:10 +0200 (DST) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.1807121657120.75@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1807121647310.75@tvgsbejvaqbjf.bet>
Hi,
On Thu, 12 Jul 2018, Johannes Schindelin wrote:
> On Wed, 11 Jul 2018, Vitali Lovich wrote:
>
> > On Wed, Jul 11, 2018 at 7:50 PM Vitali Lovich <vlovich@gmail.com> wrote:
> > >
> > > Typically git rev-parse --show-toplevel prints the folder containing
> > > the .git folder regardless what subdirectory one is in. One exception
> > > I have found is that if one is within the context of git rebase --exec
> > > then show-toplevel always just prints the current directory it's
> > > running from.
> > >
> > > Repro (starting with cwd within git project):
> > > > (cd xdiff; git rev-parse --show-toplevel)
> > > ... path to git repository
> > > > git rebase -i 18404434bf406f6a6f892ed73320c5cf9cc187dd
> > > # Stop at some commit for editing
> > > > (cd xdiff; git rev-parse --show-toplevel)
> > > ... path to git repository
> > > > git rebase 18404434bf406f6a6f892ed73320c5cf9cc187dd -x "(cd xdiff; git rev-parse --show-toplevel)"
> > > ... path to git repository/xdiff !!!
> > >
> > > This seems like incorrect behaviour to me since it's a weird
> > > inconsistency (even with other rebase contexts) & the documentation
> > > says "Show the absolute path of the top-level directory." with no
> > > caveats.
> >
> > Sorry. Forgot to include the git versions I tested with (2.13.1,
> > 2.17.0, 2.18.0)
>
> This is actually not so much a bug in `rebase` as in `rev-parse
> --show-top-level`:
>
> $ GIT_DIR=$PWD/.git git -C xdiff rev-parse --show-toplevel
> C:/git-sdk-64/usr/src/git/xdiff
And the reason for this behavior is that setting `GIT_DIR` explicitly
makes Git *always* consider the current working directory to be the
top-level directory:
https://github.com/git/git/blob/v2.18.0/setup.c#L1061-L1063
I wonder whether changing the line
(https://github.com/git/git/blob/v2.18.0/sequencer.c#L2635)
argv_array_pushf(&child_env, "GIT_DIR=%s", absolute_path(get_git_dir()));
to
argv_array_push(&child_env, "GIT_DIR");
breaks anything (and whether it fixes the bug you demonstrated via
`rev-parse --show-toplevel`).
Ciao,
Johannes
next prev parent reply other threads:[~2018-07-12 15:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-12 2:50 rev-parse --show-toplevel broken during exec'ed rebase? Vitali Lovich
2018-07-12 2:53 ` Vitali Lovich
2018-07-12 14:49 ` Johannes Schindelin
2018-07-12 15:02 ` Johannes Schindelin [this message]
2018-07-12 15:23 ` Junio C Hamano
2018-07-12 17:39 ` Vitali Lovich
2018-07-13 18:47 ` brian m. carlson
2018-07-13 20:19 ` Jeff King
2018-07-13 23:05 ` brian m. carlson
2018-07-14 0:35 ` [PATCH] sequencer: pass absolute GIT_WORK_TREE to exec commands brian m. carlson
2018-07-14 0:57 ` Jeff King
2018-07-14 17:55 ` brian m. carlson
2018-07-14 18:38 ` [PATCH v2] " brian m. carlson
2018-07-14 21:19 ` Jeff King
2018-07-14 21:05 ` [PATCH] " Johannes Schindelin
2018-07-14 21:09 ` brian m. carlson
2018-07-16 18:14 ` rev-parse --show-toplevel broken during exec'ed rebase? Junio C Hamano
2018-07-16 18:39 ` Jeff King
2018-07-16 21:10 ` Junio C Hamano
2018-07-19 20:28 ` Johannes Schindelin
2018-07-19 22:09 ` SZEDER Gábor
2018-07-19 22:34 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.QRO.7.76.6.1807121657120.75@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=vlovich@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).