[elpa] master 31220f1 3/3: * .travis.yml: Add recipes to test for Emacs 25.3 and Emacs 26.2

2019-07-30 Thread Tino Calancha
branch: master
commit 31220f15ca19e455b7e5c4b8d1591e2d844e5d96
Author: Tino Calancha 
Commit: Tino Calancha 

* .travis.yml: Add recipes to test for Emacs 25.3 and Emacs 26.2
---
 packages/gited/.travis.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/packages/gited/.travis.yml b/packages/gited/.travis.yml
index 8f189c2..16553cf 100644
--- a/packages/gited/.travis.yml
+++ b/packages/gited/.travis.yml
@@ -9,6 +9,8 @@ env:
 # - EVM_EMACS=emacs-24.3-travis # advice-add requires >= 24.4
   - EVM_EMACS=emacs-24.4-travis
   - EVM_EMACS=emacs-24.5-travis
+  - EVM_EMACS=emacs-25.3-travis
+  - EVM_EMACS=emacs-26.2-travis
   - EVM_EMACS=emacs-git-snapshot-travis
 
 before_install:



[elpa] master 1a92768 2/3: Separate versions from file names with --

2019-07-30 Thread Tino Calancha
branch: master
commit 1a927685dcb546c27b0e119dc33bccd55147e56a
Author: Tino Calancha 
Commit: Tino Calancha 

Separate versions from file names with --

Bump version to v0.5.4
* packages/gited/gited.el (gited-diff):
Add separator (--) after versions.

* packages/gited/gited-tests.el (gited-diff-test): Add test.
---
 packages/gited/gited-tests.el | 14 ++
 packages/gited/gited.el   |  5 ++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/packages/gited/gited-tests.el b/packages/gited/gited-tests.el
index e72e32e..fff6de5 100644
--- a/packages/gited/gited-tests.el
+++ b/packages/gited/gited-tests.el
@@ -198,6 +198,20 @@ Return the last evaled BODY form."
   (delete-directory dir1 'recursive)
   (delete-directory dir2 'recursive
 
+(ert-deftest gited-diff-test ()
+  "Test for `gited-diff'.
+Create a repository with 2 identical branches, `master' and `foo'.
+Each branch contains just one file `foo'.  Since this file has same name as one
+of the branches, then we must add '--' after the versions.
+For example, the Git command to get the diff between the 2 branches is as 
follows:
+git diff master foo --."
+  (skip-unless (executable-find vc-git-program))
+  (let ((dir (make-temp-file "gited" 'dir))
+(inhibit-message t))
+(with-gited-repo dir
+  (gited-copy-branch "master" gited-initial-filename)
+  (with-specified-completion-branch gited-initial-filename
+(should-not (gited-diff "master"))
 
 (provide 'gited-tests)
 ;;; gited-tests.el ends here
diff --git a/packages/gited/gited.el b/packages/gited/gited.el
index 5900c7a..283e5cb 100644
--- a/packages/gited/gited.el
+++ b/packages/gited/gited.el
@@ -12,7 +12,7 @@
 ;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
 ;; Last-Updated: Tue Jul 30 18:28:26 CEST 2019
 ;;   By: calancha
-;; Update #: 697
+;; Update #: 698
 
 ;;
 ;;
@@ -1974,8 +1974,7 @@ diff OLD-REF REF."
 (with-current-buffer buf
   (let ((inhibit-read-only t))
 (erase-buffer)
-(gited-git-command `("diff" ,old-ref ,ref)
-   (current-buffer)))
+(gited-git-command `("diff" ,old-ref ,ref "--") (current-buffer)))
   (display-buffer buf))
 (gited--set-output-buffer-mode buf 'diff)))
 



[elpa] master 2393f3a 1/3: Avoid side-effects in a couple of functions

2019-07-30 Thread Tino Calancha
branch: master
commit 2393f3a7d17eb3ebe674127821925c60547d1bcb
Author: Tino Calancha 
Commit: Tino Calancha 

Avoid side-effects in a couple of functions

Fixes a long-standing issue.
See Emacs Prince analysis of the Bug and John Wick's fix here:
https://youtu.be/nVLeQoBeNL8

* packages/gited/gited.el (gited--handle-new-or-delete-files)
(gited-add-patched-files):
Avoid unsafe `nconc' usage, i.e. quoted constant list as a non-last
argument.

* packages/gited/gited-tests.el (gited-test-add-patch-bug):
Add test.  Clean previous tests by adding helper some functions/variables.
---
 packages/gited/gited-tests.el | 216 +++---
 packages/gited/gited.el   |  10 +-
 2 files changed, 146 insertions(+), 80 deletions(-)

diff --git a/packages/gited/gited-tests.el b/packages/gited/gited-tests.el
index 89c549c..e72e32e 100644
--- a/packages/gited/gited-tests.el
+++ b/packages/gited/gited-tests.el
@@ -1,6 +1,6 @@
 ;;; gited-tests.el --- Tests for gited.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha ,
 ;; Keywords:
@@ -30,77 +30,117 @@
 (require 'gited)
 (eval-when-compile (require 'cl-lib))
 
+;; Settings for a test repository.
+(defvar gited-user-name "John Doe")
+(defvar gited-user-email "john@example.com")
+(defvar gited-initial-commit-msg "Initialize repository.")
+(defvar gited-initial-filename "foo")
+(defvar gited-initial-file-content "Test file")
+
+(defvar gited-remote-repo "https://github.com/calancha/foo";)
+(defvar gited-remote-repo-branch "fail-say-foo-test")
+(defvar gited-remote-repo-file "do_not_delete.el")
+
+(defun gited-create-new-repo (dir)
+  "Create a new repository at DIR and return its gited buffer."
+  (let ((inhibit-message t))
+(write-region gited-initial-file-content
+  nil
+  (expand-file-name gited-initial-filename dir))
+(dired dir)
+(gited-git-command '("init"))
+(gited-git-command `("config" "user.email" ,gited-user-email))
+(gited-git-command `("config" "user.name" ,gited-user-name))
+(gited-git-command `("add" ,gited-initial-filename))
+(gited-git-command `("commit" "-m" ,gited-initial-commit-msg))
+(gited-list-branches "local")
+gited-buffer))
+
+(defmacro with-gited-repo (dir &rest body)
+  "Create a new Git repository at DIR and evaluate BODY.
+The repository consists of just one file with content
+`gited-initial-file-content'.
+The forms in BODY are evaluated with DIR as `default-directory'."
+  (declare (indent 1) (debug (form body)))
+  `(let* ((gited-expert t)
+  (inhibit-message t))
+ (unwind-protect
+ (progn
+   (gited-create-new-repo ,dir)
+   ,@body)
+   (delete-directory ,dir 'recursive
+
+(defmacro with-specified-completion-branch (branch &rest body)
+  "Fix branch completions to BRANCH and evaluate BODY.
+This macro uses `cl-letf' to temporary fix the completions.
+Return the last evaled BODY form."
+  (declare (indent 1) (debug (form body)))
+  `(cl-letf (((symbol-function 'completing-read)
+  (lambda (&rest _) ,branch)))
+ ,@body))
+
 (ert-deftest gited-test1 ()
   (skip-unless (executable-find vc-git-program))
-  (let* ((dir (make-temp-file "gited" 'dir))
- (file (expand-file-name "foo" dir))
- (gited-expert t)
- (inhibit-message t)
- dired-buf)
-(unwind-protect
-(let ((str "Initialize repository."))
-  (write-region "Test file" nil file)
- (setq dired-buf (dired dir))
-  (gited-git-command '("init"))
- (gited-git-command '("config" "user.email" 
"john@example.com"))
- (gited-git-command '("config" "user.name" "John Doe"))
-  (gited-git-command '("add" "foo"))
-  (gited-git-command `("commit" "-m" ,str))
-  (gited-list-branches "local")
-  (should (gited-dir-under-Git-control-p))
-  (should (gited-buffer-p))
-  (should (equal str (gited--last-commit-title)))
-  (should (equal "master" (gited-current-branch)))
-  (should-not (gited-branch-exists-p "foo"))
-  (gited-copy-branch "master" "foo")
-  (should (gited-branch-exists-p "foo"))
-  (gited-toggle-marks)
-  (should (= 2 (gited-number-marked)))
+  (let ((dir (make-temp-file "gited" 'dir)))
+(with-gited-repo dir
+  (progn
+(should (gited-dir-under-Git-control-p))
+(should (gited-buffer-p))
+(should (equal gited-initial-commit-msg (gited--last-commit-title)))
+(should (equal "master" (gited-current-branch)))
+;; Only master branch do exist
+(should-not (gited-branch-exists-p gited-initial-filename))
+;; Create a new branch (copy of master)
+(gited-copy-branch "master" gited-initial-filename)
+(should (gite

[elpa] master updated (db4d0fb -> 31220f1)

2019-07-30 Thread Tino Calancha
calancha pushed a change to branch master.

  from  db4d0fb   Add an autoload cookie to adjust-parens
   new  2393f3a   Avoid side-effects in a couple of functions
   new  1a92768   Separate versions from file names with --
   new  31220f1   * .travis.yml: Add recipes to test for Emacs 25.3 and 
Emacs 26.2


Summary of changes:
 packages/gited/.travis.yml|   2 +
 packages/gited/gited-tests.el | 230 --
 packages/gited/gited.el   |  13 ++-
 3 files changed, 163 insertions(+), 82 deletions(-)