This repository has been archived by the owner on Aug 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git commits should use the authenticated user's username
- Loading branch information
Erick Tryzelaar
committed
Mar 26, 2014
1 parent
2d2254e
commit 7ff88c6
Showing
2 changed files
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
import org.springframework.core.task.TaskExecutor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.validation.BindingResult; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
@@ -355,6 +357,8 @@ public ResponseEntity<Map<String, Object>> getCurrentBranch(@PathVariable String | |
|
||
@RequestMapping(value = "/projects/{projectId}/current-branch/commit", method = RequestMethod.POST) | ||
public ResponseEntity<Map<String, Object>> commitBranch(@PathVariable String projectId) throws GitAPIException, IOException { | ||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
|
||
Map<String, Object> response = new HashMap<>(); | ||
|
||
MetaGraphTx tx = metaGraphService.newTransaction(); | ||
|
@@ -381,7 +385,7 @@ public ResponseEntity<Map<String, Object>> commitBranch(@PathVariable String pro | |
Git git = historyService.projectGitRepository(projectMetadata); | ||
try { | ||
git.commit() | ||
.setAuthor("user", "[email protected]") | ||
.setAuthor(authentication.getName(), "") | ||
.setMessage("commit") | ||
.call(); | ||
} finally { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ | |
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.validation.BindingResult; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
@@ -118,6 +120,7 @@ public ResponseEntity<byte[]> export(@PathVariable String graphId, | |
public ResponseEntity<Map<String, Object>> save(@PathVariable String graphId, | ||
@Valid GraphExportBean item, | ||
BindingResult result) throws IOException, GitAPIException { | ||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
|
||
Map<String, Object> response = new HashMap<>(); | ||
|
||
|
@@ -180,7 +183,7 @@ public ResponseEntity<Map<String, Object>> save(@PathVariable String graphId, | |
.call(); | ||
|
||
git.commit() | ||
.setAuthor("user", "[email protected]") | ||
.setAuthor(authentication.getName(), "") | ||
.setMessage("commit") | ||
.call(); | ||
} finally { | ||
|