Commit Graph

27 Commits

Author SHA1 Message Date
Félix Baylac Jacqué e6fe3864e2 Release: 0.5
Fix the short form cloning regression.
2023-01-20 12:05:12 +01:00
Félix Baylac Jacqué 47083f9a74 Bugfix 2: do not clone a repository already downloaded
Second stab at fixing this bug. Except I tool the time to do it in a
non-rushed clean way this time around.

We introduce a properly tested is-clone-url-in-code-root predicate. We
then plug this predicate at the clone call sites instead of wrapping
the interactive command.
2023-01-20 11:53:30 +01:00
Félix Baylac Jacqué fe7c50f5a1 Release: 0.4 2023-01-15 12:03:53 +01:00
Félix Baylac Jacqué ff7ca8d534 bugfix: do not clone twice a git repository
Trying to clone a repository already living in the code root was
leading to a bogus "xxx does not seem to be a valid git repository
URL" error.

We fix this by first resolving the repository path on the local disk
and check whether or not we already cloned it. If that's the case,
open the repository instead of trying to clone it.
2023-01-15 11:50:51 +01:00
Félix Baylac Jacqué 9cde40c311
open-function: add some more docs 2023-01-02 14:05:56 +01:00
Matt Gleeson 04715d88f1 add my-repo-pins-open-function to allow e.g. magit-status 2022-12-31 09:36:07 -06:00
Félix Baylac Jacqué 98e76c2d17
[bugfix] Reformat git command output newlines
The git stdout newline separator is customizable. Sadly for us, it
seems like it uses a carriage return (CR) separator by default. Emacs
won't treat CR as a newline, it needs a CR;LF.

We can configure git to use CR;LF, that being said, we don't want to
modify the user's git configuration here.

Adding a process filter to rewrite the newline separators on the go.
2022-11-27 13:42:37 +01:00
Félix Baylac Jacqué df1b7adc7e [bugfix] Support more clone full URLs
Supporting the git/ssh scheme for fully qualified URLs.

Quoting https://git-scm.com/docs/git-clone#_git_urls:

> The following syntaxes may be used with them:

>   ssh://[user@]host.xz[:port]/path/to/repo.git/
>   git://host.xz[:port]/path/to/repo.git/
>   http[s]://host.xz[:port]/path/to/repo.git/
>   ftp[s]://host.xz[:port]/path/to/repo.git/
>
> An alternative scp-like syntax may also be used with the ssh protocol:
>   [user@]host.xz:path/to/repo.git/
2022-11-15 18:26:15 +01:00
Félix Baylac-Jacqué a768efebba [bugfix] Do not create an empty dir when git clone fails
git clone is creating a destination empty directory before even
attempting to clone the remote URL. It means that if the user-supplied
remote URL happen to be invalid, an empty directory is getting created
at dest, preventing us to try cloning the same repository once again.

We fixed that issue by checking whether the remote git repository
exists using git ls-remote **before** calling git clone.

git ls-remote will fail on a git repository not containing any git
commit. We add a function to the test bed creating a git repo with one
commit. It's a bit hacky, but that's the best setup I could come with.
We embed a dummy git repo to the my-repo-pins codebase and copy it
during the test phase to a tmp workspace.
2022-11-11 10:55:35 +01:00
Marcin S bb8f205bad
Support git worktrees
Simple change that also accepts `.git` *files*, instead of only `.git`
directories, as indicating valid git projects. This is a cheap way (i.e. low
performance cost) to detect git worktree repos.

Closes #11
2022-07-25 20:17:02 +02:00
Félix Baylac-Jacqué 274e116fbd
my-repo-pin: bump to 0.2
Changelog:

- Add the my-repo-pins-max-depth customization variable. This variable
  prevents my repo pins from accidentally recursing too far in the
  code-root directory. Solves a performance issue with git subtrees.
- When cloning a project from a fullly qualified URL, we make sure the
  project does not exists locally first. If it does, we jump to the
  local clone without trying to clone it again.
2022-07-17 16:11:26 +02:00
Félix Baylac-Jacqué 23419e5cc5
my-repo-pins--get-code-root-projects: add max-depth stop gap
We currently discriminate a regular directory from a project by
looking for a .git directory. This heuristics works reasonably well
but isn't perfect. It'll fail for non-git projects, git worktree, etc.

We were recursing through the code root until we reached a project. If
the project detection heuristics fails, we'll recurse way too deep.
This can create some serious performance issues.

We introduce a maximum recursion depth to prevent the tree walker from
recursing too deep. We set this maximum to 2 by default to reflect the
expected <forge>/<user>/<project> scheme.

We expose this maximum depth via a customization variable. If set to
nil, there won't be any limit.

Kudos to Marcin S. aka. m-cat for the help.

Bug report: https://github.com/NinjaTrappeur/my-repo-pins/issues/7
2022-07-17 16:11:15 +02:00
Félix Baylac-Jacqué 14d803aaae
full url git clone: jump to local dir if project already checked out
When cloning a project from a fullly qualified URL, we make sure the
project does not exists locally. If it does, we jump to the local
clone without trying to clone it again.

Fixes https://github.com/NinjaTrappeur/my-repo-pins/issues/9
2022-07-17 16:01:57 +02:00
Félix Baylac-Jacqué d1f9e9fed7
Homepage: point to personal website instead of github 2022-07-11 14:57:00 +02:00
Félix Baylac-Jacqué a5bbf53873
Docstrings: fix typos 2022-07-11 13:42:41 +02:00
Félix Baylac-Jacqué a1cd2892b4
Docstrings: removing trailing parenthesis in examples 2022-07-11 13:41:56 +02:00
Félix Baylac-Jacqué aa9983aa8e
Doc: my-repo-pins.el -> my-repo-pins
Removing the unnecessary ".el" suffix. It was originally here to
disambiguate h.el from the original h project.

We now have a unique name, we don't need this disambiguation anymore.
2022-07-11 13:16:03 +02:00
Félix Baylac-Jacqué f6c9aaa417
Package meta: fix homepage URL
Fixes https://github.com/NinjaTrappeur/my-repo-pins/issues/3
2022-07-11 13:09:44 +02:00
Félix Baylac-Jacqué 01dacd4b01
completing-read-or-custom: fix docstring typo 2022-07-05 10:39:48 +02:00
Félix Baylac-Jacqué 2d0f9d5549
'() => nil
As pointed by the
https://github.com/melpa/melpa/pull/8093#issuecomment-1173207615
comment, '() == nil. Replacing with the more explicit nil form.
2022-07-05 10:38:37 +02:00
Félix Baylac-Jacqué 788049b64d
Remove unnecessary progn calls
As mentionned by riscy in the comment
https://github.com/melpa/melpa/pull/8093#issuecomment-1173207615, you
don't need any progn for let, lambda, defun and when bodies.

Removing the unecessary progn calls, leaving the 4 necessary ones: the
ones wrapping the if/else bodies.
2022-07-05 10:34:43 +02:00
Félix Baylac-Jacqué 26b0373de3
Documentation: remove bogus triple semi-colons
Addressing part of the melpa review comment
https://github.com/melpa/melpa/pull/8093
2022-07-05 10:24:04 +02:00
Félix Baylac-Jacqué b454f29682
Errors: use user-error when relevant
Error can open a edebug instance, which does not make a lot of sense
when the issue clearly comes from the user configuration. Replacing
these occurences with user-error instead.

https://github.com/melpa/melpa/pull/8093#issuecomment-1173207615
2022-07-05 10:12:56 +02:00
Félix Baylac-Jacqué 4f20fc55dc
evil-mode bindings: remove eval-based dirty hack.
We use the declare-function function to declare the evil-local-set-key
function to the bytecode compiler instead.

Massive kudos to riscy for this tip!

Related to the Melpa review comment
https://github.com/melpa/melpa/pull/8093#issuecomment-1173207615
2022-07-05 10:08:27 +02:00
Félix Baylac-Jacqué 9aee11bb38
UI: rename ui buffer
The UI buffer name was clashing with the my repo pins main file,
erasing the main file with the UI. facepalm...
2022-07-05 10:02:57 +02:00
Félix Baylac-Jacqué 001016ebf5
Applying lint rules
Addressing the comments made by a Melpa reviewer at
https://github.com/melpa/melpa/pull/8093#issuecomment-1166628662

Note: it seems like the maintainer use home-growned linter:
https://github.com/riscy/melpazoid/blob/master/melpazoid/melpazoid.el

It's sadly not published on Melpa, meaning I can't use it in the CI
for now (without changing too much the CI setup). Too bad :(
2022-06-27 18:30:15 +02:00
Félix Baylac-Jacqué c058603766
Rename the project
Hinted by the Melpa maintainers here:
https://github.com/melpa/melpa/pull/8093

Using a single letter name was a mistake. Renaming the project to
something a bit more sensible. Maybe not too sensible that being said:
we had to adopt a pun.

Kudos to Wiwi for the pun: it's perfect.
2022-06-27 18:19:25 +02:00
Renamed from h.el (Browse further)