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

4 messages from 2006-08-03 to 2006-08-04. Participants: Robert Shearman, Junio C Hamano, Jeff King.
Thread: https://gitlist.dev/t/5109

## Robert Shearman, 2006-08-03 18:06

Subject: Regression: git-commit no longer works from within subdirectories
Message-ID: <44D23B1C.80704@codeweavers.com>
URL: https://gitlist.dev/e/44D23B1C.80704%40codeweavers.com

```
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, 2006-08-03 19:05

Subject: Re: Regression: git-commit no longer works from within subdirectories
Message-ID: <7vzmelprm8.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vzmelprm8.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <44D23B1C.80704@codeweavers.com>

```
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, 2006-08-03 20:29

Subject: Re: Regression: git-commit no longer works from within subdirectories
Message-ID: <20060803202957.GA26838@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20060803202957.GA26838%40coredump.intra.peff.net
In-Reply-To: <44D23B1C.80704@codeweavers.com>

```
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, 2006-08-04 04:26

Subject: Re: Regression: git-commit no longer works from within subdirectories
Message-ID: <7vy7u5nn1q.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vy7u5nn1q.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060803202957.GA26838@coredump.intra.peff.net>

```
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.

```
