stevenharman / git_tracker

Some simple tricks that make working with Pivotal Tracker even better... and easier... um, besier!
https://github.com/stevenharman/git_tracker
MIT License
170 stars 11 forks source link

git merge --no-ff <branch> prompts to edit commit message #4

Closed alindeman closed 12 years ago

alindeman commented 12 years ago

Without git_tracker and under a no conflict scenario, git merge --no-ff <branch> will not prompt for a commit message. With git_tracker, $EDITOR is always started and prompts for a commit message.

stevenharman commented 12 years ago

My gut tells me that git_tracker is modifying the .git/EDIT_COMMIT_MSG file which in turn causes git to fire up the $EDITOR. Likely, git_tracker should NO-OP when source is merge. See: http://book.git-scm.com/5_git_hooks.html

stevenharman commented 12 years ago

@alindeman I'm having trouble recreating this. Perhaps the issue was fixed by some changes I've made recently to fix a few other issues?

Can you try with the latest version, 1.2.0+, and see if its still happening? Hit me up in iChat the next time this thing bites you and we'll troubleshoot it together!

alindeman commented 12 years ago

Well, shiiiiittt. Not a bug in git_tracker, it's a change in git 1.7.10.

From the release notes:

 * From this release on, the "git merge" command in an interactive
   session will start an editor when it automatically resolves the
   merge for the user to explain the resulting commit, just like the
   "git commit" command does when it wasn't given a commit message.

   If you have a script that runs "git merge" and keeps its standard
   input and output attached to the user's terminal, and if you do not
   want the user to explain the resulting merge commits, you can
   export GIT_MERGE_AUTOEDIT environment variable set to "no", like
   this:

    #!/bin/sh
    GIT_MERGE_AUTOEDIT=no
    export GIT_MERGE_AUTOEDIT

   to disable this behavior (if you want your users to explain their
   merge commits, you do not have to do anything).  Alternatively, you
   can give the "--no-edit" option to individual invocations of the
   "git merge" command if you know everybody who uses your script has
   Git v1.7.8 or newer.

Sorry for the bug report; it must have coincided with me upgrading git. I will probably be setting that environment variable, as modifying merge commit messages doesn't seem that useful to my current workflow.