Commit graph

96 commits

Author SHA1 Message Date
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
Félix Baylac-Jacqué 8c86c9ae7c
README: document what this project is about 2022-06-24 18:05:53 +02:00
Félix Baylac-Jacqué 2f18545014
h--git-clone-from-forge-result: jump to dir after clone 2022-06-23 09:35:12 +02:00
Félix Baylac-Jacqué 82543d9e02
h--forge-fetchers-state: init all forges state to loading
We introduce the h--init-forges-state function in charge of
initializing the forge state and setting all the forges status to
loading. It prevents the forge names to gradually pop-up during a
forge request and instead display them with their appropriate status.
2022-06-21 08:55:26 +02:00
Félix Baylac-Jacqué af0940261c Make git subprocess async
The synchronous git process call was freezing the whole UI for a
*pretty long* time when checking out a big git repository.

We move into using a asynchronous process. This change required quite
a lot of sync-related changes. Both in the h.el codebase as well as in
the test suite.

On top of making the git call asynchronous, we also take advantage of
not freezing the UI anymore to open a window displaying the git clone
progress.
2022-06-20 21:32:31 +02:00
Félix Baylac-Jacqué 57eb402850
h--pick-relevant-forges: remove function
h--pick-relevant-forges is an artifact of a former architecture.

On top of being some useless code, it was brittle and was preventing
us from cloning a repository from savannah.
2022-06-16 21:00:30 +02:00
Félix Baylac-Jacqué 24596ca098
h-forge-fetchers: add Codeberg.org to the default forge fetchers 2022-06-16 19:04:05 +02:00
Félix Baylac-Jacqué a65c66ff66
forges: introduce Gitea support
We use the Gitea API to determine whether or not a given repo exists.
If it does, we use the API response to properly determine the SSH and
HTTPS clone URLs.
2022-06-16 18:59:45 +02:00
Félix Baylac-Jacqué 95eac63fe9
h-forge-fetchers: add git.sr.ht to the default fetchers 2022-06-16 17:27:56 +02:00