git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-svn: Simplify calculation of GIT_DIR

From
Barry Wardell <barry.wardell@gmail.com>
Date
Mar 3, 2012, 19:45 UTC
Message-ID
<CAHrK+Z9fRQqLSY=3kc+8WkifTy1mJoA5ZFyGjXbdS8SXg9v=9w@mail.gmail.com>
In-Reply-To
<1330799233.691.40.camel@centaur.lab.cmartin.tk>
On Sat, Mar 3, 2012 at 6:27 PM, Carlos Martín Nieto <cmn@elego.de> wrote:
Show 6 quoted lines
>
> > -# make sure we're always running at the top-level working directory
> > +# Access an existing repository
>
> Is there a reason making sure we're at the top-level dir isn't necessary
> anymore?
No, in fact it is still necessary.
Show 20 quoted lines
> >  unless ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {
> > -     unless (-d $ENV{GIT_DIR}) {
> > -             if ($git_dir_user_set) {
> > -                     die "GIT_DIR=$ENV{GIT_DIR} explicitly set, ",
> > -                         "but it is not a directory\n";
> > -             }
> > -             my $git_dir = delete $ENV{GIT_DIR};
> > -             my $cdup = undef;
> > -             git_cmd_try {
> > -                     $cdup = command_oneline(qw/rev-parse --show-cdup/);
> > -                     $git_dir = '.' unless ($cdup);
> > -                     chomp $cdup if ($cdup);
> > -                     $cdup = "." unless ($cdup && length $cdup);
> > -             } "Already at toplevel, but $git_dir not found\n";
> > -             chdir $cdup or die "Unable to chdir up to '$cdup'\n";
>
> Here you delete a chdir to the top-level directory, just as you deleted
> the comment above, yet in the commit message you don't explain why this
> isn't necessary anymore. Doesn't the rest of the code still assume that
> it's running at the top-level dir?
Yes, you're right. I will restore the chdir and submit a new patch.
Barry
Previous: Carlos Martín Nieto
Message 3 of 3 in “git-svn: Simplify calculation of GIT_DIR”
  1. git-svn: Simplify calculation of GIT_DIRBarry Wardell, Mar 3, 2012
  2. Carlos Martín NietoMar 3, 2012
  3. Barry WardellMar 3, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.