Skip to contentSkip to conversation

Regression: git-commit no longer works from within subdirectories

DISCUSSION Robert Shearman 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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,

Signature · 1 line
Rob Shearman
#1 lore raw
Quoted 4 lines · Robert Shearman

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

---

builtin-read-tree.c +1 -1
index 49c10bf..8e3b04e 100644
@@ -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];
#2 lore raw
Quoted 3 lines · Jeff King

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.

#3 lore raw
In reply to Robert Shearman
Quoted 3 lines · Robert Shearman

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.