aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2024-06-25 23:09:55 +0200
committerJonas Bernoulli <jonas@bernoul.li>2024-06-25 23:09:55 +0200
commit703dfe58120cc5bdf1a1a454362b174a164d3613 (patch)
treeea0e3864c38a555d61b1d6e5c4049d80f0d84996
parentb5aa1afc40ab9573efa0ea42f716baf80e65abe1 (diff)
Remove magit-libgit.el
This is just a proof-of-concept. Until that changes its dead weight that should not be packaged. Removing it from version control is the only way to prevent it from getting packaged anyway.
-rw-r--r--.github/workflows/test.yml2
-rw-r--r--default.mk14
-rw-r--r--lisp/Makefile5
-rw-r--r--lisp/magit-base.el10
-rw-r--r--lisp/magit-core.el9
-rw-r--r--lisp/magit-git.el35
-rw-r--r--lisp/magit-libgit.el81
-rw-r--r--lisp/magit-mode.el9
8 files changed, 7 insertions, 158 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 6f3c7f1..01d105e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,7 +1,5 @@
name: Test
on: [push, pull_request]
-env:
- BUILD_MAGIT_LIBGIT: "false"
jobs:
test:
name: Test
diff --git a/default.mk b/default.mk
index 6a50e28..2c3cc37 100644
--- a/default.mk
+++ b/default.mk
@@ -40,8 +40,6 @@ GITSTATS_DIR ?= $(TOP)docs/stats
GITSTATS_ARGS ?= -c style=https://magit.vc/assets/stats.css \
-c max_authors=180 -c graph_max_authors=7
-BUILD_MAGIT_LIBGIT ?= false
-
## Files #############################################################
PKG = magit
@@ -57,9 +55,6 @@ EPUBFILES = $(addsuffix .epub,$(filter-out git-commit,$(PACKAGES)))
ELS = git-commit.el
ELS += magit-section.el
ELS += magit-base.el
-ifeq "$(BUILD_MAGIT_LIBGIT)" "true"
-ELS += magit-libgit.el
-endif
ELS += magit-git.el
ELS += magit-mode.el
ELS += magit-margin.el
@@ -171,13 +166,6 @@ ifeq "$(DASH_DIR)" ""
DASH_DIR = $(TOP)../dash
endif
-LIBGIT_DIR ?= $(shell \
- find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/libgit-[.0-9]*' 2> /dev/null | \
- sort | tail -n 1)
-ifeq "$(LIBGIT_DIR)" ""
- LIBGIT_DIR = $(TOP)../libgit
-endif
-
SEQ_DIR ?= $(shell \
find -L $(ELPA_DIR) -maxdepth 1 -regex '.*/seq-[.0-9]*' 2> /dev/null | \
sort | tail -n 1)
@@ -218,7 +206,6 @@ LOAD_PATH = -L $(TOP)lisp
ifdef CYGPATH
LOAD_PATH += -L $(shell cygpath --mixed $(COMPAT_DIR))
LOAD_PATH += -L $(shell cygpath --mixed $(DASH_DIR))
- LOAD_PATH += -L $(shell cygpath --mixed $(LIBGIT_DIR))
LOAD_PATH += -L $(shell cygpath --mixed $(SEQ_DIR))
LOAD_PATH += -L $(shell cygpath --mixed $(TRANSIENT_DIR))
LOAD_PATH += -L $(shell cygpath --mixed $(WITH_EDITOR_DIR))
@@ -228,7 +215,6 @@ ifdef CYGPATH
else
LOAD_PATH += -L $(COMPAT_DIR)
LOAD_PATH += -L $(DASH_DIR)
- LOAD_PATH += -L $(LIBGIT_DIR)
LOAD_PATH += -L $(SEQ_DIR)
LOAD_PATH += -L $(TRANSIENT_DIR)
LOAD_PATH += -L $(WITH_EDITOR_DIR)
diff --git a/lisp/Makefile b/lisp/Makefile
index 0f7f52d..9a16e39 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -12,12 +12,7 @@ all: lisp
git-commit.elc:
magit-section.elc:
magit-base.elc: magit-section.elc
-ifeq "$(BUILD_MAGIT_LIBGIT)" "true"
-magit-libgit.elc:
-magit-git.elc: magit-base.elc magit-libgit.elc
-else
magit-git.elc: magit-base.elc
-endif
magit-mode.elc: magit-base.elc magit-git.elc
magit-margin.elc: magit-base.elc magit-mode.elc
magit-process.elc: magit-base.elc magit-git.elc magit-mode.elc
diff --git a/lisp/magit-base.el b/lisp/magit-base.el
index 7c71870..c7bc75c 100644
--- a/lisp/magit-base.el
+++ b/lisp/magit-base.el
@@ -861,16 +861,12 @@ See info node `(magit)Debugging Tools' for more information."
(delete-dups
(cl-mapcan
(lambda (lib)
- (let ((path (locate-library lib)))
- (cond
- (path
- (list (file-name-directory path)))
- ((not (equal lib "libgit"))
- (error "Cannot find mandatory dependency %s" lib)))))
+ (if-let ((path (locate-library lib)))
+ (list (file-name-directory path))
+ (error "Cannot find mandatory dependency %s" lib)))
'(;; Like `LOAD_PATH' in `default.mk'.
"compat"
"dash"
- "libgit"
"transient"
"with-editor"
;; Obviously `magit' itself is needed too.
diff --git a/lisp/magit-core.el b/lisp/magit-core.el
index ff15486..57b08f4 100644
--- a/lisp/magit-core.el
+++ b/lisp/magit-core.el
@@ -37,15 +37,6 @@
(require 'magit-transient)
(require 'magit-autorevert)
-(when (and (not magit-inhibit-libgit)
- (magit--libgit-available-p))
- (condition-case err
- (require 'magit-libgit)
- (error
- (setq magit-inhibit-libgit 'error)
- (message "Error while loading `magit-libgit': %S" err)
- (message "That is not fatal. The `libegit2' module just won't be used."))))
-
;;; Options
(defgroup magit nil
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 16c8b22..d1785d7 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -65,41 +65,6 @@
(cl-pushnew 'orig-rev eieio--known-slot-names)
(cl-pushnew 'number eieio--known-slot-names))
-;;; Git implementations
-
-(defvar magit-inhibit-libgit t
- "Whether to inhibit the use of libgit.
-Use of libgit is inhibited by default because support for libgit
-in magit is only a stub for now. There is no benefit in using
-it.")
-
-(defvar magit--libgit-available-p 'unknown
- "Whether libgit is available.
-Use the function by the same name instead of this variable.")
-
-(defun magit--libgit-available-p ()
- (if (eq magit--libgit-available-p 'unknown)
- (setq magit--libgit-available-p
- (and module-file-suffix
- (let ((libgit (locate-library "libgit")))
- (and libgit
- (or (locate-library "libegit2")
- (let ((load-path
- (cons (expand-file-name
- (convert-standard-filename "build")
- (file-name-directory libgit))
- load-path)))
- (locate-library "libegit2")))))))
- magit--libgit-available-p))
-
-(defun magit-gitimpl ()
- "Return the Git implementation used in this repository."
- (if (and (not magit-inhibit-libgit)
- (not (file-remote-p default-directory))
- (magit--libgit-available-p))
- 'libgit
- 'git))
-
;;; Options
;; For now this is shared between `magit-process' and `magit-git'.
diff --git a/lisp/magit-libgit.el b/lisp/magit-libgit.el
deleted file mode 100644
index 6db1094..0000000
--- a/lisp/magit-libgit.el
+++ /dev/null
@@ -1,81 +0,0 @@
-;;; magit-libgit.el --- (POC) Teach Magit to use Libgit2 -*- lexical-binding:t -*-
-
-;; Copyright (C) 2008-2024 The Magit Project Contributors
-
-;; Author: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
-;; Maintainer: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
-
-;; SPDX-License-Identifier: GPL-3.0-or-later
-
-;; Magit is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published
-;; by the Free Software Foundation, either version 3 of the License,
-;; or (at your option) any later version.
-;;
-;; Magit is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with Magit. If not, see <https://www.gnu.org/licenses/>.
-
-;; You should have received a copy of the AUTHORS.md file, which
-;; lists all contributors. If not, see https://magit.vc/authors.
-
-;;; Commentary:
-
-;; This library is not used by default and it is highly experimental.
-;; It only implements a single method. Do not use this.
-
-;; This library teaches Magit to use functions provided by the
-;; `libegit2' module to perform certain tasks. That module used the
-;; Libgit2 implementation of the Git core methods and is implemented
-;; in the `libgit' package.
-
-;; The hope is that using a C module instead of calling out to `git'
-;; all the time increases performance; especially on Windows where
-;; starting a process is unreasonably slow.
-
-;;; Code:
-
-(require 'cl-lib)
-(require 'compat)
-(require 'dash)
-(require 'eieio)
-(require 'subr-x)
-
-(when (and (featurep 'seq)
- (not (fboundp 'seq-keep)))
- (unload-feature 'seq 'force))
-(require 'seq)
-
-(require 'magit-git)
-
-(require 'libgit)
-
-;;; Utilities
-
-(defun magit-libgit-repo (&optional directory)
- "Return an object for the repository in DIRECTORY.
-If optional DIRECTORY is nil, then use `default-directory'."
- (and-let* ((default-directory
- (let ((magit-inhibit-libgit t))
- (magit-gitdir directory))))
- (magit--with-refresh-cache
- (cons default-directory 'magit-libgit-repo)
- (libgit-repository-open default-directory))))
-
-;;; Methods
-
-(cl-defmethod magit-bare-repo-p
- (&context ((magit-gitimpl) (eql libgit)) &optional noerror)
- (and (magit--assert-default-directory noerror)
- (if-let ((repo (magit-libgit-repo)))
- (libgit-repository-bare-p repo)
- (unless noerror
- (signal 'magit-outside-git-repo default-directory)))))
-
-;;; _
-(provide 'magit-libgit)
-;;; magit-libgit.el ends here
diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index 4c4465e..2547505 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -1412,9 +1412,9 @@ repositories."
"Zap caches for the current repository.
Remove the repository's entry from `magit-repository-local-cache',
-remove the host's entry from `magit--host-git-version-cache', set
-`magit-section-visibility-cache' to nil for all Magit buffers of
-the repository and set `magit--libgit-available-p' to `unknown'.
+remove the host's entry from `magit--host-git-version-cache', and
+set `magit-section-visibility-cache' to nil for all Magit buffers
+of the repository.
With a prefix argument or if optional ALL is non-nil, discard the
mentioned caches completely."
@@ -1438,8 +1438,7 @@ mentioned caches completely."
:key #'car :test #'equal)))
(dolist (buffer (magit-mode-get-buffers))
(with-current-buffer buffer
- (setq magit-section-visibility-cache nil)))))
- (setq magit--libgit-available-p 'unknown))
+ (setq magit-section-visibility-cache nil))))))
;;; Utilities