Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Be explicit about when to allow empty commits. Closes #31.
Browse files Browse the repository at this point in the history
  • Loading branch information
xendk committed Dec 8, 2014
1 parent a852edc commit 81ad8ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 5 additions & 6 deletions bandaid.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function drush_bandaid_apply($project = NULL) {

// Commit local version.
Git::add('.', TRUE);
Git::commit("Committing local.");
Git::commit("Committing local.", TRUE);

// Create a diff to show the user.
$patch = Git::diff($checkout_ref);
Expand Down Expand Up @@ -449,16 +449,15 @@ function drush_bandaid_apply($project = NULL) {
if (Git::apply($project['local_patch_file'])) {
drush_log(dt('Patched with @filename.', array('@filename' => basename($project['local_patch_file']))), 'ok');
unlink($project['local_patch_file']);
// Create a commit we can checkout.
Git::add('.');
Git::commit('Added local patch.');
}
else {
drush_log(dt('Error applying local patch. Please apply it manually.'), 'error');
}
}

// Create a commit we can checkout.
Git::add('.');
Git::commit('Added patches.');

// Check out the unmodified local version to the repo.
Git::checkout($sha);

Expand Down Expand Up @@ -778,7 +777,7 @@ function _bandaid_clone_and_tearoff($project) {
_bandaid_fix_info_files($checkout_dir);

Git::add('.', TRUE);
Git::commit("Committing local.");
Git::commit("Committing local.", TRUE);

// Create local patch.
$patch = Git::diff('bandaid_patch', 'bandaid_local');
Expand Down
5 changes: 3 additions & 2 deletions bandaid.inc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ class Git {
/**
* Commit changes.
*/
public static function commit($message) {
return static::exec('git commit --allow-empty -m %s', array($message), 'CANNOT_COMMIT');
public static function commit($message, $allow_empty = FALSE) {
$allow_empty = $allow_empty ? '--allow-empty' : '';
return static::exec('git commit %s -m %s', array($allow_empty, $message), 'CANNOT_COMMIT');
}

/**
Expand Down

0 comments on commit 81ad8ff

Please sign in to comment.