diff --git a/README.md b/README.md index 68b00cb..5437b94 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ **Based on https://github.com/git-time-metric/gtm** -
GTM Logo
-
Git Time Metric
+ +

+ logo +

### Seamless time tracking for all your Git projects ![Release](https://github.com/DEVELOPEST/gtm-core/workflows/Release/badge.svg?branch=master) @@ -20,7 +22,7 @@ See wiki: https://github.com/DEVELOPEST/gtm-core/wiki/Installation GTM is automatic, seamless and lightweight. There is no need to remember to start and stop timers. It runs on occasion to capture activity triggered by your editor. The time metrics are stored locally with the git repository as [Git notes](https://git-scm.com/docs/git-notes) and can be pushed to the remote repository. -###
Plugins
+### Plugins Simply install a plugin for your favorite editor and the GTM command line utility to start tracking your time now. @@ -45,7 +47,7 @@ Git Time Metric initialized for /my/project/dir ### Edit some files in your project -Check your progress with `gtm status`. +Check your progress with `gtm status`.
$ gtm status
 
@@ -84,14 +86,15 @@ For help from the command line type `gtm --help` and `gtm  --help`.
 For additional help please consult the [Wiki](https://github.com/DEVELOPEST/gtm-core/wiki).
 
 # Contributing
-If you find a bug or have an idea for a new feature please feel free to file new issues and submits PRs.  In particular if there isn't a plugin for your favorite editor, go ahead and create one!
+If you find a bug or have an idea for a new feature please feel free to file new issues and submits PRs.  
+In a particular if there isn't a plugin for your favorite editor, go ahead and create one!
 
 For more detail on how to write plugins, check out the [Wiki](https://github.com/DEVELOPEST/gtm-core/wiki/Editor-Plugins).
 
 # Building from source
 
 ### Install go
-You can follow any go installation tutorial, one for ubuntu for example: https://medium.com/golang-basics/installing-go-on-ubuntu-b443a8f0eb55
+You can follow any go installation tutorial, one for Ubuntu for example: https://medium.com/golang-basics/installing-go-on-ubuntu-b443a8f0eb55
 
 ### Install apt dependencies
 ```bash
@@ -103,7 +106,7 @@ sudo apt-get install libgit2-dev libssh2-1-dev libssl-dev cmake
 git clone https://github.com/DEVELOPEST/gtm-core.git
 mv gtm-core $GOPATH/src/github.com/DEVELOPEST/
 cd $GOPATH/src/github.com/DEVELOPEST/gtm-core
-git submodule update --init # Install vendor dependecies
+git submodule update --init  # Install vendor dependecies
 ```
 
 ### Install dependencies
@@ -111,7 +114,7 @@ git submodule update --init # Install vendor dependecies
 go get -d github.com/Masterminds/sprig
 go get -d github.com/libgit2/git2go
 cd $GOPATH/src/github.com/libgit2/git2go
-git submodule update --init # get libgit2
+git submodule update --init  # get libgit2
 cd vendor/libgit2
 mkdir build && cd build
 cmake ..
diff --git a/project/project.go b/project/project.go
index 9a71d49..2d8f315 100644
--- a/project/project.go
+++ b/project/project.go
@@ -39,12 +39,14 @@ var (
 			RE:      regexp.MustCompile(`(?s)[/:a-zA-Z0-9$_=()"\.\|\-\\ ]*gtm(.exe"|)\s+commit\s+--yes\.*`),
 		},
 	}
-	// GitConfig is map of git configuration settingsx
+	// GitConfig is map of git configuration settings
 	GitConfig = map[string]string{
-		"alias.pushgtm":     "push origin refs/notes/gtm-data",
-		"alias.fetchgtm":    "fetch origin refs/notes/gtm-data:refs/notes/gtm-data",
-		"notes.rewriteRef":  "refs/notes/gtm-data",
-		"notes.rewriteMode": "concatenate"}
+		"alias.pushgtm":        "push origin refs/notes/gtm-data",
+		"alias.fetchgtm":       "fetch origin refs/notes/gtm-data:refs/notes/gtm-data",
+		"notes.rewriteRef":     "refs/notes/gtm-data",
+		"notes.rewriteMode":    "concatenate",
+		"notes.rewrite.rebase": "true",
+		"notes.rewrite.amend":  "true"}
 	// GitIgnore is file ignore to apply to git repo
 	GitIgnore = "/.gtm/"
 
diff --git a/readme/logo.svg b/readme/logo.svg
new file mode 100644
index 0000000..8251405
--- /dev/null
+++ b/readme/logo.svg
@@ -0,0 +1,171 @@
+
+
+  
+    
+      
+    
+    
+      
+    
+    
+      
+      
+    
+  
+  
+    
+    
+    
+    
+  
+  
+    
+      
+        image/svg+xml
+        
+        
+      
+    
+  
+  
+    
+    
+    
+    
+    GTM
+  
+
diff --git a/scm/git.go b/scm/git.go
index 7e03bea..fa4b55d 100644
--- a/scm/git.go
+++ b/scm/git.go
@@ -461,8 +461,9 @@ func CreateNote(noteTxt string, nameSpace string, wd ...string) error {
 	defer util.Profile()()
 
 	var (
-		repo *git.Repository
-		err  error
+		repo     *git.Repository
+		err      error
+		prevNote *git.Note
 	)
 
 	if len(wd) > 0 {
@@ -486,6 +487,23 @@ func CreateNote(noteTxt string, nameSpace string, wd ...string) error {
 		When:  headCommit.Author().When,
 	}
 
+	prevNote, err = repo.Notes.Read("refs/notes/"+nameSpace, headCommit.Id())
+
+	if prevNote != nil {
+		noteTxt += "\n" + prevNote.Message()
+		if err := repo.Notes.Remove(
+			"refs/notes/"+nameSpace,
+			prevNote.Author(),
+			prevNote.Committer(),
+			headCommit.Id()); err != nil {
+			return err
+		}
+
+		if err := prevNote.Free(); err != nil {
+			return err
+		}
+	}
+
 	_, err = repo.Notes.Create("refs/notes/"+nameSpace, sig, sig, headCommit.Id(), noteTxt, false)
 
 	return err