threads / discuss / 5109

Regression: git-commit no longer works from within subdirectories

Subject: Regression: git-commit no longer works from within subdirectories

## tl;dr

4 messages between Aug 3, 2006 and Aug 4, 2006.

replies: 3people: 3as markdown or json

Robert Shearman· Aug 3, 2006, 18:06 UTC · lore
Hi,

In the latest master branch git-commit no longer works from within subdirectories. Instead, you have to go to the top-level directory of the git tree to do the commit.

It fails with a confusing message when you are in a subdirectory: rob@saturn:~/wine-git/dlls/msi$ git commit action.c usage: git-read-tree (<sha> | [[-m [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] <sha1> [<sha2> [<sha3>]])

I'm not sure whether the previous behaviour was intentional, but I got used to it. Either way, I don't think users upgrading from 1.4.1 would appreciate a user-facing change like this in a 0.0.1 incremental release.

Can this be changed back to the previous behaviour?
Thanks,
-- 
Rob Shearman
Junio C Hamano· Aug 3, 2006, 19:05 UTC · re: Robert Shearman · lore

Re: Regression: git-commit no longer works from within subdirectories

Robert Shearman <rob@codeweavers.com> writes:
> In the latest master branch git-commit no longer works from within
> subdirectories. Instead, you have to go to the top-level directory of
> the git tree to do the commit.

This is broken and sorry I did not notice it earlier because I usually run the tip of "next". Will take a look.

Jeff King· Aug 3, 2006, 20:29 UTC · re: Robert Shearman · lore

Re: Regression: git-commit no longer works from within subdirectories

On Thu, Aug 03, 2006 at 07:06:20PM +0100, Robert Shearman wrote:
> It fails with a confusing message when you are in a subdirectory:
> rob@saturn:~/wine-git/dlls/msi$ git commit action.c
> usage: git-read-tree (<sha> | [[-m [--aggressive] | --reset | 
> --prefix=<prefix>] [-u | -i]] <sha1> [<sha2> [<sha3>]])

The culprit is the recent changes to the builtins. cmd_read_tree now takes an extra parameter 'prefix' which shadows the global declaration in builtin-read-tree.c (and has a completely different meaning).

The one-liner below fixes it (though style-wise, you may prefer to rename the shadowed variable).

-Peff
---
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 49c10bf..8e3b04e 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -870,7 +870,7 @@ static const char read_tree_usage[] = "g
 
 static struct lock_file lock_file;
 
-int cmd_read_tree(int argc, const char **argv, const char *prefix)
+int cmd_read_tree(int argc, const char **argv, const char *git_prefix)
 {
        int i, newfd, stage = 0;
        unsigned char sha1[20];
Junio C Hamano· Aug 4, 2006, 04:26 UTC · re: Jeff King · lore

Re: Regression: git-commit no longer works from within subdirectories

Jeff King <peff@peff.net> writes:
> The culprit is the recent changes to the builtins. cmd_read_tree now
> takes an extra parameter 'prefix' which shadows the global declaration
> in builtin-read-tree.c (and has a completely different meaning).

Thanks -- well spotted. And of course "next" does not suffer because the prefix global is gone and is replaced with a member of a structure that is given as a parameter.

← back to recent threads