Commit Graph

104 Commits

Author SHA1 Message Date
Félix Baylac Jacqué de3e4baffd CI: add 28.2 and release-snaphot (29) targets. 2023-03-02 19:57:28 +01:00
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
Ninjatrappeur 765629e4c6
Merge pull request #20 from mattgleeson/custom-open 2023-01-02 14:08:59 +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
Ninjatrappeur 6ed7d45cec
Merge pull request #18 from NinjaTrappeur/nin/fix-git-formatting 2022-11-27 13:49:10 +01: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é 4866b1d1ef Add ert-async dependency to test package 2022-11-16 18:38:31 +01:00
Ninjatrappeur e6d7d6c21c
Merge pull request #16 from NinjaTrappeur/nin/fix-clone-url-parsing
[bugfix] Support more clone full URLs
2022-11-15 18:29:32 +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
Ninjatrappeur 98500ddde2
Merge pull request #15 from NinjaTrappeur/nin/do-not-create-dir-on-failure
[bugfix] Do not create an empty dir when git clone fails
2022-11-11 11:20:53 +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
Ninjatrappeur f460f17c52
Merge pull request #12 from m-cat/support-git-worktrees 2022-07-26 10:13:43 +02: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
Ninjatrappeur 3a85c415b2
Merge pull request #8 from NinjaTrappeur/nin/limit-recursion 2022-07-17 16:16:49 +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
Ninjatrappeur 939a4dfd1c
Merge pull request #10 from NinjaTrappeur/nin/fix-full-url-jump 2022-07-17 16:08:53 +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
Ninjatrappeur 6ba6054165
Merge pull request #6 from miangraham/master
readme: Fix require in Quick Start
2022-07-12 06:52:43 +02:00
M. Ian Graham 9f56f50601
readme: Fix require in Quick Start 2022-07-12 12:19:00 +09:00
Ninjatrappeur 9e7ff9c243
Merge pull request #5 from NinjaTrappeur/nin-move-homepage 2022-07-11 15:00:00 +02:00
Félix Baylac-Jacqué d1f9e9fed7
Homepage: point to personal website instead of github 2022-07-11 14:57:00 +02:00
Ninjatrappeur 636caf953f
Merge pull request #4 from NinjaTrappeur/nin/fix-homepage-url 2022-07-11 13:45:20 +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é 42b9cef601
Readme: add install instructions 2022-07-11 13:31:04 +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é cff21c3fcb Readme: rethink catch phrase.
Kudos to Jonas for the help.
2022-07-03 22:29:31 +02:00
Félix Baylac-Jacqué f86167cf2d
Merge branch 'nin/rename-project' 2022-06-27 18:46:32 +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
Ninjatrappeur d4de753259
Merge pull request #2 from NinjaTrappeur/nin/rename-project
Rename the project
2022-06-27 18:24:54 +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
Félix Baylac-Jacqué 1030d83f26
h--tests-init-fake-git-repo: remove useless exit-code 2022-06-24 19:09:34 +02:00
Félix Baylac-Jacqué 9b953a7faa
Package summary: shortening it >60 chars 2022-06-24 19:08:55 +02:00
Félix Baylac-Jacqué 5d1568fe85
h--call-git-in-dir: guard callback call in case of absent callback 2022-06-24 19:03:34 +02:00
Félix Baylac-Jacqué 3cb5c5e2d3
Readme: add absolute clone demo 2022-06-24 18:56:37 +02:00
Félix Baylac-Jacqué abae82205a
Emacs Package Metadata: Tidy everything before release 2022-06-24 18:50:03 +02:00
Félix Baylac-Jacqué c235160136
h--call-git-in-dir: funcall the callback even in case of failure
We had a bug when git was exiting with a strange error code. We were
ending up with a event in the form of:

    exited abnormally with code 128

I'm not sure how to properly handle these events. I fixed this error
by calling the callback regardless of the event. It might backfire in
the future though: in some cases, a process can trigger a event
without exiting according to the manual. In that case, we'll end up
calling the callback with nil as exit code. I'm not 100% sure h.el
will handle that gracefully.

That being said, I never encountered this use case so far. I guess
it'll be a problem for future me to solve!
2022-06-24 18:07:05 +02:00