Commit Diff


commit - c3185bf708050fc668a36aee33e4bf053a34ed82
commit + db89d6fde605ba589cb2ed0cac89b3eceae8b4e8
blob - 54ff57ff255d4a2b02f27a8dbc13576a6cadf969
blob + 65e4b0f046c3533bd75b0fa529185d92066ab742
--- vc-got.el
+++ vc-got.el
@@ -351,6 +351,16 @@ given COMMIT."
   "Integrate BRANCH into the current one."
   (with-temp-buffer
     (zerop (vc-got--call "integrate" branch))))
+
+(defun vc-got--update (branch &optional paths)
+  "Update to a different commit or BRANCH.
+Optionally restrict the update operation to files at or within
+the specified PATHS."
+  (with-temp-buffer
+    (unless (zerop (vc-got--call "update" "-b" branch "--" paths))
+      (error "[vc-got] can't update to branch %s: %s"
+             branch
+             (buffer-string)))))
 
 (defun vc-got--diff (&rest args)
   "Call got diff with ARGS.  The result will be stored in the current buffer."
@@ -839,11 +849,7 @@ true, NAME should create a new branch otherwise it wil
 (defun vc-got-retrieve-tag (dir name _update)
   "Switch to the tag NAME for files at or below DIR."
   (let ((default-directory dir))
-    (with-temp-buffer
-      (unless (zerop (vc-got--call "update" "-b" name "--" dir))
-        (error "[vc-got] can't switch to tag %s: %s"
-               name
-               (buffer-string))))))
+    (vc-got--update name dir)))
 
 
 ;; Miscellaneous