aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/git.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-11-29 13:42:03 -0400
committerJoey Hess <joey@kitenet.net>2010-11-29 13:42:03 -0400
commit170cb0247926d0b7c736e61b2ff66d6a3095f271 (patch)
tree173554ac802671a2d04094229819f31e16fb2241 /IkiWiki/Plugin/git.pm
parenta5120846cb6461616dce4d0042a4fd45211170e4 (diff)
downloadikiwiki-170cb0247926d0b7c736e61b2ff66d6a3095f271.tar
ikiwiki-170cb0247926d0b7c736e61b2ff66d6a3095f271.tar.gz
git: Avoid adding files when committing, so as not to implicitly add files like recentchanges files that are not normally checked in, when fixing links after rename.
Diffstat (limited to 'IkiWiki/Plugin/git.pm')
-rw-r--r--IkiWiki/Plugin/git.pm20
1 files changed, 11 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index 39d88d002..3db4af729 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -496,16 +496,16 @@ sub rcs_commit (@) {
return $conflict if defined $conflict;
}
- rcs_add($params{file});
- return rcs_commit_staged(
- message => $params{message},
- session => $params{session},
- );
+ return rcs_commit_helper(@_);
}
sub rcs_commit_staged (@) {
# Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename.
+ return rcs_commit_helper(@_);
+}
+
+sub rcs_commit_helper (@) {
my %params=@_;
my %env=%ENV;
@@ -546,10 +546,12 @@ sub rcs_commit_staged (@) {
$params{message}.=".";
}
}
- push @opts, '-q';
- # git commit returns non-zero if file has not been really changed.
- # so we should ignore its exit status (hence run_or_non).
- if (run_or_non('git', 'commit', @opts, '-m', $params{message})) {
+ if (exists $params{file}) {
+ push @opts, '--', $params{file};
+ }
+ # git commit returns non-zero if nothing really changed.
+ # So we should ignore its exit status (hence run_or_non).
+ if (run_or_non('git', 'commit', '-m', $params{message}, '-q', @opts)) {
if (length $config{gitorigin_branch}) {
run_or_cry('git', 'push', $config{gitorigin_branch});
}