|
1 | 1 | # git-gui misc. commit reading/writing support
|
2 | 2 | # Copyright (C) 2006, 2007 Shawn Pearce
|
3 | 3 |
|
| 4 | +set author_name "" |
| 5 | +set author_email "" |
| 6 | +set author_date "" |
| 7 | + |
4 | 8 | proc load_last_commit {} {
|
5 | 9 | global HEAD PARENT MERGE_HEAD commit_type ui_comm
|
| 10 | + global author_name author_email author_date |
6 | 11 | global repo_config
|
7 | 12 |
|
8 | 13 | if {[llength $PARENT] == 0} {
|
@@ -34,6 +39,10 @@ You are currently in the middle of a merge that has not been fully completed. Y
|
34 | 39 | lappend parents [string range $line 7 end]
|
35 | 40 | } elseif {[string match {encoding *} $line]} {
|
36 | 41 | set enc [string tolower [string range $line 9 end]]
|
| 42 | + } elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} { |
| 43 | + set author_name $name |
| 44 | + set author_email $email |
| 45 | + set author_date $time |
37 | 46 | }
|
38 | 47 | }
|
39 | 48 | set msg [read $fd]
|
@@ -107,8 +116,12 @@ proc do_signoff {} {
|
107 | 116 |
|
108 | 117 | proc create_new_commit {} {
|
109 | 118 | global commit_type ui_comm
|
| 119 | + global author_name author_email author_date |
110 | 120 |
|
111 | 121 | set commit_type normal
|
| 122 | + set author_name "" |
| 123 | + set author_email "" |
| 124 | + set author_date "" |
112 | 125 | $ui_comm delete 0.0 end
|
113 | 126 | $ui_comm edit reset
|
114 | 127 | $ui_comm edit modified false
|
@@ -327,6 +340,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
|
327 | 340 | global ui_comm selected_commit_type
|
328 | 341 | global file_states selected_paths rescan_active
|
329 | 342 | global repo_config
|
| 343 | + global env author_name author_email author_date |
330 | 344 |
|
331 | 345 | gets $fd_wt tree_id
|
332 | 346 | if {[catch {close $fd_wt} err]} {
|
@@ -366,6 +380,11 @@ A rescan will be automatically started now.
|
366 | 380 | }
|
367 | 381 | }
|
368 | 382 |
|
| 383 | + if {$author_name ne ""} { |
| 384 | + set env(GIT_AUTHOR_NAME) $author_name |
| 385 | + set env(GIT_AUTHOR_EMAIL) $author_email |
| 386 | + set env(GIT_AUTHOR_DATE) $author_date |
| 387 | + } |
369 | 388 | # -- Create the commit.
|
370 | 389 | #
|
371 | 390 | set cmd [list commit-tree $tree_id]
|
|
0 commit comments