git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: marc PINHEDE <marc.pinhede@gmail.com>
To: git@vger.kernel.org
Subject: Git stash (or git rev-parse) doesn't inherit the '--work-tree' parameter
Date: Thu, 30 Nov 2017 17:02:10 +1000	[thread overview]
Message-ID: <CAJsT1ck6dCPLLMLjgq9jrQmOAC-6jF6kFEX6aaRJGw3Hn9He=w@mail.gmail.com> (raw)

Hello guys,

I don't know if this is a normal behavior, so I'll just explain it here.

* Behavior:

from a directory OUTSIDE my git repo, I can run this command successfully:
 $ git --git-dir=/my/repo/path/.git --work-tree=/my/repo/path pull origin master

But this one:
 $ git --git-dir=/my/repo/path/.git --work-tree=/my/repo/path stash
Will fails with :
 'fatal: $program_name cannot be used without a working tree.'
(Yes, the error message has been corrected since, but I use debian, so
I'm at least 6 month late).

* A bit of investigation:
I don't know many about git internal functioning, but with a bit of
googleing, I would point out git-sh-setup.sh:204, in function
require_work_tree, called by git-stash.
I could test (from outside my git repo, again):
 git --git-dir=/my/repo/path/.git --work-tree=/my/repo/path rev-parse
--is-inside-work-tree
return:
 false

What surprise me is that 'git-dir' seems to be passed ok to rev-parse:
 git --git-dir=/my/repo/path/.git --work-tree=/my/repo/path rev-parse --git-dir
returns:
 /my/repo/path/.git

* Question
Is this a normal behavior? Stash can only be applied in current
working directory?
If yes, I'll have to change my script to
 (cd && git command)
If not, should I push a bug report somewhere?

Marc

             reply	other threads:[~2017-11-30  7:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30  7:02 marc PINHEDE [this message]
2017-12-04 10:55 ` Git stash (or git rev-parse) doesn't inherit the '--work-tree' parameter Jacob Keller

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='CAJsT1ck6dCPLLMLjgq9jrQmOAC-6jF6kFEX6aaRJGw3Hn9He=w@mail.gmail.com' \
    --to=marc.pinhede@gmail.com \
    --cc=git@vger.kernel.org \
    /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).