gajus / gajus/gitdown

Crashes on new branch

Open
#57 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
450
Forks
50
PR merge metrics
No merged PRs in 30d

Description

When creating a new branch, which consequently has no remote branch, I get this behavior:
```sh
npx gitdown ./README_src.md --output-file ./README.md
Unhandled rejection Error: Branch ("issue-36") definition does not exist in the config.
```

This has previously been noted in #27 but closed without change. I think, this is undesirable behavior.

I'd like to get a more understandable error message instead of an exception, if failure is the expected behavior for new branches. Ideally, I'd like this to work for new branches as well, but since `git` itself won't setup tracking without the remote branch, that's probably out of scope for `gitdown`.

It would be nice to get a warning if no URLs are needed, but an error when this prevents building.

Also, when the README file cannot be updated, gitdown should fail with a non-zero exit code. My use-case is that gitdown updates my README.md from a README.src.md via commit hook. If that goes through despite not doing its work, that is a recipe for disaster.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the `npx gitdown ./README_src.md --output-file ./README.md` command on a new branch without a remote tracking branch. Trace the CLI path that handles the missing branch definition and README update failure. Done means failures produce understandable output and a non-zero exit code, while cases needing no URLs can warn or complete as appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, javascript
Domain
cli, tooling
Issue type
Bug
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.