[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [elpa] master 872014e: Prevent accidental deletion of .git
From: |
Stefan Monnier |
Subject: |
Re: [elpa] master 872014e: Prevent accidental deletion of .git |
Date: |
Wed, 18 Nov 2015 10:10:26 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> How about the attached?
Looks like a good start, thank you.
> @@ -207,8 +207,11 @@ (defun archive--process-simple-package (dir pkg vers
> desc req extras)
> "Deploy the contents of DIR into the archive as a simple package.
> Rename DIR/PKG.el to PKG-VERS.el, delete DIR, and return the descriptor."
> ;; Write DIR/foo.el to foo-VERS.el and delete DIR
> - (rename-file (expand-file-name (concat pkg ".el") dir)
> - (concat pkg "-" vers ".el"))
> + (if (file-symlink-p (expand-file-name (concat pkg ".el") dir))
> + (copy-file (expand-file-name (concat pkg ".el") dir)
> + (concat pkg "-" vers ".el"))
> + (rename-file (expand-file-name (concat pkg ".el") dir)
> + (concat pkg "-" vers ".el")))
I'd use
(let ((src (expand-file-name (concat pkg ".el") dir)))
(funcall (if (file-symlink-p src) #'copy-file #'rename-file)
src (concat pkg "-" vers ".el")))
to avoid redundancy.
> (defun archive--core-package-copy-file
> (source dest emacs-repo-root package-root exclude-regexp)
> - "Copy file from SOURCE to DEST ensuring subdirectories."
> + "Link file from SOURCE to DEST ensuring subdirectories."
The function name would need to be correspondingly adjusted ;-)
> - (copy-file absolute-core-file-name absolute-package-file-name))
> + (if (memq system-type '(windows-nt ms-dos))
> + (copy-file absolute-core-file-name absolute-package-file-name)
> + (make-symbolic-link absolute-core-file-name +
> absolute-package-file-name t)))
I don't have a Windows system to test it, but if possible I'd rather
have something like
(if (fboundp 'make-symbolic-link) ...)
or
(condition-case nil
(make-symbolic-link absolute-core-file-name
absolute-package-file-name t)
(<the-error-signalled-by-make-symbolic-link>
(copy-file absolute-core-file-name absolute-package-file-name)))
We'd also want to try and fix the directory-deletion code accordingly,
so it's less trigger happy.
Stefan "who also got caught by this directory deletion code"
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Stefan Monnier, 2015/11/08
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Thomas Fitzsimmons, 2015/11/18
- Re: [elpa] master 872014e: Prevent accidental deletion of .git,
Stefan Monnier <=
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Stephen Leake, 2015/11/18
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Eli Zaretskii, 2015/11/18
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Thomas Fitzsimmons, 2015/11/25
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Stefan Monnier, 2015/11/25
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Thomas Fitzsimmons, 2015/11/26
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Stefan Monnier, 2015/11/26
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Thomas Fitzsimmons, 2015/11/27
- Re: [elpa] master 872014e: Prevent accidental deletion of .git, Stefan Monnier, 2015/11/27