From ae6af58304a372151b3e982cc40bffb0def17057 Mon Sep 17 00:00:00 2001 From: David Caldwell Date: Wed, 2 May 2012 12:14:38 -0700 Subject: [PATCH] [commit-patch] Use --relative with "git diff" so that commit-partial doesn't silently fail when you in a subdirectory. "git apply" seems to filter the diff so that only files within the current directory (and its descendants) get applied. It (crazily) does this silently and there doesn't seem to be an option to override this. The other option would be to cd to the project root just before calling "git apply" but I think it's more intuitive to diff from your current directory--just cd to the root yourself if you want to see the whole project's changes. --- commit-patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit-patch b/commit-patch index cdd36f9..3928e3e 100755 --- a/commit-patch +++ b/commit-patch @@ -103,7 +103,7 @@ while (!$vc{name}) { chdir $repo; # otherwise commit-partial from within a project subdir fails. } elsif (-d "$repo/.git") { %vc = (name => 'git', - diff => 'git diff', + diff => 'git diff --relative', # Use --relative here because "git diff | git apply --cached" fails to apply hunks from files not in your current dir tree commit => 'git commit', amend => 'git commit --amend', message => sub { ('-m', $_[0]) }, -- 2.51.2