gabrielcsapo / gabrielcsapo/node-git-server

If the tag contains `00`, it will break there

オープン
#113 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
262
フォーク
81
PR マージ指標
30日以内にマージされた PR はありません

説明

I tried to push the following tag: `v72.94001.10`
However, the tag passed to the `tag` event was the following value:

```js
const { Git } = require('node-git-server');

const repos = new Git('path/to/tmp', {
autoCreate: true,
});

repos.on('tag', (tag) => {
// tag.version === 'v72.94' // What!?
});

repos.listen(49152, { type: 'http' }, () => {
// ...
});
repos.server.on('error', err => { throw err });
```

Apparently, tag names are cut off when `00` is encountered.
I have looked into the reason for this and found the following regular expression to be the cause.

https://github.com/gabrielcsapo/node-git-server/blob/2ab22a4d3f1a9c77314236c401e176f994f2f758/src/service.ts#L13

[This pattern is defined so that tag names after spaces, null characters, or `00` are not retrieved](https://regexper.com/#%28%5B0-9a-fA-F%5D%2B%29%20%28%5B0-9a-fA-F%5D%2B%29%20refs%5C%2F%28heads%7Ctags%29%5C%2F%28.*%3F%29%28%20%7C00%7C%5Cu0000%29%7C%5E%280000%29%24).
_Why?_ Tag names (and branch names) can contain `00`. What is the reason for excluding anything after `00`?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

報告にあるタグ v72.94001.10 で問題を再現し、続いて src/service.ts の 13 行目にある正規表現と、その周辺のタグイベント解析を調べてください。00 を含むタグ名とブランチ名が保持される一方で、既存の ref 解析の動作が維持されることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
git, node.js, typescript
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。