jacebrowning / jacebrowning/gitman

Support creating hard links (in additional to symlinks)

Open
#301 7 comments 0 reactions 0 assignees View on GitHub
feature help wanted
Dominant language
Python
Stars
225
Forks
36
Avg merge
15h 47m
Merged PRs (30d)
8

Description

With for example, gitman.yml:

```
location: vendor/gitman
sources:
- repo: https://github.com/jacebrowning/gitman.git
name: gitman
rev: main
type: git
links:
- source: doc
target: vendor/doc/gitman
```

And .gitignore:
```
vendor/gitman
```

`vendor/doc/gitman` will be a symlink, and content in `vendor/gitman` will be ignored.

For my project I want to keep copies of the libraries I use, and since git does not follow symlinks the approach above does not work.

I could of course remove the entry in .gitignore, but then I get a lot of unneeded resources.

Hard links seem to be the way to resolve this. Suggested implementation, gitman.yml:

```
location: vendor/gitman
sources:
- repo: https://github.com/jacebrowning/gitman.git
name: gitman
rev: main
type: git
hardlinks:
- source: doc
target: vendor/doc/gitman
```

`vendor/doc/gitman` would be a regular directory, each file inside would be a hardlink, and any nesting directory would be recreated with the same name as a directory (not symlink). Like a copy (cp -r) but the files are hard linked instead of copies.

Of course hard links has some limitations, has to be on same file system for instance. So an option to fallback to a copy would perhaps required.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing handling for the `links` entries in `gitman.yml` and the command entry point that creates symlinks. Define how the proposed `hardlinks` entries should recreate directories, handle cross-filesystem failures, and optionally fall back to copying; done means the configured files are linked as regular files while existing symlink behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
cli, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.