git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add NEED_WORK_TREE for more commands
Date: Sat, 27 Oct 2007 13:42:16 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0710271335190.4362@racer.site> (raw)
In-Reply-To: <20071027081910.GA23381@laptop>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1215 bytes --]

Hi,

On Sat, 27 Oct 2007, Nguyễn Thái Ngọc Duy wrote:

> +		{ "annotate", cmd_annotate, RUN_SETUP | NEED_WORK_TREE },
> +		{ "blame", cmd_blame, RUN_SETUP | NEED_WORK_TREE },

Both can be sensibly run without a work tree: "git blame <commit> <file>"

> +		{ "format-patch", cmd_format_patch, RUN_SETUP | NEED_WORK_TREE },

This can be run without work tree in any case, methinks.  AFAICT 
format-patch only ever uses information from the object database.

> +		{ "ls-files", cmd_ls_files, RUN_SETUP | NEED_WORK_TREE },

That has already been commented on.

> +		{ "reset", cmd_reset, RUN_SETUP | NEED_WORK_TREE },

"git reset --soft HEAD <commit>" makes sense in a bare repository.

> +		{ "update-index", cmd_update_index, RUN_SETUP | NEED_WORK_TREE },

That has been coommented on, too.

I agree that there are modes for these commands (except format-patch), in 
which they want a work-tree, but they have other modes, too, so IMHO it 
should be solved a la 6d9ba67b(Commands requiring a work tree must not run 
in GIT_DIR).  You'll see that ls-files already has some special handling 
here, and this could be refactorised to requires_work_tree(), which should 
make the code much more elegant.

Ciao,
Dscho

      parent reply	other threads:[~2007-10-27 12:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-27  8:19 [PATCH] Add NEED_WORK_TREE for more commands Nguyễn Thái Ngọc Duy
2007-10-27  9:08 ` Mike Hommey
2007-10-27 10:18   ` Nguyen Thai Ngoc Duy
2007-10-27 10:42     ` Mike Hommey
2007-10-27 12:42 ` Johannes Schindelin [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0710271335190.4362@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=pclouds@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.
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 NNTP newsgroup(s).