Re: [PATCH] Add NEED_WORK_TREE for more commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux