Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2010-06-12 20:05:12 +0400
committerJunio C Hamano <gitster@pobox.com>2010-06-13 20:42:38 +0400
commit643cb5f7c99e77a4a3e97213dd226a7dc2650c02 (patch)
tree9eaf300ca31ad8b4a382e8990843c68bbf144b1f /builtin
parent0d4dbcd35e89a549055e34daf410e4579571b984 (diff)
commit: use value of GIT_REFLOG_ACTION env variable as reflog message
The environment variable GIT_REFLOG_ACTION was used by git-commit.sh, but when it was converted to a builtin (f5bbc3225c4b073a7ff3218164a0c820299bc9c6, Port git commit to C, Nov 8 2007) this was lost. Let's use it again as it is more user friendly when reverting or cherry-picking to see "revert" or "cherry-pick" in the reflog rather than to just see "commit". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index c5ab683d5b..58bad61306 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1232,13 +1232,16 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
}
/* Determine parents */
+ reflog_msg = getenv("GIT_REFLOG_ACTION");
if (initial_commit) {
- reflog_msg = "commit (initial)";
+ if (!reflog_msg)
+ reflog_msg = "commit (initial)";
} else if (amend) {
struct commit_list *c;
struct commit *commit;
- reflog_msg = "commit (amend)";
+ if (!reflog_msg)
+ reflog_msg = "commit (amend)";
commit = lookup_commit(head_sha1);
if (!commit || parse_commit(commit))
die("could not parse HEAD commit");
@@ -1249,7 +1252,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
struct strbuf m = STRBUF_INIT;
FILE *fp;
- reflog_msg = "commit (merge)";
+ if (!reflog_msg)
+ reflog_msg = "commit (merge)";
pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
fp = fopen(git_path("MERGE_HEAD"), "r");
if (fp == NULL)
@@ -1272,7 +1276,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
if (allow_fast_forward)
parents = reduce_heads(parents);
} else {
- reflog_msg = "commit";
+ if (!reflog_msg)
+ reflog_msg = "commit";
pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
}